akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){
    return b?gcd(b,a%b):a;
}
int main(){
    int n;
    cin >> n;
    vector<ll>a(n);
    REP(i,n)cin >> a[i];
    ll answer;
    answer = gcd(a[0],a[1]);
    REP(i,n)answer = gcd(answer,a[i]);
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 4020
N = int(input())
T, A = map(int,input().split())
H = list(map(int,input().split()))

def f(x):
    return T - x*0.006

ans = 1000
count = 0
for i in range(N):
    y = A - f(H[i])
    y = max(y,-y)
    if y < ans:
        count = i+1
    ans = min(ans,y)

print(count)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0)
      break;

    int dice[6] = {1, 3, 6, 4, 2, 5};
    int sum = 1;

    for (int i = 0; i < n; ++i) {
      string cmd;
      cin >> cmd;

      int tmp;
      switch (cmd[0]) {
        case 'N':
          tmp = dice[0];
          dice[0] = dice[4];
          dice[4] = dice[2];
          dice[2] = dice[5];
          dice[5] = tmp;
          break;
        case 'E':
          tmp = dice[0];
          dice[0] = dice[3];
          dice[3] = dice[2];
          dice[2] = dice[1];
          dice[1] = tmp;
          break;
        case 'W':
          tmp = dice[0];
          dice[0] = dice[1];
          dice[1] = dice[2];
          dice[2] = dice[3];
          dice[3] = tmp;
          break;
        case 'S':
          tmp = dice[0];
          dice[0] = dice[5];
          dice[5] = dice[2];
          dice[2] = dice[4];
          dice[4] = tmp;
          break;
        case 'R':
          tmp = dice[4];
          dice[4] = dice[1];
          dice[1] = dice[5];
          dice[5] = dice[3];
          dice[3] = tmp;
          break;
        case 'L':
          tmp = dice[4];
          dice[4] = dice[3];
          dice[3] = dice[5];
          dice[5] = dice[1];
          dice[1] = tmp;
          break;
      }

      sum += dice[0];
    }

    cout << sum << endl;
  }
}


Measured memory_bytes: 3112
import java.util.Scanner;

public class Main {
    static int n = 0;
    static int m = 0;
    static int x = 0;
    static int[] c = null;
    static int[][] a = null;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        x = in.nextInt();
        c = new int[n];
        a = new int[n][m];
        for(int i=0; i<n; i++) {
            c[i] = in.nextInt();
            for(int j=0; j<m; j++) {
                a[i][j] = in.nextInt();
            }
        }
        for(int i=0; i<m; i++) {
            int sumSkill = 0;
            for(int j=0; j<n; j++) {
                sumSkill += a[j][i];
            }
            if(sumSkill<x) {
                System.out.println(-1);
                return;
            }
        }
        
        int ans = Integer.MAX_VALUE;
        for(int i=0; i<(1<<n); i++) {
            int cost = totalCost(i);
            if(cost>0) {
                ans = Math.min(ans, cost);
            }
        }
        System.out.println(ans);
    }
    private static int totalCost(int books) {
        int total = 0;
        int[] sumSkills = new int[m];
        for(int i=0; i<n; i++) {
            if((books & (1<<i)) == 0) {
                continue;
            }
            for(int j=0; j<m; j++) {
                sumSkills[j] += a[i][j];
            }
            total += c[i];
        }
        for(int j=0; j<m; j++) {
            if(sumSkills[j] < x) {
                return -1;
            }
        }
        return total;
    }
}


Measured memory_bytes: 37272
import sys
from sys import exit
from math import gcd, factorial, ceil, floor, sqrt
from bisect import bisect_left, bisect_right
from copy import deepcopy
from heapq import heapify, heappop, heappush
from itertools import permutations, combinations, product, accumulate
from collections import defaultdict, deque, Counter
sys.setrecursionlimit(10**7)

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

N = int(input())

ans = 0
for a in range(1, N):
    b = (N-1)//a
    ans += b
print(ans)

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

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

  if ( N < 1200 ) cout << "ABC" << endl;
  else if ( N >= 1200 && N < 2800 ) cout << "ARC" << endl;
  else cout << "AGC" << endl;
}

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

using namespace std;

int main(void){
	int N;
	string str[100];
	cin	>> N;
	int i,j;
	for(i=0;i<N;i++) cin >> str[i];
	//ここまで入力
	int flag = 0;
	for(i=0;i<N-1;i++){
		if(str[i][str[i].size()-1] != str[i+1][0]){
			flag = 1;
			break;
		}
	}
	int flag2 = 0;
	if(flag == 1){
		cout << "No" << endl;
	}else{
		for(i=0;i<N;i++){
			for(j=i+1;j<N;j++){
				if(str[i] == str[j]){
					flag2 = 1;
					break;
				}
			}
			if(flag2 == 1) break;
		}
	}
	if(flag2 == 1){
		cout << "No" << endl;
	}
	if(flag == 0 && flag2 == 0){
		cout << "Yes" << endl;
	}
}

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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

