akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define setDP(arr) memset(arr,-1,sizeof arr)
#define Clear(arr) memset(arr,0,sizeof arr)
#define oo 2000000000
#define inf 1000000000000000000
#define P1 31
#define P2 37
#define M  1000000007
#define M2 1000000009
#define pii pair<ll,ll>
typedef long long ll;
using namespace std;
const int N = 355001;
const int SQRTN = 320;
const int LOGN = 20;
const long double PI = acos(-1);
const long double TAU = 2*PI;


ll n , m , x;
string s,t;

map<int,char> aa;

signed main(){
    cin >> n >> m >> s >> t;
    x = n*m;
    int v1,v2;
    v1=x/n;
    v2=x/m;
    for(int i = 0 ; i < n ; i++){
        aa[1+(i*v1)]=s[i];
    }
    for(int i = 0 ; i < m ; i++){
        if(aa.find(1+(i*v2))==aa.end())continue;
        if(aa[1+(i*v2)]==t[i])continue;
        return puts("-1"),0;
    }
    x = n/__gcd(n,m);
    x*=m;
    cout << x << endl;



}


Measured memory_bytes: 4736
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace kyoupuro
{
    class MainClass
    {
        public static void Main()
        {
            MainClass mainClass = new MainClass();
            mainClass.Start();
        }

        void Start() {
            var something = Console.ReadLine().Split(' ');
            var a = something.Select(int.Parse).ToArray();

            Console.WriteLine(Math.Min(a[1] / a[0], a[2]));
        }
    }
}


Measured memory_bytes: 13396
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

vector<int> uf, usz;
int nc;

void init(int n){
  vector<int> uf_(n);
  vector<int> usz_(n, 1);
  uf = uf_;
  usz = usz_;
  nc = n;

  for(int i = 0; i < uf.size(); i++){
    uf[i] = i;
  }
}

int find(int a){
  return (uf[a] == a) ? a : uf[a] = find(uf[a]);
}

void union_(int a, int b){
  a = find(a);
  b = find(b);

  if(a != b){
    if(usz[a] >= usz[b]){
      swap(a, b);
    }
    uf[a] = b;
    usz[b] += usz[a];
    nc--;
  }
}

int check(int a, int b){
  return (find(a) == find(b)) ? 1 : 0;
}

int get_size(int a){
  return usz[find(a)];
}

