akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	map<ll, ll> mp;
  ll n, k;
  cin >> n >> k;
  rep(i, n) {
    ll a, b;
    cin >> a >> b;
    mp[a] += b;
  }
  for(auto i : mp) {
    k -= i.second;
    if (k <= 0) {
      cout << i.first << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 4224
import java.util.*;

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

        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String ans = "Good";

        for (int i = 0; i < s.length()-1; i++) {
            if (s.substring(i,i+1).equals(s.substring(i+1,i+2))) {
                ans = "Bad";
                break;
            }
        }

        System.out.println(ans);

    }
}



Measured memory_bytes: 21716
#include<iostream>
using namespace std;
int a[13];
int main()
{a[1]=1,a[2]=3,a[3]=1,a[4]=2,a[5]=1,a[6]=2,a[7]=1,a[8]=1,a[9]=2,a[10]=1,a[11]=2,a[12]=1;int x,y;cin>>x>>y;if(a[x]==a[y])cout<<"Yes"<<endl;else cout<<"No"<<endl;return 0;}


Measured memory_bytes: 256
/*
    Life Before Death, Strength Before Weakness, Journey Before Destination
    ------------------------------------------------------------------------
    You don't become great by trying to be great.
    You become great by wanting to do something,
    and then doing it so hard that you become great in the process.
    */

    //#pragma comment(linker, ack:200000000")
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include <bits/stdc++.h>
    using namespace std;
    #define rep(i, n)    for(ll i = 0; i < (n); ++i)
    #define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
    #define repD(i, a, n)  for(ll i = a; i >= (n); --i)
    #define trav(a, x) for(auto& a : x)
    #define all(x) x.begin(), x.end()
    #define sz(x) (int)(x).size()
    #define fill(a)  memset(a, 0, sizeof (a))
    #define fst first
    #define snd second
    //#define mp make_pair
    #define pb push_back
    #define PI           3.141592653589793238462643383279502884197169399  /* pi */
    // #define te
    typedef long double ld;
    typedef long long ll;
    typedef pair<ll, ll> pii;
    typedef vector<ll> vi;
    const int maxN = 200100;
    typedef pair<pii, ll> piii;

    ll n, m;
    vector<pair<pii, ll>> v;
    vi d;

    ll getmin(ll x){
    	ll val = 1e18;
    	for(int i=x; i > 0; i-= i&-i) val = min(val, d[i]);
    	return val;
    }

    void update(ll x, ll y){
    	for(int i=x; i <= n ; i+= i&-i) d[i] = min(d[i], y);
    }

    void solve() {
    	cin >> n >> m;
    	v.resize(m);
    	d.resize(n+1, 1e18);

    	rep(i, m){
    		ll l, r, c;
    		cin >> l >> r >> c;
    		v[i] = {{l, r}, c};
    	}

    	sort(v.rbegin(), v.rend());
    	d[n] = 0;

    	rep(i, m){
    		ll l, r, c;
    		l = v[i].fst.fst;
    		r = v[i].fst.snd;
    		c = v[i].snd;
    		ll dis = getmin(r);
    		update(l, dis + c);
    	}
    	if( d[1] == 1e18 ) cout << "-1" << endl;
    	else cout << d[1] << endl;
    }

    int main() {
      cin.sync_with_stdio(0); cin.tie(0);
      cin.exceptions(cin.failbit);
      // ll ti;   cin >> ti;  while(ti--)
      solve();
      return 0;
    }


Measured memory_bytes: 3328
N = int(input())

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

M=int(input())

a=[]
for k in range(M):
    a.append(list(map(int,input().split())))

cal=sum(t)

for j in range(M):
    print(cal - t[a[j][0]-1] + a[j][1])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
typedef pair<pill,int> PA;
ll MOD;
//ll MOD = 1000000007;
// ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	ll weight;
};
int N,V,PP;
ll M;
vector<ll> times;
vector<string> hoge;
int main(){
	cin>>N;
	rep(i,N){
		string str;
		ll t;
		cin>>str>>t;
		hoge.pb(str);
		times.pb(t);
	}
	string ehoge;
	cin>>ehoge;
	ll ans=0;
	bool flag=false;
	rep(i,N){
		if(flag){
			ans+=times[i];
		}
		if(ehoge==hoge[i])flag=true;
	}
	cout<<ans<<endl;
}


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