struct union_find {
	vector<int> v;
	union_find(int n) : v(n, -1) {}
	int find(int x) { return v[x] < 0 ? x : v[x] = find(v[x]); }
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
		if (-v[x] < -v[y]) swap(x, y);
		v[x] += v[y]; v[y] = x;
	}
	bool root(int x) { return v[x] < 0; }
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -v[find(x)]; }
};

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<int>> a(H, vector<int>(W));
    rep(y, H) {
        string s; cin >> s;
        rep(x, W) a[y][x] = (s[x] == '#');
    }
    union_find uf(H * W);
    rep(y, H) rep(x, W) rep(k, 4) {
        int _y = y + dy[k];
        int _x = x + dx[k];
        if (0 <= _y && _y < H && 0 <= _x && _x < W && a[y][x] != a[_y][_x]) {
            uf.unite(y * W + x, _y * W + _x);
        }
    }
    vector<vector<int>> num(H * W, vector<int>(2));
    rep(u, H * W) {
        int U = uf.find(u);
        int k = a[u / W][u % W];
        num[U][k]++;
    }
    ll ans = 0;
    rep(u, H * W) ans += (ll)num[u][0] * num[u][1];
    cout << ans << endl;
}


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

int main(){
    int n;
    string taro,hanako;
    int status;
    int taro_sum=0,hanako_sum=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>taro;
        cin>>hanako;
        int length;
        if(taro.length()>hanako.length()){
            length=hanako.length();
            status=1;
        }else if(taro.length()<hanako.length()){
            length=taro.length();
            status=2;
        }else{
            length=hanako.length();
            status=0;
        }
        bool check=false;
        for(int j=0;j<length;j++){
            if(taro[j]<hanako[j]){
                hanako_sum+=3;
                check=true;
                break;
            }else if(hanako[j]<taro[j]){
                taro_sum+=3;
                check=true;
                break;
            }
        }
        //途中まで完全一致
        if(!check){
            if(status==0){
                taro_sum+=1;
                hanako_sum+=1;
            }else if(status==1){
                taro_sum+=3;
            }else{
                hanako_sum+=3;
            }
        }
    }
    cout<<taro_sum<<" "<<hanako_sum<<endl;
    return 0;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define ll long long int
#define dbg(x) cout<<"( "<<#x<<" -> "<<x<<" )"<<endl;
using namespace std;
int main()
{
    int a,b,c,k;
    scanf("%d%d%d%d",&a,&b,&c,&k);
    while (a>=b)
    {
        b=b*2;
        k--;
    }
    while (b>=c)
    {
        c=c*2;
        k--;
    }
    if (k>=0)
    printf("Yes\n");
    else
    printf("No\n");
    return 0;
}

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


int main(){
  int min, al[26] = {100}, n;
  string str, ans;

  for(int i=0; i<26; ++i)
    al[i] = 100;
  
  cin >> n;

  for(int i=0; i<n; ++i){
    cin >> str;

    int a[26] = {0};
    for(int k=0; k<str.size(); ++k){
      ++a[str[k]-'a'];
    }

    for(int k=0; k<26; ++k){
      if(al[k] > a[k]){
	al[k] = a[k];
      }
    }
  }

  for(int i=0; i<26; ++i){
    if(al[i] != 100){
      for(int k=0; k<al[i]; ++k){
	ans+= i + 'a';
      }
    }
  }

  cout << ans << endl;
  
  return 0;
}


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

int main(){
    int m, f, r;

    while(1){
      cin>>m>>f>>r;
    
      if(m == -1 && f == -1 && r == -1) break;
    
      /* 入力された点数に対する処理... */
      if(m == -1 || f == -1){
          cout<<"F"<<endl;
          continue;
      }
      if((m+f)>=80){
          cout<<"A"<<endl;
          continue;
      }
      if((m+f)>=65&&(m+f)<80){
          cout<<"B"<<endl;
          continue;
      }
      if((m+f)>=50&&(m+f)<65){
          cout<<"C"<<endl;
          continue;
      }
      if((m+f)>=30&&(m+f)<50){
          if(r>=50){
              cout<<"C"<<endl;
              continue;
          }else{
              cout<<"D"<<endl;
              continue;
          }
      }
      if((m+f)<30){
          cout<<"F"<<endl;
          continue;
      }
    }
}







Measured memory_bytes: 3096
#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define N	    100001
#define rep(i,a,b)  for(int i=a;i<b;i++)
int dp[N];
int main() {
	int n;
	cin>>n;
	int a[n + 1];
	rep(i, 0, n)
		cin>>a[i];
	a[n] = a[n- 1];
	for(int i = n - 2; i >= 0; i--) {
		dp[i] = min(abs(a[i] - a[i + 1]) + dp[i + 1], abs(a[i] - a[i + 2]) + dp[i + 2]);
	}
	cout<<dp[0]<<endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#define N 100010
int n,m,a[N];
int main() {
	scanf("%d%d%d",&n,&m,a);
	int p=0;
	for(int i=1;i<n;++i) {
		scanf("%d",a+i);
		if(a[i]+a[i-1]>=m) p=i;
	}
	if(!p) puts("Impossible");
	else {
		puts("Possible");
		for(int i=1;i<p;++i) printf("%d\n",i);
		for(int i=n-1;i>=p;--i) printf("%d\n",i);
	}
	return 0;
}

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

#define int           long long
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (long long )(1e18+1)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){
    cerr << name << " = " << arg1 << endl;
}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args){
    const char *name = strchr(names, ',');
    cerr.write(names, name-names) << " = " << arg1 << endl;
    _F(name+2, args...);
}
template<typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2> &q){
    in >> q.F >> q.S; return in;
}
template<typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> &q){
    out << q.F << " " << q.S; return out;
}
template< typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F+p2.F, p1.S+p2.S};
}
template< typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F-p2.F, p1.S-p2.S};
}

