akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

vector<ll> f(ll n) {
    vector<ll> res;
    for (ll a = 2; a*a <= n; a++) {
        if (n%a != 0) continue;
        while (n%a == 0) {
            n /= a;
        }
        res.push_back(a);
    }
    if (n != 1) res.push_back(n);
    return res;
} 

int main() {
    ll a, b;
    cin >> a >> b;
    const auto &ares = f(a);
    const auto &bres = f(b);
    int ans = 0;
    for (auto x : ares) {
        for (auto y : bres) {
            if (x == y) ans++;
        }
    }
    ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  int n, x, t;
  cin >> n >> x >> t;
  int ans = ceil((float)n / x) * t;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3584
def ncr(n, r):
    num = den = 1

    for i in range(r):
        num = (num * (n - i)) % MOD
        den = (den * (i + 1)) % MOD

    return (num * pow(den, MOD - 2, MOD)) % MOD

MOD = 10 ** 9 + 7

n, a, b = map(int, input().split())

x = pow(2, n, MOD)

print((x - ncr(n, a) - ncr(n, b) - 1) % MOD)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
using namespace std;

class RMQ{
public:
  
  int n;
  vector<int> A;
  
  const int INF = (1LL<<31)-1;
  
  RMQ(){}

  RMQ(int n_){
    n = 1;
    while( n_ > n ) n *= 2;
    A.resize( n * 2 - 1, INF );
  }
  
  void update(int x, int a){
    x += n - 1;
    A[x] = a;
    while(x){
      x = ( x + 1 ) / 2 - 1;
      A[x] = min( A[x*2+1], A[x*2+2] );
    }
  }
  
  int find(int a, int b, int l, int r, int k = 0){
    if( r <= a || b <= l ) return INF;
    if( a <= l && r <= b ) return A[k];
    int v1 = find( a, b, l, (l+r)/2, k*2+1 );
    int v2 = find( a, b, (l+r)/2, r, k*2+2 );
    return min( v1, v2 );
  }
  
};

signed main(){
  
  int n, q;
  cin>>n>>q;
  
  RMQ rmq(n);
  
  while(q--){
    
    int com, a, b;
    cin>>com>>a>>b;
    
    if( com == 0 ){
      rmq.update( a, b );
    }
    else{
      cout<<rmq.find( a, b+1, 0, rmq.n )<<endl;
    }
    
  }
  
  return 0;
}



Measured memory_bytes: 4972
#include <bits/stdc++.h>
using namespace std;

int chk(int i) {
  int cnt = 0;
  while (i % 2 == 0) i /= 2, cnt++;
  return cnt;
}

int main() {
  long long N, M, L, A;
  cin >> N >> M >> L;

  int x = chk(L);

  while (cin >> A) {
    if (chk(A) != x) {
      cout << 0 << "\n";
      return 0;
    }
    L = L * A / __gcd(L, A);
    if (L / 2 > M) {
      cout << 0 << "\n";
      return 0;
    }
  }

  cout << (M - L / 2) / L + 1 << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
#define pb push_back

int n, h[100005], dp[100005], k;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> n >> k;
    for (int i = 1; i <= n; ++i) cin >> h[i];
    for (int i = 2; i <= k; ++i) {
    	dp[i] = 1e9 + 7;
    	for (int j = 1; j <= i - 1; ++j) {
    		dp[i] = min(dp[i], abs(h[i] - h[j]) + dp[j]);
    	}
    }
    for (int i = k + 1; i <= n; ++i) {
    	dp[i] = 1e9 + 7;
    	for (int j = i - 1; j >= i - k; --j) {
    		dp[i] = min(dp[i], abs(h[i] - h[j]) + dp[j]);
    	}
    }
    cout << dp[n] << '\n';
    return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>

typedef struct{
  int map[16];
  int sp;
  int md;
}Board;
//左側の数字が、右側の番地に存在したときのMD
int md[16][16];
//dfsの現在のBoardの記録
Board ndfs;
int mov[4]={4,1,-1,-4};

int dfs(int lim,int now,int before);
int idasearch(Board x);
int calcmd(Board x);

int main(void){
  int i,j,sum=0;
  char x,dummy;
  Board start;
  //MD対応表作成
  for(i=0;i<15;i++)for(j=0;j<16;j++)md[i+1][j]=abs(i/4-j/4)+abs(i%4-j%4);
  /*for(i=1;i<16;i++){
    for(j=0;j<16;j++)printf("%d ",md[i][j]);
    printf("\n");
    }*/
  //読み込み
  for(i=0;i<16;i++){
    /*if(i%4!=3)scanf("%c ",&x);
    else scanf("%c%c",&x,&dummy);
    if(x>='1'&&x<='9')start.map[i]=x-'0';
    else if(x>='a'&&x<='f')start.map[i]=10+x-'a';
    else {
      start.sp = i;
      start.map[i]=0;
      }*/
    scanf("%d",&start.map[i]);
    if(start.map[i]==0)start.sp=i;
  }
  //転倒数の計算
  sum=3-start.sp/4;
  for(i=0;i<15;i++)for(j=i+1;j<16;j++)if(start.map[i]>start.map[j]&&start.map[j]!=0)sum++;
  if(sum%2==1)printf("impossible\n");
  else{
    //IDA*
    start.md = calcmd(start);
    //printf("%d\n",start.md);
    printf("%d\n",idasearch(start));
  }
  //for(i=0;i<16;i++)printf("%d",start.map[i]);
  return 0;
}

int calcmd(Board x){
  int i,ans=0;
  for(i=0;i<16;i++)if(x.map[i]!=0)ans+=md[x.map[i]][i];
  x.md = ans;
  return ans;
}
int idasearch(Board x){
  int ans=-1,i;
  for(i=1;i<=80;i++){
    ndfs = x;
    ans = dfs(i,0,-10);
    if(ans!=-1)break;
  }
  return ans;
}
int dfs(int lim,int now,int before){
  //if(lim==19)printf("%d %d\n",now,ndfs.md);
  int i,ans=-1,tmp;
  Board dummy = ndfs;
  //答えになっているか判定
  if(dummy.md==0)return now;
  //探索うちきり
  if(ndfs.md+now>=lim)return -1;
  for(i=0;i<4;i++){
    if(dummy.sp%4==0&&i==2)continue;
    if(dummy.sp%4==3&&i==1)continue;
    ndfs = dummy;
    //-のマスの移動
    ndfs.sp+=mov[i];
    //範囲内かどうか、一手前に戻ってないかどうか
    if(ndfs.sp>=0&&ndfs.sp<16&&before+i!=3){
      //mdをずらす
      ndfs.md -= md[dummy.map[ndfs.sp]][ndfs.sp];
      ndfs.md += md[dummy.map[ndfs.sp]][dummy.sp];
      //swap
      ndfs.map[dummy.sp]=dummy.map[ndfs.sp];
      ndfs.map[ndfs.sp]=0;
      /*for(int j=0;j<16;j++)printf("%2d",dummy.map[j]);
      printf("\n");
      for(int j=0;j<16;j++)printf("%2d",ndfs.map[j]);
      printf("\n\n");*/
      ans = dfs(lim,now+1,i);
      if(ans!=-1)break;
    }
  }
  return ans;
}


Measured memory_bytes: 2108
using System;
class Program
{
	static void Main(string[] args)
	{
      string[] param = Console.ReadLine().Split(' ');
      int ball = int.Parse(param[0]);
      int person = int.Parse(param[1]);
      
      if (person == 1) {
       Console.WriteLine(0); 
      }
      else {
       // ボールを配る.
       for (int i = 0; i < (person-1); i++) {
        ball--;
       }
       Console.WriteLine(ball - 1);
      }
	}
}

Measured memory_bytes: 13140
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 20;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

int main() {
	double ans = 0;
	int N, K;
	scanf("%d %d", &N, &K);
	for (int i = 1; i <= N; i++) {
		int c = 0;
		double p = 1.0 / N;
		int t = i;
		while (t < K) {
			t *= 2;
			p /= 2;
		}
		ans += p;
	}
	return !printf("%.20lf\n", ans);
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int ans = 0;
		for (int i = 0; i < n; i++) {
			int tmp = sc.nextInt();
			if (tmp >= k)
				ans++;
		}
		sc.close();
		System.out.println(ans);
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}


Measured memory_bytes: 50088
import java.util.*;
 
class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int ans = 0;
    for(int i=a; i<=b; i++){
      if(i/10000 == i%10){
        int x = i/10;
        int y = i%10000;
        if(x%10 == y/1000){
          ans++;
        }
      }
    }
    System.out.println(ans);

    sc.close();
  }
}