int main(){
	vector<ll> ans;
	ll n,m;
 	cin>>n>>m;
 	init(n);
	vector<pair<ll,ll> > v;
	rep(i,0,m){
		ll a,b;
		cin>>a>>b;
		a--;b--;
		v.pb(mp(a,b));
	}
	ll total = n*(n-1)/2;
	reverse(all(v));
	rep(i,0,v.sz){
		ans.pb(total);
		ll a = v[i].fi;
		ll b = v[i].se;
		if(find(a)!=find(b)){
			total-=get_size(a)*get_size(b);
			union_(a,b);
		}
	}
	reverse(all(ans));
	rep(i,0,ans.sz){
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 5480
N = int(input())
a = [int(input()) - 1 for i in range(N)]
c,s = 1, a[0]

while s != 2 and c < N:
    c = c + 1
    s = a[s-1]

now = 0
c = 0

while True:
    if now == 1:
        print(c)
        break
    if c >= N:
        print("-1")
        break
    c += 1
    now = a[now]


Measured memory_bytes: 49624
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
typedef long long ll;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

using cake = pair<ll,vector<ll>>;

int main(){
    int x,y,z,k;
    cin >> x >> y >> z >> k;
    vector<ll> a(x),b(y),c(z);
    rep(i,x)cin >> a[i];
    rep(i,y)cin >> b[i];
    rep(i,z)cin >> c[i];

    
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    sort(c.begin(),c.end());
    reverse(c.begin(),c.end());

    priority_queue<cake> que;
    set<cake> se;

    que.push(cake(a[0]+b[0]+c[0],vector<ll>{0,0,0}));
    se.insert(cake(a[0]+b[0]+c[0],vector<ll>{0,0,0}));
    
    rep(i,k){
        cout << que.top().first << endl;
        ll anum = que.top().second[0];
        ll bnum = que.top().second[1];
        ll cnum = que.top().second[2]; 
        que.pop();
        if(anum+1<x){
            cake c1 = cake(a[anum+1]+b[bnum]+c[cnum],vector<ll>{anum+1,bnum,cnum});
            if(!se.count(c1)){se.insert(c1);que.push(c1);}
        }
        if(bnum+1<y){
            cake c2 = cake(a[anum]+b[bnum+1]+c[cnum],vector<ll>{anum,bnum+1,cnum});
            if(!se.count(c2)){se.insert(c2);que.push(c2);}
        }
        if(cnum+1<z){
            cake c3 = cake(a[anum]+b[bnum]+c[cnum+1],vector<ll>{anum,bnum,cnum+1});
            if(!se.count(c3)){se.insert(c3);que.push(c3);}
        }
    }
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

int main()
{
    int A, B;
    cin >> A >> B;
    if(A<10&&B<10) cout << A*B << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PI 3.141592653589793238462
using namespace std;
typedef long long ll;
typedef long double db;
ll a[200005],b[200005],p[200005];
int main(){
    ll n;cin>>n;
    for(ll i=1;i<=n;i++){
        cin>>a[i];p[a[i]]++;
    }
    for(ll i=1;i<=n;i++){
        cin>>b[i];p[b[i]]++;
    }
    for(int i=1;i<=n;i++){
        if(p[i]>n){cout<<"No"<<endl;return 0;}
    }
    cout<<"Yes"<<endl;
    reverse(b+1,b+1+n);
    for(int i=1;i<=n;i++){
        if(a[i]==b[i]){
            for(int j=1;j<=n;j++){
                if(b[j]!=a[i]&&b[i]!=a[j]){
                    swap(b[i],b[j]);break;
                }
            }
        }
    }
    for(int i=1;i<=n;i++){
        cout<<b[i]<<" ";
    }cout<<endl;
} 

Measured memory_bytes: 8292
S = input()

ans = 0
lists = [0 for i in range(2019)]
lists[0] += 1

num = 0
for i in range(len(S) - 1, -1, -1):
    num += pow(10, len(S) - 1 - i, 2019) * int(S[i])
    lists[num % 2019] += 1

for i in range(2019):
    if lists[i] >= 2:
        ans += (lists[i] * (lists[i] - 1)) // 2

print(ans)


Measured memory_bytes: 9340
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 101010101000;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
//最大公約数
ll gcd(ll x, ll y){
  if(x%y==0){
    return y;
  }else{
    return(gcd(y,x%y));
  }
}
//最小公倍数
ll lcm(ll x, ll y){
  return x*y/gcd(x,y);
}


int main(){
  ll a,b;
  cin>>a>>b;
  cout << lcm(a,b);
}


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

int main() {
 int x,a,b;
  cin>>x>>a>>b;
  int A=abs(a-x);
  int B=abs(b-x);
  if(A>B) cout<<'B'<<endl;
  else cout<<'A'<<endl;
}
    

Measured memory_bytes: 256
n = int(input())
x = list(map(int,input().split()))
x.sort()
ans = 9999999999999999
for p in range(x[0],x[n-1]+1):
    tmp = 0
    for j in range(n):
        tmp += (x[j] - p) ** 2
    ans = min(tmp,ans)
print(ans)


Measured memory_bytes: 9040
/*Saurav Paul*/
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define loop(i,a,b)           for(ll i=a;i<=b;++i)
#define boost		          ios_base::sync_with_stdio(0);
#define eb                    emplace_back
#define mp                    make_pair
#define clr(x)                x.clear()
#define MOD                   1e9+7
#define itoc(c)               ((char)(((int)'0')+c))
#define ctoi(c)               ((int)(((int)c)-'0'))
#define all(p)                p.begin(),p.end()
#define iscn(num)             scanf("%d",&num);
#define scn(num)              scanf("%lld",&num);
#define scn2(num,num2)        scanf("%lld%lld",&num,&num2);

using namespace std;
///////////////////////

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef PAUL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define dbg(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#ifdef ONLINE_JUDGE
#define cerr if (false) cerr
#endif

////////////////////////

template<typename T>T set_bit(T N,T pos){return N=N | (1<<pos);}
template<typename T>T reset_bit(T N,T pos){return N= N & ~(1<<pos);}
template<typename T> bool check_bit(T N,T pos){return (bool)(N & (1<<pos));}
template<typename T>void bin_print(T N){bitset<25>bit(N);cerr<<bit.to_string()<<"\n";}
template<typename T> void max_self(T &a, T b){
	a=max(a,b);
}
template <typename T > void min_self(T &a, T b){
	a=min(a,b);
}
template <typename T > void add_self(T &a, T b){
	a+=b;
}
////////////////////////

template<typename T> void ara_read(T &v,ll n){
	int temp;
	for(ll i=0; i< n; i++){
		scanf("%d",&temp);
		v.emplace_back(temp);
	}
}
template<typename T> void ara_print(T &v){
	for(ll x : v)
		printf("%lld ",x);
	puts("");
}
////////////////////////
const int INF = 1e9 + 99;
typedef pair<int,int> Pair;
typedef vector<int> vec;;


int main()
{
	int n;
	scanf("%d",&n);
	vector <int > v;
	ara_read(v,n);
	sort(all(v));
	
	int ans = v[n/2]-v[(n/2)-1];
	printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define ll long long
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};

int main(){
  string S;
  cin>>S;
  vector<ll> a(S.size()+1,0);
  for(ll i=0;i<S.size();i++){
    if(S[i]=='<'){
      a[i+1]=max(a[i+1],a[i]+1);
    }
  }
  for(ll i=S.size()-1;i>=0;i--){
    if(S[i]=='>'){
      a[i]=max(a[i],a[i+1]+1);
    }
  }
  ll sum=0;
  for(ll i=0;i<a.size();i++) sum+=a[i];
  cout<<sum<<endl;
}


Measured memory_bytes: 4740
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)			 	 cerr<<#x<<": "<<x<<endl
#define trace2(x, y)		 	 cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		 	 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	 	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin >> n;
	ll c[n],v[n];
	rep(i,0,n){
		cin >> v[i];
	}
	rep(i,0,n){
		cin >> c[i];
	}
	ll ans=0;
	rep(i,0,n){
		if(v[i]>=c[i]){
			ans+=v[i]-c[i];
		}
	}
	cout << ans;
	return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] a = new int[M];
    int[] b = new int[M];
    for (int i = 0; i < M; i++) {
      a[i] = sc.nextInt();
      b[i] = sc.nextInt();
    }
    boolean[] path1 = new boolean[N + 1]; // 1->midに行けるかどうか
    boolean[] path2 = new boolean[N + 1]; // mid->Nに行けるかどうか
    Arrays.fill(path1, false);
    Arrays.fill(path2, false);
    for (int i = 0; i < M; i++) {
      if (a[i] == 1) {
        path1[b[i]] = true;
      }
      if (b[i] == N) {
        path2[a[i]] = true;
      }
    }
    for (int i = 1; i <= N; i++) {
      if (path1[i] && path2[i]) {
        System.out.println("POSSIBLE");
        return;
      }
    }
    System.out.println("IMPOSSIBLE");
  }
}

Measured memory_bytes: 96608
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cctype>
#include <cstdio>
#include <math.h>
using f32 = float;
using f64 = double;
using f80 = __float80;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<LL>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
#define REP(i, n) for (LL i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
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 n,a,b,c,d,e,f,x,y,z;
string  s;
int main()
{
    char s;
    cin >> s;
 if (isupper(s))
   {
       cout << "A" << endl;
   }
   else
   {
       cout << "a" << endl;
   }
  

}

Measured memory_bytes: 3632
#!/usr/bin/env python3
#ABC137 C

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def comb(n,r):
    return math.factorial(n)//math.factorial(n-r)//math.factorial(r)
n = I()
s = [input() for _ in range(n)]
x = [list(Counter(s[i]).items()) for i in range(n)]
for i in x:
    i.sort()

y = [tuple(i) for i in x]
f = defaultdict(lambda : 0)
for i in range(n):
    f[y[i]] += 1
ans = 0
for i in f.values():
    if i < 2:
        continue
    ans += comb(i,2)
print(ans)


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

using namespace std;

typedef long long ll;

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

    int cnt = 0;
    for (char i = '0'; i <= '9'; i++) {
        size_t pi = S.find(i);
        if (pi == string::npos) { continue; }

        for (char j = '0'; j <= '9'; j++) {
            size_t pj = S.find(j, pi+1);
            if (pj == string::npos) { continue; }

            for (char k = '0'; k <= '9'; k++) {
                size_t pk = S.find(k, pj+1);
                if (pk == string::npos) { continue; }

                cnt++;
            }
        }
    }

    cout << cnt << endl;

    /*
    int cnt = 0;
    for (int i = 0; i < 1000; i++) {
        int c[3] = { i / 100, (i % 100) / 10, i % 10};
        int p = 0;
        for (int j = 0; j < N; j++) {
            if (S[j] == ('0' + c[p])) {
                p++;
            }
            if (p == 3) {
                cnt++;
                break;
            }
        }
    }

    cout << cnt << endl;
    */
/*
    map<string, bool> A1, A2, A3;
    A1[S.substr(N-1, 1)] = true;
    A1[S.substr(N-2, 1)] = true;
    A2[S.substr(N-2)] = true;
    for (int i = N - 3; i >= 0; i--) {
        for (auto const& e : A2) {
            string s = S.substr(i, 1);
            s += e.first;
            A3[s] = true;
        }

        for (auto const& e : A1) {
            string s = S.substr(i, 1);
            s += e.first;
            A2[s] = true;
        }

        A1[S.substr(i, 1)] = true;
    }
    
    cout << A3.size() << endl;
*/    
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#include <atcoder/all> 
#define endl "\n"
using namespace std;
using namespace atcoder;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる


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

  int n,q;
  cin>>n>>q;

  fenwick_tree<ll> f(n);

  rep(i,n){
    ll x;
    cin>>x;
    f.add(i,x);
  }

  rep(i,q){
    int a,b,c;
    cin>>a>>b>>c;
    if(a==0) f.add(b,c);
    else cout << f.sum(b,c) << endl;
  }

}