void solve(){
    int n, k;
    cin >> n >> k;
    int h[n];
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    int ans[n];
    ans[0] = 0;
    for(int i = 1; i < n; i++){
        ans[i] = inf;
        for(int j = -k; j < 0; j++){
            if(i+j >= 0)
                ans[i] = min(ans[i], ans[i+j]+abs(h[i]-h[i+j]));
        }
    }
    cout << ans[n-1] << endl;
}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   

    int t = 1;
    start = clock(); 

    cout << fixed << setprecision(12);

    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
    //freopen("error.txt", "w", stderr);
    //#endif

    //cin >> t;

    for(int i = 1; i <= t; ++i){
        //cout << "Case #" << i << ": "; 
        solve();
        //cout << endl;
    }
    //cerr << time(start);
    return 0;
}

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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<" --- "<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e6+10;
const ll mod=1e9+7;
ll dp[maxn][3];
int n;

int main(){
	io;
	cin>>n;
	dp[1][0]=1;dp[1][1]=1;dp[1][2]=8;
	ll ans=0;
	for(int i=2;i<=n;i++){
		ans+=(dp[i-1][0]+dp[i-1][1])*qpow(10,n-i,mod);ans%=mod;
		dp[i][0]+=dp[i-1][0]*9+dp[i-1][2];dp[i][0]%=mod;
		dp[i][1]+=dp[i-1][1]*9+dp[i-1][2];dp[i][1]%=mod;
		dp[i][2]=(dp[i-1][2]*8)%mod;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 26908
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
//
//class UnionFind {
//private:
//    int sz;
//    vector<int> par, size_;
//public:
//    UnionFind(){}
//    UnionFind(int node_size) : sz(node_size), par(sz), size_(sz, 1){
//        iota(par.begin(), par.end(), 0);
//    }
//    int find(int x){
//        if(par[x] == x) return x;
//        else return par[x] = find(par[x]);
//    }
//    void unite(int x, int y){
//        x = find(x); y = find(y);
//        if(x == y) return;
//        if(size_[x] < size_[y]) swap(x,y);
//        par[y] = x;
//        size_[x] += size_[y];
//    }
//    int size(int x){
//        x = find(x);
//        return size_[x];
//    }
//    bool same(int x, int y){
//        return find(x) == find(y);
//    }
//};
//void no(){
//    cout << "Impossible" << endl;
//    exit(0);
//}
//int main(){
//    cin.tie(nullptr);
//    ios::sync_with_stdio(false);
//    int n, m;
//    cin >> n >> m;
//    vector<vector<int>> g(n);
//    vector<int>a(n);
//    rep(i,n)cin >> a[i];
//    rep(i,m){
//        int x, y;
//        cin >> x >> y;
//        x--;y--;
//        g[x].push_back(y);
//        g[y].push_back(x);
//    }
//    if(m == n - 1){
//        cout << 0 << endl;
//        return 0;
//    }
//    if(n / 2 < n - m - 1){
//        no();
//    }
//}
void no(){
    cout << -1 << endl;
    exit(0);
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int>a(n+1);
    rep(i,n+1)cin >> a[i];
    ll sum = accumulate(a.begin(), a.end(), 0LL);
    ll ans = 0;
    ll left = 1;
    for(int i = 0; i <= n; i++){
        ans += left;
        if(left < a[i])no();
        left -= a[i];
        sum -= a[i];
        left = min(2 * left, sum);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3968
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int n;
  cin >> n;
  vector<ll> a(n);
  ll x = 0, y = 0, min = 1000000000000000;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    x += a[i];
  }
  for (int i = n - 1; i >= 1; i--) {
    x -= a[i];
    y += a[i];
    if (abs(x - y) < min) min = abs(x - y);
  }
  cout << min << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 998244353LL
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair

#define FOR(i, a, b) for (ll i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (ll i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 105
ll n;

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

    cin >> n;
    ll ans = 0;
    bool sml = false;
    while(n != 0){
        if(n <= 9){
            if(sml) ans += (n-1);
            else ans += n;
        } else if(n % 10 == 9){
            ans += 9;
        } else{
            ans += 9; sml = true;
        }
        n /= 10;
    }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
/* ex 3_1
  kt125 */

#include <stdio.h>

int main(void) {
  int n;
  scanf("%d", &n);
  
  switch(n % 10){
    case 2: case 4: case 5: case 7: case 9:
      printf("hon"); break;
    case 0: case 1: case 6: case 8:
      printf("pon"); break;
    case 3:
      printf("bon"); break;
  }
  return 0;
}



Measured memory_bytes: 1676
#include"iostream"
#include"cstdio"

#define MAXN
using namespace std;
typedef long long LL;
#define INF 0x7fffffff

int a[100050];

int main()
{
	int n;
	scanf("%d", &n);
	scanf("%d", &a[1]);
	for(int i = 2; i <= n; i++)
	{
		scanf("%d", &a[i]);
		if(a[i] == a[i - 1])
		{
			i--;
			n--;
		}
	}
	int cnt = 0, p = 1;
	while(p <= n)
	{
		cnt++;
		p++;
		if(a[p - 1] < a[p])
			while(p <= n && a[p - 1] < a[p])
				p++;
		else
			while(p <= n && a[p - 1] > a[p])
				p++;
		//cout << p << ' ';
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
using namespace std;
struct Dice{
  int s[6];
  void roll(char c){
    int b;
    if(c=='E'){
      b=s[0];
      s[0]=s[3];
      s[3]=s[5];
      s[5]=s[2];
      s[2]=b;
    }
    if(c=='W'){
      b=s[0];
      s[0]=s[2];
      s[2]=s[5];
      s[5]=s[3];
      s[3]=b;
    }
    if(c=='N'){
      b=s[0];
      s[0]=s[1];
      s[1]=s[5];
      s[5]=s[4];
      s[4]=b;
    }
    if(c=='S'){
      b=s[0];
      s[0]=s[4];
      s[4]=s[5];
      s[5]=s[1];
      s[1]=b;
    }
    if(c=='R'){
      b=s[1];
      s[1]=s[2];
      s[2]=s[4];
      s[4]=s[3];
      s[3]=b;
    }    
  }
  int top() {
    return s[0];
  }
  int right(){
    return s[2];
  }
  int left(){
    return s[3];
  }
  int front(){
    return s[1];
  }
};
bool same(Dice a,Dice b){
  for(int i=0;i<6;i++) if(a.s[i]!=b.s[i]) return false;
  return true;
}
int main(){
  Dice d[100];
  int n;cin >> n;
  for(int j=0;j<n;j++) 
    for(int i=0;i<6;i++)
      cin >> d[j].s[i];
  
  bool ff = true;
  for(int k=0;k<n-1;k++){
    for(int l=k+1;l<n;l++){
      bool f=false;
      for(int i=0;i<4;i++){
	d[l].roll('R');
	for(int j=0;j<4;j++){
	  d[l].roll('N');
	  if(same(d[k],d[l])) f=true;
	}
      }
      d[l].roll('E');
      for(int j=0;j<4;j++){
	d[l].roll('N');
	if(same(d[k],d[l])) f=true;
      }
      
      d[l].roll('W');
      d[l].roll('W');
      for(int j=0;j<4;j++){
	d[l].roll('N');
	if(same(d[k],d[l])) f=true;
      }
      if(f) ff=false;
    }
  }
  
  cout << (ff?"Yes":"No") << endl;
  return 0;
}



Measured memory_bytes: 3104
import java.util.Scanner

object Main {
  def main(args: Array[String])= {
    val sc = new Scanner(System.in)

    val X = sc.nextInt
    println(
      X match{
        case 3 => "YES"
        case 5 => "YES"
        case 7 => "YES"
        case _ => "NO"
      }
    )
  }
}

Measured memory_bytes: 25428
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

LL dp[110][10][2];

int main(){
    fastcin();

    string n;
    cin >> n;
    int k;
    cin >> k;
    int m = n.size();
    dp[0][0][1] = 1;
    rep(i, m)rep(j, k+1)rep(flag, 2){
        if(flag){
            int border = n[i]-'0';
            if(border > 0){
                dp[i+1][j+1][1] += dp[i][j][1];
                dp[i+1][j+1][0] += dp[i][j][1]*(border-1);
                dp[i+1][j][0] += dp[i][j][1];
            }else{
                dp[i+1][j][1] += dp[i][j][1];
            }
        }else{
            dp[i+1][j+1][0] += dp[i][j][0]*9;
            dp[i+1][j][0] += dp[i][j][0];
        }
    }
    cout << dp[m][k][0]+dp[m][k][1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mod1 1000000007
#define ff first
#define ss second
#define INF 1e9
#define INFLL 1e18
typedef long long int ll;
// #define intLL unsigned long long int//used when x<2^64-1 && x>0
#define int long long//used when x<2^63-1
int fact[200005];
int power(int a, int b)
{
    int res=1;
    while(b)
    {
        if(b&1)
        {
            res*=a;
            res%=mod1;
        }
        a*=a;
        a%=mod1;
        b/=2;
    }
    return res;
}
int add(int a, int b)
{
    return (0LL+a+b)%mod1;
}
int sub(int a, int b)
{
    return add(a, mod1-b);
}
int mul(int a, int b)
{
    return (1LL*a*b)%mod1;
}
int inv(int x)
{
    return power(x, mod1-2);
}
int nCr(int n, int r)
{
    return mul(fact[n], inv(mul(fact[r], fact[n-r])));
}
int cmp(const pair<int, int> &a, const pair<int, int> &b)
{
    return (a.ff>b.ff);
}
int32_t main()
{

    IOS;
    int n, m, s;
    cin>>n>>m>>s;
    vector<pair<int, pair<int,int>>> gr[55];//{v, {cost, time}}
    for(int i=0;i<m;i++)
    {
        int u, v, a, b;
        cin>>u>>v>>a>>b;
        u--, v--;
        gr[u].pb({v, {a, b}});
        gr[v].pb({u, {a, b}});
    }
    int c[n+1], d[n+1];
    for(int i=0;i<n;i++)
        cin>>c[i]>>d[i];
    s=min(s, 2500LL);
    int dp[n+1][2501];
    for(int i=0;i<n;i++)
        for(int j=0;j<2501;j++)
            dp[i][j]=INFLL;
    dp[0][s]=0;//dp[i][j] means reached at vertex i with j coins left
    for(int lol=0;lol<n+1;lol++)
    {
        for(int i=0;i<n;i++)
        {
            for(auto it: gr[i])
            {
                for(int j=0;j<=2500;j++)
                {
                    if(j-it.ss.ff>=0)
                    {
                        dp[i][j-it.ss.ff]=min(dp[i][j-it.ss.ff], dp[it.ff][j]+it.ss.ss);
                    }
                }
            }
            for(int j=0;j<=2500;j++)
            {
                if(j-c[i]>=0)
                    dp[i][j]=min(dp[i][j], dp[i][j-c[i]]+d[i]);
            }
        }
    }
    for(int i=1;i<n;i++)
    {
        int ans=INFLL;
        for(int j=0;j<=2500;j++)
            ans=min(ans, dp[i][j]);
        cout<<ans<<"\n";
    }
    return 0;
}

Measured memory_bytes: 4644
#include <iostream>
#include <string>
#include <stddef.h>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>

using namespace std;


int main() {
	string s;
	string w;
	int count=0;
	cin >> w;
	transform(w.begin(), w.end(), w.begin(), ::tolower);
	while (cin >> s) {
		if (s == "END_OF_TEXT") break;
		transform(s.begin(), s.end(), s.begin(), ::tolower);
		if (s == w) count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 1192
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int h = std.nextInt();
        int n = std.nextInt();
        int[] as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = std.nextInt();
        }

        String ans = "No";
        if (h <= Arrays.stream(as).sum()) {
            ans = "Yes";
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 50472
N, K = map(int,input().split())

A = list(map(int,input().split()))

B = [0]*41

for i in range(N):
    for j in range(41):
        if (A[i]>>j) & 1 == 1:
            B[j] += 1
#print(B)

C = [0]*41
for i in range(41):
    if (K>>i) & 1 == 1:
        C[i] += 1
#print(C)
D =[]
for i in range(40,-1,-1):
    count = 0
    if C[i] == 1:
        count += B[i]*2**i
        for k in range(40,i,-1):
            if C[k] == 0:
                count += B[k]*2**k
            else:
                count += (N-B[k])*2**k
        for j in range(i):
            if N-B[j] >= B[j]:
                count += (N-B[j])*2**j
            else:
                count += B[j]*2**j
    D.append(count)
score = 0
for i in range(41):
    if C[i] == 0:
        score += B[i]*2**i
    else:
        score += (N-B[i])*2**i
D.append(score)
#print(D)
print(max(D))


Measured memory_bytes: 14840
import itertools
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall

N, M, R = map(int, input().split())
r = [int(i) for i in input().split()]

G = [[10**8]*(N+1) for _ in range(N+1)]   # 1-indexed
for _ in range(M):
    A, B, C = map(int, input().split())
    # 無向グラフ
    G[A][B] = C
    G[B][A] = C

    # 有向グラフ
    # G[A][B]=C

dg = csgraph_from_dense(G, null_value=10**8)
d = floyd_warshall(dg)


ans = 10**12
for Q in itertools.permutations(r):
    c = 0
    for i in range(R-1):
        c += d[Q[i]][Q[i+1]]
    ans = min(ans, c)
print(int(ans))


Measured memory_bytes: 19340
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>

static const int MOD = 998244353;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T>
T pow_ (T x, T n, T M){
    uint64_t u = 1, xx = x;
    while (n > 0){
        if (n&1) u = u * xx % M;
        xx = xx * xx % M;
        n >>= 1;
    }
    return static_cast<T>(u);
};

template <class T> class Factorial {
    T mod;
    vector<uint64_t> facts, factinv;

public:
    Factorial(int n, T mod) : facts(static_cast<u32>(n+1)), factinv(static_cast<u32>(n+1)), mod(mod) {
        facts[0] = 1;
        for (int i = 1; i < n+1; ++i) facts[i] = facts[i-1]*i % mod;
        factinv[n] = pow_(facts[n], static_cast<uint64_t>(mod - 2), static_cast<uint64_t>(mod));
        for (int i = n-1; i >= 0; --i) factinv[i] = factinv[i+1] * (i+1) % mod;
    }

    T fact(int k) const {
        if(k >= 0) return static_cast<T>(facts[k]);
        else return static_cast<T>(factinv[-k]);
    }

    T operator[](const int &k) const {
        if(k >= 0) return static_cast<T>(facts[k]);
        else return static_cast<T>(factinv[-k]);
    }

    T C(int p, int q) const {
        if(q < 0 || p < q) return 0;
        return static_cast<T>(facts[p]*  factinv[q] % mod * factinv[p-q] % mod);
    }

    T P(int p, int q) const {
        if(q < 0 || p < q) return 0;
        return static_cast<T>((facts[p] * factinv[p-q]) % mod);
    }

    T H(int p, int q) const {
        if(p < 0 || q < 0) return 0;
        return static_cast<T>(q == 0 ? 1 : C(p+q-1, q));
    }
};


int main() {
    ll n, a, b, k;
    cin >> n >> a >> b >> k;
    Factorial<ll> f(n, MOD);
    ll ans = 0;
    for (ll i = 0; i <= (k+a-1)/a; ++i) {
        if(k < i*a) continue;
        if((k-i*a)%b) continue;
        ll j = (k-i*a)/b;
        if(i > n || j > n) continue;
        (ans += f.C(n, i)*f.C(n, j)) %= MOD;
    }
    cout << ans << "\n";

    return 0;
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, M;
    cin >> N >> M;

    ll ans = 0;
    if (N == 1) {
        if (M == 1) {
            ans = 1;
        } else {
            ans = M-2;
        }
    } else {
        if (M == 1) {
            ans = N-2;
        } else {
            ans = (N-2)*(M-2);
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/**
 * B - FizzBuzz Sum
 * https://atcoder.jp/contests/abc162/tasks/abc162_b
 */
#include <bits/stdc++.h>
using namespace std;

int main() {
    // FizzBuzz列の N 項目までに含まれる数の和を出力せよ。
    long long N;
    cin >> N;

    long long sum = 0;
    for (long long i = 1; i <= N; i++) {
        // i が 3 でも 5 でも割り切れるなら、ai=FizzBuzz
        // そうではなく i が 3 で割り切れるなら、ai=Fizz
        // そうではなく i が 5 で割り切れるなら、ai=Buzz
        if (i % 3 == 0 || i % 5 == 0) {
            continue;
        }

        sum += i;
    }

    cout << sum << endl;
}


Measured memory_bytes: 3568
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;

int main()
{
	long long int x, y;
	scanf("%lld %lld", &x, &y);
	if(x-y==0 || x-y==1 || x-y==-1){
		printf("%s\n", "Brown");
	}else{
		printf("%s\n", "Alice");
	}
	return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e6+3)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
int main()
{
	int n;
	cin>>n;
	vector<ll>h(n);
	for(ll &x:h)cin>>x;
	vector<ll>dp(n,INF);
	if(n == 2)cout<<abs(h[1] - h[0]);
	else{
		dp[0] = 0;
		dp[1] = abs(h[1]-h[0]);
		for(int i=2;i<n;i++)dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),
		                                dp[i-2]+abs(h[i]-h[i-2]));
		cout<<dp[n-1];
	}
	
}

Measured memory_bytes: 4760
from collections import Counter
n=int(input())
a=list(map(int, input().split()))
b=[a[i] for i in range(n) if i%2==0]
c=[a[i] for i in range(n) if i%2==1]
b2=Counter(b)
c2=Counter(c)
b3=b2.most_common(3)
c3=c2.most_common(3)
ans=n
for i in b3:
    for j in c3:
        if i[0]!=j[0]:
            ans=min(ans,n-i[1]-j[1])
        else:
            ans=min(ans,n-max(i[1],j[1]))
print(ans)

Measured memory_bytes: 19040
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  ll n,q;
  cin >> n>>q;
  string s;
  cin >>s;
  ll ss=s.size();
  ll l[q],r[q];
  for(ll i=0;i<q;i++) cin >>l[i]>>r[i];
  ll k[ss];
  for(ll i=0;i<ss;i++) k[i]=0;
  for(ll i=1;i<ss;i++){
    if(s[i]=='C'&&s[i-1]=='A') k[i]+=(k[i-1]+1);
    else k[i]=k[i-1];
  }
  for(ll i=0;i<q;i++){
    cout <<k[r[i]-1]-k[l[i]-1]<<endl;
  }
}


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

int main() {

  int h, w;
  cin >> h >> w;

  vector<string> grid;
  string tmp;

  for (int i = 0; i < h; i++) {
    cin >> tmp;
    grid.push_back(tmp);
  }

  int ri = 0;
  int rj = 0;

  int cntL[2010][2010];
  int cntR[2010][2010];
  int cntU[2010][2010];
  int cntD[2010][2010];
   
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {

      rj = w - j - 1;
      ri = h - i - 1;

      if (grid[i][j] == '#') {

        cntL[i][j] = 0;
        cntU[i][j] = 0;
      }
      else{

        if (j == 0)
          cntL[i][j] = 1;
        else
          cntL[i][j] = cntL[i][j - 1] + 1;

        if (i == 0)
          cntU[i][j] = 1;
        else
          cntU[i][j] = cntU[i - 1][j] + 1;
      }

      if (grid[ri][rj] == '#') {

        cntR[ri][rj] = 0;
        cntD[ri][rj] = 0;
      }
      else {

        if (rj == w - 1)
          cntR[ri][rj] = 1;
        else
          cntR[ri][rj] = cntR[ri][rj + 1] + 1;

        if (ri == h - 1)
          cntD[ri][rj] = 1;
        else
          cntD[ri][rj] = cntD[ri + 1][rj] + 1;
      }
    }
  }

  int ans = 0;

  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++)
      if (ans < cntL[i][j] + cntR[i][j] +
          cntU[i][j] + cntD[i][j])
        ans = cntL[i][j] + cntR[i][j] +
          cntU[i][j] + cntD[i][j];

  cout << ans - 3;

  return 0;
}



Measured memory_bytes: 67456
N,A,B = map(int,input().split())
#NをA+Bで割ったときの商
shou = N//(A+B)
#NをA+Bで割ったときのあまり
amari = N%(A+B)

#amariがA以上であれば青を使い切ってる　この時はA*shou+A
if amari >= A:
    print(A*shou+A)
#amariがAより小さいときは青が途中　この時はA*shou+amari
elif amari < A:
    print(A*shou+amari)

Measured memory_bytes: 2940
#include <stdio.h>

int score[1010][1010];

int max2 (int a, int b){
  if (a >= b) return a;
  else return b;
}

int len_of_str(const char s[]){
  int num = 0;

  while(s[num]) num++;

  return num;
}


int main() {
  char a[1100];
  char b[1100];
  int datanum;
  scanf("%d",&datanum);
  for(int c = 0; c < datanum; c++){

  scanf("%1100s",a);
  scanf("%1100s",b);
  int num1 = len_of_str(a);
  int num2 = len_of_str(b);


  for(int i = num1; i > 0; i--) a[i] = a[i - 1];
  a[0] = ' ';
  for(int j = num2; j > 0; j--) b[j] = b[j - 1];
  b[0] = ' ';

  for(int i = 0; i <= num1; i++) score[i][0] = 0;
  for(int j = 0; j <= num2; j++) score[0][j] = 0;

  int maximum = 0;

  for(int i = 1; i<= num1; i++){
    for (int j = 1; j <= num2; j++){
      if (a[i] == b[j])score[i][j] = score[i-1][j-1] + 1;
      else if (a[i] != b[j]) score[i][j] = max2(score[i][j-1],score[i-1][j]);
      maximum = max2(maximum,score[i][j]);
    }
  }



  printf("%d\n",maximum);
}
  return 0;
}



Measured memory_bytes: 6540
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int MOD = 1e9 + 7;
const int INF = 1e9 + 200;
const ll INFLL = 2e18 + 200;

int main() {
    int N, X, T;
    cin >> N >> X >> T;
    cout << (N / X + (N % X != 0)) * T << endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 3;

void solve() {
    string s; cin >> s;
    string ans = "No";
    for (int i = 0; i < 3; ++i) {
        if(s[i]=='7') ans = "Yes";
    }
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 3632
import sys

#+++++

def cc(sa, sb):
	aa=set(list(sa))
	bb=list(set(list(sb)))
	count=0
	for c in bb:
		if c in aa:
			count+=1
	return count


def main():
	n=int(input())
	s=input()
	ans=0
	for i, _ in enumerate(s):
		ans=max(ans, cc(s[:i], s[i:]))
	
	print(ans)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 3064
#include <cstdlib>
#include <cstdio>
long long pw[20];
long long calc(long long d,int b,int p){
	if (abs(d)>=pw[b]) return 0;
	if (!b) return 1;
	if (b==1) return d?0:10;
	long long x=pw[b-1]-1,v=0;
	for (int i=-9;i<=9;i++)
		if ((d-i*x)%10==0)
			v+=calc((d-i*x)/10,b-2,0)*(10-abs(i)-p);
	return v;
}
int main(){
	int D;
	scanf("%d",&D);
	pw[0]=1;
	for (int i=1;i<=18;i++) pw[i]=pw[i-1]*10ll;
	long long ans=0;
	for (int i=1;i<=18;i++) ans+=calc(D,i,1);
	printf("%lld\n",ans);
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int A, B; std::cin >> A >> B;
  std::cout << std::ceil((double)A/B) << std::endl;
  return 0;
}


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

using namespace std;


//int a[20005]={0};
int main()
{
    long long a[3];
    cin>>a[0]>>a[1]>>a[2];
    int cnt=0;
    int flag=0;
    while(a[0]%2==0&&a[1]%2==0&&a[2]%2==0)
    {
        long long b[3];
        b[0]=a[0];
        b[1]=a[1];
        b[2]=a[2];
        a[0]=(b[1]+b[2])/2;
        a[1]=(b[0]+b[2])/2;
        a[2]=(b[1]+b[0])/2;
        cnt++;
        if(cnt>10000){
            flag=1;
            break;
        }
    }
    if(flag==0)
        cout<<cnt<<endl;
    else
        cout<<"-1"<<endl;
    return 0;
}


Measured memory_bytes: 256
#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>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;



//---素因数分解------
map<ll, ll > prime_factor(ll n) {
    map<ll, ll > pf;
    for(ll f=2; f*f<=n; ++f){
        while(n%f == 0){
            pf[f]++;
            n /= f;
        }
    }
    if(n!=1) pf[n] = 1;
    return pf;
}



//---main---------------------------------------------
int main(){
    //main
    ll N;
    cin >> N;

    //map<ll,ll> pf = prime_factor(N);
    
    
    ll ans = 0;
    for(auto pf: prime_factor(N)){
        int fn = 1;
        while(pf.second >= fn){
            pf.second -= fn;
            fn++;
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

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

int main()
{
    int N, X;
    cin >> N >> X;
    int m;
    int minimum = INT_MAX;
    for (int i = 0; i < N; i++)
    {
        cin >> m;
        minimum = min(minimum, m);
        X -= m;
    }
    cout << N + X / minimum << endl;
}


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

int main(){
    int n;cin>>n;
    cout<<n<<":";
    for(int i=2;i*i<=n;i++){
        while(n%i==0){
            cout<<" "<<i;
            n/=i;
        }
    }
    if(n>1)cout<<" "<<n;
    cout<<endl;
}


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

bool solve(int x, vector<int> &V, int now_idx, int max_idx)
{

    if (x == 0)
    {
        return true;
    }
    else
    {
        now_idx++;
        if (now_idx > max_idx)
        {
            return false;
        }
        return solve(x - V[now_idx], V, now_idx, max_idx) || solve(x, V, now_idx, max_idx);
    }
}

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

    int q;
    cin >> q;
    vector<int> M(q);
    for (int i = 0; i < q; i++)
    {
        cin >> M[i];
    }

    for (int i = 0; i < q; i++)
    {
        if (solve(M[i], A, 0, n - 1) || solve(M[i] - A[0], A, 0, n - 1))
        {
            cout << "yes" << endl;
        }
        else
        {
            cout << "no" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
#define llong long long
#define mkpr make_pair
#define x first
#define y second
#define iter iterator
#define riter reversed_iterator
#define y1 Lorem_ipsum_
#define tm dolor_sit_amet_
using namespace std;

inline int read()
{
	int x = 0,f = 1; char ch = getchar();
	for(;!isdigit(ch);ch=getchar()) {if(ch=='-') f = -1;}
	for(; isdigit(ch);ch=getchar()) {x = x*10+ch-48;}
	return x*f;
}

const int mxN = 1e5;
const int mxM = 2e5;
const int INF = 1e9;
struct Edge
{
	int v,nxt,id;
} e[mxM*2+3];
int w[mxM+3];
int fe[mxN+3];
int d[mxN+3];
int mn[mxN+3];
bool vis[mxN+3];
int p[mxN+3],pi[mxN+3];
int c[mxN+3];
int n,m,en;

void addedge(int u,int v,int id)
{
	en++; e[en].v = v; e[en].id = id;
	e[en].nxt = fe[u]; fe[u] = en;
}

bool cmp_d(int x,int y) {return d[x]<d[y];}

int main()
{
	n = read(),m = read();
	for(int i=1; i<=n; i++) d[i] = read();
	for(int i=1; i<=m; i++) {int u = read(),v = read(); addedge(u,v,i),addedge(v,u,i);}
	bool ok = true;
	for(int i=1; i<=n; i++)
	{
		mn[i] = INF;
		for(int o=fe[i]; o; o=e[o].nxt)
		{
			mn[i] = min(mn[i],d[e[o].v]);
		}
		if(mn[i]>d[i]) {ok = false; break;}
	}
	if(!ok) {puts("-1"); return 0;}
	for(int i=1; i<=n; i++) p[i] = i;
	sort(p+1,p+n+1,cmp_d);
	for(int i=1; i<=m; i++) w[i] = INF;
	for(int i=1; i<=n; i++)
	{
		int u = p[i]; bool found = false;
		if(vis[u]) continue;
		for(int o=fe[u]; o; o=e[o].nxt)
		{
			int v = e[o].v;
			if(vis[v])
			{
				c[u] = c[v]^1;
				w[e[o].id] = d[u];
				vis[u] = true;
				found = true; break;
			}
		}
		if(found) continue;
		for(int o=fe[u]; o; o=e[o].nxt)
		{
			int v = e[o].v;
			if(d[v]==d[u])
			{
				c[u] = 0,c[v] = 1;
				w[e[o].id] = d[u];
				vis[u] = vis[v] = true;
				found = true; break;
			}
		}
		assert(found);
	}
	for(int i=1; i<=n; i++) printf("%c",c[i]?'W':'B'); puts("");
	for(int i=1; i<=m; i++) printf("%d\n",w[i]);
	return 0;
}

Measured memory_bytes: 9984
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

#include <stdio.h>

void print(int A[], int N){
	rep(i, N){
		if (i > 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}

void insertionSort(int A[], int N){
	int v;

	FOR(i, 1, N){
		v = A[i];
		int j = i - 1;
		while (j >= 0 && A[j] > v){
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		print(A, N);
	}
}

int main() {

	int N;
	cin >> N;

	const int MAX_N = 10000;
	int A[MAX_N];
	rep(i, N){
		cin >> A[i];
	}
	print(A, N);
	insertionSort(A, N);

	return 0;
}

Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//総数から奇数パターンの数を差し引く
int main(){
  long long N; cin >>N;
  long long num_even = 0;
  REP(i,N){
    long long a;
    cin >> a;
    if(a%2==0) num_even++;
  }
  long long r = pow(3,N) - pow(2,num_even);
  cout << r << "\n";
  
}

Measured memory_bytes: 256