Measured memory_bytes: 20692
s = input()
n = len(s)
dp = [[0]*13 for _ in range(n+1)]
dp[0][0] = 1

mod = 10**9 + 7

for i in range(n):
    c = s[i]
    if c == '?':
        V = [0,1,2,3,4,5,6,7,8,9]
    else:
        V = [int(c)]
    for v in V:
        d = v*pow(10, n-i-1, 13)%13
        for j in range(13):
            dp[i+1][(j+d)%13] += dp[i][j]

    for j in range(13):
        dp[i+1][j%13] %= mod

print(dp[n][5])


Measured memory_bytes: 63912
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    int a[2][N];
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < N; j++)
        {
            cin >> a[i][j];
        }
    }
    int sum = 0;
    int m = -1;
    int x = 0;
    for (int i = 0; i < N; i++)
    {
        x += a[0][i];
        for (int j = i; j < N; j++)
        {
            sum += a[1][j];
        }
        m = max(m, sum + x);
        sum = 0;
    }
    cout << m << endl;
}

Measured memory_bytes: 256
def solve():
  n = int(input())
  s = input()
  
  leftblack = 0
  leftwhite = 0
  rightblack = s.count('#')
  rightwhite = s.count(".")
  
  ans = leftblack+rightwhite
  
  for i in range(n):
    if s[i] == "#":
      leftblack += 1
      rightblack -= 1
    else:
      leftwhite += 1
      rightwhite -= 1
    ans = min(ans,leftblack+rightwhite)
  
  print(ans)