Measured memory_bytes: 8256
#include <iostream>
#include <string>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#define N 100
using namespace std;

typedef struct{
	int parent;
	int right;
	int left;
} Node;
Node node[N];
int d[N],h[N],deg[N];

int hig(int);
int dep(int);
int sib(int);
void swap(int *,int *);

int main(){
	int n,id,l,r;
	cin>>n;
	for(int i=0;i<n;i++){
		node[i].parent=-1; //???????´¢??¨
		d[i]=-1;
		deg[i]=0;
		h[i]=-1;
	}
	for(int i=0;i<n;i++){
		cin>>id>>l>>r;
		node[id].left=l;
		if(l!=-1) deg[id]++;
		node[id].right=r;
		if(r!=-1) deg[id]++;
		node[l].parent=id;
		node[r].parent=id;
	}
	for(int i=0;i<n;i++){
		if(node[i].parent==-1){
			d[i]=0;
			dep(i);
		}
		if(deg[i]==0){ //leaf??????
			h[i]=0;
			hig(i); //??¬???
		}
	}

	for(int i=0;i<n;i++){
		if(node[i].parent==-1) printf("node %d: parent = -1, sibling = -1, degree = %d, depth = 0, height = %d, root\n",i,deg[i],h[i]);
		else{
			printf("node %d: parent = %d, sibling = %d, ",i,node[i].parent,sib(i));
			printf("degree = %d, depth = %d, height = %d, ",deg[i],d[i],h[i]);
			if(h[i]==0) printf("leaf\n");
			else printf("internal node\n");
			// ???????????????
		}
	}
	return 0;
}

