akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>  // ver1.8
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
#define PAI 3.14159265358979
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  cout << fixed << setprecision(14);
  int n,k;
  cin >> n >> k;
  if(k==gcd(n,k)) cout << -1 << endl;
  else cout << n << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define SUM_LIMIT 100001
using namespace std;

int main() {
  long int N, K, a, b, sum[SUM_LIMIT] = {0}, i;
  cin >> N >> K;
  for (i = 0; i < N; i++) {
    cin >> a >> b;
    sum[a] += b;
  }
  for (i = 0; K > 0; i++) {
    K -= sum[i];
  }
  cout << i - 1 << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>
using namespace std;
typedef long long LL;
const int N=1e5+100;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
int p[N];
inline void WA() { puts("No"); exit(0); }
inline void AC() { puts("Yes"); exit(0); }
int main()
{
	int n=gi(),i;
	for (i=1;i<=n;i++) p[i]=gi();
	int a=*max_element(p+1,p+1+n),b=*min_element(p+1,p+1+n);
	
	if (a-b>1) WA();
	if (a==b) {
		if (a==n-1) AC();
		if (a>n/2) WA();
	} else {
		int s=0;
		for (i=1;i<=n;i++) s+=p[i]==b;
		if (s+(n-s)/2<a) WA();
		if (a<=s) WA();
	}
	AC();
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& base) {
    for (T const& i : base) {
        out << i << ' ';
    }
    return out;
}
int main() {
    string s, t;
    cin >> s;
    cin >> t;
    int n1 = s.length(), n2 = t.length();
    int DP[n1 + 1][n2 + 1];
    for(int i = 0; i <= n1; ++i) DP[i][0] = 0;
    for(int i = 0; i <= n2; ++i) DP[0][i] = 0;
    for(int i = 1; i <= n1; ++i){
        for(int j = 1; j <= n2; ++j){
            if(s[i-1] == t[j-1]){
                DP[i][j] = DP[i-1][j-1] + 1;
            }
            else{
                DP[i][j] = max(DP[i-1][j], DP[i][j-1]);
            }
        }
    }
    string ans;
    int i = n1, j = n2;
    while(i > 0 && j > 0){
        if(s[i-1] == t[j-1]){
            ans += s[i-1];
            --i, --j;
        }
        else{
            if(DP[i][j] == DP[i-1][j]) --i;
            else --j;
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;

}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; ++i) {
    cin >> a.at(i);
    --a.at(i);
  }
  int curr = 0;
  int ans = 0;
  set<int> st = {curr};
  while (curr != 1)
  {
    curr = a.at(curr);
    if (st.count(curr)) {
      ans = -1;
      break;
    }
    st.insert(curr);
    ++ans;
  }
  cout << ans << endl;
}


Measured memory_bytes: 5376
import java.util.Scanner;

public class Main{
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int N;
		int a, b;
		while ((N = scn.nextInt()) != 0) {
			int A = 0, B = 0;
			for (int i = 0; i < N; i++) {
				a = scn.nextInt();
				b = scn.nextInt();
				if (a > b) {
					A += a + b;
				} else if (a < b) {
					B += a + b;
				} else {
					A += a;
					B += b;
				}
			}
			System.out.println(A + " " + B);
		}
	}
}



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

const long long MOD = 1000000007;

#define MAX 20000050
long long cache_f[MAX],cache_invf[MAX],cache_inv[MAX];
void init_cache_egced(){
    long long maxn=MAX;
    cache_f[0]=1; for (long long i=1;i<maxn;i++) cache_f[i]=cache_f[i-1]*i%MOD;
    cache_inv[0]=cache_inv[1]=1; for (long long i=2;i<maxn;i++) cache_inv[i]=MOD-(MOD/i)*cache_inv[MOD%i]%MOD;
    cache_invf[0]=cache_invf[1]=1;for (long long i=2;i<maxn;i++) cache_invf[i]=cache_invf[i-1]*cache_inv[i]%MOD;
}

long long C(long long x,long long y){
    if (y<0||y>x) return 0;
    return cache_f[x]*cache_invf[y]%MOD*cache_invf[x-y]%MOD;
}

void solve(long long H, long long W, long long K){
    init_cache_egced();
    long long ans=0;
    for(long long k = 1; k <= K; k++)
    {
        long long ret=(H*W%MOD*2%MOD*cache_inv[H+W]%MOD*(k-1)%MOD*cache_inv[H+W-1]%MOD*(K+1-k)%MOD
            +(H+W)*cache_inv[H+W]%MOD*(K+1-k)%MOD)%MOD;
        ans=(ans+ret)%MOD;
    }
    ans=(ans+K)%MOD;
    ans=ans*cache_f[H+W]%MOD*cache_invf[H+W-K]%MOD;
    cout<<ans<<endl;
}

int main(){
    long long H;
    scanf("%lld",&H);
    long long W;
    scanf("%lld",&W);
    long long K;
    scanf("%lld",&K);
    solve(H, W, K);
    return 0;
}


Measured memory_bytes: 468992
main = do
    str <- getLine
    let (n:x:_) = map read $ words str
    if ((n,x) == (0,0)) then
        return ()
    else do
        print $ sum [1 | a <- [1..(n-2)], b <- [(a+1)..(n-1)], c <- [(b+1)..(min (n) (x-a-b))], a+b+c==x]
        main

Measured memory_bytes: 5004
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<assert.h>
#include<algorithm>
//#include<iostream>
using namespace std;

char s[10];
int main()
{
	scanf("%s",s);int len=strlen(s);
	bool flag=0;
	for (int i=0;i<len-1;i++)
		if (s[i]=='A' && s[i+1]=='C') flag=1;
	puts(flag?"Yes":"No");
	return 0;
}