int main() {
  ll Q, H, S, D;
  cin >> Q >> H >> S >> D;
  ll N; cin >> N;
  Q *= 4; H *= 2;
  ll x = 0;
  if(D <= 2 * Q && D <= 2 * H && D <= 2 * S) {
    x += ((N / 2) * D);
    if(N % 2 == 1) {
      x += min(Q, min(H, S));
    }
  } else {
    x += min(Q, min(H, S)) * N;
  }
  cout << x << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#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>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
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 Per(i,sta,n) for(int i=n-1;i>=sta;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 long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n;
string s;

vector<int> G[500010];
int a[500010];

int dfs(int s){
    if(a[s]!=-1) return a[s];
    int res=-1;
    for(int t:G[s]){
        res=max(res,dfs(t));
    }
    a[s]=res+1;
    return res+1;
}

void solve(){
    cin >> s;n=s.length();n++;
    rep(i,n){
        a[i]=-1;
    }
    rep(i,n-1){
        if(s[i]=='<'){
            G[i+1].push_back(i);
        }
        else{
            G[i].push_back(i+1);
        }
    }
    ll ans=0;
    rep(i,n){
        ans+=dfs(i);
        //cout << a[i] << endl;
    }
    cout << ans << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

Measured memory_bytes: 53532
function Main(input) {
 
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n")[0];
    
    console.log(input.substr(0, 3));
    
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29544
import java.util.Scanner;
class Main{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        
        int a = scan.nextInt();
        int b = scan.nextInt();
        
        System.out.print((a*b)+" ");
        System.out.println(2*(a+b));
    }
}


Measured memory_bytes: 25948
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int main(){
  int a,b; cin >> a >> b;
  a--,b--;
  vector<bool> v(3,true);
  v[a] = false; v[b] = false;
  rep(i,3){
    if(v[i]) cout << i+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
X,Y =map(int,input().split())

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


if (X+Y)%3 !=0:
  print(0)
  
else:
  n=(X+Y)//3
  r=(-2*X+Y)//(-3)
  ans=cmb(n,r,mod)
  print(ans)
  

Measured memory_bytes: 128068
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
//----------------------------------------------------------------

// int MOD = 998244353;
int MOD = 1000000007;

#define N 100010
int par[N];
int rnk[N];
int weight[N];

void init(int n){
    for(int i=0;i<n;i++){
        par[i] = i;
        weight[i] = 1;
        rnk[i] = 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(rnk[x] < rnk[y]){
        weight[find(y)] += weight[find(x)];
        par[x] = y;
    }
    else{
        weight[find(x)] += weight[find(y)];
        par[y] = x;
        if(rnk[x] == rnk[y]) rnk[x]++;
    }
}

bool same(int x,int y){
    return find(x) == find(y);
}

//----------------------------------------------------------------
signed main(){

	ll n,k,q;
	cin >> n >> k >> q;
	vll cnt(n,0);
	rep(i,q){
		ll a;cin >> a;
		cnt[a-1]++;
	}
	rep(i,n){
		if(k-q+cnt[i] >= 1)cout << "Yes" << endl;
		else cout << "No" << endl;
	}



	

	return 0;
}

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

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://ddcc2017-final.contest.atcoder.jp/tasks/ddcc2017_final_b
// rm -r -f test;oj dl https://abc141.contest.atcoder.jp/tasks/abc141_b

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    string a, b, c;
    cin>>a>>b>>c;
    cout << a[0] << b[0] << c[0];
    // end

    return 0;
}


Measured memory_bytes: 256
import math

def rot60(s,t):
    v=t-s
    a=1/2+complex(0,(math.sqrt(3)/2))
    return v*a+s

def puts(p):
    x=p.real
    y=p.imag
    print('{real} {imaginary}'.format(real=x,imaginary=y))

def koch(p1, p2, n):
    if n==0:
        return

    s=(p2-p1)*(1/3)+p1
    t=(p2-p1)*(2/3)+p1
    u=rot60(s,t)
    koch(p1,s,n-1)
    puts(s)
    koch(s,u,n-1)
    puts(u)
    koch(u,t,n-1)
    puts(t)
    koch(t,p2,n-1)
    
n=int(input())
s=complex(0,0)
t=complex(100,0)
puts(s)
koch(s,t,n) 
puts(t)


Measured memory_bytes: 5720
N = int(input())
L = []
t = 0

for i in range(N):
  a, b = map(int, input().split())
  L.append((a,b,b-a))
L = sorted(L, key = lambda x: x[1])
for a, b, c in L:
  if t > c:
    print ("No")
    break
  t += a
else:
  print ("Yes")

Measured memory_bytes: 41392
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * AtCoder Beginner Contest 130<br>
 * B - Bounding<br>
 * https://atcoder.jp/contests/abc130/tasks/abc130_b<br>
 */
public class Main {

    public static void main(String[] args) {

        String[] input1;
        String[] input2;

        try (Scanner sc = new Scanner(System.in)) {
            input1 = sc.nextLine().split(" ");
            input2 = sc.nextLine().split(" ");

            int N = Integer.parseInt(input1[0]);
            int X = Integer.parseInt(input1[1]);

            List<Integer> list = new ArrayList<Integer>();
            for (String str : input2) {
                list.add(Integer.parseInt(str));
            }
            // 計算
            int result = calc(N, X, list);

            // 出力
            System.out.println(result);
        } 
    }

    private static int calc(int N, int X, List<Integer> list) {
        int ans = 0;
        int count = 1;
        for (int i = 0; i < N; i++) {
            ans = ans + list.get(i);
            if (X < ans) {
                break;
            }
            count++;
        }
        return count;
    }
}

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

const int MN = 101234;
vector <int> adj[MN];

int dfs(int v, int p) {
	cerr << v << ' ' << p << endl;
	int cnt[3] = {};
	for (int u: adj[v]) 
		if (u != p)
			cnt[dfs(u, v)]++;
	if (cnt[2])
		return 2;
	if (cnt[1] > 1)
		return 2;
	return 1 - cnt[1];
}

int main() {
	int n;
	cin >> n;
	for (int i = 1; i < n; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	for (int i = 0; i < n; i++) 
		if (adj[i].size() == 1) {
			if (dfs(i, i))
				cout << "First";
			else
				cout << "Second";
			return 0;
		}
}

Measured memory_bytes: 9176
#include <iostream>
#include <algorithm>
#include <functional>
#include <set>
#include <vector>
#include <array>
#include <cmath>

#define r(i, v, n) for(int i = v; i < n; i++)
#define re(i, v, n) for(int i = v; i <= n; i++)

using namespace std;


int main() {
    int n, k, x, y;
    char c;
    vector<vector<int>> v(4100, vector<int>(4100, 0));
    scanf("%d %d", &n, &k);
    int dk = 2 * k;
    r(i, 0, n) {
        scanf("%d %d %c", &x, &y, &c);
        if (c == 'W') {
            c = 'B';
            x += k;
        }
        x %= dk;
        y %= dk;
        v[x+1   ][y+1   ]++;
        v[x+1+k ][y+1   ]--;
        v[x+1   ][y+1+k ]--;
        v[x+1+k ][y+1+k ]+=2;
        v[x+1+dk][y+1+k ]--;
        v[x+1+k ][y+1+dk]--;
        v[x+1+dk][y+1+dk]++;
    }

    r(i, 0, 4 * k) {
        r(j, 0, 4 * k) {
            if (i == 0 && j == 0) {
                continue;
            } else if (i == 0 && j != 0) {
                v[i][j] += v[i][j - 1] + 0 - 0;
            } else if (i != 0 && j == 0) {
                v[i][j] += 0 + v[i - 1][j] - 0;
            } else {
                v[i][j] += v[i][j - 1] + v[i - 1][j] - v[i - 1][j - 1];
            }
        }
    }

    r(i, 0, 4 * k) {
        r(j, 0, 4 * k) {
            if (i < dk && j < dk) {
                continue;
            } else if (dk <= i && j < dk) {
                v[i%dk][j] += v[i][j];
            } else if (i < dk && dk <= j) {
                v[i][j%dk] += v[i][j];
            } else {
                v[i%dk][j%dk] += v[i][j];
            }
        }
    }

    int max_count = 0;
    r(i, 0, 4 * k) {
        r(j, 0, 4 * k) {
            int val = v[i][j];
            if (max_count < val) {
                max_count = val;
            }
        }
    }

    printf("%d", max_count);

    return 0;
}

Measured memory_bytes: 66048
class in{struct It{int it;const bool rev;explicit constexpr It(int it_, bool rev=false):it(it_),rev(rev){}int operator*(){return it;}bool operator!=(It& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const It i,n;public:explicit constexpr in(int n):i(0),n(n<0?0:n){}explicit constexpr in(int i,int n):i(i,n<i),n(n){}const It& begin(){return i;}const It& end(){return n;}};

#include <bits/stdc++.h>
using namespace std;

int Scc(const vector<vector<int>>& adj, vector<int>& color) {
    const int n = adj.size();
    vector<int> num(n, 0), low(n, 0), sta;
    color.assign(n, 0);
    bitset<1000> inS(n);
    int t = 0, colnum = 0;
    function<void(int)> visit = [&](int cur) {
        low[cur] = num[cur] = ++t;
        sta.emplace_back(cur); inS[cur] = 1;
        for(int nxt : adj[cur]) {
            if(num[nxt] == 0) {
                visit(nxt);
                low[cur] = min(low[cur], low[nxt]);
            } else if(inS[nxt])
              low[cur] = min(low[cur], num[nxt]);
        }
        if(low[cur] == num[cur]) {
            while(true) {
                int nxt = sta.back(); sta.pop_back(); inS[nxt] = false;
                color[nxt] = colnum;
                if(cur == nxt) break;
            }
            ++colnum;
        }
    };
    for(int v : in(n))
      if(num[v] == 0)
        visit(v);
    return colnum;
}

using i64 = long long;
const i64 MOD = 1e9 + 7;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    vector<vector<int>> __adj(n);
    for(int _ : in(m)) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        __adj[u].emplace_back(v);
    }
    vector<int> color;
    int col = Scc(__adj, color);
    vector<vector<int>> radj(col);
    vector<int> deg(col, 0);
    vector<bitset<1000>> used(col, bitset<1000>(0));
    for(int v : in(n))
      for(int u : __adj[v])
        if(color[v] != color[u] && used[color[u]][color[v]] == 0)
          radj[color[u]].emplace_back(color[v]), ++deg[color[v]], used[color[u]][color[v]] = 1;
    vector<i64> dp(col, -1LL);
    i64 ans = 1LL;
    function<i64(int)> dfs = [&](int v) {
        i64& res = dp[v];
        if(res != -1LL) return res;
        res = 1LL;
        for(int u : radj[v])
          res = res * dfs(u) % MOD;
        return ++res;
    };
    for(int v : in(col)) {
        if(dp[v] != -1LL || deg[v] != 0) continue;
        ans = ans * dfs(v) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3376
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N,keep=2e5+1,ans=0;; cin>>N;
  for(int i=0; i<N; i++){
    ll p; cin>>p;
    if(keep>p){
      ans++;
      keep=p;
    }   
  }
  cout<<ans<<endl;
}


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

int main() {
	long int A,B,r,x,tmp;
	cin >>A>>B;
	x=A*B;
	if(A<B){
		tmp = A;
		A = B;
    	B = tmp;
    }
    r = A%B;
    while(r!=0){
    	A=B;
    	B=r;
    	r=A%B;
    }
    cout <<x/B<<endl;



}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char s[12];
	int i, j, flg = 0, cnt, flgA = 0;

	scanf("%s", s);

	for (cnt = 0; s[cnt] != '\0'; cnt++);

	for (i = 0; i < cnt; i++)
	{
		if (s[i] >= 'A' && s[i] <= 'Z')
		{
			flgA++;
		}
	}
	
	if (flgA >= 3)
	{
		printf("WA");
	}
	else if (cnt == 4)
	{
		if (s[2] == 'C' && s[0] == 'A')
		{
			printf("AC");
		}
		else
		{
			printf("WA");
		}
	}
	else
	{
		for (i = 2; i <= cnt - 2; i++)
		{
			if (s[i] == 'C' && s[0] == 'A')
			{
				printf("AC");
				flg = 1;
				break;
			}
		}
		if (flg == 0)
		{
			printf("WA");
		}
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

int main(void)
{
    std::vector<int64_t> data = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int64_t K;
    std::cin >> K;

    std::cout << data.at(K-1) << std::endl;

    return 0;
}

Measured memory_bytes: 256
//A
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String a = in.next();
		if( Character.isUpperCase( a.charAt( 0 ) ) ) 
          System.out.println( "A" );
        else
          System.out.println( "a" );
	}
}

Measured memory_bytes: 35448
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

const ll mod = static_cast<ll>(1e9) + 7;

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

    const ll n = N * (N - 1) / 2;
    const ll m = M * (M - 1) / 2;

    cout << n + m << endl;

    return 0;
}


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

int main(){
	int A, B, C; cin >> A >> B >> C;
	int ans = max<int>({
		10 * A + B + C,
		A + 10 * B + C,
		A + B + 10 * C,
	});
	cout << ans << endl;
}

Measured memory_bytes: 256
n, d = gets.strip.split(" ").map(&:to_i)
answer=[]
line=[]
require "matrix"

n.times do
  line << gets.strip.split.map(&:to_i)
end
(n-1).times do |i|
  (n-1-i).times do|j|
 v1=Vector.elements(line[i])
 v2=Vector.elements(line[i+1+j])
 answer <<   (v2 - v1).r.to_f
  end
end
puts answer.select{|e| e==e.to_i}.count

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

#define INF 1e12

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,q; cin>>a>>b>>q;
    vll s(a+2),t(b+2);
    s[0]=t[0]=-INF;
    s[a+1]=t[b+1]=INF;
    rep(i,a) cin>>s[i+1];
    rep(i,b) cin>>t[i+1];
    while(q--){
        ll x; cin>>x;
        auto itr = upper_bound(all(s),x); itr--;
        ll sl = *itr;
        ll sr = *lower_bound(all(s),x);
        itr = upper_bound(all(t),x); itr--;
        ll tl = *itr;
        ll tr = *lower_bound(all(t),x);
        ll ans=max(x-sl,x-tl);
        chmin(ans,max(sr-x,tr-x));
        chmin(ans,tr-sl+min(x-sl,tr-x));
        chmin(ans,sr-tl+min(x-tl,sr-x));
        cout<<ans<<"\n";
    }
    return 0;
}


Measured memory_bytes: 2944
#include <stdio.h>
#include <algorithm>
using namespace std;
const int maxn = 5050;
long long f[2 * maxn], nf[2 * maxn];
int p[maxn];
int main(){
	int n, A, B; scanf("%d %d %d", &n, &A, &B);
	for(int i = 1; i <= n; i++){
		int x; scanf("%d", &x);
		p[x] = 2 * i;
	}
	int l = 2 * n + 1;
	for(int i = 1; i <= n; i++){
		long long mi = f[1];
		f[1] += B;
		for(int j = 2; j <= l; j++){
			mi = min(mi, f[j]);
			long long cost = (p[i] < j) * A + (p[i] > j) * B;
			f[j] = mi + cost;
		}
	}
	long long ans = 1ll<<62;
	for(int j = 1; j <= l; j++) ans = min(ans, f[j]);
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int main(void){

	long long a,b,c, d;
	long long k1,k2,k3,k4;
	long long  x, y, z;
	long long xx, yy;

	scanf("%lld %lld", &xx,&yy);
	if (xx % 3 == 0 || yy % 3 == 0){
		printf("0\n");
		return 0;
	}
	x = xx;
	y = yy;
	a = (x / 3)*y;
	x = x - (x / 3);
	if (x % 2 == 0 || y % 2 == 0)b = (x*y) / 2;
	else if (x > y)b = ((x + 1)*y) / 2;
	else b = (x*(y + 1)) / 2;
	k1 = b - a;

	x = xx;
	y = yy;
	a = ((x / 3)+1)*y;
	x = x - (x / 3)-1;
	if (x % 2 == 0 || y % 2 == 0)b = (x*y) / 2;
	else if (x > y)b = ((x - 1)*y) / 2;
	else b = (x*(y - 1)) / 2;
	k2 = a - b;
	if (k2 < k1)k1 = k2;

	x = xx;
	y = yy;
	a = (y / 3)*x;
	y = y - (y / 3);
	if (x % 2 == 0 || y % 2 == 0)b = (x*y) / 2;
	else if (x > y)b = ((x + 1)*y) / 2;
	else b = (x*(y + 1)) / 2;
	k3 = b - a;
	if (k3 < k1)k1 = k3;

	x = xx;
	y = yy;
	a = ((y / 3)+1)*x;
	y = y - 1 - (y / 3);
	if (x % 2 == 0 || y % 2 == 0)b = (x*y) / 2;
	else if (x > y)b = ((x - 1)*y) / 2;
	else b = (x*(y - 1)) / 2;
	k4 = a - b;
	if (k4 < k1)k1 = k4;

	printf("%lld\n", k1);

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include <cstdio>
#include<vector>
#include<map>
#include<utility>
#include<list>
#include<algorithm>
#include <ctype.h>
#include<deque>
using namespace std;
using ll = long long int;

int s;
map<int, int>tmp;

int main(void) {
	cin >> s;
	tmp[s] = 1;
	ll i;
	for (i = 2; i < 1000000; i++) {
		if (s % 2 == 0) {
			s = s / 2;
		}
		else {
			s = 3 * s + 1;
		}
		tmp[s]++;
		if (tmp[s] == 2)
			break;
	}
	cout << i << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int num[200][2]={},count=0,i=0,sum,a,ans,keta=0;
    while(scanf("%d %d",&num[count][0],&num[count][1])!=EOF){
        count++;
    }
    for(i=0;i<count;i++){
        sum=num[i][0]+num[i][1];
        keta=0;
        while(sum!=0){
            sum/=10;
            keta++;
        }
        printf("%d\n",keta);
    }
    return 0;
}


Measured memory_bytes: 2112
/*================================================================
*
*   创 建 者： badcw
*   创建日期： 2020/6/21 20:07
*
================================================================*/
#include <bits/stdc++.h>

#define ll long long
using namespace std;

const int maxn = 1e5+50;
const int mod = 1e9+7;
ll qp(ll a, ll n, ll mod = ::mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int num[maxn];
int n;
ll res = 0;

void change(int x, int y) {
    res -= 1ll * num[x] * x;
    res += 1ll * num[x] * y;
    num[y] += num[x];
    num[x] = 0;
}

int main(int argc, char* argv[]) {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        int x;
        scanf("%d", &x);
        num[x] ++;
        res += x;
    }
    int q;
    scanf("%d", &q);
    while (q--) {
        int x, y;
        scanf("%d%d", &x, &y);
        change(x, y);
        printf("%lld\n", res);
    }
    return 0;
}

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

public class Test
{
	public static void Main()
	{
		// your code goes here
		
		var hoi = Console.ReadLine().Split().Select(nyan => int.Parse(nyan)).ToArray(); //この呪文覚えたい
		int n = hoi[0];
		int m = hoi[1];
		
		var a = Console.ReadLine().Split().Select(nyaan => int.Parse(nyaan)).ToArray(); //この呪文覚えたい
		
		int sum = 0;
		for(int i=0;i!=m;i++){
			
			sum += a[i];
			
		}
		
		int ans = n - sum;
		if(ans<0){
			
			ans = -1;
			
		}
		
		Console.WriteLine(ans);
		
	}
}

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

int main(){
  int A, B;
  cin >> A >> B;
  
  if (A <= 5){
    cout << 0 << endl;
  }
  else if (6 <= A && A <= 12){
    cout << B / 2 << endl;
  }
  else{
    cout << B << endl;
  }
}


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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

long long INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n; cin >> n;
	cout << (n+1)/2 << endl;
}	


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int i,n;
  cin>>n;
  int a[n],count[n+10]={0};
  for(i=1;i<n;i++)
  {
    cin>>a[i];
    count[a[i]]++;
  }
  for(i=1;i<=n;i++)
    cout<<count[i]<<"\n";
  
  return 0;
}

Measured memory_bytes: 5128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1e18;

int main() {
	ll N, K;
	scanf("%lld%lld", &N, &K);
	vector<ll> A(N);
	for(ll i=0; i<N; i++) scanf("%lld", &A[i]);
	sort(A.begin(), A.end());

	ll pluscount=0;
	ll zerocount=0;
	ll minuscount=0;
	for(ll i=0; i<N; i++){
		if(A[i]>0)pluscount++;
		else if(A[i]==0)zerocount++;
		else minuscount++;
	}

	ll left = INF;
	ll right = -INF;
	//答えをval以下にできるか？ = val以下の数をK個以上用意できるか？
	auto isOK = [&](ll val) -> bool {
		if(val==0){
			ll t=minuscount*pluscount;//マイナス
			t+=(minuscount+pluscount)*zerocount;//0
			t+=zerocount*(zerocount-1)/2;//0
			return t>=K;
		}

		ll t=0;
		for(ll i=0; i<N; i++){
			if(A[i]==0){
				if(val>0){
					t+=(N-1);
				}
				continue;
			}
			if(val>0){
				if(A[i]>0){//＋ >= ＋*(小さいやつ)
					auto it=partition_point(A.begin(), A.end(), [&](ll x){
						return val>=A[i]*x;
					});
					ll idx=it-A.begin();
					t+=idx;
					if(it==A.end() || A[i]<*it)t--;
				}else{//＋ >= ー*(ーの大きいやつはだめ)
					auto it=partition_point(A.begin(), A.end(), [&](ll x){
						return val<A[i]*x;
					});
					ll idx=it-A.begin();
					t+=N-idx;
					if(it!=A.end() && *it<=A[i])t--;
				}
			}else{
				if(A[i]>0){//ー >= ＋*(ーの大きいやつ)
					auto it=partition_point(A.begin(), A.end(), [&](ll x){
						return val>=A[i]*x;
					});
					ll idx=it-A.begin();
					t+=idx;
				}else{//ー >= ー*(＋の大きいやつ)
					auto it=partition_point(A.begin(), A.end(), [&](ll x){
						return val<A[i]*x;
					});
					ll idx=it-A.begin();
					t+=N-idx;
				}
			}
		}
		return t>=K*2;
	};

	while((ll)abs(right - left) > 1) {
		ll mid = left + (right - left) / 2;
		if(isOK(mid)) left = mid;
		else right = mid;
	}
	
	printf("%lld\n", left);
	return 0;
}


Measured memory_bytes: 1792
#include <math.h>
#include <bits/stdc++.h>//一括で読み込み
typedef long long ll;
using namespace std;

struct flowEdge 
{
	ll to, cap, rev;
};

class Max_Flow//最大流問題のDinic法。頂点数10^3,辺数10^4程度なら大体間に合う
{
public:
	vector<vector<flowEdge>> G;
	vector<ll>level, iter;

	void init(ll size_) 
  {
		G.resize(size_);
		level.resize(size_);
		iter.resize(size_);
	}

	void add_flowEdge(ll from, ll to, ll cap) 
  {
		G[from].push_back(flowEdge{to, cap, (ll)G[to].size()});
		G[to].push_back(flowEdge{from, 0, (ll)G[from].size()-1});
	}

	void bfs(ll s) 
  {
		for (ll i = 0; i < level.size(); i++) level[i] = -1;
		queue<ll> que;
		level[s] = 0;
		que.push(s);
		while (!que.empty())
    {
			ll v = que.front(); que.pop();
			for (ll i = 0; i < G[v].size(); i++)
      {
				flowEdge &e = G[v][i];
				if (e.cap > 0 && level[e.to] < 0) 
        {
					level[e.to] = level[v] + 1;
					que.push(e.to);
				}
			}
		}
	}

	ll dfs(ll v, ll t, ll f) 
  {
		if (v == t) return f;
		for (ll &i = iter[v]; i < G[v].size(); i++)
    {
			flowEdge &e = G[v][i];
			if (e.cap > 0 && level[v] < level[e.to])
      {
				ll d = dfs(e.to, t, min(f, e.cap));
				if (d > 0) {
					e.cap -= d;
					G[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}

	ll max_flow(ll s, ll t)
  {
		ll flow = 0;
		for(;;)
    {
			bfs(s);
			if (level[t] < 0) return flow;
			for (int i = 0; i < iter.size(); i++) iter[i] = 0;
			ll f;
			while ((f = dfs(s, t, (1LL<<60))) > 0)
      {
				flow += f;
			}
		}
	}
};

ll h, w;

vector<pair<ll, ll>> L;//最大流の頂点

int main()
{
	cin >> h >> w;
  string a[h];
	for (int i = 0; i < h; i++)//辺数
  {
		cin >> a[i];
	}
  
  Max_Flow X;
  X.init(h+w+2);//頂点数で初期化

  for(int i = 0; i < h; i++)
  {
    for(int j = 0; j < w; j++)
    {
      if(a[i][j] == 'S')
      {
        X.add_flowEdge(0, i+1, (1LL<<60));//つなぐ頂点とコスト
        X.add_flowEdge(0, h+1+j, (1LL<<60));
      }
      else if(a[i][j] == 'T')
      {
        X.add_flowEdge(i+1, h+w+1, (1LL<<60));
        X.add_flowEdge(h+1+j, h+w+1, (1LL<<60));
      }
      else if(a[i][j] == 'o')
      {
        X.add_flowEdge(i+1, h+1+j, 1);
        X.add_flowEdge(h+1+j, i+1, 1);
      }
    }
  }
  ll answer = X.max_flow(0, h+w+1);
  if(answer < 999999)
	 cout << answer << endl;//開始頂点から終了頂点までの最大流を求める
  else cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 1536
S=input()
Len=len(S)-1
ans=0
for i in range(1<<Len):
  Tmp=S[0]
  cnt=0
  for j in range(Len):
    if 1&(i>>j):
      Tmp+='+'
      Tmp+=S[j+1]
    else:
      Tmp+=S[j+1]
  cnt=eval(str(Tmp))
  ans+=cnt
print(ans)

Measured memory_bytes: 8984
#include<iostream>
#include<cstring>
#include<stdio.h>
using namespace std;
static const int M = 1046527;
static const int NIL = -1;
static const int L = 14;

char H[M][L];

int getChar(char ch){
  if(ch == 'A') return 1;
  else if(ch == 'C') return 2;
  else if(ch == 'G') return 3;
  else if(ch == 'T') return 4;
  else return 0;
}

long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for(i = 0; i < strlen(str); i++){
    sum += p * (getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M - 1)); }

int find(char str[]){
  long long key, i, h;
  key = getKey(str);
  for(i = 0;; i++){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key, i, h;
  key = getKey(str);
  for(i = 0;;i++){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0) return 1;
    else if(strlen(H[h]) == 0){
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}

int main(){
  int i, n, h;
  char str[L], com[9];
  for(i = 0; i < M; i++) H[i][0] = '\0';
  cin >> n;
  for(i = 0; i < n; i++){
    scanf("%s %s", com, str);

    if(com[0] == 'i'){
      insert(str);
    } else {
      if(find(str)){
        cout << "yes" << endl;
      } else {
        cout << "no" << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 15504
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define FORD(i,a,b) for(ll i=a;i>=b;i--)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define sqr(x)  ((x) * (x)) 
#define cub(x)  ((x) * (x) * (x))
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; }
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
// ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

// 選択ソートは離れた場所をswapするため、安定ではない
int selectionSort(int a[], int n){
  int cnt = 0;
  FOR(i,0,n-1){
    int minj = i;
    FOR(j,i,n-1){
      if(a[j]<a[minj]) minj = j;
    }
    if(i!=minj) ++cnt;
    swap(a[i],a[minj]);
  }
  return cnt;
}

int main(){
  int n; cin >> n;
  int a[n];
  FOR(i,0,n-1) cin >> a[i];
  int ans = selectionSort(a,n);

  FOR(k,0,n-1) {
    if(k!=n-1) cout << a[k] << " ";
    else cout << a[k];
  }
  cout << endl;
  cout << ans << endl;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> num(N, 1);
    vector<bool> check(N, false);
    if (N == 1 && M == 0) {
        cout << 0 << endl;
        return 0;
    }
    rep(i, M) {
        int s, c;
        cin >> s >> c;
        s--;
        if (check[s] && num[s] != c) {
            cout << -1 << endl;
            return 0;
        } else {
            num[s] = c;
        }
        check[s] = true;
    }

    if (N >= 2 && num[0] == 0) {
        cout << -1 << endl;
    } else {
        rep(i, N) {
            if (!check[i] && i != 0) cout << 0;
            else cout << num[i];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
import math
import itertools

n,d = map(int,input().split())
x_list = [list(map(int,input().split())) for i in range(n)]

def integer(x1,x2):
    count = 0
    for i in range(d):
        count += (x1[i]-x2[i])**2
    if math.sqrt(count).is_integer():
        return 1
    else:
        return 0

count = 0
for lists in itertools.combinations(x_list,2):
    count += integer(lists[0],lists[1])

print(count)

Measured memory_bytes: 3064
MOD = 10 ** 9 + 7

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

ans = 0
total = pow(2, n, MOD)


def comb(n, k):
    bunshi = 1
    bunbo = 1
    for i in range(k):
        bunshi *= n - i
        bunbo *= i+1
        bunshi %= MOD
        bunbo %= MOD
    return (bunshi * pow(bunbo, MOD-2, MOD)) % MOD


ans = total - (comb(n, a) + comb(n, b)) - 1
print(ans % MOD)


Measured memory_bytes: 39280
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}
Int tmpi = 0;
double tmpd = 0.0;


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

    double w, h, x, y;
    cin >> w >> h >> x >> y;

    int ans = x==w/2.0 && y==h/2.0;
    printf("%.10lf %d", w*h/2, ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>
using namespace std;
 
long long mod = 1000000007;
 
int main() {
    int n;
    cin >> n;
    long long a[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
 
    long long sum = 0;
    long long acc = 0;
    for (int i = 0; i < n; ++i) {
        sum = (sum + (a[i] * acc)) % mod;
        /* acc += (a[i] % mod); */
        acc = (acc + a[i]) % mod;
    }
    cout << sum % mod << "\n";
    return 0;
}


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

typedef long long ll;
typedef double d;

#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (abs(a*b)/gcd(a,b))
#define sqr(a) (a*a)

#define tt int t; cin>>t; while(t--)
#define lo(i, a, b) for(int i=a; i<b; i++)
#define rlo(i, a) for(int i=a; i>0; i--)
#define be(a) a.begin(),a.end()
#define sz(x) x.size()
#define nl cout<<"\n";
#define sp cout<<" ";

#define op() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

int main()
{
    op();
    int a[4],f=0,s=0;
    cin>>a[0]>>a[1]>>a[2];
    lo(i,0,3)
    {
        if(a[i]==5)
            f++;
        if(a[i]==7)
            s++;
    }
    if(f==2&&s==1)
        cout<<"YES";
    else
        cout<<"NO";
    nl;
    return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int dp[110][4];

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

	int N;

	cin >> N;

	rep(i, 0, 4)dp[0][i] = 1;
	rep(i, 1, N)
	{
		int t = 0;
		rep(j, 0, 4)
		{
			t += dp[i - 1][j];
			t %= MOD;
		}
		rep(j, 0, 4)
		{
			dp[i][j] = t;
		}
		if (2 <= i)
		{
			dp[i][1] = (dp[i][1] + MOD - (dp[i - 2][0] + dp[i - 2][2])) % MOD;
			dp[i][2] = (dp[i][2] + MOD - dp[i - 2][0]) % MOD;
			if (3 <= i)
			{
				dp[i][2] += dp[i - 3][2];
				dp[i][2] %= MOD;
			}
		}
		if (3 <= i)
		{
			dp[i][1] = (dp[i][1] + MOD - (dp[i - 3][0] * 3));
		}
	}

	int ans = 0;
	rep(i, 0, 4)
	{
		ans += dp[N - 1][i];
	}

	cout << ans % MOD << endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;
int ans = 0;
int N;
void dfs(long long x, int a, int b, int c)
{
    if (x > N)
    {
        return;
    }
    if (a && b && c)
    {
        ans++;
    }
    dfs(x * 10 + 7, a + 1, b, c);
    dfs(x * 10 + 5, a, b + 1, c);
    dfs(x * 10 + 3, a, b, c + 1);
}

int main(void)
{
    cin >> N;
    dfs(0, 0, 0, 0);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a.sort()
b.sort()

for i in range(x+1,y+1):
    if a[n-1]<i<=b[0]:
        print('No War')
        break
else:
    print('War')

Measured memory_bytes: 3060
S = input()
ans = [0 for i in range(len(S) + 1)]

for i in range(len(S)):
    if "<" == S[i]:
        ans[i + 1] = ans[i] + 1

for i in range(len(S) - 1, -1, -1):
    if ">" == S[i]:
        ans[i] = max(ans[i], ans[i + 1] + 1)

print(sum(ans))


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

int main() {
    int n,t;
    cin >> n >> t;
    int minc = 2000;
    for (int i = 0; i < n; i++) {
        int ci,ti;
        cin >> ci >> ti;
        if (t >= ti) {
            minc = min(minc, ci);
        }
    }
    if (minc == 2000) cout << "TLE" << endl;
    else cout << minc << endl;
}

Measured memory_bytes: 256
def solve(N, Ps):
    ans = 0
    for i in range(1, N):
        if Ps[i - 1] == i and Ps[i] == i + 1:
            Ps[i - 1] = i + 1
            Ps[i] = i
            ans += 1
    ans += sum(1 for i in range(N) if Ps[i] == i + 1)
    return ans

if __name__ == "__main__":
    N = int(input())
    Ps = list(map(int, input().split(" ")))
    print(solve(N, Ps))


Measured memory_bytes: 14008
// 約数の数

#include <iostream>
using namespace std;

int main()
{
    int a, b, c;
    int count = 0;

    cin >> a >> b >> c;
    for (int i = a; i <= b; i++) {
        if (!(c % i))
            count++;
    }
    cout << count << '\n';
    return 0;
}


Measured memory_bytes: 3092
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define RALL(qpqpq)           (qpqpq).rbegin(),(qpqpq).rend()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define RFOR(i,tptpt,ypypy)  for(LL i=(tptpt);i>=(ypypy);i--)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int d, n;

int main() {
	cin >> d >> n;
	if (n == 100)n++;
	if (d == 0) {
		cout << n << endl;
	}
	if (d == 1) {
		cout << 100 * n << endl;
	}
	if (d == 2) {
		cout << 10000 * n << endl;
	}
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] a = sc.next().toCharArray();
        char[] b = sc.next().toCharArray();
        String ans = "";
        for(int i = 0; i < n; i++){
            ans += a[i];
            ans += b[i];
        }
        System.out.println(ans);
    }
}



Measured memory_bytes: 21844
using System;
using System.Collections.Generic;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var q = int.Parse(Console.ReadLine());
            var qList = new List<KeyValuePair<int, int>>(q);
            var minL = 100000;
            var maxR = 0;
            for (int i = 0; i < q; ++i)
            {
                var lr = Console.ReadLine().Split(' ');
                var l = int.Parse(lr[0]);
                var r = int.Parse(lr[1]);
                minL = l < minL ? l : minL;
                maxR = r > maxR ? r : maxR;
                qList.Add(new KeyValuePair<int, int>(l, r));
            }

            var likeList = CreateLike2017List(minL, maxR);
            var sumList = CreateSumList(likeList);

            foreach (var query in qList)
            {
                Console.WriteLine(sumList[query.Value - minL + 1] - sumList[query.Key - minL]);
            }
        }

        static List<int> CreateLike2017List(int min, int max)
        {
            var list = new List<int>(max - min + 1);
            for (var i = min; i <= max; ++i)
            {
                list.Add(Like2017(i));
            }
            return list;
        }

        static List<int> CreateSumList(List<int> src)
        {
            var total = 0;
            var sumList = new List<int>(src.Count + 1);
            sumList.Add(0);
            foreach (var value in src)
            {
                total += value;
                sumList.Add(total);
            }
            return sumList;
        }

        static int Like2017(int n)
        {
            return IsPrime(n) && IsPrime((n + 1) / 2) ? 1 : 0;
        }

        static bool IsPrime(int n)
        {
            if (n == 1)
            {
                return false;
            }
            if (n == 2)
            {
                return true;
            }
            if (n % 2 == 0)
            {
                return false;
            }
            int i = 3;
            while (i * i <= n)
            {
                if (n % i == 0)
                {
                    return false;
                }
                i = i + 2;
            }
            return true;
        }
    }
}


Measured memory_bytes: 19016
program xor_world
  implicit none
  integer(8) :: a, b
  read(*,*) a, b
  write(*,'(i0)') f(a,b)
contains
  recursive function f(a,b) result(y)
    implicit none
    integer(8), intent(in) :: a, b
    integer(8)             :: y
    if (a.ne.0_8) then
      y = xor(f(0_8,a-1),f(0_8,b))
      return
    end if
    if (mod(b,2_8).eq.1) then
      y = mod((b+1_8)/2_8,2_8)
    else
      y = xor(mod(b/2_8,2_8),b)
    end if
    return
  end function f
end program xor_world

Measured memory_bytes: 256