solve()

Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
vector<int>kaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    //if(!kaijo[0])init_fact(2000010);
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,m,x,c[15],a[15][15],ans=INF;
signed main(){
    cin>>n>>m>>x;
    rep(i,n){
        cin>>c[i];
        rep(j,m)cin>>a[i][j];
    }
    rep(i,(1<<n)){
        int sum[12];
        fill(sum,sum+12,0);
        int cost=0;
        rep(j,n){
            if((i>>j)&1){
                cost+=c[j];
                rep(k,m){
                    sum[k]+=a[j][k];
                }
            }
        }
        rep(j,m){
            if(sum[j]<x)goto ng;
        }
        chmin(ans,cost);
        ng:;
    }
    if(ans==INF)cout<<-1<<endl;
    else cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3676
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <numeric>
#include <map>   
#include <stdio.h>
#include <queue>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define PB push_back
#define ull unsigned long long
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807
#define sortR(a,b) sort(a, b, greater<int>())

using namespace std;


int main() {
	vector<vector<pair<int, int>>> adjlist(100000, vector < pair<int, int>>());
	ll N, M, i, b, c, j, jcount=0, icount=0, ans = 0, num = 0;
	bool flag = true;
	cin >> N >> M;
	cout << (N * 3 + M) / 2 << endl;
	return 0;/**/

}


Measured memory_bytes: 2560
//
// Created by yamunaku on 2019/08/10.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    int x,y;
    cin >> x >> y;
    for(int i=y-x+1;i<y+x;i++){
        cout << i << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#-*-coding:utf-8-*-

def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    threshold1 = -(-sum(a_list) // n)
    threshold2 = sum(a_list) // n
    ans1 = 0
    ans2 = 0
    for i in a_list:
        ans1 += (i - threshold1) ** 2
        ans2 += (i - threshold2) ** 2

    print(min(ans1, ans2))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    S = input().strip()

    x = 0
    for s in S:
        x += int(s)
        x %= 9

    if x == 0:
        print("Yes")
    else:
        print("No")






if __name__ == '__main__':
    main()


Measured memory_bytes: 9332
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int N, M, K, A;
    scanf("%d%d", &N, &M);
    int a[32] = {0};

    for (int i = 0; i < N; i++)
    {
        scanf("%d", &K);
        while(K--){
            scanf("%d", &A);
            a[A]++;
        }
    }

    int cnt = 0;
    for (int i = 1; i <= M; i++)
    {
        if(a[i] == N)
            cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 128
N = int(input())
s = list(map(int, input().split()))
cond = True
for i in s:
  if i%2 == 0:
    if i%3 == 0 or i%5 == 0:
      continue
    else:
      cond = False
      break
if cond is True:
  print("APPROVED")
else:
  print("DENIED")

Measured memory_bytes: 3060
// class point	の練習（クラスの高度な実装）
#include <iostream>
using namespace std;



int main() {
	int a, b;

	cin >> a >> b;

	if (a < b)cout << "a < b\n";
	else if (a > b)cout << "a > b\n";
	else cout << "a == b\n";
	return 0;
}




Measured memory_bytes: 3092
#include <bits/stdc++.h>

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;

    vector<int> a;
    vector<int> b;
    for (int i = 0; i < M; i++) {
        int tmpA, tmpB;
        cin >> tmpA >> tmpB;
        a.push_back(tmpA - 1);
        b.push_back(tmpB - 1);
    }

    // 考え方メモ
    // 前提：グラフの経路は頂点の並びで全パターン洗い出せる

    vector<int> permutation;
    for (int i = 0; i < N; i++) {
        permutation.push_back(i);
    }

    // 考え方メモ
    // 具体例：
    // case1: (0, 1, 2) -> (0, 1) = (a0, b0) or (a1, b1) or (a2, b2)
    // case2: (0, 2, 1) -> (0, 2) = (a0, b0), (2, 1) = (a1, b1)
    int allPathClearCount = 0;
    do {
        int pathClearCount = 0;
        if (permutation.at(0) != 0) break;

        for (int i = 0; i < N - 1; i++) {
            int num = permutation.at(i);
            int nextNum = permutation.at(i + 1);
            for (int j = 0; j < M; j++) {
                if ((a.at(j) == num && b.at(j) == nextNum) || (a.at(j) == nextNum && b.at(j) == num)) {
                    pathClearCount++;
                }
            }
        }
        if (pathClearCount == N - 1) {
            allPathClearCount++;
        }
    } while (next_permutation(permutation.begin(), permutation.end()));

    cout << allPathClearCount << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>

using namespace std;

const ll N = 3e5+100;
const ll MOD = 1e9+7;

int main()
{

	ll h,a;
	cin>>h>>a;ll sum=0;
	for(int i =1;i<=a;i++){
		ll x;
		cin>>x;
		sum+=x;
	}
	
	if(sum>=h)cout<<"Yes\n";else cout<<"No\n";
	return 0;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define ip pair<ll,ll>
#define ff first
#define ss second
#define MAX 100005
const ll MOD = 1000000007;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);

	ll a;
	cin>>a;
	cout<< a + a*a + a*a*a <<endl;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long NR;
int main()
{
    int a;
    cin>>a;
    string s;
    string t;

       cin>>s;
       cin>>t;



/*for(int j=0;j<a;j++)
{
    cin>>t[j];
}
*/
for(int k=0;k<a;k++)
{
    cout<<s[k]<<t[k];
}






      return 0;
}


Measured memory_bytes: 256
long d[2<<17],*p,m=1e9+7;main(a,k){scanf("%*d%d",&k);p=d+k;for(*p=1;~scanf("%d",&a);){for(;d-p--;)*p+=p[1];for(;p++-d<k;*p%=m)*p-=p[a+1];}printf("%ld",*d);}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

pll A[100005], B[100005];

int main()
{
    string S, T;
    cin >> S >> T;
    A[0] = B[0] = pll(0, 0);
    REP(i, S.length())
    {
        A[i + 1] = A[i];
        if (S[i] == 'A')
            A[i + 1].first++;
        else
            A[i + 1].second++;
    }
    REP(i, T.length())
    {
        B[i + 1] = B[i];
        if (T[i] == 'A')
            B[i + 1].first++;
        else
            B[i + 1].second++;
    }

    int Q;
    cin >> Q;
    REP(i, Q)
    {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--;
        c--;
        pll s(A[b].first - A[a].first, A[b].second - A[a].second);
        pll t(B[d].first - B[c].first, B[d].second - B[c].second);

        ll sa = s.first + s.second * 2;
        ll ta = t.first + t.second * 2;
        if (abs(sa - ta) % 3 == 0)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 3968
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();

		if(A>B) {
			System.out.println(-1);
			return;
		}
//
//		double double125A = (double)A * 1.25;
//		double doubleB = (double)B;
//		if(doubleB > double125A || (double125A > doubleB && 12.5*(double)A - 10*(double)B > 12.5)) {
//			System.out.println(-1);
//		} else {
//			int resultA = ((double)A*12.5)*2 % 2 == 0 ? (int)(A*12.5) : (int)(A*12.5)+1;
//			System.out.println(Math.max(resultA, (int)(B*10)));
//		}

		int min = 0;
		for (int i = 1; i <= 1009; i++) {
			int i008 = (int)(i*0.08);
			int i010 = (int)(i*0.1);
			if(i008 == A && i010 == B) {
				min = i;
				break;
			}
		}
		if(min==0){
			System.out.println(-1);
		} else {
			System.out.println(min);
		}
	}
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
ll dp1[5005]={0},dp2[25000005]={0};
const ll inf=174417441744;
signed main(){
  ll n;
  cin>>n;
  ll ga,sa,ba,gb,sb,bb;
  cin>>ga>>sa>>ba>>gb>>sb>>bb;

  for(int i=0;i<5005;i++) dp1[i]=-inf;
  dp1[n]=n;
  for(int i=n;i>=1;i--){
    if(i-ga>=0&&gb>ga) dp1[i-ga]=max(dp1[i-ga],dp1[i]+gb-ga);
    if(i-sa>=0&&sb>sa) dp1[i-sa]=max(dp1[i-sa],dp1[i]+sb-sa);
    if(i-ba>=0&&bb>ba) dp1[i-ba]=max(dp1[i-ba],dp1[i]+bb-ba);
  }
  for(int i=0;i<25000005;i++) dp2[i]=-inf;
  for(int i=0;i<=5005;i++){
    if(dp1[i]>=0) dp2[dp1[i]]=dp1[i];
  }
  for(int i=25000000;i>=1;i--){
    if(i-gb>=0&&ga>gb) dp2[i-gb]=max(dp2[i-gb],dp2[i]+ga-gb);
    if(i-sb>=0&&sa>sb) dp2[i-sb]=max(dp2[i-sb],dp2[i]+sa-sb);
    if(i-bb>=0&&ba>bb) dp2[i-bb]=max(dp2[i-bb],dp2[i]+ba-bb);
  }
  ll ans=0;
  for(int i=0;i<25000005;i++){
    ans=max(ans,dp2[i]);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 195584
import java.util.ArrayList;
import java.util.Scanner;

class adj_list{
    public int u,k;
    public int[] v;
}

class timestamp{
    public boolean d_flg = false;
    public int id,f,d;
}

public class Main {

    private static ArrayList<adj_list>  ar = new ArrayList<adj_list>();
    private static ArrayList<timestamp> t  = new ArrayList<timestamp>();

    private static final int U     =  0,
                             K     =  1,
                             START =  1,
                             END   = -1;

    private static int times = 0;

    public static void main(String[] args) {

        //input
         Scanner sc = new Scanner(System.in).useDelimiter(System.getProperty("line.separator"));
         int      N = sc.nextInt();

         adj_list a;String[] s;
         for(int i = 0;i < N;i++){
             s = sc.next().split("\\s");
             a = new adj_list();
             a.u = Integer.parseInt(s[U]);
             a.k = Integer.parseInt(s[K]);
             a.v = new int[a.k];
             for(int j=0;j<a.k;j++){a.v[j] = Integer.parseInt(s[j+2]);}
             ar.add(a);
             t.add(new timestamp());
         }
         for(int i=0;i<N;i++){t.get(i).id = i+1;}

         //calculation
         int V = START;
         while(V != END){
        	 DFS(V);
        	 V = getNextVertex(V);
         }

         //output
         for (timestamp ts:t) {System.out.println(ts.id + " " + ts.d + " " + ts.f);}
    }

    private static int getNextVertex(int v){
    	int ret = END;
    	for(timestamp ts:t){if(v < ts.id && !ts.d_flg){ret = ts.id;break;}}
    	return ret;
    }

    private static void DFS(int id){
        timestamp out;
        out = get_OUT_list(id);
        if   (out.d_flg){return;}
        else {out.d_flg = true;}
        out.d = ++times;
        adj_list in;
        in  = get_IN_list(id);
        for(int i=0;i<in.k;i++){DFS(in.v[i]);}
        out.f = ++times;
    }

    private static adj_list get_IN_list(int id){
        adj_list ret = null;
        for(adj_list a:ar){if(a.u == id){ret = a;}}
        return ret;
    }

    private static timestamp get_OUT_list(int id){
        timestamp ret = null;
        for(timestamp ts:t){if(ts.id == id){ret = ts;}}
        return ret;
    }
 }

Measured memory_bytes: 20304
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - Welcome to AtCoder
            var line = ReadLine();
            int N = line[0];
            int M = line[1];

            var ac = new int[N + 1];
            var wa = new int[N + 1];
            
            for(int i = 0; i < M; i++)
            {
                var s = Console.ReadLine();
                int p = int.Parse(s.Substring(0, s.Length - 3));

                if (s.EndsWith("AC"))
                {
                    ac[p]++;
                }
                else
                {
                    if (ac[p] == 0)
                    {
                        wa[p]++;
                    }                    
                }
            }

            int correct = 0;
            int penalty = 0;

            for(int i = 1; i <= N; i++)
            {
                if (ac[i] > 0)
                {
                    correct++;
                    penalty += wa[i];
                }
            }

            Console.WriteLine("{0} {1}", correct, penalty);
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 16348
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int h,w,ans;

main() {
    cin >> h >> w;
    ans = min(min((int)1,h%3)*w,min((int)1,w%3)*h);
    rep(i,h+1) {
        int a,b,c;
        a = i*w;
        b = (h-i)*(w/2);
        c = (h-i)*((w+1)/2);
        ans = min(ans,max(a,max(b,c))-min(a,min(b,c)));
    }
    rep(i,w+1) {
        int a,b,c;
        a = i*h;
        b = (w-i)*(h/2);
        c = (w-i)*((h+1)/2);
        ans = min(ans,max(a,max(b,c))-min(a,min(b,c)));
    }
    cout << ans << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define mod 1000000007
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int ans=0;
    do{
        ans++;
        n/=k;
    }while(n>0);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
int N,Now;
const int MO = 1e9+7;
using namespace std;
int main(){
    scanf("%d",&N);
    long long Ans = 1;
    int P = N;
    for(int i=1,j=1; i<=N; i++,j++){
        scanf("%d",&Now);
        if(Now>=j*2-1) continue;
        Ans = Ans*j%MO;
        P--; j--;
    }
    for(; P; P--)
        Ans = Ans*P%MO;
    printf("%d",(int)Ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int calc(vector<int> &data, vector<vector<int>> &dp, int l, int r) {
    int ret = 0;
    if(dp[l][r] != -1) return dp[l][r];
    if(abs(r-l) <= 1) return 0;

    if(abs(data[l]-data[r-1]) < 2 && calc(data, dp, l+1, r-1) == r-l-2) ret = r - l;

    for(int mid=l+1; mid<r; mid++) {
        ret = max(ret, calc(data, dp, l, mid)  + calc(data, dp, mid, r));
    }

    dp[l][r] = ret;
    //cout<<"dp["<<l<<"]["<<r<<"] = "<<dp[l][r]<<endl;
    return ret;

}

int solve() {
    int n;
    cin >> n;
    if(n==0) return 0;

    vector<vector<int>> dp;
    dp.resize(n+1);
    for(auto &item: dp) {
        item.resize(n+1, -1);
    }
    vector<int> data;
    data.resize(n);

    for(int i=0; i<n; i++) {
        cin >> data[i];
    }


    cout << calc(data, dp, 0, n) << endl;

    return 1;
}

int main() {
    while(solve());
}



Measured memory_bytes: 3168
#include<stdio.h>
int main()
{
    int a,b,k,i,c;

    while(scanf("%d",&k)!=EOF)
    {
        scanf("%d %d",&a,&b);
        c = 1;
        for(i=a;i<=b;i++)
        {
            if(i%k==0)
            {
                c = 0;
                break;
            }
        }

        if(c)
            printf("NG\n");
        else
            printf("OK\n");
    }

    return 0;
}


Measured memory_bytes: 1624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  while(cin >> n && n) {
    int t[1000],z[1000];
    memset(t,-1,sizeof(t));
    memset(z,0,sizeof(z));
    while(n--) {
      int h,m;
      string _,a,b;
      cin >> _;
      scanf("%d%*c%d",&h,&m);
      cin >> a >> b;
      int x,y=h*60+m;
      stringstream ss;
      ss << b;
      ss >> x;
      if(a=="I") t[x]=y;
      else {
    if(x==0) {
      for(int i=1; i<1000; i++) {
        if(t[i]!=-1) z[i]+=y-max(t[0],t[i]);
      }
    } else {
      if(t[0]!=-1) z[x]+=y-max(t[0],t[x]);
    }
    t[x]=-1;
      }
    }
    int ans=0;
    for(int i=1; i<1000; i++) ans=max(ans,z[i]);
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 1284
#include <cstdio>
#include <cmath>
#define rad(r) (r * M_PI / 180)
int main() {
	int a, b, C;
	scanf("%d %d %d", &a, &b, &C);
	printf("%f\n", 0.5 * a * b * sin(rad(C)));
	printf("%f\n", a + b + sqrt(a*a + b*b - 2 * a*b*cos(rad(C))));
	printf("%f\n", b * sin(rad(C)));
}

Measured memory_bytes: 1112
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

// -----------------------------------------------------------------------------------------------------

// -----------------------------------------------------------------------------------------------------

let main() =
    let n = read int
    let bs = reada int |> Array.distinct
    if Array.length bs = n then "YES" else "NO"
    |> puts
    ()

// -----------------------------------------------------------------------------------------------------
main()
writer.Dispose()


Measured memory_bytes: 45020
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define lowbit(x) (x)&(-x)
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,a,b) for (int i=a;i>=b;i--)
#define maxd 998244353
typedef long long ll;
const int N=100000;
const double pi=acos(-1.0);
int n,a[400];
ll dp[310][90050][2];

int read()
{
	int x=0,f=1;char ch=getchar();
	while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
	while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
	return x*f;
}

int main()
{
	n=read();ll sum=0;
	rep(i,1,n) {a[i]=read();sum+=a[i];}
	dp[0][0][0]=1;dp[0][0][1]=1;
	rep(i,1,n)
	{
		rep(j,0,sum)
		{
			dp[i][j][0]=dp[i-1][j][0];
			dp[i][j][1]=(dp[i-1][j][1]*2)%maxd;
			if (j>=a[i])
			{
				dp[i][j][0]=(dp[i][j][0]+dp[i-1][j-a[i]][0])%maxd;
				dp[i][j][1]=(dp[i][j][1]+dp[i-1][j-a[i]][1])%maxd;
			}
		}
	}
	ll ans=1;
	rep(i,1,n) ans=(ans*3)%maxd;
	rep(i,(sum+1)/2,sum)
	{
		ans=(ans-dp[n][i][1]*3)%maxd;
		if (i*2==sum)
		{
			ans=(ans+dp[n][i][0]*3)%maxd;
		}
	}
	ans=(ans%maxd+maxd)%maxd;
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 422784
#include <bits/stdc++.h>
using namespace std;

int main(){
    // int n[4];
    vector <int> v(4,0);

    for(int i =0;i<4;i++){
        cin >> v[i];
    }

    sort(v.begin(), v.end());
    if(v[0] == 1 && v[1] == 4 && v[2] == 7 && v[3] == 9){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  string type = "Three";
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    string color;
    cin >> color;
    if (color == "Y"){
      type = "Four";
    }
  }
  cout << type << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(final String[] args) {
        final FastScanner scanner = new FastScanner(System.in);
        System.out.println(scanner.nextInt() * scanner.nextInt());
    }

    private static class FastScanner {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(final InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (final IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (final IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }
    }
}


Measured memory_bytes: 32692
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<deque>
using namespace std;

int main() {

    int n, k;
    while(cin >> n >> k && (n || k)) {

        vector<int> exist (k);
        vector<vector<int> > need(n, vector<int>(k));

        for(int i = 0; i < k; i++)  cin >> exist[i];
        for(int i = 0; i < n; i++) {
            for (int j = 0; j < k; j++) {
                cin >> need[i][j];
            }
            
        }

        bool possible = true;
        for(int i = 0; i < k; i++) {
            int sum = 0;
            for (int j = 0; j < n; j++) {
                sum += need[j][i];
                if (sum > exist[i]) {
                    possible = false;
                    break;
                }
            }
            if (!possible) break;
        }

        if(possible)    cout << "Yes" << endl;
        else            cout << "No" << endl;
            
    } 
    return 0;
}

Measured memory_bytes: 936
#include<stdio.h>
int main(void)
{
	int i, n;
	int a[100000], b[100000];
	scanf("%d", &n);
	if (n == 3 || n == 5 || n == 7)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));



struct mint {
	int x;
	mint(int x = 0) :x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= MOD)x -= MOD;
		return *this;
	}
	mint & operator-=(const mint a) {
		if ((x += MOD - a.x) >= MOD)x -= MOD;
		return *this;
	}
	mint & operator*=(const mint a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint a)const {
		return mint(*this) += a;
	}
	mint operator-(const mint a)const {
		return mint(*this) -= a;
	}
	mint operator*(const mint a)const {
		return mint(*this) *= a;
	}
	mint pow(int t)const {
		if (!t)return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1)a *= *this;
		return a;
	}

	//for prime mod
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a)const {
		mint res(*this);
		return res /= a;
	}
};
ostream& operator<<(ostream& os, const mint& m) {
	os << m.x;
	return os;
}


signed main() {
	int N;
	cin >> N;
	mint a = 9;
	a = a.pow(N);
	mint ans = 10;
	ans = ans.pow(N);
	a *= 2;
	ans -= a;
	mint b = 8;
	b = b.pow(N);
	ans += b;
	cout << ans;
}

Measured memory_bytes: 3640
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;
int w[100050];
int v[100050];
long long dp[100050];
const int INF =1<<30;

int main(){
	int n,W;
	cin>>n>>W;
	for(int i=0;i<n;i++){
		scanf("%d",&w[i]);
		scanf("%d",&v[i]);
	}
	for(int i=0;i<n;i++){
		for(int j=W-1;j>=0;j--){
			if(j+w[i]<=W){
				dp[j+w[i]]=max(dp[j+w[i]],dp[j]+v[i]);
			}
		}
	}
	
	
	cout<<dp[W];
	
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#define MOD 1000000007
using namespace std;

int k, s, cvp=0;

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>k>>s;
	for (int i = 0; i <= k; ++i){
		if(s==i){
			cvp++;
			break;
		}
		if(s-i>2*k)continue;
		for (int j=0; j <= k; ++j){
			if(i+j>s)break;
			if(s-i-j>k)continue;
			cvp++;
		}
	}	
	cout<<cvp;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
map<long long int,long long int> mp;
long long int dp[N];
const long long int mod=1e9+7;
int main()
{
    long long int n,m;
    cin>>n>>m;
    dp[1]=dp[2]=1;
    dp[2]++;
    for(int i=1;i<=m;i++)
    {
        long long int tmp;
        cin>>tmp;
        mp[tmp]=1;
    }
    if(mp[1]==1)
        dp[2]=1,dp[1]=0;
    if(mp[2]==1)
        dp[1]=1,dp[2]=0;
    if(mp[1]==1&&mp[2]==1)
        dp[1]=dp[2]=0;

    for(int i=3;i<=n;i++)
    {
        if(mp[i]==1)
            dp[i]=0;
        else
            dp[i]=(dp[i-1]+dp[i-2])%mod;
    }
    cout<<dp[n]<<endl;
    //cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 7296
import sys;
import math;
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_string(): return sys.stdin.readline().strip()

n = int(input());
arr = get_array();
dp = [0 for i in range(n)];
dp[0]=0;
dp[1]=abs(arr[1]-arr[0]);
for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]));
#print(dp);
print(dp[n-1]);


Measured memory_bytes: 90140
#include <bits/stdc++.h>
#include <iomanip>
#include <algorithm>
#define ll long long
#include <unordered_map>
using namespace std;
 
int main() {
  string T;
  cin >> T;
  for(ll i = 0; i < T.size(); i++) {
    if(T.at(i) == '?') T.at(i) = 'D';
  }
  cout << T << endl;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S[MX];
vi va, vb;

int p[MX];
void input() {
  ;
  cin >> N >> M;
  rep(i, 1, M) { cin >> p[i] >> S[i]; };
}
map<int, int> mp;
set<int> st;
int seitou, pena;
void solve() {
  rep(i, 1, M) {
    if (st.find(p[i]) == st.end())  // wa
    {
      if (S[i] == "WA") {
        mp[p[i]]++;
      } else {
        st.insert(p[i]);
      }
    }
  }
  seitou = st.size();
  for (auto x : st) {
    pena += mp[x];
  }
  cout << seitou << " " << pena << endl;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 17408
#include <stdio.h>
#include <vector>
using namespace std;
 
int main(void) {
  int n, i, j, u, d, ans = 1, k;
  char s[10];
  int dis[200];
  for(i = 0; i < 200; ++i) dis[i] = 1000;
  dis[0] = 0;
  scanf("%d", &n);
  vector<int> v[200];
  for(i = 0; i < n; ++i) {
    scanf("%d", &u);
    scanf("%s", s);
    scanf("%d", &d);
    u--, d--;
    d += 100;
    if(s[0] == 'l') v[u].push_back(d);
    else v[d].push_back(u);
  }
  for(i = 0; i <= 200; ++i) {
    char f = 1;
    for(j = 0; j < 200; ++j) {
      for(k = 0; k < v[j].size(); ++k) if(dis[v[j][k]] > dis[j] - 1) dis[v[j][k]] = dis[j] - 1, f = 0;
    }
    if(f) break;
    else if(i == 200) ans = 0;
  }
  if(ans) printf("0\n");
  else printf("1\n");
  return 0;
}


Measured memory_bytes: 2704
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    vector<int> t(N + 1), x(N + 1), y(N + 1);
    t.at(0) = 0, x.at(0) = 0, y.at(0) = 0;
    for (int i = 1; i <= N; ++i) {
        cin >> t.at(i) >> x.at(i) >> y.at(i);
    }

    for (int i = 1; i <= N; ++i) {
        if (t.at(i) % 2 != (x.at(i) + y.at(i)) % 2) {
            cout << "No" << endl;
            exit(0);
        }
        int d = abs(x.at(i) - x.at(i - 1)) + abs(y.at(i) - y.at(i - 1));
        if (d > t.at(i) - t.at(i - 1)) {
            cout << "No" << endl;
            exit(0);
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t,u;
    int x;
    cin>>s>>t;
    for(int j=0;j<s.size()-1;j++){
    x=s.at(s.size()-1);
    u=s;
    for(int i=0;i<s.size()-1;i++){
        if(u==t){
            cout<<"Yes"<<endl;
            return 0;
        }
        s.at(i+1)=u.at(i);
    }
    s.at(0)=x;
    }
    if(s==t){
            cout<<"Yes"<<endl;
            return 0;
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;
typedef pair<int,P> PP;

void Main() {
  int n;
  R n;
  PP a[n];
  rep(i,n-1) cin >> a[i].F >> a[i].S.F >> a[i].S.S;
  rep(k,n) {
    int d[n];
    d[k]=0;
    REP(i,k,n-1) {
      d[i+1]=d[i];
      while(d[i+1]<a[i].S.F||(d[i+1]-a[i].S.F)%a[i].S.S) d[i+1]++;
      d[i+1]+=a[i].F;
    }
    pr(d[n-1]);
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
import java.io.*;
public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		String[] i=str.split(" ");
		int a=Integer.parseInt(i[0]);
		int b=Integer.parseInt(i[1]);
		
		int d=a/b;
		int e=a%b;
		double f=(double)a/b;
		
		System.out.printf("%d %d %.5f",d,e,f);
	}

}

Measured memory_bytes: 17052
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
using namespace std;

#define ll long long int

const int MOD = 1000000007;

int max(int a, int b) {

	if (a > b)return a;
	else return b;

}
int main() {

	int N, K;
	ll ans = 1;

	cin >> N >> K;
	
	ans *= K;
	for (int i = 0; i < N - 1; i++) {

		ans *= (K - 1);

	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
BA = [[0, 0] for i in range(n)]
for i in range(n):
    BA[i][1], BA[i][0] = map(int, input().split())
ans = 'Yes'

BA_ = sorted(BA)
t = 0
for i in range(n):
    t += BA_[i][1]
    if t>BA_[i][0]:
        ans = 'No'
        break
print(ans)

Measured memory_bytes: 37280
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 200005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

vi inp() {
  string s;
  cin>>s;
  vi a;
  rep(i,sz(s)) a.pb(s[i]-'0');
  return a;
}

int solve(vi& a, vi& b, int z) {
  int n = sz(a);
  vp p(n,P(INF,INF));
  {
    int r = -INF;
    rep(i,n) if (b[i]) r = i-n;
    rep(i,n) {
      if (b[i]) r = i;
      if (a[i]) p[i].fi = i-r;
    }
  }
  {
    int l = INF;
    drep(i,n) if (b[i]) l = i+n;
    drep(i,n) {
      if (b[i]) l = i;
      if (a[i]) p[i].se = l-i;
    }
  }
  sort(rng(p));
  while (sz(p) && p.back().fi == INF) p.pop_back();
  int m = sz(p);
  int mx = 0;
  int res = INF;
  drep(i,n) {
    while (sz(p) && p.back().fi > i) {
      maxs(mx,p.back().se);
      p.pop_back();
    }
    if (z < -i) continue;
    int now = i+(z-(-i));
    if (z < mx) now += (mx-z)*2;
    mins(res,now);
  }
  // if (res+m == 2) cerr<<a<<" / "<<b<<" : "<<z<<endl;
  return res+m;
}

int main() {
  vi a = inp();
  vi b = inp();
  int n = sz(a);
  if (a == b) {
    cout<<0<<endl;
    return 0;
  }
  if (b == vi(n)) {
    cout<<-1<<endl;
    return 0;
  }
  int ans = INF;
  rep(ri,2) {
    vi rb = b;
    rep(i,n) {
      vi ra(n);
      rep(j,n) ra[j] = a[j]^rb[j];
      mins(ans, solve(ra,b,i));
      mins(ans, solve(ra,b,i-n));
      rotate(rb.begin(),rb.begin()+1,rb.end());
    }
    reverse(rng(a));
    reverse(rng(b));
  }
  cout<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 256
import math

a,b,c=map(float,input().split())

d=math.radians(c)
s=1/2*a*b*math.sin(d)
h=b*math.sin(d)
e=abs(math.sqrt(b**2+a**2-2*a*b*math.cos(d)))
l=a+b+e
print('{:.8f}'.format(s))
print('{:.8f}'.format(l))
print('{:.8f}'.format(h))



Measured memory_bytes: 5692