Measured memory_bytes: 128
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
	string str;
	cin>>str;
	int len=str.length(),tot[3]={};
	for(int i=0;i<len;i++)
		tot[str[i]-'a']++;
	sort(tot,tot+3);
	if(tot[2]-tot[0]>1 || tot[2]-tot[1]>1) printf("NO\n");
	else printf("YES\n");
	return 0;
}


Measured memory_bytes: 512
using System;

class Program {
  static void Main() {
    int n = int.Parse(Console.ReadLine());
    int k = int.Parse(Console.ReadLine());
    int a = 1;
    while (n-- > 0) {
      a = Math.Min(a * 2, a + k);
    }
    Console.WriteLine(a);
  }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    while(true){
        int n; cin >> n;
        if(n == 0) return 0;
        else{
            vector<int> Score(n);
            REP(i, n) cin >> Score[i];
            int ave = 0;
            whole(sort, Score);
            for(int i = 1; i < n - 1; i++) ave += Score[i];
            ave /= n - 2;
            cout << ave << endl;
        }
    }
}


Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
const int N = 250005;
const int mod = 998244353;
struct Num {
	int v[6];
	inline Num(int v0 = 0, int v1 = 0, int v2 = 0, int v3 = 0, int v4 = 0, int v5 = 0) {
		v[0] = v0, v[1] = v1, v[2] = v2, v[3] = v3, v[4] = v4, v[5] = v5;
	}
	inline bool operator < (const Num &oth) const {
		if (v[0] != oth.v[0]) return v[0] < oth.v[0];
		if (v[1] != oth.v[1]) return v[1] < oth.v[1];
		if (v[2] != oth.v[2]) return v[2] < oth.v[2];
		if (v[3] != oth.v[3]) return v[3] < oth.v[3];
		if (v[4] != oth.v[4]) return v[4] < oth.v[4];
		if (v[5] != oth.v[5]) return v[5] < oth.v[5];
		return false;
	}
};
const int X[6] = {1145141, 1919810, 2333333, 4456787, 9901231, 9374317};
const int invX[6] = {54107771, 595887626, 222430835, 659760181, 892625991, 232131244};
int n, C[6], f[6][N], g[6][N], h[6][N];
char S[N];
map<Num, int> mp;
int main() {
	scanf("%d %s", &n, S + 1);
	for (int k = 0; k < 6; k++) {
		C[k] = 0;
		for (int i = n; i >= 1; i--) {
			if (S[i] == '+') C[k] = (C[k] + 1) % mod;
			else if (S[i] == '-') C[k] = (C[k] + mod - 1) % mod;
			else if (S[i] == '>') C[k] = 1ll * C[k] * X[k] % mod;
			else C[k] = 1ll * C[k] * invX[k] % mod;
		}
		f[k][n + 1] = 0;
		g[k][n + 1] = C[k];
		h[k][n + 1] = 1;
		for (int i = n; i >= 1; i--) {
			if (S[i] == '+') {
				f[k][i] = (f[k][i + 1] + mod - h[k][i + 1]) % mod;
				g[k][i] = (g[k][i + 1] + mod - h[k][i + 1]) % mod;
				h[k][i] = h[k][i + 1];
			} else if (S[i] == '-') {
				f[k][i] = (f[k][i + 1] + h[k][i + 1]) % mod;
				g[k][i] = (g[k][i + 1] + h[k][i + 1]) % mod;
				h[k][i] = h[k][i + 1];
			} else if (S[i] == '>') {
				f[k][i] = f[k][i + 1];
				h[k][i] = 1ll * h[k][i + 1] * invX[k] % mod;
				g[k][i] = (g[k][i + 1] + 1ll * C[k] * (h[k][i] - h[k][i + 1] + mod)) % mod;
			} else {
				f[k][i] = f[k][i + 1];
				h[k][i] = 1ll * h[k][i + 1] * X[k] % mod;
				g[k][i] = (g[k][i + 1] + 1ll * C[k] * (h[k][i] - h[k][i + 1] + mod)) % mod;
			}
		}
	}
	long long ans = 0;
	for (int i = n; i >= 1; i--) {
		++mp[Num(f[0][i + 1], f[1][i + 1], f[2][i + 1], f[3][i + 1], f[4][i + 1], f[5][i + 1])];
		auto it = mp.find(Num(g[0][i], g[1][i], g[2][i], g[3][i], g[4][i], g[5][i]));
		if (it != mp.end()) ans += it -> second;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 37632
N = int(input())
A = list(map(int, input().split()))

A_sorted = sorted(A)
A_set = list(set(A))
A_cnt = dict()
for a in A:
    if not a in A_cnt.keys():
        A_cnt[a] = 1
    else:
        A_cnt[a] += 1

if A_cnt.get(0) == N:
    print("Yes")
    exit()

if len(A_set) > 3 or len(A_set) == 1 or N%3 != 0:
    print("No")
    exit()

B = []
B.append(A_set[0])
B.append(A_set[1])
for _ in range(N-2):
    B.append(B[-1] ^ B[-2])

B_sorted = sorted(B)
if A_sorted == B_sorted:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14212
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,d,n,t,m,array[100000+10],ans=0,sum1=0,sum2=0,sum3=0,sum=0,cnt=0,cnt1=0,cnt2=0,cnt3=0,flag=0,flag1=0,flag2=0;
    long long int minirow=INT_MAX,minicol=INT_MAX,maxrow=INT_MIN,maxcol=INT_MIN;
    int i,j;
    string s[100],p;
    char ch;
    cin>>p;
    int len=p.length();
    int len1=(len-1)/2;
    int len2=(len+3)/2;
    //cout<<len<<endl;
    len=len-1;
    d=len;
    len1=len1-1;
    len2=len2-1;
    //cout<<len2<<endl;
    a=0;
    while(len>a)
    {
        //cout<<p[a]<<endl;
        if(p[a++]!=p[len--])
        {
            flag=1;
            break;
        }
    }
    int l=0;
    while(len1>l)
    {
        //cout<<p[a]<<endl;
        if(p[l++]!=p[len1--])
        {
            flag1=1;
            break;
        }
    }
    while(len>len2)
    {
        //cout<<p[a]<<endl;
        if(p[len2++]!=p[len--])
        {
            flag2=1;
            break;
        }
    }
    if(flag==0&&flag1==0&&flag2==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{
	int H1, M1, H2, M2, K;
	cin >> H1 >> M1 >> H2 >> M2 >> K;

	int m = (H2 - H1) * 60 + (M2 - M1);

	cout << m - K << endl;


}






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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i<N; i++) cin >> A.at(i);
  
  string yorn = "YES";
  
  sort(A.begin(), A.end());
  
  for(int i=0; i<(N-1); i++){
    if(A.at(i) == A.at(i+1)) yorn = "NO";
  }
  cout << yorn << endl;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;



int main(){
  int n;
  cin >> n;
  if (n/10 == 9 || n%10 == 9) cout << "Yes\n";
  else cout << "No\n";
}

Measured memory_bytes: 256
// God put a smile upon your face <3

#include <bits/stdc++.h>

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    while(cin >> n >> m)
    {
		ans = max(0LL, (n * (n - 1))) / 2 + max(0LL, m * (m - 1)) / 2;

		cout << ans << endl;
    }


}





Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int n;
int u,v;
vector<int> ga[200100];
vector<int> ch[200100];
int zsize[200100];
long long dp1[200100],dp2[200100],MOD=1000000007;
long long fac[200100],ifac[200100],inv[200100];
long long C(long long x,long long y){
	return fac[x]*ifac[y]%MOD*ifac[x-y]%MOD;
}
long long kuai(long long x,long long y){
	long long rr=1LL;
	while(y){
		if(y&1)
			rr=(rr*x)%MOD;
		x=(x*x)%MOD;
		y>>=1;
	}
	return rr;
}
void solve1(int u,int p){
	dp1[u]=1LL;
	for(int v:ga[u]){
		if(v!=p){
			ch[u].push_back(v);
			solve1(v,u);
			zsize[u]+=zsize[v];
			dp1[u]=dp1[u]*C(zsize[u],zsize[v])%MOD*dp1[v]%MOD;
		}
	}
	zsize[u]++;
}
void solve2(int u){
	for(int v:ch[u]){
		dp2[v]=dp2[u]*dp1[v]%MOD*kuai(dp1[v]*C(n-1,zsize[v])%MOD,MOD-2)%MOD*C(n-1,n-zsize[v])%MOD;
		solve2(v);
	}
}
int main(){
	#ifdef FILIN
		#ifndef LOCAL
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	cin>>n;
	inv[1]=1LL;
	for(int i=2;i<=n;i++)
		inv[i]=(MOD-((MOD/i)*inv[MOD%i])%MOD);
	fac[0]=1LL;
	ifac[0]=1LL; 
	for(int i=1;i<=n;i++){
		fac[i]=(fac[i-1]*(long long)(i))%MOD;
		ifac[i]=(ifac[i-1]*inv[i])%MOD;
	}
	for(int i=1;i<n;i++){
		cin>>u>>v;
		ga[u].push_back(v);
		ga[v].push_back(u);
	} 
	solve1(1,-1);
	dp2[1]=dp1[1];
	solve2(1);
	for(int i=1;i<=n;i++){
		cout<<dp2[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 30464
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();
        int c;

        //入れ替え
        if(a<b){
            c = a;
            a = b;
            b = c;
        }

        while(a%b != 0){
            int d = a%b;
            a = b;
            b = d;
        }

        System.out.println(b);

    }
}


Measured memory_bytes: 26164
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main() {
    string s;

    while (getline(cin, s)) {
        int sum = 0;
        vector<int> arr(s.length());

        for (int i = 0; i < s.length(); i++) {
            if (s.at(i) == 'I') {
                arr.at(i) = 1;
            }
            else if (s.at(i) == 'V') {
                arr.at(i) = 5;
            }
            else if (s.at(i) == 'X') {
                arr.at(i) = 10;
            }
            else if (s.at(i) == 'L') {
                arr.at(i) = 50;
            }
            else if (s.at(i) == 'C') {
                arr.at(i) = 100;
            }
            else if (s.at(i) == 'D') {
                arr.at(i) = 500;
            }
            else if (s.at(i) == 'M') {
                arr.at(i) = 1000;
            }
        } //end for

        for (int j = arr.size()-1; j >=0;j--) {
            if (j == arr.size() - 1) {
                sum += arr.at(j);
            }
            else if (arr.at(j) < arr.at(j + 1)) {
                sum -= arr.at(j);
            }
            else {
                sum += arr.at(j);
            }
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 3112
import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
h = LI()
dp = [float('INF')]*N
dp[0] = 0
for i,j in itertools.product(range(N),[1,2]):
    if i+j>=N:
        continue
    dp[i+j] = min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
print(dp[-1])


Measured memory_bytes: 15192
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m,a,b,now=1;
char ans[1005][1005];
int main()
{
	scanf("%d%d%d%d",&n,&m,&a,&b);//ÏÈÌîB 
	for(int i=1;i<=n;++i) for(int j=1;j<=m;++j) ans[i][j]='.';
	if(m&1) {
		now=2;
		int jian=min(b,n/2);
		b-=jian;
		for(int i=1;i<=jian;++i) {ans[i*2-1][1]='^';ans[i*2][1]='v';}
		if(m!=1&&jian==n/2&&(b&1)) {--b;ans[n][m]='v';ans[n-1][m]='^';}
	}
	for(int i=1;i<n;i+=2) for(int j=now;j<=m;++j) if(b) {if(ans[i][j]=='.'&&ans[i+1][j]=='.') {ans[i][j]='^';ans[i+1][j]='v';--b;}} else break;
	if(b) {printf("NO");return 0;}
	for(int i=1;i<=n;++i) for(int j=1;j<m;++j) if(a) {if(ans[i][j]=='.'&&ans[i][j+1]=='.') {ans[i][j]='<';ans[i][j+1]='>';--a;}}else break;
	if(a) {printf("NO");return 0;}
	printf("YES\n");
	for(int i=1;i<=n;++i) puts(ans[i]+1);
	return 0;
}

Measured memory_bytes: 2176
class PrintTestCases:
    def __init__(self):
        self.i = 1

    def output(self, x):
        print "Case %d: %d" % (self.i, x)
        self.i += 1

if __name__ == "__main__":
    ptc = PrintTestCases();
    while True:
        x = int(raw_input())
        if x == 0:
            break
        ptc.output(x)

Measured memory_bytes: 6440
import java.io.*;
  
class Main
{
    public static void main (String[ ] args) throws Exception
    {
        BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
        StringBuffer sb = new StringBuffer();
          
        while(true)
        {
            String[] strAry = (br.readLine()).split(" ");
            int h = Integer.parseInt(strAry[0]);
            int w = Integer.parseInt(strAry[1]);
          
            if(0 == h & 0 == w)
            {
                break;
            }
  
            for(int i = 0; i < h; i++)
            {
                for(int j = 0; j < w; j++)
                {
                    sb.append("#");
                }
                sb.append("\n");
            }
            sb.append("\n");
        }
        System.out.print(sb);
    }
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
    long double a, b;
    cin >> a >> b;

    cout << (ll) (a * b + 0.001) << endl;
    return 0;
}



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

/*                    ॐ Shree ॐ                     */
/* ॐ ॐ ॐ
ॐ भूर् भुवः स्वः
तत् सवितुर्वरेण्यं
भर्गो देवस्य धीमहि
धियो यो नः प्रचोदयात्
*/
typedef long long ll;
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
// online submission
#endif
	string a,b;
	cin>>a>>b;
	int count=0;
	for(int i=0;i<a.size();i++){
		if(a[i]!=b[i]){
			count++;
		}
	}
	cout<<count;
}

Measured memory_bytes: 3744
#include <iostream>
using namespace std;

int main(){
  int n;
  cin >> n;
  int max=0;
  for(int i=1;i<35;++i){
    int m=1;
    for(int j=1;j<35;++j){
      m*=i;
      if(j==1)continue;
      if(m>n){
        break;
      }else if(m==n){
        cout << n << endl;
        return 0;
      }else{
        if(m>max)max=m;
      }
    }
  }
  cout << max << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        char[] c = s.toCharArray();
        
        int count = 1;
        int length = s.length();
        for(int i = 0; i < length-1; i++){
            if(c[i] == c[i+1]){
                i += 2;
                if(i >= length){
                    break;
                }
                count++;
                if(i >= length-1){
                    break;
                }
            }
            count++;
        }
        
        System.out.println(count);
    }
}

Measured memory_bytes: 25988
s = input()
t = input()
n = len(s)

slist = []
scount = []
tlist = []
tcount = []

for i in range(n):
  if not s[i] in slist:
    slist.append(s[i])
    scount.append(1)
  else:
    for j in range(len(slist)):
      if slist[j] == s[i]:
        scount[j] += 1
   
  if not t[i] in tlist:
    tlist.append(t[i])
    tcount.append(1)
  else:
    for j in range(len(tlist)):
      if tlist[j] == t[i]:
        tcount[j] += 1
        
print("Yes") if scount == tcount else print("No")
       

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

using namespace std;
typedef long long ll;
#define debug(x) cerr << x << "\n"
#define all(x) (x).begin(),(x).end()
#define exist(s, e)((s).find(e) != (s).end())

const int INF = 1000000000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,m,a,b,c,d,dist;
    vector<pair<int, int>> student;
    // 距離とチェックポイントのpair
    vector<pair<int, int>> ans;
    cin >> n >> m;
    for(int i=0;i<n;i++) {
        cin >> a >> b;
        student.push_back(pair<int,int>(a,b));
        ans.push_back(pair<int, int>(INF, 0));
    }
    for(int i=1;i<=m;i++) {
        cin >> c >> d;
        for (int j = 0;j<n;j++) {
            dist = abs(c-student[j].first) + abs(d-student[j].second);
            if (dist < ans[j].first) {
                ans[j].first = dist;
                ans[j].second = i;
            }
        }
    }
    for(auto& s: ans) {
        cout << s.second << '\n';
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
const ll MAX = 2400000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

void Main(){
    COMinit();
    ll r1;cin>>r1;r1--;
    ll c1;cin>>c1;c1--;
    ll r2;cin>>r2;
    ll c2;cin>>c2;
    ans+=COM(r2+c2+2,r2+1);
    ans%=MOD;
    ans-=COM(r1+c2+2,r1+1);
    ans=(ans+MOD)%MOD;
    ans+=COM(r1+c1+2,r1+1);
    ans%=MOD;
    ans-=COM(r2+c1+2,r2+1);
    ans=(ans+MOD)%MOD;
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}

Measured memory_bytes: 56448
import itertools

N = int(input())
num_list = [list(map(int, input().split())) for _ in range(2)]

all_list = list(itertools.permutations(range(1,1+N)))

ans = abs(all_list.index(tuple(num_list[0])) - all_list.index(tuple(num_list[1])))
print(ans)

Measured memory_bytes: 8052
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;

int n,v[N];
long long c,x[N],s[N],a[N],b[N],ans,MX,mx;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> c;
	for (int i=1;i<=n;i++){
		cin >> x[i] >> v[i];
		s[i]=s[i-1]+v[i];
		a[i]=max(a[i-1],s[i]-x[i]*2);
		b[i]=max(b[i-1],s[i]-x[i]);
	}
	ans=b[n];
	for (int i=n;i;i--){
		MX=max(MX,s[n]-s[i-1]-(c-x[i])*2);
		mx=max(mx,s[n]-s[i-1]-(c-x[i]));
		ans=max(ans,max(a[i-1]+mx,b[i-1]+MX));
	}
	cout << ans << "\n";
}

Measured memory_bytes: 3840
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
 
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1000000007
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
//ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
int N;
int C[214514];
int mem[214514];
ll dp[214514]={0};
int ans[214514];
vi dif;
vi dif_loop;
vi same;
vi same_loop;
ll gcd(ll a, ll b) {
	return b != 0 ? gcd(b, a % b) : a;
}
int Bcnt[214514]={0};
int main(){
	int n;
	cin>>n;
	string str;
	cin>>str;
	int now=0;
	rep(i,n){
		if(str[i]=='#')now++;
		Bcnt[i+1]=now;
	}
	int ans=n;
	for(int i=0;i<=n;i++){
		ans=min(ans,Bcnt[i]+(n-i)-Bcnt[n]+Bcnt[i]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1412
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    string s,t;
    int n;
    cin>>n;
    cin>>s>>t;
    int ans = INF;
    for(int i=0;i<=n;i++){
        bool f = true;
        for(int j=i;j<n;j++){
            if( s[j]!=t[j-i] )f = false;
        }
        if(f)ans = min(ans,i*2+(n-i));
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  string S,T;
  int N;
  cin>>N;
  cin>>S>>T;
  REP(i,N){
    cout<<S[i]<<T[i];
  }
  cout<<endl;
  return 0;
}


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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n;
    cin>>n;
    n%=10;
    if(n == 3){
        cout << "bon" << endl;
    }else if(n == 0 or n == 1 or n == 6 or n == 8){
        cout << "pon" << endl;
    }else cout << "hon" << endl;
    return 0;
}

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


int x[20][20];
int y[20][20];
int A[20];

double length(int x1,int x2,int y1,int y2) {
    return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

int main() {
  int N;
  cin >> N;
  
  vector<int> X,Y; 
  vector<int> V(N);
  
  for(int i = 0;i < N;i++){
    int xi,yi;
  	cin >> xi >> yi;
    X.push_back(xi);
    Y.push_back(yi);
    V.at(i) = i;
  }
  
  double sum_path = 0;
  int cnt = 0;
  do {
    double tmp_sum = 0.0;
    for(int i = 1;i < N; i++){
      tmp_sum += length(X.at(V[i-1]),X.at(V[i]),Y.at(V[i-1]),Y.at(V[i]));
    }
    
    sum_path += tmp_sum;
    cnt++;
  } while(next_permutation(V.begin(), V.end()));     // 次の順列を生成
  
  cout << fixed;
  cout << setprecision(10) << sum_path / cnt << endl;
  
  return 0; 
}


Measured memory_bytes: 256
#template
def inputlist(): return [int(k) for k in input().split()]
def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)
def len_check(k,n):
    if len(k) == n:
        return k
    else:
        for _ in range(n-len(k)):
            k = '0'+k
        return k
#template
D,G = inputlist()
ans = 10**9
li = [0]*D
for i in range(D):
    li[i] = inputlist()
for i in range(2**D):
    lis = []
    k = base10to(i,2)
    k = len_check(k,D)
    for d in range(D):
        if k[d] == '1':
            otake = [(d+1)*100] + li[d]
            lis.append(otake)
    lis.sort(reverse=True)
    n = len(lis)
    tmp = 0
    count = 0
    for t in range(n):
        p = lis[t][1]
        point = lis[t][0]
        for pt in range(1,p+1):
            tmp += point
            count +=1
            if pt == p:
                tmp += lis[t][2]
            if tmp >= G:
                ans = min(ans,count)
                break
print(ans)

Measured memory_bytes: 56684
#include <iostream>

using namespace std;

using ULL = int64_t;

int main(void) {

	ULL N, M;
	cin >> N >> M;

	for (int i = M / N; i > 0; i--) {
		if (M % i == 0) {
			cout << i << endl;
			return 0;
		}
	}


	return 0;
}

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

using namespace std;

int cnt[4001][4001][2];

signed main() {
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    int x[n], y[n];
    char c[n];
    int K = 2 * k;
    for(int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> c[i];
        cnt[x[i] % K + 1][y[i] % K + 1][c[i] == 'B']++;
    }
    
    for(int z = 0; z <= 1; z++) {
        for(int i = 0; i < 2 * K; i++) {
            for(int j = 0; j < 2 * K; j++) {
                cnt[i + 1][j + 1][z] = cnt[i % K + 1][j % K + 1][z];
            }
        }
        for(int i = 1; i <= 2 * K; i++) {
            for(int j = 1; j <= 2 * K; j++) {
                cnt[i][j][z] += cnt[i - 1][j][z] + cnt[i][j - 1][z] - cnt[i - 1][j - 1][z];
            }
        }
    }
    int ans = 0;
    auto sum = [&](int lx, int ly, int rx, int ry, int z) {
        return cnt[rx][ry][z] - cnt[lx][ry][z] - cnt[rx][ly][z] + cnt[lx][ly][z];
    };
    for(int i = 0; i <= K; i++) {
        for(int j = 0; j <= K; j++) {
            int cnt1 = sum(i, j, i + k, j + k, 0);
            int cnt2 = sum(i + k, j, i + K, j + k, 1);
            int cnt3 = sum(i, j + k, i + k, j + K, 1);
            int cnt4 = sum(i + k, j + k, i + K, j + K, 0);
            
            ans = max(ans, cnt1 + cnt2 + cnt3 + cnt4);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 126208
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
using ll = long long;

int main() {
  ll x, y;
  cin >> x >> y;
  ll count = 0;
  for (ll i = x; i <= y; i = i * 2) {
    count++;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3588
import java.util.Scanner;

class Main{
	public static void main(String[] args)  {

		// Operation Dice1 simulation
		Scanner sc = new Scanner(System.in);

		// dice space save
		String[] tmp = sc.nextLine().split(" ");
		int[] diceNum = new int[Diceclass.DICEDESIGN];
		for (int i = 0; i < Diceclass.DICEDESIGN; i++) {
			diceNum[i] = Integer.parseInt(tmp[i]);
		}
		Diceclass diceSpace = new Diceclass(diceNum);

		// order save
		String[] order = sc.nextLine().split("");

		// order run
		for (int i = 0; i < order.length; i++) {
			switch (order[i]) {
			case "N":
				diceSpace.orderN();
				break;
			case "S":
				diceSpace.orderS();
				break;
			case "E":
				diceSpace.orderE();
				break;
			case "W":
				diceSpace.orderW();
				break;
			}
		}
		System.out.println(diceSpace.outputTOP(diceSpace.TOP));
	}
}
class Diceclass {

	// declear
	static final int DICEDESIGN = 6;
    static final int TOP = 0; //?????¢ ex:1
    static final int FRONT = 1;//??£??¢ ex:2
    static final int RIGHT = 2;// ex:3 order:East
    static final int LEFT = 3;// ex:4???order:West
    static final int BACK = 4;//?£???¢ ex:5 order:North
    static final int BOTTOM = 5;// ex:6 order:South

    int[][] dice = new int[DICEDESIGN][2];

    public Diceclass(){
    	for (int i = 0; i < DICEDESIGN; i++) {
    		// [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]
    		/*for (int j = 0; j < 3; j++) {
    			dice[i][j] = dice[i+1][j+1]; // error
			}*/
			 dice [i][0] = i+1;
			 dice[i][1] = dice [i][0];
		}
    }

	/*
	 * Sample Input
	 * 1 1 2 4 8 16 32
	 * SE
	 * Sample Output
	 * 1 8
	 */

	public Diceclass(int[] diceNum) {
		this();

		for (int i = 0; i < DICEDESIGN; i++) {
			// [[1, 1], [2, 2], [3, 4], [4, 8], [5, 16], [6, 32]]
			dice[i][1] = diceNum[i];
		}
	}

	public void orderN() {// clear

		// logic T - T ->F, B ->F, BA ->BT, T ->BA
		int[] temp = dice[TOP];
		dice[TOP] = dice[FRONT];
		dice[FRONT] = dice[BOTTOM];
		dice[BOTTOM] = dice[BACK];
		dice[BACK] = temp;
	}

	public void orderS() {// clear

		// logic BT - F -> BT, T ->F, BA -> T, BT ->BA
		int[] temp = dice[BOTTOM];
		dice[BOTTOM] = dice[FRONT];
		dice[FRONT] = dice[TOP];
		dice[TOP] = dice[BACK];
		dice[BACK] = temp;
	}

	public void orderE() {
		// logic L - R->BT, T->R, L->T, B->L
		int[] temp = dice[BOTTOM];
		dice[BOTTOM] = dice[RIGHT];
		dice[RIGHT] = dice[TOP];
		dice[TOP] = dice[LEFT];
		dice[LEFT] = temp;

	}

	public void orderW() {
		// logic R - BT -> R, L -> BT, L -> T, T->R
		int[] temp = dice[RIGHT];
		dice[RIGHT] = dice[BOTTOM];
		dice[BOTTOM] = dice[LEFT];
		dice[LEFT] = dice[TOP];
		dice[TOP] = temp;

	}

	public int outputTOP(int top) {
		// TOP?
		return dice[top][1];
	}

}

Measured memory_bytes: 26040
#include <bits/stdc++.h>
#include <unordered_set>
#include <stdio.h>

using namespace std;

#define ll long long
#define ull unsigned long long
#define PI 3.141592653589793
#define vi vector<int>
inline double degcos(double ang) {return cos(ang*PI/180);}
inline double degsin(double ang) {return sin(ang*PI/180);}
#define for(i,j,k,in) for (int i = j; i < k; i += in)

/*---END OF TEMPLATE---*/


int arr[200005];
int pre[200005];

int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    //ifstream fin("data.in");
    //ofstream fout("data.out");
    int k,n;
    cin >> k >> n;
    memset(arr,0,sizeof(arr));
    memset(pre,0,sizeof(pre));
    for(i,0,n,1) cin >> arr[i];
    if (n == 1) {
        cout << 0;
        return 0;
    }
    int sum = 0;
    for(i,0,n,1) {
        if (i == 0) {
            pre[i] = arr[i]-arr[n-1]+k;
        }
        else {
            pre[i] = arr[i]-arr[i-1];
        }
        sum += pre[i];
    }
    cout << sum - *max_element(pre,pre+n);



}

Measured memory_bytes: 1792
H,N=map(int,raw_input().split())
A=map(int,raw_input().split())
A.sort(reverse=True)
ans=False
for i in range(N):
  H = H - A[i]
  if H<=0:
    ans = True
    break
if ans:
  print "Yes"
else:
  print "No"

Measured memory_bytes: 11316
#include<bits/stdc++.h>
 
using namespace std;
 
using int64 = long long;
 
int main() {
  int N, C[100000];
  cin >> N;
  for(int i = 0; i < N; i++) cin >> C[i];
  int Q;
 
  int st[100000] = {};
  cin >> Q;
  for(int i = 0; i < Q; i++) {
    int t, x, d;
    cin >> t >> x >> d;
    if(t == 1) {
      --x;
      st[x] += d;
      if(st[x] > C[x]) {
        cout << x + 1 << endl;
        return (0);
      }
    } else {
      --x;
      st[x] -= d;
      if(st[x] < 0) {
        cout << x + 1 << endl;
        return (0);
      }
    }
  }
 
  cout << "0" << endl;
}


Measured memory_bytes: 3488
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <tuple>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rep1(i, n) for(int i=1; i<=n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
#define countof(array) (sizeof(array) / sizeof(array[0]))
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string as = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string ab = {"abcdefghijklmnopqrstuvwxyz"};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

void yes() {
  cout << "Yes" << endl;
}

void no() {
  cout << "No" << endl;
}

void print_array(int array[], int len) {

  for(int i=0; i<len; ++i) {
    cout << array[i] << endl;
  }

}

ll absolute(ll x) {
  return (x<0)? (-1)*x : x;
}

//g++ AtCoder.cpp -o AtCoder
//AtCoder

//--------------------------
int main() {

  int n;
  cin >> n;

  cout << n/2 + n%2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
 
using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
 
//recollect
//simplify
//divide into cases (i.e. i = 1, 2, N, a prime number, etc...)
  
void solve() {
	int n, m;
	cin >> n >> m;
	
	map<int, int> u;
	for(int i = 0; i < n; i++) {
		int k;
		cin >> k;
		for(int j = 0; j < k; j++) {
			int a;
			cin >> a;
			u[a]++;
		}
	}
	
	int ans = 0;
	for(ii i : u) {
		if(i.ss == n) ans++;
	}
	
	cout << ans << endl;
}
 
int main(){
#define MULTITEST 0
#if MULTITEST   
 
    CASET {
        solve();
    }
    
#else
 
    solve();
    
#endif
 
    return 0;
}

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

int main(){
  string N;
  cin>>N;
  
  int sum=0;
  
  for(int i=N.size()-1;i>=0;i--){
    sum+=(N.at(i)-'0')*pow(10,N.size()-1-i);
  }
  
  int sum1=0;
  
  int X;
  
  int Y;
  
  for(int i=0;i<N.size();i++){
    
    if(i==0){
      sum1+=sum%10;
      X=sum%10;
  }
    else if(i==1){
      sum1+=((sum-X)/10)%10;
      int b=(sum-X)/10;
           X=b%10;
             Y=b;
    }
    
      
    else{
    sum1+=((Y-X)/10)%10;
           int a=(Y-X)/10;
      X=a%10;
      Y=a;
      
             
      
    }
  }
  
    
      
  
  if(sum%sum1==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main(){

	int w,h;
	while(cin>>w>>h&&!(w==0&&h==0)){
		vector<string> orders;
		string str;
		getline(cin,str);
		while(1){
			getline(cin,str);
			orders.push_back(str);
			if(str=="STOP"){
				break;
			}
		}
		int cy=0;
		int cx=0;
		// 0:up,1:right,2:down,3:left
		int angle=0;
		for(int i = 0; i < orders.size(); i++){
			if(orders[i].substr(0,7)=="FORWARD"){
				int px=cx;
				int py=cy;
				if(angle==0)
					cy+=atoi(orders[i].substr(8).c_str());
				else if(angle==1)
					cx+=atoi(orders[i].substr(8).c_str());
				else if(angle==2)
					cy-=atoi(orders[i].substr(8).c_str());
				else if(angle==3)
					cx-=atoi(orders[i].substr(8).c_str());
				if(!(cy>=0&&cx>=0&&cy<h&&cx<w)){
					cy=max(0,cy);
					cx=max(0,cx);
					cy=min(h-1,cy);
					cx=min(w-1,cx);
				}
			}
			else if(orders[i]=="RIGHT"){
				angle++;
				angle%=4;
			}
			else if(orders[i]=="LEFT"){
				angle--;
				angle=(angle+4)%4;
			}
			else if(orders[i].substr(0,8)=="BACKWARD"){
				int px=cx;
				int py=cy;
				if(angle==2)
					cy+=atoi(orders[i].substr(9).c_str());
				else if(angle==3)
					cx+=atoi(orders[i].substr(9).c_str());
				else if(angle==0)
					cy-=atoi(orders[i].substr(9).c_str());
				else if(angle==1)
					cx-=atoi(orders[i].substr(9).c_str());
				if(!(cy>=0&&cx>=0&&cy<h&&cx<w)){
					cy=max(0,cy);
					cx=max(0,cx);
					cy=min(h-1,cy);
					cx=min(w-1,cx);
				}
			}
			else if(orders[i]=="STOP"){
				break;
			}
		}
		cout<<cx+1<<" "<<cy+1<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF -1e18
#define INF 1e18
#define int ll int
#define double long double
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef pair<int,pair<int,int>> PIPI;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}

int fact[1000005],fact_inv[1000005];
int ncr(int n,int r){
    if(n<r){return 0;}
    if(n==r||r==0){return 1;}
    return (((fact[n]*fact_inv[n-r])%mod)*fact_inv[r])%mod;
    //return x; 
}
int npr(int n,int r)
{
    int x=ncr(n,r);
    x=(x*fact[r])%mod;
    return x;
}
signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{//cout<<"Case #"<<T1<<": ";
    int n,m;
    cin>>n>>m;
    fact[0]=1;int ans=0;
    for(int i=1;i<1000005;i++){
        fact[i]=(fact[i-1]*i)%mod;
        fact_inv[i]=power(fact[i],mod-2);
    }
    int c=1;
    for(int i=0;i<=n;i++)
    {
        ans+=c*(ncr(n,i)*npr(m-i,n-i))%mod;
        ans%=mod;
        ans=(ans+mod)%mod;
        c*=-1;
    }
    ans*=npr(m,n);
    ans%=mod;
    ans=(ans+mod)%mod;
    cout<<ans<<endl;
}


return 0;
}





Measured memory_bytes: 19240
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define forn(i, n) for (ll i = 0; i < n; i++)
#define forn1(i, n) for (ll i = 1; i <= n; i++)
#define EPS 1e-9
#define ff first
#define ss second
#define pb push_back
#define sortx(x) sort(x.begin(), x.end())
ll table[3][3];
ll pos[5][5];
int main()
{
    ios::sync_with_stdio(0);

    ll number;
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> table[i][j];
        }
    }
    ll N, b, cnt = 0;
    cin >> N;
    while (N--)
    {
        cin >> b;
        forn(i, 3)
        {
            forn(j, 3)
            {
                if (table[i][j] == b)
                {
                    pos[i][j] = 1;
                    cnt++;
                }
            }
        }
    }
    if (cnt < 3)
    {
        cout << "No\n";
        return 0;
    }
    bool bingo = false;
    for (ll i = 0; i < 3; i++)
    {
        if (pos[i][0] && pos[i][1] && pos[i][2])
        {
            bingo = true;
        }
    }
    for (ll j = 0; j < 3; j++)
    {
        if (pos[0][j] && pos[1][j] && pos[2][j])
        {
            bingo = true;
        }
    }

    if (pos[0][0] && pos[1][1] && pos[2][2])
    {
        bingo = true;
    }
    if (pos[0][2] && pos[1][1] && pos[2][0])
    {
        bingo = true;
    }
    cout << (bingo ? "Yes\n" : "No\n");

    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

int main(void) {
    int i;
    REP (i,4) {
        char c;
        cin >> c;
        cout << c;
    }
    cout << " ";
    REP (i,8) {
        char c;
        cin >> c;
        cout << c;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#define ll long long
using namespace std;

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

const int N=5005;
const int Mod=1000000007;
//const int inv=500000004;
int n,m,a[N];
ll f[N][N],s[N][N];

inline ll fpow(ll a,ll b){
	ll ret=1;
	while(b){if(b&1) ret=ret*a%Mod;a=a*a%Mod;b>>=1;}
	return ret;
}

signed main(){
	n=read();m=read();ll inv=fpow(2,Mod-2);
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++){
			if(i==j) continue;
			if(a[i]>a[j]) f[i][j]=1;
		}
	for(int i=1;i<=m;i++){		
		int x=read(),y=read();
		f[x][y]=f[y][x]=(f[x][y]+f[y][x])%Mod*inv%Mod;
		for(int j=1;j<=n;j++){
			if(j==x||j==y) continue;			
			f[x][j]=f[y][j]=(f[x][j]+f[y][j])%Mod*inv%Mod;
			f[j][x]=f[j][y]=(f[j][x]+f[j][y])%Mod*inv%Mod;
		}
/*		for(int j=1;j<=n;j++){
			f[x][j]=s[x][j],f[j][x]=s[j][x];
			f[y][j]=s[y][j],f[j][y]=s[j][y];
		}
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++) printf("f[%d][%d]=%d\n",i,j,f[i][j]);
		*/
	}
	ll ans=0;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++) ans=(ans+f[i][j])%Mod;
	printf("%lld\n",ans*fpow(2,m)%Mod);
	return 0;
}


Measured memory_bytes: 119168
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
ll gcd(ll a, ll b){
  if(b==0) return a;
  else gcd(b,a%b);
}
ll lcm(ll a, ll b){
  return a/gcd(a,b)*b;
}
int main(){
  int n,m;
  cin >> n >> m;
  vector<pair<bool,int>> r;
  rep(i,n) r.push_back(make_pair(false,1));
  r[0]={true,1};
  rep(i,m){
    int x,y;
    cin >> x >> y;
    x--;
    y--;
    if(r[x].first){
      r[y].first=true;
      r[y].second++;
      r[x].second--;
      if(r[x].second==0)r[x].first=false;
    }
    else{
      r[y].second++;
      r[x].second--;
    }
  }
  int ans=0;
  rep(i,n){
    if(r[i].first)ans++;
  }
  cout << ans<< endl;
  
  return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
int v[26];
int main(){
	fastIO;  
	for(int i=0;i<26;i++)v[i]=0;
	string s;
	cin>>s;
	for(int i=0;i<(int)s.size();i++){
		v[s[i]-'a']++;	
	}
	for(int i=0;i<26;i++){
		if(v[i]%2 != 0){
			cout<<"No\n";
			return 0;
		}
	}
	cout<<"Yes\n";
	return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    double l;
    cin >> l;
    l /= 3;
    cout << fixed << setprecision(12);
    ANS(l * l * l);
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;

    int cnt = 0;

    for (int i = 0; i < 3; i++)
        if (s[i] == 'o')    ++cnt;
    
    int sum = 700 + 100*cnt;

    cout << sum << endl;
}

Measured memory_bytes: 256