int dep(int id){
	int l=node[id].left;
	int r=node[id].right;
	if(l!=-1){
			d[l]=d[id]+1; //???????????????????¶????
			dep(l);
	}
	if(r!=-1){
		d[r]=d[id]+1;
		dep(r);
	}
	return 0;
}

int hig(int i){
	int n=node[i].parent;
	if(n!=-1 && (h[n]<h[i]+1)){
		h[n]=h[i]+1;
		hig(n);
	}
	return 0;
}

int sib(int i){
	int n=node[i].parent;
	if(node[n].left==i) return node[n].right;
	else return node[n].left;
}
void swap(int *a,int *b){
	int w=*a;
	*a=*b;
	*b=w;
}

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

using namespace std;

template<typename T> void drop(const T &x){cout<<x<<'\n';exit(0);}

void solve() {
  string s;
  cin >> s;
  int n = (int)s.size();
  long long ans = 0;
  for(int bit = 0; bit < (1<<(n-1)); ++bit) {
    long long num = s[0] - '0';
    for(int i = 0; i < n-1; ++i) {
      if(bit & (1<<i)) {
        ans += num;
        num = 0;
      }
      num = num * 10 + (s[i+1] - '0');
    }
    ans += num;
  }
  cout << ans << '\n';
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tt=1;
  //cin >> tt;
  while(tt--) solve();

  return 0;
}


