akhauriyash/Code-Regression huggingface dataset:
Q = int(input())
MAX = 10**5

def findAllOfPrime(N):
    prime = [True] * (N + 1)
    prime[0] = False
    prime[1] = False

    x = 2
    while x**2 <= N:
        if prime[x]:
            j = 2
            while x * j <= N:
                prime[x * j] = False
                j += 1
        x += 1

    return prime

prime = findAllOfPrime(MAX)
primeSum = [0] * (MAX + 1)
for x in range(1, MAX + 1):
    primeSum[x] = primeSum[x - 1]
    if prime[x] and prime[(x + 1) // 2]:
        primeSum[x] += 1
        

for _ in range(Q):
    cnt = 0
    l, r = map(int, input().split())

    print(primeSum[r] - primeSum[l - 1])





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

int main() {
  int pay_money ;
  int number ;
  cin >> pay_money >> number ;
  int nokori = pay_money % 500 ;
  int donnna = number - nokori ;
  
  if (donnna >= 0){
    cout << "Yes" << endl ;
  }
  else {
    cout << "No" << endl ;
  }
}

Measured memory_bytes: 256
/*author: hyperion_1724
  date: 
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	

	long long N,K;
	cin>>N>>K;
	long long V[N];
	for (long long i = 0; i < N; ++i)
	{
		cin>>V[i];			
	}
	long long ans=0;
	for (long long i = 0; i <= min(K,N); ++i)
	{
		for (long long j = 0; j <= min(K-i,N-i); ++j)
		{
			multiset<long long> Z;
			long long a=0;
			for (long long k = 0; k < i; ++k)
			{
				a+=V[k];
				if(V[k]<0)
				{
					Z.insert(V[k]);
				}
			}
			for (long long k = 0; k < j; ++k)
			{
				a+=V[N-1-k];
				if(V[N-1-k]<0)
				{
					Z.insert(V[N-1-k]);
				}
			}
			long long out=K-i-j;
			while(out>0 && Z.size()>0)
			{
				auto it=Z.begin();
				a=a-(*it);
				Z.erase(it);
				out--;
			}
			ans=max(ans,a);
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
int x,y;
scanf("%d%d",&x,&y);
if(x==2||y==2) printf("No\n");
else if(x==4||x==6||x==9||x==11){
 if(y==4||y==6||y==9||y==11) printf("Yes\n");
 else printf("No\n");
}else{
 if(y==4||x==6||y==9||y==11) printf("No\n");
 else printf("Yes\n");
}
return 0;
}

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

int main(){
    int n,m,x;
    int l=0,r=0;
    cin>>n>>m>>x;
    rep(i,m){
        int a;
        cin >> a;
        if(a<x) l++;
        if(x<a) r++;
    }
    cout << min(l,r) <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int d, l; cin >> d >> l;
	cout << d / l + d % l << endl;
	
	return 0;
}


Measured memory_bytes: 3132
# Me
class Check():
    def __init__(self):
        self.now_t, self.now_x, self.now_y = 0, 0, 0

    def do(self, t, x, y):
        distance = ((x - self.now_x) + (y - self.now_y))
        duration = t - self.now_t
        if duration < distance:
            return False

        if distance % 2 != duration % 2:
            return False

        self.now_t, self.now_x, self.now_y = t, x, y
        return True


N = int(input())
c = Check()
for i in range(N):
    a = [int(x) for x in input().split()]
    if not c.do(a[0], a[1], a[2]):
        print('No')
        exit()
print('Yes')


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

using namespace std;


int N, K;
vector< int > g[2000];
bool v[2000];

int feel(int idx, int depth)
{
  if(depth < 0 || v[idx]++) return (0);
  int ret = 1;
  for(auto &to : g[idx]) ret += feel(to, depth - 1);
  return (ret);
}

int main()
{
  cin >> N >> K;
  for(int i = 0; i < N - 1; i++) {
    int A, B;
    cin >> A >> B;
    --A, --B;
    g[A].push_back(B);
    g[B].push_back(A);
  }

  int ret = 0;
  if(K & 1) {
    for(int i = 0; i < N; i++) {
      for(auto &to : g[i]) {
        memset(v, false, sizeof(v));
        v[to] = true;
        int proc = feel(i, K / 2);
        v[to] = false;
        proc += feel(to, K / 2);
        ret = max(ret, proc);
      }
    }
  } else {
    for(int i = 0; i < N; i++) {
      memset(v, false, sizeof(v));
      ret = max(ret, feel(i, K / 2));
    }
  }

  cout << N - ret << endl;

}

Measured memory_bytes: 384
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    H,W,D=MI()
    A=LLIN(H)
    
    def get_cost(fr:tuple, to:tuple):
        return abs(fr[0]-to[0]) + abs(fr[1]-to[1])

    cord_of_x = {}
    for h in range(H):
        for w in range(W):
            cord_of_x[A[h][w]] = (h,w)

    cumsum = [0]*(H*W+1+D)
    for x in range(1,H*W):
        if x+D not in cord_of_x:
            break
        cost = get_cost(cord_of_x[x], cord_of_x[x+D])
        cumsum[x+D]+=cumsum[x]+cost


    Q=I()
    LR=LLIN(Q)
    for l,r in LR:
        d = l%D
        print(cumsum[r]-cumsum[l])
if __name__ == '__main__':
    main()

Measured memory_bytes: 77404
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  ll x, y; cin >> x >> y;
  if ((x<2 && y<2) || abs(x-y) < 2) cout << "Brown\n";
  else cout << "Alice\n";
  return 0;
}


Measured memory_bytes: 256
/* @CopyRight:   Script by vimer(micro.script@hotmail.com). All rights reserved.
 * @Version:     1.0
 * @Date:        Saturday, May 20, 2017
 * @Description: A - ι⊥l
 * @Environment: Code::Blocks 16.01, GCC 4.9.
 */
#include<iostream>
using namespace std;
int main(){
    int a = 0, b = 0, c = 0;
    cin >> a >> b >> c;
    if(b - a == c - b) cout << "YES" ;
    else cout << "NO";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
/*
 *      ┌─┐       ┌─┐ + +
 *   ┌──┘ ┴───────┘ ┴──┐++
 *   │                 │
 *   │       ───       │++ + + +
 *   ███████───███████ │+
 *   │                 │+
 *   │       ─┴─       │
 *   │                 │
 *   └───┐         ┌───┘
 *       │         │
 *       │         │   + +
 *       │         │       Code is far away from bug with the animal protecting
 *       │         └──────────────┐
 *       │                        │
 *       │                        ├─┐
 *       │                        ┌─┘
 *       │                        │
 *       └─┐  ┐  ┌───────┬──┐  ┌──┘  + + + +
 *         │ ─┤ ─┤       │ ─┤ ─┤
 *         └──┴──┘       └──┴──┘  + + + +
 *                神兽保佑
 *               代码无BUG!
 */

#include<bits/stdc++.h>
using namespace std;
class IN{
public:
    template<typename T>
    IN& operator >>(T &x){read(x);return *this;}
    IN& operator >>(double &x){scanf("%lf",&x);return *this;}
    IN& operator >>(char *s){scanf("%s",s);return *this;}
    IN& operator >>(char &c){c=getchar();return *this;}
private:
    template<typename T>
    void read(T &x){
        T f=1;int c=getchar();x=0;
        while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
        while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
        x*=f;
    }
}in;
class NL{}nl;
class BK{}bk;
class OUT{
public:
    template<typename T>
    OUT& operator <<(T x){write(x);return *this;}
    OUT& operator <<(const char *s){printf("%s",s);return *this;}
    OUT& operator <<(char c){putchar(c);return *this;}
    OUT& operator <<(BK x){putchar(' ');return *this;}
    OUT& operator <<(NL x){putchar('\n');return *this;}
private:
    template<typename T>
    void write(T x){
        if(x<0)putchar('-'),x=-x;
        if(x>=10)write(x/10);
        putchar(x%10+48);
    }
}out;

#define pb(x) push_back(x)
#define fi first
#define se second
#define rep(i,a,n) for(int i=a;i<=n;++i)
#define per(i,n,a) for(int i=n;i>=a;--i)
#define mem(a,x) memset(a,x,sizeof(a))
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;
/*****************************************************************************************************/
ll Pow(ll a,ll b,ll mod){ll res=1;a%=mod;while(b){if(b&1)(res*=a)%=mod;(a*=a)%=mod;b>>=1;}return res%mod;}
ll inv(ll a,ll p){if(a==1)return 1;return (p-p/a)*inv(p%a,p)%p;}//p为素数,a<p
ll C(ll n,ll m,ll p){ll res=1;for(ll i=1,j=n-m+1;i<=m;++i,++j){res=res*inv(i,p)%p*j%p;}return res;}
/*****************************************************************************************************/
/*ll ask(int x){ll res=0;while(x)res+=c[x],x-=x&-x;return res;}
void add(ll v,int x){while(x<=n)c[x]+=v,x+=x&-x;}*/
const int p=1e9+7;
const int N=2e5+10;
int a[N];
int main(){
    int k,n;
    in>>k>>n;
    rep(i,0,n-1)
        in>>a[i];
    sort(a,a+n);
    int M=-1;
    rep(i,0,n-1){

        M=max(M,min(abs(a[(i+1)%n]-a[i]),k-abs(a[(i+1)%n]-a[i])));
    }
    out<<k-M;
    return 0;
}


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

int main(){
    int N, K;
    cin >> N >> K;
    vector<ll> H(N);
    for(int i= 0; i<N; i++){
        cin >> H[i];
    }

    sort(H.begin(), H.end(), greater<ll>());

    ll ans = 0;
    for(int i=K; i<N; i++){
        ans += H[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <queue>
#include <vector>
#include <array>

using namespace std;

int main(int argc, char* argv[]){
    int H, W;
    cin >> H >> W;
    queue<array<int, 2>> search_que;
    vector < vector<int> > area(H, vector<int>(W, 0));

    for (int i = 0; i < H; ++i){
        for (int j = 0; j < W; ++j){
            char a;
            cin >> a;
            if (a == '#'){
                area[i][j] = 1;
                search_que.push({i, j});
            }
        }
    }
    int n = 0;
    while(!search_que.empty()){
        queue<array<int, 2>> tmp_search_que;
        while(!search_que.empty()){
            auto black_pos = search_que.front();
            auto n_i = black_pos[0];
            auto n_j = black_pos[1];
            if (n_i > 0 && area[n_i-1][n_j] == 0){
                area[n_i-1][n_j] = 1; 
                tmp_search_que.push({n_i-1, n_j});
            }
            if (n_i < H-1 && area[n_i+1][n_j] == 0){
                area[n_i+1][n_j] = 1; 
                tmp_search_que.push({n_i+1, n_j});
            }
            if (n_j > 0 && area[n_i][n_j-1] == 0){
                area[n_i][n_j-1] = 1; 
                tmp_search_que.push({n_i, n_j-1});
            }
            if (n_j < W-1 && area[n_i][n_j+1] == 0){
                area[n_i][n_j+1] = 1; 
                tmp_search_que.push({n_i, n_j+1});
            }
            search_que.pop();
        }
        if (tmp_search_que.empty()){
            break;
        }
        search_que = tmp_search_que;
        n++;

        // for debug (print current area status)
        // cout << n << "OP" << endl;
        // for(auto&& h: area){
        //     for(auto&& w: h){
        //         if (w){
        //             cout << '#';
        //         } else {
        //             cout << '.';
        //         }
        //     }
        //     cout << endl;
        // }
        // cout << endl;
    }

    cout << n << endl;

    return 0;
}

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

P p[600000];
ll sum[600000];
ll D[600000];
int main(){
	int n;scanf("%d",&n);
	rep(i,n){
		scanf("%lld%lld",&p[i].first,&p[i].second);
	}
	sort(p,p+n);
	rep(i,n){
		if(i)sum[i]+=sum[i-1];
		sum[i]+=p[i].second;
	}
	D[n-1]=LLONG_MIN/2;
	ll ans=0;
	for(int i=n-1;i>=0;i--){
		if(i!=n-1){
			D[i]=D[i+1];
		}
		D[i]=max(D[i],sum[i]-p[i].first);
		ll cnt=D[i];
		if(i)cnt-=sum[i-1];
		ans=max(ans,cnt+p[i].first);
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 18884
#include <iostream>

using namespace std;

typedef long long ll;
const ll MAX_N = 100000;
int N,M;
ll L[MAX_N],R[MAX_N];


void solve(){
  
ll max_L = L[0];
ll min_R = R[0];
  for(int k=1;k<M;k++){
    if(min_R<L[k] || R[k]<max_L){
      min_R = -1;
      max_L = 0;
      break;
    }
    else{
      max_L = max(max_L,L[k]);
      min_R = min(min_R,R[k]);
    }
  }
  cout << min_R-max_L+1 << endl;
}

int main(){
  cin >> N >> M;
  for(int i=0;i<M;i++){
    cin >> L[i] >> R[i];
  }
  solve();
}


Measured memory_bytes: 1792
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
int dp[6][1010];//動的計画法
int prime[10000001];
char str[1010][1010];
vector<pair<int,int> > pc[100001];
int ABS(int a){return max(a,-a);}
int main(){
   long long n;
   while(cin>>n,n){
       int no=0;
       long long length=1;
       int val[100];
       for(int i=0;n;i++){
           val[no++]=n%(length*(-10))/length;
           if(val[no-1]<0) val[no-1]+=10;
           n-=(val[no-1])*length;
           length*=(-10);
       }
       for(int i=no-1;i>=0;i--) cout<<val[i];
       cout<<endl;
   }
    return 0;
}


Measured memory_bytes: 5444
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Eric
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD_147 solver = new TaskD_147();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD_147 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long mod = 1_000_000_007;
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = in.nextLong();

            long res = 0;
        /*if (n%2==0) {
            for (int i=0; i<n; i++)
            res ^=  a[i];
        }*/

            for (int i = 0; i <= 60; i++) {
                long nbBits0 = 0;
                long nbBits1 = 0;
                for (int j = 0; j < n; j++) {
                    boolean isBit1 = (a[j] & (1L << i)) != 0;
                    if (isBit1)
                        nbBits1++;
                    else
                        nbBits0++;
                }
                long nbCarry = 1L << i;
                nbCarry %= mod;
                //nbCarry *= (nbBits) * (nbBits-1);
                nbCarry *= nbBits0;
                nbCarry %= mod;
                nbCarry *= nbBits1;
                nbCarry %= mod;
                res += nbCarry;
                res %= mod;
            }
            out.println(res);
        }

    }
}



Measured memory_bytes: 95456
// 以下のライブラリを使ってみる.
// giuseppe55氏.
// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2296579#1
#include <bits/stdc++.h>
using namespace std;
#define LL long long

LL N, M;
vector<vector<pair<LL, LL> > > G;
 
LL maxFlow(LL a, LL b){
    LL F = 0;
    while(true){
        queue<LL> Q;
        vector<LL> used(N, -1), pred(N, -1), cap(N);
        Q.push(a);
        used[a] = 0;
        cap[a] = LONG_LONG_MAX;
        while(Q.size() != 0){
            LL v = Q.front();
            Q.pop();
            for(LL w = 0; w < N; w++){
                LL f1 = G[v][w].first, f2 = G[w][v].first, c = G[v][w].second, r = c - f1 + f2;
                if(r > 0 && used[w] == -1){
                    used[w] = used[v]++;
                    pred[w] = v;
                    cap[w] = min(cap[v], r);
                    Q.push(w);
                }
            }
        }
        if(used[b] == -1) break;
        F += cap[b];
        LL v = b;
        while(v != a){
            LL w = pred[v], f1 = G[w][v].first, f2 = G[v][w].first, c = G[w][v].second, o = min(f2, cap[b]);
            G[v][w].first -= o;
            G[w][v].first += cap[b] - o;
            v = w;
        }
    }
    return F;
}
 
 
int main(){

    // 1. 入力情報.
    scanf("%d %d", &N, &M);
    
    // 2. グラフ.
    G.resize(N, vector<pair<LL, LL> >(N, {0, 0}));
    for(LL m = 0; m < M; m++){
        LL A, B, C;
        scanf("%d %d %d", &A, &B, &C);
        G[A][B].second = C;
    }
    
    // 3. 出力.
    cout << maxFlow(0, N - 1) << endl;
    return 0;

}


Measured memory_bytes: 3308
#include <bits/stdc++.h>
using namespace std;
int S[1000000]={0};
int T[50000]={0};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,q,k,ans=0;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> S[i];
	}
	cin >> q;
	for(int i=0;i<q;i++){
		cin >> T[i];
	}
	sort(T,T+q);
	sort(S,S+n);
	int t=0,s=0;k=-1;
	while(s<n && t<q){
		if(S[s]==T[t]){
			if(T[t]!=k){
				++ans;
				k = T[t];
			}
			++s;
		}else if(S[s]>T[t]){
			++t;
		}else{
			++s;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3600
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define MOD 998244353LL
#define seg_size 262144*4
#define REP(a,b) for(long long a = 0;a < b;++a)
long long dp[5001][5001] = {};
int main() {
	long long n, aa, bb;
	cin >> n >> aa >> bb;
	REP(i, 5001) {
		REP(q, 5001) {
			dp[i][q] = LONG_INF;
		}
	}
	dp[0][0] = 0;
	REP(i, n) {
		long long a;
		cin >> a;
		for (int q = 0; q <= n; ++q) {
			if (q <= a) {
				dp[i + 1][q] = min(dp[i + 1][q], dp[i][q] + aa);
				dp[i + 1][a] = min(dp[i + 1][a], dp[i][q]);
			}
			else {
				dp[i + 1][q] = min(dp[i + 1][q], dp[i][q] + bb);
			}
		}
	}
	long long ans = LONG_INF;
	for (int i = 0; i <= n; ++i) {
		ans = min(ans, dp[n][i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 195712
#include <stdio.h>


const int year[4] = {1868, 1912, 1926, 1989};
const int month[4] = {9, 7, 12, 1};
const int day[4] = {8, 30, 25, 8};
const char gengou[5] = {'p', 'm', 't', 's', 'h'};//??????pre-meiji, meiji, taisyou, syowa, heisei??¨??????

char gengouka (int inputyear, int inputmonth, int inputday)
{
    int i;
    char y;//y?????????????????????????????????
    for (i = 0; i <= 3; ++i) {
        if (inputyear == year[i]) {//?¢?????????´?????¨????????????
            if (inputmonth == month[i]) {
                if (inputday < day[i]) {
                    y = gengou[i];
                    break;
                } else if (inputday >= day[i]) {
                    y = gengou[i + 1];
                    break;
                } 
            } else if (inputmonth < month[i]) {
                y = gengou[i];
                break;
            } else if (inputmonth >= month[i]) {
                y = gengou[i + 1];
                break;
            }
            break;
        } else if (inputyear < year[i]) {
            y = gengou[i]; 
            break;
        } 
        if (inputyear > year[3]) {//???????????????????????§??????
            y = gengou[4];
            break;
        }
    }
    return y;
}

int main(void) 
{
    int inputyear, inputmonth, inputday, outputyear;
    while ((scanf("%d %d %d", &inputyear, &inputmonth, &inputday)) != EOF) {
        char y = gengouka(inputyear, inputmonth, inputday);
        if (y == 'p') {
            printf("pre-meiji\n");
        } else if (y == 'm') {
            outputyear = inputyear - year[0] + 1;
            printf("meiji %d %d %d\n", outputyear, inputmonth, inputday);
        } else if (y == 't') {
            outputyear = inputyear - year[1] + 1;
            printf("taisho %d %d %d\n", outputyear, inputmonth, inputday); 
        } else if (y == 's') {
            outputyear = inputyear - year[2] + 1;
            printf("showa %d %d %d\n", outputyear, inputmonth, inputday);
        } else {
            outputyear = inputyear - year[3] + 1;
            printf("heisei %d %d %d\n", outputyear, inputmonth, inputday);
        }
    } 
    return 0;
}

Measured memory_bytes: 1036
fn getline() -> String {
    let mut __ret = String::new();
    std::io::stdin().read_line(&mut __ret).ok();
    return __ret;
}

fn solve(n: u32) -> u32 {
    let p: f64 = (n as f64).log2().floor();
    return p.exp2() as u32;
}

fn main() {
    let s = getline();
    let n: u32 = s.trim().parse().unwrap();
    let ans: u32 = solve(n);
    println!("{}", ans);
}


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

using namespace std;

int main(void)
{
    int n;
    cin >> n;
    int a, b;
    int maxv = 1;
    vector<pair<int, int>> points;
    map<pair<int, int>, int> maps;
    for (int i = 0; i < n; ++i)
    {
        cin >> a >> b;
        points.push_back(std::make_pair(a, b));
    }
    if (n == 1)
    {
        cout << 1 << endl;
    }
    else
    {
        for (int i = 0; i < points.size(); ++i)
        {
            for (int j = 0; j < points.size(); ++j)
            {
                if (i != j)
                {
                    pair<int, int> p = points[i];
                    pair<int, int> q = points[j];
                    pair<int, int> vec = std::make_pair(q.first - p.first, q.second - p.second);
                    if (maps.find(vec) != maps.end())
                    {
                        maps.at(vec) += 1;
                        maxv = max(maxv, maps.at(vec));
                        //cout << "(" << vec.first << ", " << vec.second << "): " << maps.at(vec) << endl;
                    }
                    else
                    {
                        maps.insert(std::make_pair(vec, 1));
                        maxv = max(maxv, 1);
                        //cout << "(" << vec.first << ", " << vec.second << ") inserted" << endl;
                    }
                }
            }
        }

        cout << n - maxv << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007;
int dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};
ll dp[100100][13];

int main() {
    int n;
    cin >> n;
    vector<int> a(n),cnt(100010,0);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if(a[i] != 0) cnt[a[i]-1]++;
        cnt[a[i]]++;
        cnt[a[i]+1]++;
    }
    int ans = 0;
    for(int i = 0; i < 100010; ++i) {
        ans = max(ans,cnt[i]);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){

  int n;
  cin >> n;
  double x[n];
  string u[n];
  double ans=0;
  for(int i=0;i<n;i++){
    cin >> x[i] >> u[i];
    if(u[i]=="BTC"){
      ans = ans + x[i]*380000;
    }else{
      ans = ans + x[i];
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
//typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;

ll bit[200010];
//ll kai[3010];
ll Cnt[1000010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }



/*ll sum(ll i)
{
	//i += 1;
	ll t = 0;
	while (i > 0)
	{
		t += bit[i];
		i -= i & -i;
	}
	return t;
}

void add(ll i, ll x)
{
	//i += 1;
	while (i <= 200005)
	{
		bit[i] += x;
		i += i & -i;
	}
}*/

/*`ll SAIKI(ll S) {
	for (ll T = S; ; T = (T - 1) & S) {

	}
}*/



void test() {
	cout << "888888888888888888888888" << endl;
}

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

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; 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 comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}

void makePrimeList(ll x) {
	ll X = x;
	for (ll j = 2; j * j <= x; j++) {
		ll cnt = 0;
		while (X % j == 0) {
			cnt++;
			X /= j;
		}
		if (cnt) {
			Cnt[j] = max(Cnt[j], cnt);
		}
	}
	if (X != 1) Cnt[X] = max(Cnt[X], 1LL);
}

double a, b, x, ans;

void solve() {
	cin >> a >> b >> x;
	x /= a;
	if (a * b / 2 < x) {
		x -= a * b / 2;
		double high = x * 2 / a;
		ans = atan((b - high) / a) * 180 / 3.1415926535;
		printf("%.10lf\n", ans);
	}
	else {
		double high = x * 2 / b;
		ans = atan(b / high) * 180 / 3.1415926535;
		printf("%.10lf\n", ans);
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	ll N;
	cin >> N;
}

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

int main() {
    int o,a,b;
    cin >> a >> b;
    if(a>b){
        o=a;
        a--;
    }else {
        o=b;
        b--;
    }
    if(a>b) o+=a;
    else o+=b;
    cout << o << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())

table = []
for i in range(n-1):
    c , s , f = map(int,input().split())
    table.append([c,s,f])

for i in range(n):
    time = 0
    for j in range(i,n-1):
        if time < table[j][1]:
            time = table[j][1]
        elif time > table[j][1]:
            if time % table[j][2] != 0:
                time += table[j][2] -(time%table[j][2])
        time += table[j][0]
    print(time)

Measured memory_bytes: 3188
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
    int n;
    cin >> n;

    int count,x,sum=0;
    for(int i=1; i<=n; i++){
        x = i;
        count = 0;
        while(x){
            x /= 10;
            count++;
        }
        if(count % 2 != 0){
            sum++;
        }
    }
    cout << sum << endl;
    return 0;
}

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

int main() {
    int n;
    cin>>n;
    string s;
    cin>>s;
    vector<vector<int>> dp(n+5, vector<int>(n+5, 0));
    dp[n][n] = 0;
    int mx = 0;
    for (int i=n-1; i>=0; i--) {
        for (int j=n-1; j>=0; j--) {
            if (i>=j) dp[i][j] = 0;
            else if (s[i]!=s[j]) dp[i][j] = 0;
            else {
                dp[i][j] = 1+dp[i+1][j+1];
                if (dp[i][j]+i>j) dp[i][j] = j-i;
            }
            mx = max(mx, dp[i][j]);
        }
    }
    printf("%d\n", mx);
}

Measured memory_bytes: 98304
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int N;
	long W;
	long baseWeight;
	Tuple[] list;
	List<Tuple>[] lists;
	List<int[]> pattern;

	static class Tuple {
		long w;
		int v;

		Tuple(String line) {
			String[] tokens = line.split(" ");
			w = Long.parseLong(tokens[0]);
			v = Integer.parseInt(tokens[1]);
		}
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		W = Long.parseLong(tokens[1]);
		list = new Tuple[N];
		for (int i = 0; i < N; ++i) {
			Tuple tuple = new Tuple(in.readLine());
			list[i] = tuple;
		}
		baseWeight = list[0].w;

		// 振り分け
		lists = new List[4];
		for (int i = 0; i < 4; ++i) {
			lists[i] = new ArrayList<>();
		}
		for (int i = 0; i < N; ++i) {
			int index = (int) (list[i].w - baseWeight);
			lists[index].add(list[i]);
		}
		for (int i = 0; i < 4; ++i) {
			Collections.sort(lists[i], new Comparator<Tuple>() {
				@Override
				public int compare(Tuple o1, Tuple o2) {
					return -1 * Integer.compare(o1.v, o2.v);
				}
			});
		}
	}

	long calcValue(int[] pat) {
		long result = 0L;
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < pat[i]; ++j) {
				result += lists[i].get(j).v;
			}
		}
		return result;
	}

	void calc() {
		pattern = new ArrayList<>();
		// まず振り分けパターンを求める
		for (int w0 = 0; w0 <= Math.min(W / baseWeight, lists[0].size()); ++w0) {
			long remainWeight1 = W - baseWeight * (long) w0;
			for (int w1 = 0; w1 <= Math.min(remainWeight1 / (baseWeight + 1L), lists[1].size()); ++w1) {
				long remainWeight2 = remainWeight1 - (baseWeight + 1L) * (long) w1;
				for (int w2 = 0; w2 <= Math.min(remainWeight2 / (baseWeight + 2L), lists[2].size()); ++w2) {
					long remainWeight3 = remainWeight2 - (baseWeight + 2L) * (long) w2;
					int w3 = Math.min((int) (remainWeight3 / (baseWeight + 3L)), lists[3].size());

					int[] pat = new int[4];
					pat[0] = w0;
					pat[1] = w1;
					pat[2] = w2;
					pat[3] = w3;
					pattern.add(pat);
				}
			}
		}
	}

	void showResult() {
		long result = 0;
		for (int i = 0; i < pattern.size(); ++i) {
			result = Math.max(result, calcValue(pattern.get(i)));
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 26464
#include<iostream>
#include<string>
#include<cstdio>
#include <cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    ll a, b; cin >> a >> b;
    if(a == b) {
        cout << 1 << endl;
        return 0;
    }
    ll c = a + b;
    if(c % 2 == 0) {
        cout << c / 2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

using ll = long long int;
using namespace std;

int main(){

  ll N;
  cin >> N;

  ll ans = 0;

  if(N == 2){
    cout << 1 << endl;
    return 0;
  }

  // n = 0
  for(ll i = 1; i*i <= N-1; i++){
    // if i is divisor of N-1
    if((N-1)%i == 0){
      if(i==1){
        ans++;
      }
      else if(i*i == N-1){
        ans++;
      }
      else{
        ans+=2;
      }
    }
  }

  // n>1;
  vector<ll> divN;
  ans++; // the case K = N
  for(ll i = 2; i*i <= N; i++){
    if(N%i == 0){
      if(i*i == N){
        divN.push_back(i);
      }
      else{
        divN.push_back(i);
        divN.push_back(N/i);
      }
    }
  }

  // count answer
  ll tmp;
  for(ll i = 0; i < divN.size(); i++){
    tmp = N;
    while(tmp%divN[i] == 0){
      tmp = tmp/divN[i];
    }
    if(tmp%divN[i] == 1){
      ans++;
    }
  }

  cerr << "Answer:" << endl;
  cout << ans << endl;

  return 0;
  
}


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

long long k, s, cnt = 0;

int main() {
  cin >> k >> s;
  for(int i = 0; i <= k; ++i)
    for(int j = 0; j <= k; ++j)
      if(s - i - j >= 0 && s - i - j <= k) ++cnt;
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
S = input()
ans = 'AC'
if S[0] != 'A':
    ans = 'WA'
if S[2:][:-1].count('C') != 1:
    ans = 'WA'
if (S.count('A') != 1) or (S.count('C') != 1) or (not S.replace('A','a').replace('C','c').islower()):
    ans = 'WA'
print(ans)

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

int main()
{
    int n, k; cin>>n>>k;
    vector<int> a(n);
    for(auto& e: a) cin>>e;
    sort(rbegin(a), rend(a));
    
    int res=n;
    long s=0;
    for(int i=0; i<n; ++i) {
        s+=a[i];
        if (s>=k) { res=min(res, n-i-1); s-=a[i]; }
    }
    cout<<res<<endl;
}

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

struct StNode
{
  StNode* m_poParnt;
  StNode* m_poLeft;
  StNode* m_poRigt;
  int m_nKey;

  StNode(int nNo) :
    m_poParnt(nullptr), m_poLeft(nullptr), m_poRigt(nullptr), m_nKey(nNo)
  { }
};

void fnPreOrder(StNode* poNode)
{
  if (poNode == nullptr)  return;

  cout << " " << poNode->m_nKey;
  fnPreOrder(poNode->m_poLeft);
  fnPreOrder(poNode->m_poRigt);
}

void fnInOrder(StNode* poNode)
{
  if (poNode == nullptr)  return;

  fnInOrder(poNode->m_poLeft);
  cout << " " << poNode->m_nKey;
  fnInOrder(poNode->m_poRigt);
}

void fnInsert(StNode*& rpoRoot, StNode* poNewNod)
{
  StNode* poParnt = nullptr;
  StNode* poNode = rpoRoot;

  while (poNode != nullptr)
  {
    poParnt = poNode;
    if (poNewNod->m_nKey < poNode->m_nKey)
      poNode = poNode->m_poLeft;
    else
      poNode = poNode->m_poRigt;
  }

  poNewNod->m_poParnt = poParnt;
  if (poParnt == nullptr)
    rpoRoot = poNewNod;
  else if (poNewNod->m_nKey < poParnt->m_nKey)
    poParnt->m_poLeft = poNewNod;
  else
    poParnt->m_poRigt = poNewNod;
}

void fnBinSchTree(StNode*& rpoRoot)
{
  int nMaxSiz;
  cin >> nMaxSiz;

  for (int i = 0; i < nMaxSiz; ++i)
  {
    string sCmd;
    cin >> sCmd;
    if (sCmd[0] == 'i')
    {
      int nNo;
      cin >> nNo;
      StNode* poNewNod = new StNode(nNo);
      fnInsert(rpoRoot, poNewNod);
    }
    if (sCmd[0] == 'p')
    {
      fnInOrder(rpoRoot);
      cout << endl;
      fnPreOrder(rpoRoot);
      cout << endl;
    }
  }
}

void fnPstOrder(StNode* poNode)
{
  if (poNode == nullptr)  return;

  fnPstOrder(poNode->m_poLeft);
  fnPstOrder(poNode->m_poRigt);
  delete poNode;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  StNode* poRoot = nullptr;

  fnBinSchTree(poRoot);
//fnPstOrder(poRoot);
}

Measured memory_bytes: 26660
using System;
using System.Linq;

class C
{
	static void Main()
	{
		var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
		var scs = new int[h[1]].Select(_ => Console.ReadLine()).ToArray();

		var r = Enumerable.Range(0, 1000).Select(i => $"{i}").Where(x => x.Length == h[0] && scs.All(sc => x[sc[0] - '1'] == sc[2])).ToArray();
		Console.WriteLine(r.Any() ? r[0] : "-1");
	}
}


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

#define reps(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) reps(v, 0, n)
#define lep(v, n) reps(v, 1, n + 1)

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }
template<typename T> void show(T& a, char del='\n', char last='\n'){ rep(i, a.size() - 1) cout << a[i] << del; cout << a[a.size() - 1] << last; }

struct Sieve {
  vector<bool> data;
  const int size;
  Sieve(int size) : size(size), data(size + 1, true) {}
  void build(){
    for (int i = 2; i * i <= size; ++i){
      for (int j = i * i; j <= size; j += i){
        data[j] = false;
      }
    }
    data[0] = data[1] = false;
  }
  bool isPrime(int x){
    return data[x];
  }
};

int main()
{
  Sieve p(500000);
  p.build();

  int n;
  while (n = in()){
    int count = 0;
    reps(i, n + 1, 2 * n + 1){
      if (p.isPrime(i)) count++;
    }
    printf("%d\n", count);
  }
  return 0;
}

Measured memory_bytes: 1248
#include <stdio.h>

int main()
{
  char *p, buf[32];
  int i, n, q, c, x, y;
  fgets(buf, 32, stdin);
  for (n=0,p=buf; *p!=' '; n = n * 10 + *(p++) - '0'); 
  int s[n];
  for (i=0; i<n; i++) s[i]=i;
  for (q=0,p++; *p!='\n'; q = q * 10 + *(p++) - '0');
  for (i=0; i<q; i++) {
    fgets(buf, 32, stdin);
    c = buf[0];
    for (x=0,p=buf+2; *p!=' '; x = x * 10 + *(p++) - '0');
    for (y=0,p++; *p!='\n'; y = y * 10 + *(p++) - '0');
    if (c=='0') {
      while(s[x]!=x) x=s[x];
      while(s[y]!=y) y=s[y];
      if (s[x]<s[y]) s[y] = s[x];
      else s[x] = s[y];
    } else {
      while(s[x]!=x) x=s[x];
      while(s[y]!=y) y=s[y];
      putc_unlocked('0'+(x==y), stdout);
      putc_unlocked('\n', stdout);
    }
  }
  return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#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;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c;
  cin>>a>>b>>c;
  set<int>se;
  se.insert({a,b,c});
  cout<<se.size()<<endl;

  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

main(){
    INCANT;
    int n, x, l, res = 0;
    string s;
    in(n, x);
    rep(i, 1, n + 1){
        in(l);
        res += l;
        if(res > x){
            print(i);
            return 0;
        }
    }
    print(n + 1);
}


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

#define MOD 998244353
LL powmod(LL a, LL n){
	if(n == 0) return 1;
	if(n % 2) return (a*powmod(a,n-1)) % MOD;
	LL c = powmod(a, n/2);
	return (c*c) % MOD;
}
LL inv(LL a){
	return powmod(a, MOD-2);
}
LL fact[1100000];
LL invfact[1100000];
LL p2[1100000];
LL i2[1100000];
LL ncr(LL n, LL r){
	if(r < 0 || n < 0) return 0;
	if(n < r) return 0;
	LL a = fact[n];
	a = (a * invfact[r]) % MOD;
	a = (a * invfact[n-r]) % MOD;
	return a;
}
LL finalans = 0;
LL solve2(LL a, LL b, LL c){
	if(b == 0){
		if(a == 0 && c == 0){
			return 1;
		}
		return 0;
	}
	if(a == 0) return ncr(b-1+c,b-1);
	if(c == 0) return ncr(b-1+a,b-1);
	return ncr(a-1+b+c-1+1,b-1);
}

void solve(string a, string b, string c, string d){
	LL na = 0;
	LL nb = 0;
	for(int i = 0; i < a.size(); i++) na += a[i] - '0';
	for(int i = 0; i < b.size(); i++) nb += b[i] - '0';
	LL lc = 0;
	LL rc = 0;
	LL ld = 0;
	LL rd = 0;
	LL l2 = 0;
	LL r2 = 0;
	for(int i = 0; i < c.size(); i++) rc += c[i] - '0';
	for(int i = 0; i < d.size(); i++) rd += d[i] - '0';
	for(int i = 0; i < c.size(); i++){
		if(c[i] == '1' && d[i] == '1'){
			r2++;
		}
	}


	LL lsols = 0;
	LL ans = 0;
	for(int i = 0; i < c.size(); i++){
		rc -= (c[i] - '0');
		rd -= (d[i] - '0');
		if(c[i] == '1' && d[i] == '1'){
			r2--;
		}
		if(c[i] == '0' && d[i] == '0') continue;
		LL rsol = solve2(rc, nb, rd);
		rsol *= inv(p2[r2]);
		rsol %= MOD;

		LL lsol = solve2(lc, na, ld);
		lsol *= inv(p2[l2]);
		lsol %= MOD;
		lsols = (lsols + lsol) % MOD;

		ans += rsol * lsols;
		ans %= MOD;

		lc += (c[i] - '0');
		ld += (d[i] - '0');
		if(c[i] == '1' && d[i] == '1'){
			l2++;
		}		
	}
	ans *= p2[l2];
	ans %= MOD;
	//cout << ans << endl;
	finalans += ans;
	finalans %= MOD;
}
int main(){
	fact[0] = 1;
	invfact[0] = 1;
	p2[0] = 1;
	LL inv2 = inv(2);
	for(LL i = 1; i < 1100000; i++){
		fact[i] = (i*fact[i-1]) % MOD;
		invfact[i] = inv(fact[i]);
		p2[i] = (2*p2[i-1]) % MOD;
		i2[i] = (inv2*i2[i-1]) % MOD;
	}

	LL n, m;
	cin >> n >> m;
	string a, b, c, d;
	cin >> a >> b >> c >> d;
	int n0 = 0;
	for(int i = 0; i < a.size(); i++) n0 += a[i] - '0';
	for(int i = 0; i < b.size(); i++) n0 += b[i] - '0';
	for(int i = 0; i < c.size(); i++) n0 += c[i] - '0';
	for(int i = 0; i < d.size(); i++) n0 += d[i] - '0';
	if(n0 == 0){
		cout << 1 << endl;
		return 0;
	}
	solve(a,b,c,d);
	solve(c,d,a,b);
	cout << finalans << endl;
}


Measured memory_bytes: 35456
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int gcd(int x, int y) {
    if (x < y) swap(x, y);
    int r = x%y;
    if (r == 0) {
        return y;
    }
    return gcd(y, r);
}

int main(){
    string S, T;
    cin >> S >> T;
    for (int i=0; i<S.size(); i++) {
        if (S[i] != T[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3628
// AOJ 2200: Mr. Rito Post Office
// 2017.12.9

#include <stdio.h>
#include <string.h>

int land[202][202], sea[202][202];
int dp[1002][202];
int z[1002];

char buf[4000], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

int main()
{
	int n, m, r, x, y, i, j, k, t;

    while (fgets(p=buf, 15, stdin) && *p != '0') {
		n = getint(), m = getint();
		memset(land, 0x07, sizeof(land));
		memset(sea,  0x07, sizeof(sea));
		for (i = 0; i < n; i++) land[i][i] = sea[i][i] = 0;

		while (m--) {
			fgets(p=buf, 30, stdin);
			x = getint()-1, y = getint()-1, t = getint();
			if (*p == 'L') { if (t < land[x][y]) land[x][y] = land[y][x] = t; }
			else           { if (t < sea [x][y]) sea [x][y] = sea [y][x] = t; }
		}
		fgets(p=buf, 10, stdin), r = getint()-1;
		fgets(p=buf, 4000, stdin);
		for (i = 0; i <= r; i++) z[i] = getint()-1;

		for (k = 0; k < n; k++) for (i = 0; i < n; i++) for (j = 0; j < n; j++) {
			t = land[i][k] + land[k][j];
			if (t < land[i][j]) land[i][j] = t;
			t = sea[i][k] + sea[k][j];
			if (t < sea[i][j]) sea[i][j] = t;
		}

		memset(dp, 0x07, sizeof(dp));
		dp[0][z[0]] = 0;

		for (k = 1; k <= r; k++) {
			for (i = 0; i < n; i++) {
				for (j = 0; j < n; j++) {
					if (i == j) t = dp[k-1][j] + land[z[k-1]][z[k]];
					else 		t = dp[k-1][j] + land[z[k-1]][j] + sea[j][i] + land[i][z[k]];
					if (t < dp[k][i]) dp[k][i] = t;
				}
			}
		}
		t = 0x7ffffff;
		for (i = 0; i < n; i++) if (dp[r][i] < t) t = dp[r][i];
		printf("%d\n", t);
	}
	return 0;
}

Measured memory_bytes: 2852
#include <iostream>
#include <string>
using namespace std;
int main () {
  string s;
  char b;
  int tmp=0;
  int ans=0;
  
  cin >> s;
  for (int i=0; i<s.length(); i++) {
    switch (s[i]) {
    case 'A':
    case 'C':
    case 'G':
    case 'T':
      tmp++;
      break;
    default:
      if(ans<tmp) ans=tmp;
      tmp=0;
      break;
    }
  }
  cout << (ans>tmp?ans:tmp) << endl;
  return 0;
}

Measured memory_bytes: 256