Measured memory_bytes: 3568
val = list(map(int, input().split()))
N = int(input())
price = [v / (2 ** i)  for i, v in enumerate(val)]
sortedIndex = []
sortedPrice = sorted(price)
price2 = price.copy()
for p in sortedPrice:
    sortedIndex.append(price2.index(p))
    price2[price2.index(p)] = -1

temp = 0
ans = 0
for i in sortedIndex:
    size  = (0.25 * (2 ** i))
    times = int(N / size)
    # print (size, times)
    N -= size * times
    ans += val[i] * times
# for i in sortedIndex:
#     while N > temp:
#         if(N < temp + 0.25 * (2 ** i)):
#             break
#         temp += 0.25 * (2 ** i)
#         ans += val[i]

print (ans)


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

int main() {
  string S;
  cin >> S;
int A,B,C,D;
  A=S.at(0);
  B=S.at(1);
  C=S.at(2);
  D=S.at(3);
  if (A==B||B==C||C==D) {
    cout << "Bad" << endl;
  }
  else {
  cout << "Good" << endl;
}
}


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

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

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// now += mint(2).pow(s) - 1; こんな感じで、2のs乗を求められrう
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
int main()
{
	
	COMinit();
	ll n, m, k;
	cin >> n >> m >> k;

	mint ans = 0;
	
	for(int x = 1; x <= (n-1); x++){
		mint tmp = x * m * m * (n - x);
		ans += tmp;
	}
	for(int y = 1; y <= (m-1); y++){
		mint tmp = y * n * n * (m - y);
		ans += tmp;
	}
	ans *= COM(n*m-2,k-2);
	cout << ans << endl;
}


Measured memory_bytes: 15576
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		
		String[] s = S.split("");
		int check = 0;
		
		for(int i = 0; i < s.length; i++) {
			int count = 0;
			for(int j = i; j < s.length; j++) {
				if(s[i].equals(s[j])) {
					count++;
				}
			}
			if(count >= 2) {
				System.out.println("no");
				check++;
				break;
			}
		}
		if(check == 0) {
			System.out.println("yes");
		}
	}
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)

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

int main(){

	ll n, k;cin >> n >> k;
	vector<P> v;
	REP(i, n){
		ll a , b;cin >> a >> b;
		v.EB(b, a);
	}

	sort(ALL(v), greater<P>());

	set<int> s;
	priority_queue<ll,vector<ll>, greater<ll>> pq;

	ll ans = 0;
	ll now = 0;
	REP(i, n){
		if(i < k){
			if(s.count(v[i].SE)){
				pq.push(v[i].FI);
			}
			s.insert(v[i].SE);
			now += v[i].FI;
		}
		else{
			if(s.count(v[i].SE) || pq.empty())continue;
			ll tmp = pq.top();pq.pop();
			now -= tmp;
			now += v[i].FI;
			s.insert(v[i].SE);
		}

		ll sz = s.size();
		ans = max(ans, now + sz * sz);
	}

	cout << ans << endl;

	return 0;
}


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

int gcd(int a,int b){
    if(a%b==0){
        return b;
    }else{
        return(gcd(b,a%b));
    }
}

int main(){
    int k;
    long long int ans = 0;
    cin >> k;
    for(int i = 1;i < k+1;i++){
        for(int j=1;j<k+1;j++){
            for(int l=1;l<k+1;l++){
              int note = gcd(gcd(i,j),l);
              ans += note;
            }
        }
    }

    cout << ans << endl;


}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#define readInt(x) scanf("%d", &x)
#define readStr(x) scanf("%s", x)
#define rep(i, n) for(int i=0; i<(n); ++i)
#define write(x) cout << (x) << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1 << 28;
const int MAX = 1e5 + 10;

int c[3][3];

int main()
{
    rep(i, 3) {
        rep(j, 3)
            cin >> c[i][j];
    }

    for (int j = 1; j < 3; j++) {
        int c0jrel = c[0][j] - c[0][0];
        for (int i = 1; i < 3; i++) {
            if (c[i][j] - c[i][0] != c0jrel) {
                write("No");
                return 0;
            }
        }
    }
    write("Yes");
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main(void){

	int a,b,c;
	int d;

	scanf("%d %d %d",&a,&b,&c);

	d = a-b;

	if( d < c){
		printf("%d\n",c-d);
	}else{
		printf("0\n");
	}


	return 0;
}

Measured memory_bytes: 128
#[allow(unused_imports)]
use std::cmp;

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: char = sc.read();
    if n.is_ascii_lowercase() {
        println!("a");
    } else {
        println!("A");
    }
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


Measured memory_bytes: 2188
#include <bits/stdc++.h>
#define MP make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
//#define Local
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int N = 2e5 + 5;

int n;
int a[N];
ll sum[N];

ll Get(int l, int r, int m) {
    return abs(sum[r] - sum[m] - sum[m] + sum[l - 1]);
}

void run() {
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        sum[i] = sum[i - 1] + a[i];
    }
    int j = 1, k = 3;
    ll ans = 1e18;
    for(int i = 2; i <= n - 1; i++) {
        while(j < i - 1 && Get(1, i, j) > Get(1, i, j + 1)) ++j;
        while(k < n - 1 && Get(i + 1, n, k) > Get(i + 1, n, k + 1)) ++k;
        ll mx = max(sum[i] - sum[j], max(sum[j], max(sum[n] - sum[k], sum[k] - sum[i])));
        ll mn = min(sum[i] - sum[j], min(sum[j], min(sum[n] - sum[k], sum[k] - sum[i])));
//        cout << j << ' ' << i << ' ' << k << '\n';
        ans = min(ans, mx - mn);
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
#ifdef Local
    freopen("../input.in", "r", stdin);
    freopen("../output.out", "w", stdout);
#endif
    while(cin >> n) run();
    return 0;
}


Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            Solve();
        }
        private const int MOD = 1000000007;

        static void Solve()
        {
            var nw = ReadAndParseIntArr();
            int n = nw[0];
            int w = nw[1];
            var ws = new int[n];
            var vs = new int[n];
            int vmax = 0;
            for (int i = 0; i < n; ++i)
            {
                var wv = ReadAndParseIntArr();
                ws[i] = wv[0];
                vs[i] = wv[1];
                vmax = Math.Max(vmax, vs[i]);
            }

            var dp = new long[n + 1, vmax * n + 1];
            for (int val = 1; val < dp.GetLength(1); ++val)
            {
                dp[0, val] = int.MaxValue;
            }
            for (int i = 0; i < n; ++i)
            {
                for (int val = 0; val < dp.GetLength(1); ++val)
                {
                    if (val - vs[i] >= 0)
                    {
                        dp[i + 1, val] = Math.Min(dp[i, val - vs[i]] + ws[i], dp[i, val]);

                    }
                    else
                    {
                        dp[i + 1, val] = dp[i, val];
                    }
                }
            }

            long ans = 0;
            for (int val = 0; val < dp.GetLength(1); ++val)
            {
                if (dp[n, val] <= w)
                {
                    ans = Math.Max(ans, val);
                }
            }
            Console.WriteLine(ans);
        }
        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 89824
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define print(A,n) for(ll i=0;i<n;++i)cout<<A[i]<<' ';cout<<endl;
#define take(A,n) for(ll i=0;i<n;++i)cin>>A[i];
//    for(auto& it : m)
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
//  priority_queue<ll int> pq;
//  priority_queue <ll int, vector<ll int>, greater<ll int> > pq;
//  vector<ll int> v;
//  vector< pair<ll int,ll int> > v;
//  set<ll int>::iterator it=s.begin();
//  unordered_map<  pair<ll int,ll int>, ll int> mp;

ll int power(ll int x, ll int y, ll int p)  
{  
   ll int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
int n,m;
bool isval(int x,int y)
{
  if(x<0||x>n-1||y<0||y>m-1)
    return false;
  return true;
}

int main()
{
  fastio();
ll int T;
T=1;


while(T--)
{
ll int n,k,ans,i,st,cnt;
cin>>n>>k;ll int a[n+1],vis[n+1]={0};
for(i=1;i<=n;i++)
cin>>a[i];

for(i=0;i<=n;i++)
  vis[i]=-1;
vis[1]=0;
st=a[1];

cnt=1;
while(vis[st]==-1)
{
    
     vis[st]=cnt;  
  st=a[st];
  cnt++;
 

}

ll int len =cnt-vis[st];

if(k<=vis[st])

{st=1;
 while(k--)
  {
    st=a[st];
    ans=st;
  }
  cout<<ans<<endl;
}
else
{
  
  k-=vis[st];

  k%=len;


ans=st;
  while(k--)
  {
    st=a[st];
    ans=st;

  }
  cout<<ans<<endl;

}


}
    return 0;
}

Measured memory_bytes: 6780
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

using P = pair<int, int>;
int main() {
    int N;
    cin >> N;
    vector<int> s(N);
    int a = INF;
    for (int i = 0; i < N; i++) {
        cin >> s.at(i);
        if (s[i] % 10 != 0) {
            chmin(a, s[i]);
        }
    }
    int sum = accumulate(ALL(s), 0);
    if (sum % 10 == 0) {
        cout << max(sum - a, 0) << endl;
    } else {
        cout << sum << endl;
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

int main(){

    string s, t;
    cin >> s >> t;
    cout << t << s << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, R = list(map(int, read().split()))

if N >= 10:
    print(R)
else:
    print(R + 100 * (10 - N))


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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

int main() {
  vector<ll> a = {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};
  ll k;
  cin >> k;

  cout << a[k-1] << endl;

  return 0;
}

Measured memory_bytes: 256
/**
 *    author:  yoseph
 *    created: 12.07.2020 11:56:52      
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; ++i) {
		cin >> v[i];
	}
	int cnt = 0;
	for (int i = 0; i < n; i+=2) {
		if (v[i]&1) ++cnt;
	}
	cout << cnt << "\n";
	return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;
int main()

{
    ll x;
    cin >> x;
    ll y = 100LL;
    int ans = 0;
    while(y < x)
    {
        y = y * 1.01;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3164
import java.util.*

/**
 * Created on 2019/03/03.
 */



fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.next().toInt()
    val b = sc.next().toInt()
    val c = sc.next().toInt()
    val list = listOf(a, b, c).sorted()
    if (list[0] == list[2]) println("Yes") else println("No")
}


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

int main()
{
    ll N;
    cin >> N;
    ll a = 0, b = 0;
    for (ll i = 1; i <= N; i++) {
        ll x, y;
        cin >> x >> y;
        if (i == 1) a = x, b = y;

        else {
            if (x >= a && y >= b) a = x, b = y;
            else {
                ll px = a / x;
                if (a % x) px++;

                ll py = b / y;
                if (b % y) py++;

                a = x * max(px, py);
                b = y * max(px, py);
            }
        }
    }

    cout << a + b << "\n";
}


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
	c_p_c();
	int n;
	cin >> n;
	map<int, int> cnt;
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		ans += cnt[i - x];
		cnt[i + x]++;
	}
	cout << ans;




	return 0;
}
//just a comment


Measured memory_bytes: 26360
solve a b c
  | cond1 = 0
  | cond2 = -1
  | otherwise = 1 + solve a' b' c'
    where
      cond1 = ((mod a 2) + (mod b 2) + (mod c 2)) > 0
      cond2 = (a==b) && (b==c) && (c==a)
      da = div a 2
      db = div b 2
      dc = div c 2
      a' = db+dc
      b' = da+dc
      c' = da+db

main = do
  [a,b,c] <- map read . words <$> getLine :: IO [Int]
  print $ solve a b c


Measured memory_bytes: 508
#include<bits/stdc++.h>
#include<string>
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define ll long long
#define mod (ll)(1e9+7)
#define nax (ll)(1e5)
#define INFL LLONG_MAX
#define NINFL LLONG_MIN
#define INF INT_MAX
#define disp(a,n,arr) for(int i=a;i<(ll)n;i++) cout << arr[i] << " "; cout << "\n";
#define check cout << "Working\n";
#define pi pair<int,int>
#define pl pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vpl vector<pl>
#define vpi vector<pi>
#define vb vector<bool>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(a) a.begin(),a.end()
using namespace std;


int main() {
	FIO;
	int t = 1;
	//cin >> t;
	while (t--) {
		ll n,k;
		cin >> n >> k;
		long double ans = 0;
		ll two[26];
		two[0] = 1;
		for(int i=1;i<=25;i++){
			two[i] = two[i-1]*2;
		}
		for(int i=1;i<=n;i++){
			ll l = 0;
			ll r = 25;
			ll cnt = 1;
			ll mid;
			while(l <= r){
				mid = l + (r-l)/2;
				if(two[mid]*i >= k){
					cnt = mid;
					r = mid-1;
				}else l = mid + 1;
			}
			ans += 1 / (double)(two[cnt]*n);
			//cout << cnt << "\n";
		}
		cout << setprecision(12) << fixed << ans << "\n";
	}


	return 0;
}


Measured memory_bytes: 3796
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
// Use cout.flush() for interactive problems.
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    ll n, a[100005];
    cin>>n;
    int i;
    FOR0(i, n)
    {
        cin>>a[i];
    }
    sort(a, a+n);
    ll ans = 0;
    if(a[0]%2!=0)
        ans ^= n;
    FOR(i, 1, n)
    {
        ll cur = 0;
        cur = a[i] - a[i-1];
        if(cur%2!=0)
            ans ^= (n - i);
    }
    if(ans) cout<<"first";
    else cout<<"second";
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int a[3];
	for (int i = 0; i < 3; i++) {
		cin >> a[i];
	}
	sort(a, a + 3);

	cout << a[0] << " " << a[1] << " " << a[2] << endl;
	
	return 0;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(var) var.begin(), var.end()
#define vi vector<int>
int const MOD = 1e9+7;
typedef long long ll;
using namespace std;
 
int main(){
    int mat[3][3];
    for(int i = 0; i < 3; i++)
        for(int j = 0; j < 3; j++)
            cin >> mat[i][j];

    int n; cin >> n;
    while(n--){
        int m; cin >> m;
        for(int i = 0; i < 3; i++)
            for(int j = 0; j < 3; j++)
                if(m == mat[i][j])
                    mat[i][j] = -1;
    }
    bool ok = false;
    if(mat[0][0] == mat[1][1] && mat[0][0] == mat[2][2])
        ok = true;
    else if(mat[0][2] == mat[1][1] && mat[0][2] == mat[2][0])
        ok = true;
    else{
        for(int i = 0; i < 3; i++){
            if(mat[i][0] == mat[i][1] && mat[i][0] == mat[i][2]){
                ok = true;
                break;
            }
            if(mat[0][i] == mat[1][i] && mat[0][i] == mat[2][i]){
                ok = true;
                break;
            }
        }
    }
    if( ok ) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256