akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
struct node
{
    int x;
    int y;
    int ans;
}Node[200000+10];
map<ll,bool>df;
bool cmp1(struct node a,struct node b)
{
    if(a.x==b.x)
        return a.y<b.y;
    return a.x<b.x;
}
ll sum(ll x,ll y)
{
    return x*1000000+y;
}
int my_min(int a,int b)
{
    return a<b? a:b;
}
int main()
{
    int h,w,n;
    scanf("%d %d %d",&h,&w,&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d %d",&Node[i].x,&Node[i].y);
        df[sum(Node[i].x,Node[i].y)]=true;
    }
    sort(Node,Node+n,cmp1);
    int ans=h;
    int nowx,nowy;
    nowx=nowy=1;
    for(int i=0;i<n;i++)
    {
        int dis=Node[i].x-nowx;
        if(dis>0)
        {
            if(nowy+dis>Node[i].y)
            {
               	printf("%d",Node[i].x-1); 
            	return 0;
            }
			if(nowy+dis==Node[i].y)
                nowy+=(dis-1);
            if(nowy+dis<Node[i].y)
                nowy+=dis;
            nowx=Node[i].x;
        }
    }
    printf("%d",ans);
    return 0;
}



Measured memory_bytes: 15104
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		 //sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;
int main() {
    string s;
    cin>>s;
    int N = s.size();
    s.push_back('.');
    string T = "";
    rep(i,N){
        if(s[i] == 'A')T.push_back('A');
        else if(s[i] == 'B'){
            if(s[i+1] == 'C'){
                T.push_back('D');
                i++;
            }
            else{
                T.push_back('X');
            }
        }
        else{
            T.push_back('X');
        }
    }
    cerr<<T<<endl;
    ll ans = 0;
    ll cnta = 0;
    for (int i = 0; i < int(T.size()); i++){
        if(T[i] == 'A')cnta++;
        else if(T[i] == 'D'){
            ans += cnta;
        }
        else{
            cnta = 0;
        }
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 776
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static int M = 10;
	public static void main(String[] args) {
		int i,j,k;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		long h = parseLong(sc.next());
		long[] a = new long[n];
		long[] b = new long[n];
		for (i = 0; i < n; i++) {
			a[i] = parseLong(sc.next());
			b[i] = parseLong(sc.next());
		}
		sc.close();
		Arrays.parallelSort(a);
		Arrays.parallelSort(b);
		long cnt=0;
		for (i = n-1; i >= 0; i--) {
			if(b[i]<=a[n-1]) {
				break;
			}
			cnt++;
			h-=b[i];
			if(h<=0) {
				break;
			}
		}
		if(h>0) {
			cnt+=ceil((double)h/a[n-1]);
		}
		out.println(cnt);
	}
}


Measured memory_bytes: 59664
#include <iostream>
#include <string>
#include <set>

int main()
{
	int n;
	std::cin >> n;
	std::set<std::string> set;
	for (int i = 0; i < n; ++i)
	{
		std::string s;
		std::cin >> s;
		set.insert(s);
	}
	std::cout << set.size() << std::endl;
	return 0;
}


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

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <map>

using namespace std;

typedef pair<int,int> Paint;

bool Pairsecond(const Paint& pf,Paint&ps){//sortCompare
  return pf.second < ps.second;
}

#define anyfill(n,s) setw(n) << setfill(s)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define pb push_back
#define MAX 1000000000
#define MOD 1000000007


/*
確認ポイント
to_string() はC++11以降の実装;
cout<< (char)数値 //数値にあった文字に置き換えられる
cout<< (double)int型/(2など)//小数になる
length(),size()に括弧をつけ忘れてないか;
sort()が使える型//vector,string...
大文字小文字間違えてないか
cout << fixed << 小数計算//正しい小数表記になる(基本6桁)(e記法回避にも使える)
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
sqrt(数値型)でrootが取れる
vector.unique()は隣接した同じ要素を削除するので先にソートをする
*/
int main() { 
  int n,m;cin>>n>>m;
  vector<int> canse;
  for(int i = 0; pow(2,n) > i; i++){
    canse.push_back(i);
  }
  vector<int> a[m];
  for(int i = 0; m > i; i++){
    int k;cin>>k;
    for(int j = 0; k > j; j++){
      int tmp;cin>>tmp;
      a[i].push_back(tmp);
    }
    sort(a[i].begin(),a[i].end());
  }
  for(int i = 0; m> i; i++){
    int wari;cin>>wari;//a[i];
    for(int j = 0; canse.size() > j; j++){
      int nw = pow(2,n-1);
      int l = 1;
      int aok = a[i][0];
      int nwaok = 0;
      int kosu = 0;
      int ima = canse[j];
      while(nw != 0){
        if(l == aok){//0だったら個数に追加しない
          if(ima/nw == 1)kosu++;
        }
        ima = ima%nw;
        nw /= 2;
        if(l == aok){
          nwaok++;
          if(a[i].size() == nwaok)break;
          aok = a[i][nwaok];
        }
        l++;
      }
      if(kosu % 2 != wari){
        canse.erase(canse.begin()+j);
        j--;
      }
    }
  }
  cout << canse.size() << endl;
  return 0;
}




Measured memory_bytes: 384
S = input()
if S[0] == S[1] and S[2] == S[3] != S[0] or \
   S[0] == S[2] and S[1] == S[3] != S[0] or \
   S[0] == S[3] and S[1] == S[2] != S[0]:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 8992
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

const ll MOD = 1000000007LL;
const double PI = 3.14159265358979323846;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

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

	string S;
	cin >> S;
	reverse(S.begin(), S.end());

	vector<ll> residuals(S.size() + 1);
	ll residual_power_of_10 = 1;
	for (ll i = 0; i < S.size(); ++i) {
		residuals[i + 1] = (residuals[i] + (S[i] - '0') * residual_power_of_10) % 2019;
		residual_power_of_10 = (residual_power_of_10 * 10) % 2019;
	}

	map<ll, ll> residual_count;
	for (ll i = 0; i < residuals.size(); ++i) {
		if (residual_count.count(residuals[i]) == 0) {
			residual_count[residuals[i]] = 0;
		}
		++residual_count[residuals[i]];
	}

	ll res = 0;
	for (auto iter = residual_count.begin(); iter != residual_count.end(); ++iter) {
		res += iter->second * (iter->second - 1) / 2;
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 5048
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  ll N, M;
  cin >> N >> M;
  vector<ll> A(N);
  ll a, all_a = 0;
  for (int i = 0; i < N; i++) {
    cin >> a;
    all_a += a;
    A[i] = a;
  }
  sort(A.begin(), A.end());
  ll cnt = 0;
  double condition = (double)all_a / (4 * M);
  for (int i = N - 1; i >= 0; i--) {
    if (A[i] >= condition) cnt++;
  }
  string ans;
  if (cnt >= M) {
    ans = "Yes";
  } else {
    ans = "No";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  int a;
  vector<int> data(3);
  for (int i = 0; i < N; i++) {
    cin >> a;
    if(a % 4 == 0) data.at(2)++;
    else if(a % 2 == 0) data.at(1)++;
    else data.at(0)++;
  }
  if(data.at(0) <= data.at(2) || (data.at(0) == data.at(2) + 1 && data.at(1) == 0)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

const int MAXN = 21;
const int MOD = 1000000007;

int n;
bool mat[MAXN][MAXN];
int dp[22][(int) 1 << MAXN];

int bt(int cur, int marc);

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n; j++)
			scanf("%d", &mat[i][j]);
	printf("%d\n", bt(0, 0));
}

int bt(int cur, int marc){
	if(dp[cur][marc] < 0)
		return 0;
	if(dp[cur][marc] > 0)
		return dp[cur][marc];
	if(cur == n)
		return dp[cur][marc] = 1;
	for(int i = 0; i < n; i++){
		if(marc & (1 << i)) continue;
		if(mat[cur][i] == 0) continue;
		dp[cur][marc] += bt(cur + 1, marc ^ (1 << i));
		dp[cur][marc] %= MOD;
	}
	if(dp[cur][marc] == 0){
		dp[cur][marc] = -1;
		return 0;
	}
	return dp[cur][marc];
}
/*

	printf("dp[%d][", cur);
	for(int i = n; i >= 0; i--){
		if(marc & (1 << i)) printf("1");
		else printf("0");
	}
	printf("] = %d\n", dp[cur][marc]);
*/

Measured memory_bytes: 162048
require 'prime'
def func(n)
	if n == 1
		return 1
	else
		return func(n - 1) * n
	end
end


n1 = gets.to_i
n2 = func(n1)

#a = Prime.each(n2).to_a
a = Prime.prime_division(n2)
sum = 1
a.each do |i,j|
	sum = sum * (j + 1) % (10 ** 9 + 7)
end
puts sum


Measured memory_bytes: 4604
#include <stdio.h>
#include <math.h>

int main(void) {
	int S;
	scanf("%d", &S);
	int h = S/(60*60);
	int surplus = S%(60*60);
	int m = surplus/60;
	int s = surplus%60;
	printf("%d:%d:%d\n", h, m, s);
	return 0;
}

Measured memory_bytes: 592
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  input()
  v = list(map(int, input().split()))
  prev_value, post_value = 0, 0
  prev_index, post_index = 0, len(v) - 1

  while prev_index <= post_index:
    if prev_value < post_value:
      prev_value += v[prev_index]
      prev_index += 1
    else:
      post_value += v[post_index]
      post_index -= 1

  print(abs(prev_value - post_value))


if __name__ == '__main__':
  main()


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

int main(){
  ll N,M;
  cin >> N >> M;
  vector<ll> v(N);
  for(ll i=0;i<N;i++){
    cin >> v[i];
  }
  vector<ll> a(M);
  vector<ll> b(M);
  for(ll i=0;i<M;i++){
    cin >> a[i] >> b[i];
  }
  
  vector<ll> vec(N,1);
 
  for(ll i=0;i<M;i++){
    if(v[a[i]-1]>=v[b[i]-1]){
      vec[b[i]-1]=0;
    }
    if(v[a[i]-1]<=v[b[i]-1]){
      vec[a[i]-1]=0;
    }
  }
  
  ll cnt=0;
  for(ll i=0;i<N;i++){
    if(vec[i]==1){
      cnt++;
    }
  }
  cout << cnt <<endl;
}


Measured memory_bytes: 6376
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include<climits>
#include <string>
#include <map>
#include <set>
#include <list>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)

using namespace std;

/////////////////////////////////////////////////////
#define pll pair<ll,ll>

ll N;
ll ans;
ll i, j,k;

int act(){

}


int main(){
    scanf("%lld",&N);

    i = 3;
    while(true){
        ll rp=1;
        fornum(j, 0, i) rp *= 3;
        fornum(j,0,rp){
            ll nn = 1;
            ll jj = j;
            ll num=0;
            int c3=0, c5=0, c7=0;
            fornum(k,0,i){
                switch(jj%3){
                    case 0:
                        num += 3 * nn;
                        c3++;
                        break;
                    case 1:
                            num += 5 * nn;
                            c5++;
                            break;
                    case 2:
                        num += 7 * nn;
                        c7++;
                        break;
                }
                jj /= 3;
                nn *= 10;
            }
            //printf("%lld\n",num );
            if(N<num){
                printf("%lld", ans);
                return 0;
            }
            if(c3*c5*c7)
                ans++;
        }
        i++;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)



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

	int N;
	cin >> N;
	vector<pair<int,int>>A(N);
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		A[i] = { a,i + 1 };
	}
	sort(all(A));
	for (int i = 0; i < N; i++)cout << A[i].second << " ";
	cout << endl;

	return 0;
}

Measured memory_bytes: 1664
#include <stdio.h>

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int n;

  while ( scanf ( "%d", &n ) == 1 )
  {
    printf ( "3C%02d\n", ( ( n - 1 ) % 39 ) + 1 );
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    bool turn = 1;
    while(a > 0 && c > 0)
    {
        if(turn)    c -= b;
        else        a -= d;
        turn = !turn;
    }
    cout << (a > 0 ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 3632
#include <sstream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iterator>
#include <numeric>
#include <functional>
#include <climits>



using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int n;
vector<int> a;
vector<vector<bool> > dp;

void debug(){
  for (size_t i = 0; i < dp.size(); i++) {
    for (size_t j = 0; j < dp[i].size(); j++) {
      cerr << dp[i][j] << " ";
    }
    cerr << endl;
  }
}

bool doit(int  m){
  //cerr << "m=" << m << endl;
  dp.clear();
  dp.resize(m+1, vector<bool>(n, false));
  for (int i = 0; i <= m; i++) {
    dp[i][0] = (a[0] == i);
  }
  for (int i = 0; i < n; i++) {
    dp[0][i] = true;
  }
  for (int j = 1; j < n; j++) {
    //cerr << "j=" << j << endl;    
    for (int i = 1; i <= m; i++) {
      bool b1 = dp[i][j-1];
      //cerr << "i=" << i << endl;
      bool b2 = (i - a[j] >= 0) ? dp[i-a[j]][j-1] : false;
      dp[i][j] = b1 || b2;
    }
    //debug();
  }
  return dp[m][n-1];
}


int main(){
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  size_t q;
  cin >> q;
  for (size_t i = 0; i < q; i++) {
    int m;
    cin >> m;
    cout << (doit(m) ? "yes" : "no") << endl;
  }
  return 0;
}

Measured memory_bytes: 1336
tt,ta,at,aa=map(int,input().split())
 
for i in range(100):
 at-=ta 
 if at>0:
    pass
 elif at<=0:
    print("Yes")
    exit()
 tt-=aa
 if tt>0:
    pass
 elif tt<=0:
    print("No")
    exit()

Measured memory_bytes: 9128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
const int MR=1e3+10;

typedef long long LL;

int f[MR][MR][2];
int main() {
	int n,K,x,y;
	int rx,ry,rc;
	char c;
	scanf("%d%d",&n,&K);
	for(int i=0;i<n;i++){
		scanf("%d%d %c",&x,&y,&c);
		rx=(x%K+K)%K;
		ry=(y%K+K)%K;
		if((x-rx+y-ry)/K%2){
			c='W'+'B'-c;
		}
		if(c=='W') rc=0;
		else rc=1;
		f[rx][ry][rc]+=1;f[rx][K][rc]-=1;f[K][ry][rc]-=1;f[K][K][rc]+=1;
		f[0][0][rc]+=1;f[rx][0][rc]-=1;f[0][ry][rc]-=1;f[rx][ry][rc]+=1;
		rc=1-rc;
		f[rx][0][rc]+=1;f[K][0][rc]-=1;f[rx][ry][rc]-=1;f[K][ry][rc]+=1;
		f[0][ry][rc]+=1;f[0][K][rc]-=1;f[rx][ry][rc]-=1;f[rx][K][rc]+=1;
	} 
	int ans=-1;
	for(int l=0;l<2;l++)
	for(int i=0;i<K;i++){
		for(int j=0;j<K;j++){
			if(i>0 && j>0){
				f[i][j][l]+=f[i-1][j][l]+f[i][j-1][l]-f[i-1][j-1][l];
			}
			else if(i==0 && j>0){
				f[i][j][l]+=f[i][j-1][l];
			}
			else if(i>0 && j==0){
				f[i][j][l]+=f[i-1][j][l];
			}
			ans=max(ans,f[i][j][l]);
		}
	}

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

Measured memory_bytes: 8192
#include <stdio.h>
#include <stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main () 
{
int n,i,j;
int a[200010];

scanf("%d",&n);


for(i=0;i<n;i++)
{
    scanf("%d",&a[i]);
}

qsort(a, n, sizeof(int), compare_int);

for(i=0;i<n;i++)
{
    if(a[i]==a[i+1])
    {
        printf("NO");
        return 0;
    }
}

printf("YES");
return 0;
}


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int len(int x){
	int r = 0;
	while(x) r++, x /= 10;
	return r;
}
int main(){
	string s; cin >> s; int len = s.size();
	for(int i = 0; i < len;){
		int j = i, cr = 0, cl = 0;
		while(j < len && s[j] == 'R') j++, cr++;
		while(j < len && s[j] == 'L') j++, cl++;
		for(int k = 0; k < cr - 1; k++) cout << 0 << " ";
		int a = (cr + 1) / 2 + cl / 2;
		int b = cr / 2 + (cl + 1) / 2;
		cout << a << " " << b << " ";
		for(int k = 0; k < cl - 1; k++) cout << 0 << " ";
		i = j;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	string S;
	scan(N>>S);
	rep(i,S.size()){
		int a=S[i]-'A';
		a=(a+N)%26;
		printf("%c",'A'+a);
	}
	kaigyo;
	return 0;
}


Measured memory_bytes: 256
function Main(input) {
  input = input.split('\n');
  var array = input.shift();
  array = array.split(' ');
  var N = array [0];
  var M = array [1];
  var min = -1;
  var max = -1;
  for(var i = 0; i < M; i++){
  array = input.shift();
  array = array.split(' ');
    if(min == -1) {
      min = parseInt(array[0]);
    } else {
      min = Math.max(array[0], min);
    }
    if(max == -1) {
      max = parseInt(array[1]);
    } else {
      max = Math.min(array[1], max);
    }
  }
  var result = 0;
  for(var i= min;i < max + 1;i++){
    if(min<=i && i<=max){
       result++;
    }
  }
  console.log(result);
  
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29336
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
	int n, x[100], y[100];

	cin >> n;

	for (int i = 0; i < n; i++) cin >> x[i];
	for (int i = 0; i < n; i++) cin >> y[i];

	double d[4];

	for (int i = 0; i < 4; i++) d[i] = 0.0;

	for (int p = 1; p <= 3; p++){
		for (int i = 0; i < n; i++){
			d[p] += pow(fabs(x[i] - y[i]), p);
		}
		d[p] = pow(d[p], 1.0 / p);
	}

	for (int i = 0; i < n; i++){
		d[0] = (d[0] < fabs(x[i] - y[i]) ? fabs(x[i] - y[i]) : d[0]);
	}

	printf("%lf\n", d[1]);
	printf("%lf\n", d[2]);
	printf("%lf\n", d[3]);
	printf("%lf\n", d[0]);

	return 0;
}

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl

using namespace std;

typedef long long ll;
typedef string str;

const ll MAXN = 1e6 + 10;
const ll MOD = 1e6 + 3;

ll mul(ll a, ll b){
	return (a * b) % MOD;
}
ll pw(ll b, ll P){
	if(P == 0) return 1;
	if(P & 1) return mul(b, pw(b, P ^ 1));
	return pw(mul(b, b), P >> 1);
}
ll f[MAXN], iv[MAXN];
ll nCr(ll n, ll r){
	return mul(f[n], mul(iv[r], iv[n - r]));
}
ll inv(ll x){
	return pw(x, MOD - 2);
}

ll ans = 0;

ll mult(ll l, ll n){
	//debug(l); debug(n);
	if(l == 0) return 0;
	if(l + n > MOD) return 0;
	//debug(mul(f[l + n - 1], iv[l - 1]));
	return mul(f[l + n - 1], iv[l - 1]);
}

ll calc(ll x, ll d, ll n){
	if(d == 0) return pw(x, n);
	return mul( pw(d, n), mult( mul(x, inv(d)), n ));
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	f[0] = 1;
	for(int i = 1; i < MAXN; i++) f[i] = mul(f[i - 1], i);
	iv[MOD - 1] = pw(f[MOD - 1], MOD - 2);
	for(int i = MOD - 2; i >= 0; i--) iv[i] = mul(iv[i + 1], i + 1);
	ll Q;
	cin >> Q;
	ll a, b, c;
	for(int i = 0; i < Q;i++){
		cin >>a >> b>>c;
		cout << calc(a,b,c) << '\n';
	}
	return 0;
}



Measured memory_bytes: 16512
#include <bits/stdc++.h>
using namespace std;
int n,k,d,ans;
set<int>a;
int main(){
	cin>>n>>k;
	int x;
	for(int i=0;i<k;i++){
		cin>>d;
		for(int j=0;j<d;j++){
			cin>>x;
			a.insert(x);
		}
	}
	
	cout<<n-a.size();
	return 0;
}


Measured memory_bytes: 3636
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
sA = [list('{0:040b}'.format(i)) for i in A]
#m = max([len(A)for i in A])
B = list(zip(*sA))
#print(len(B[0]))
#print(A)
#print(B)
C = [0]*40
for i in range(40):
  if B[i].count('0') > len(B[i])/2:
    C[i] = 1
  else:
    C[i] = 0
#print(C)

#ans = [0] * 3
cnt = 0
dig = 39
ans = 0
while dig >= 0:
  if ans + C[cnt] * 2**dig <= K:
    ans += C[cnt] * 2**dig
    cnt += 1
    dig -= 1
  elif ans + ((C[cnt]+1)%2)*2**dig <= K:
    ans += ((C[cnt]+1)%2)*2**dig
    cnt += 1
    dig -= 1
  #print(dig+1, ans)
s = 0
for i in range(N):
  s += ans ^ A[i]
print(s)

Measured memory_bytes: 93212
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=a;i>n;i--)
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define MOD 1000000007

int main() 
{ 
	FAST;
	string s,t;
	cin>>s>>t;
	cout<<t+s<<endl;
	
    return 0;
}

Measured memory_bytes: 256
#define NDEBUG

#include <unordered_map>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <utility>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <tuple>
#include <set>
#include <map>

// [0, max)
#define FOR0(var, max) for (sl (var) = 0; (var) < (max); ++(var))
// [min, max)
#define FORi(var, min, max) for (sl (var) = (min); (var) < (max); ++(var))
// [min, max)
#define FORi_INV(var, min, max) for (sl (var) = (max) - 1; (var) + 1 > (min); --(var))
#define FORITER(var, iter) for (auto (iter) = (var).begin(); (iter) != (var).end(); (iter)++)
#define FORITER_INV(var, iter) for (auto (iter) = (var).rbegin(); (iter) != (var).rend(); (iter)++)

// a < b < c
#define LTLT(a, b, c) (((a) < (b)) && ((b) < (c)))
// a <= b < c
#define LELT(a, b, c) (((a) <= (b)) && ((b) < (c)))
// a < b <= c
#define LTLE(a, b, c) (((a) < (b)) && ((b) <= (c)))
// a <= b <= c
#define LELE(a, b, c) (((a) <= (b)) && ((b) <= (c)))

#ifndef NDEBUG
#  define MASSERT(cond) m_assert(cond, __LINE__, #cond);
#else
#  define MASSERT(...)
#endif

using namespace std;

using uc = unsigned char;
using ui = unsigned int;
using ul = unsigned long long int;

using sc = signed char;
using si = signed int;
using sl = signed long long int;

using ld = long double;

void m_assert(const bool& cond, const sl& line, const char *condstr) {
  if (!cond) {
    cerr << "Assertion Failed: " << condstr << " at line " << line << endl;
    exit(1);
  }
}

static sl A1, A2, A3;

void solve(void) {
  if (A1 + A2 + A3 < 22) {
    cout << "win" << endl;
  } else {
    cout << "bust" << endl;
  }
}

int main(void) {
  cin >> A1 >> A2 >> A3;
  solve();
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
 
    int sw;
    cin>>sw;
    int y = sw/100;
    int m = sw%100;
    if((m>=1 && m<=12) && (y>=1 && y<=12))printf("AMBIGUOUS\n");
    else if(y>=1 && y<=12)printf("MMYY\n");
    else if(m>=1 && m<=12)printf("YYMM\n");
    else printf("NA\n");
 
}

Measured memory_bytes: 256
a,b,c,d=map(int,input().split())
"""
if(b>0 and d>0):
    print(b*d)
    exit()
elif(b<0 and d<0):
    print(a*c)
    exit()
elif(b==0):
    if(c>0):
        print(0)
        exit()
    else:
        print(a*c)
        exit()
elif(d==0):
    if(a>0):
        print(0)
        exit()
    else:
        print(a*c)
        exit()
elif(b<0 and d>0):
    print(a*c)
    exit()
elif(d<0 and b>0):
    print(b*d)
    exit()
else:
    print(b*d)
    exit()
"""

ans1=a*c
ans2=a*d
ans3=b*c
ans4=b*d

print(max(max(ans1,ans2),max(ans3,ans4)))


Measured memory_bytes: 9064
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<sstream>

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)
using Graph = vector<vector<int>>;

int main(){
    ll a;
    string b;
    cin>>a>>b;
    if(b.length() == 4) b.erase(1,1);
    else b.erase(2,1);
    stringstream ss;
    ss << b;
    ll x;
    ss >> x;
    ll ans = a * x / 100;
    cout<<ans<<endl;
}

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


using namespace std;


#ifdef zxc

#include <sys/resource.h>
#include "debug.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ll = int64_t;
using ld = long double;
const ld EPS = 1e-10;
const ll MOD = 998244353;
const ld PI = 3.141592653589793;
const int maxn = 300001;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

struct pt {
    ld x, y;

    pt operator+(const pt &rhs) {
        return {x + rhs.x, y + rhs.y};
    }

    pt operator-(const pt &rhs) {
        return {x - rhs.x, y - rhs.y};
    }

    ld norm() {
        return hypotl(x, y);
    }

    pt operator*(ld v) {
        return {x * v, y * v};
    }
};

bool close_dbl(ld a, ld b) {
    return abs(a - b) < EPS;
}

bool less_dbl(ld a, ld b) {
    return a < b && !close_dbl(a, b);
}

bool less_equal_dbl(ld a, ld b) {
    return a < b || close_dbl(a, b);
}

int close_lg(int n) { return n > 1 ? 32 - __builtin_clz(n - 1) : 0; }

ll add(ll a, ll b) {
    a += b;
    if (a >= MOD) {
        a -= MOD;
    }
    return a;
}

ll mul(ll a, ll b, ll m) {
    return a * b % m;
}

ll pw(ll a, ll b, ll m) {
    ll res = 1;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = mul(res, a, m);
        }
        a = mul(a, a, m);
    }
    return res;
}

int cnt[1001];

signed main() {
#ifdef zxc
    struct rlimit rl;
    const rlim_t kStackSize = 512L * 1024L * 1024L;
    assert(!getrlimit(RLIMIT_STACK, &rl));
    rl.rlim_cur = kStackSize;
    assert(!setrlimit(RLIMIT_STACK, &rl));
    freopen("../kolya_input.txt", "r", stdin);
//    freopen("../kolya_output.txt", "w", stdout);
#else
    //    mt19937 mt(std::chrono::high_resolution_clock::now().time_since_epoch().count());
    //            freopen("", "r", stdin);
    //        freopen("hack.out", "w", stdout);
#endif
    fast_io();
    cout.precision(9);
    cout << fixed;
    auto start = chrono::steady_clock::now();
    int n;
    cin >> n;
    vector<int> a(n);
    for (int &el:a) {
        cin >> el;
        cnt[el]++;
    }
    int mx = *max_element(a.begin(), a.end());
    int mn = *min_element(a.begin(), a.end());

    if ((mx + 1) / 2 > mn) {
        cout << "Impossible";
        return 0;
    }
    for (int i = 0; i <= mx; ++i) {
        int cur_d = max(i, mx - i);
        if (!cnt[cur_d]) {
            cout << "Impossible";
            return 0;
        }
        --cnt[cur_d];
    }
    if (cnt[mn]) {
        cout << "Impossible";
        return 0;
    }
    cout << "Possible";
    auto end = chrono::steady_clock::now();

    debug("time", chrono::duration_cast<chrono::milliseconds>(end - start).count() / 1000.0);

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int r;
    cin >> r;
    cout << fixed << setprecision(10) << 2 * M_PI * r << endl;
}

Measured memory_bytes: 3824
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;

#define FOR(i,s,t) for(int i=s;i<t;i++)
#define REP(i,n) FOR(i,0,n)
#define LAST(i,n) if(i==n-1)
#define PRINT(s) cout << s << "\n"
#define SORT(A) sort(A.begin(), A.end())
#define EACHPRINT(A, T) for_each(begin(A), end(A), [&](T i){ cout << i << " "; });cout << "\n"

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    lint N; cin >> N;
    lint k = 2;

    while(true) {
      if(k*(k-1) == 2*N) {
        break;
      }

      if(k == N) {
        cout << "No\n";
        return 0;
      }

      k++;
    }

    lint size = k-1;

    vector<vector<lint>> S;

    REP(_, k) {
      vector<lint> s;
      S.push_back(s);
    }


    lint idx = 1;
    FOR(i,0,k) {
      FOR(j,i+1,k) {
        S[i].push_back(idx);
        S[j].push_back(idx);
        idx++;
      }
    }

    PRINT("Yes");
    PRINT(k);

    REP(i,k) {
      cout << size; cout << " "; EACHPRINT(S[i], lint);
    }
    
    return 0;
}


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

int main(){
  int N, W;
  cin >> N >> W;;
  vector<long long> w(N), v(N);
  for (int i=0; i<N; i++)
    cin >> w.at(i) >> v.at(i);
  
  vector<vector<long long>> dp(101, vector<long long> (1000000));
  for (int i=0; i<W+1; i++)
    dp.at(0).at(i) = 0;

  
  for(int i=0; i<N; i++){
    for(int j=0;j<W+1; j++){
      if(j - w.at(i) >= 0)
        dp.at(i+1).at(j) = max(dp.at(i).at(j), dp.at(i).at(j-w.at(i)) + v.at(i));
      else
        dp.at(i+1).at(j) = dp.at(i).at(j);
    }
  }
  cout << dp.at(N).at(W) << endl; 
}

Measured memory_bytes: 797440
n = int(input())
x = str(n)
count = 0

if len(x)<=2:
    print(0)#impossible

#elif n==100 or n==101 or n==102 or n==103 or n==104 or n==105:

else:
    num = int(x[-2]+x[-1])#しも２けた
    pot = (n-num)/100
    while(True):
        if num>5:
            num-=5
            count+=1
        else:
            count+=1
            break
    if count<=pot:
        print(1)
    else:
        print(0)



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

int main() {
	int a, b;
	char op;
	
	while (true) {
		cin >> a >> op >> b;
		
		if (op == '?') break;
		
		if (op == '+') {
			cout << a + b << '\n';
		} else if (op == '-') {
			cout << a - b << '\n';
		} else if (op == '*') {
			cout << a * b << '\n';
		} else {
			cout << a / b << '\n';
		}
	
	}
	
	return 0;
}


Measured memory_bytes: 3100
#include<iostream>
using namespace std;
int getCost(int w){
 int cost = 1150; // ?¬¬?????????
 for (int i = 11; i <= w; i++ ){
 if ( i <= 20 ) cost += 125; // ?¬¬?????????
 else if ( 30 < i ) cost += 160; // ?¬¬?????????
 else cost += 140; // ?¬¬?????????
 }
 return cost;}
int main(){
 for( int w; cin >> w && w >= 0; ) {
 cout << 4280 - getCost(w) << endl;
 }
 return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
        using namespace std;
        #define Mod 1000000007
        #define int long long
    	#define LL long long
        #define MN 400005
        int ksm(int a,int x){
        	LL ans=1,w=a;
        	while(x){
        		if(x&1)ans=ans*w%Mod;
        		w=w*w%Mod;
        		x>>=1;
        	}
        	return ans;
        }
        int n,bin[MN],fa[MN],siz[MN];
        LL f[3];
        vector<int>edge[MN];
        void dfs(int x){
        	siz[x]=1;
        	for(int i=0;i<edge[x].size();++i)
        		if(fa[x]!=edge[x][i]){
        			fa[edge[x][i]]=x;
        			dfs(edge[x][i]);
        			siz[x]+=siz[edge[x][i]];
        		}
        }
        signed main(){
        	scanf("%d",&n);
        	bin[0]=1;
        	for(int i=1;i<=n;++i)bin[i]=(bin[i-1]<<1)%Mod;
        	for(int i=1;i<n;++i){
        		int x,y;
        		scanf("%d%d",&x,&y);
        		edge[x].push_back(y);
        		edge[y].push_back(x);
        	}
        	dfs(1);
        	LL ans=0,inv2=ksm(2,Mod-2);
        	for(int x=1;x<=n;++x){
        		f[0]=1;f[1]=f[2]=0;
        		for(int i=0;i<edge[x].size();++i){
        			int v=edge[x][i],tmp;
        			if(fa[x]==v) tmp=bin[n-siz[x]];
        			else tmp=bin[siz[v]];
        			LL P=ksm(tmp,Mod-2);
        		//	cerr<<x<<" "<<v<<": "<<P<<endl;
        			(f[2]+=f[1]*(1ll-P+Mod)%Mod)%=Mod;
        			f[1]=(f[1]*(P)%Mod+f[0]*(1ll-P+Mod))%Mod;
        			f[0]=f[0]*(P)%Mod;
        		}
        		(ans+=f[2]*inv2%Mod)%=Mod;
        //		cerr<<x<<": "<<f[2]<<endl;
        	}
        	printf("%lld\n",ans%Mod);
        	return 0;
        }

Measured memory_bytes: 31872
from statistics import median

n = int(input())
a = [None] * n
b = [None] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())

if n % 2 == 1:
    print(abs(median(b) - median(a)) + 1)
else:
    print(int(abs(median(b) - median(a)) * 2) + 1)

Measured memory_bytes: 28936
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def powd(x, n, m):
  ans = 1
  while(n > 0):
    if(bin(n & 1) == bin(1)):
      ans = (ans*x)%m
    x = x*x % m
    n = n >> 1 #ビットシフト
  return ans


#a = list(map(int, input().split()))

n = int(input())
s = input()

ans = 1
if(n%2==1):
    print("No")
else:
    for i in range(n//2):
        if(s[i]!=s[i+n//2]):
            ans*=0
    if(ans==0):
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 38256
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))

f = []
s = []
t = []
for i in p:
    if i <= a:
        f.append(i)
    elif i <= b:
        s.append(i)
    else:
        t.append(i)
fc = len(f)
sc = len(s)
tc = len(t)
print(min(fc, sc, tc))

Measured memory_bytes: 7740
x1,x2,x3,x4,x5 = map(int,input().split())
if x1 == 0:
    print(1)
elif x2 == 0:
    print(2)
elif x3==0:
    print(3)
elif x4==0:
    print(4)
else:
    print(5)
    

Measured memory_bytes: 9168
#include<iostream>
using namespace std;
int main(){
	int n,p,k;
	int maxv=0,minv;
	cin>>minv>>n;
	++minv;
	for(int i=0;i<n;++i){
		cin>>p>>k;
		maxv=max(maxv,p);
		minv=min(minv,k);
	}
	cout<<max(0,minv-maxv+1)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int n;
vint e[100005];
vint g;
vint p;

void dfs_f(int u, int prev) {
    if (g[u] == 1) return;
    g[u] = 0;
    for (int v : e[u]) {
        if (v == prev) continue;
        dfs_f(v, u);
    }
}

void dfs_s(int u, int prev) {
    if (g[u] == 0) return;
    g[u] = 1;
    for (int v : e[u]) {
        if (v == prev) continue;
        dfs_s(v, u);
    }
}

bool dfs(int u, int prev) {
    bool res = false;
    if (u == n-1) {
        res = true;
        p.push_back(u);
    }
    for (int v : e[u]) {
        if (v == prev) continue;
        bool res2 = dfs(v, u);
        if (res2) {
            res = true;
            p.push_back(u);
        }
    }
    return res;
}

int main() {
    cin >> n;
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        e[a].push_back(b);
        e[b].push_back(a);
    }

    g.resize(n, -1);
    g[0] = 0;
    g[n-1] = 1;

    dfs(0, -1);

    int psz = p.size();
    rrep(i, psz/2) {
        g[p[i]] = 0;
    }
    if (psz & 1) g[p[psz/2]] = 0;
    rep(i, psz/2) {
        g[p[i]] = 1;
    }
    
    dfs_f(0, -1);
    dfs_s(n-1, -1);

    int b = 0;
    rep(i, n) if (!g[i]) b++;
    if (b > n-b) puts("Fennec");
    else puts("Snuke");

    return 0;
}

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

using namespace std;


#define MAXN 100002
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, c, h[30][MAXN]={};
  cin >> n >> c;
  for (int i = 0; i < n; ++i) {
    int s, e, k;
    cin >> s >> e >> k;
    h[k-1][s-1]++;
    h[k-1][e]--;
  }
  int ans = 0, cur[30][MAXN] = {};
  for (int i = 0; i < MAXN; ++i) {
    for (int j = 0; j < 30; ++j) {
      cur[j][i] += (i ? cur[j][i-1] : 0) + h[j][i];
    }
  }
  for (int i = 0; i < MAXN; ++i) {
    int sm = 0;
    for (int j = 0; j < 30; ++j) {
      sm += (cur[j][i]>0);
    }
    ans = max(ans, sm);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 23680
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef long long LL;
const int modn=1e9+7;
const int maxn=2e3+10;
ll d[maxn]={0},pos[maxn]={0}; 
int a[maxn]={0};
LL pow(LL a, LL n, LL p)   
{
    LL ans = 1;
    while(n)
    {
        if(n & 1) ans = ans * a % p;          
        a = a * a % p;
        n >>= 1;
    }
    return ans;
}
ll inv2=pow(2,modn-2,modn);
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=n;i++){
		bool f=1;
		for(int j=1;j<=n;j++){
			if(i==j){
				f=0;
				continue;
			}
			if(f){
				if(a[j]>a[i]){
					d[i]++;
					pos[i]++;
				}
			}
			else {
				if(a[j]>a[i]){
					d[i]++;
				}
			}
		}
	}
	ll sum=0;
	for(int i=1;i<=n;i++){
		sum=(sum+(pos[i]+1ll*(k-1)*d[i]+pos[i])%modn*1ll*(k)%modn*inv2%modn)%modn;
	}
	cout<<sum<<endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sun May  3 19:04:26 2020

@author: Kanaru Sato
"""

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

target = 1
for i in range(n):
    if a[i] == target:
        target += 1

if target == 1:
    print("-1")
else:
    print(n-target+1)

Measured memory_bytes: 24772
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
ll modExp(ll base, ll power) {
    if (power == 0) {
        return 1;
    } else {
        ll cur = modExp(base, power / 2); cur = cur * cur; cur = cur % MOD;
        if (power % 2 == 1) cur = cur * base;
        cur = cur % MOD;
        return cur;
    }
}

ll inv(ll base) {
    int g = MOD, r = base, x = 0, y = 1;
    while (r != 0) {
        int q = g / r;
        g %= r; swap(g, r);
        x -= q * y; swap(x, y);
    }
    return x < 0 ? x+MOD : x;
}

ll mul(ll A, ll B) {
	return (A*B)%MOD;
}

ll add(ll A, ll B) {
	return (A+B)%MOD;
}

ll dvd(ll A, ll B) {
    return mul(A, inv(B));
}

ll sub(ll A, ll B) {
    return (A-B+MOD)%MOD;
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    ll N, A, B; cin >> N >> A >> B;
    ll ans = modExp(2, N);
    ans = sub(ans, 1);
    ll cur = 1;
    FOR(i, 1, A+1) {
        cur = mul(cur, inv(i));
        cur = mul(cur, N-i+1);
    }
    ans = sub(ans, cur);
    cur = 1;
    FOR(i, 1, B+1) {
        cur = mul(cur, inv(i));
        cur = mul(cur, N-i+1);
    }
    ans = sub(ans, cur);
    cout << ans << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 1e6+5;
const int mo = 1e9+7;

int n;
LL f[N];
LL js[N],inv[N];

LL calc(int n,int m){return js[n]*inv[m]%mo*inv[n-m]%mo;}

int main(){
	n=get();
	if (n==2)return printf("1\n"),0;
	js[0]=js[1]=1;
	fo(i,2,n)js[i]=js[i-1]*i%mo;
	inv[0]=inv[1]=1;
	fo(i,2,n)inv[i]=1ll*(mo-mo/i)*inv[mo%i]%mo;
	fo(i,2,n)inv[i]=inv[i]*inv[i-1]%mo;
	fo(d,1,n-2){
		int c1=n-d*2,c2=d-1;
		if (c1<0)continue;
		LL tmp=calc(c1+c2,c1)*js[n-d]%mo*js[d-1]%mo;
		f[n-d]=tmp;
	}
	fd(i,n-1,2)f[i]=(f[i]+mo-f[i-1])%mo;
	LL ans=0;
	fo(i,1,n-1)ans=(ans+f[i]*i%mo)%mo;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 23680
//#pragma GCC optimize("O3")
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<bits/stdc++.h>
using namespace std;
function<void(void)> ____ = [](){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);};
const int MAXN = 2e5+7;
using LL = int_fast64_t;
int n,A[MAXN];
LL k;
set<int> S;
vector<int> vec;
void dfs(int u){
    if(S.count(u)) return;
    S.insert(u);
    vec.emplace_back(u);
    dfs(A[u]);
}
int main(){
    cin >> n >> k;
    for(int i = 1; i <= n; i++) cin >> A[i];
    dfs(1);
    if(k<(int)vec.size()) cout << vec[k] << endl;
    else{
        vector<int> vecc;
        int pos = 0;
        for(int i = 0; i < (int)vec.size(); i++){
            if(vec[i]==A[vec.back()]){
                pos = i;
                break;
            }
        }
        for(int i = pos; i < (int)vec.size(); i++) vecc.emplace_back(vec[i]);
        k -= pos;
        int m = k%(int)vecc.size();
        cout << vecc[m] << endl;
    }
    
    return 0;
}

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

int main(void)
{
	int i,lon1,lon2,count=0;
	char a[200],b[200];
	scanf("%s %s",a,b);
	
	lon1=strlen(a);
	lon2=strlen(b);
	
	if(lon1>lon2){
		printf("GREATER\n");
	} else if(lon1<lon2){
		printf("LESS\n");
	} else{
		for(i=0;i<lon1;i++){
			if(a[i]>b[i]){
				printf("GREATER\n");
				break;
			} else if(a[i]<b[i]){
				printf("LESS\n");
				break;
			} else {
				count++;
			}
		}
	}
	
	if(count==lon1){
		printf("EQUAL\n");
	}
	return 0;
}

Measured memory_bytes: 128
let [|a;b;k|] = stdin.ReadLine().Split() |> Array.map int

let m = List.min [a;b]

seq {
  for i in List.rev [1..m] do
    if a % i = 0 && b % i = 0 then
      yield i
}
|> Seq.take k
|> Seq.last
|> printfn "%d"

Measured memory_bytes: 14172
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,k;
    cin >> a>> b>>c>>k;
    //std::vector<long long long > v(3)={a,b,c};
    long long int sum=0;
    // while(k<=0)
    // {
        if((k-a)<=0)
        {
            sum+=k;
            k=0;
        }
        else
        {
            sum+=a;
            k-=a;
        }
    // }
    if(k<=b)
    {
        k=0;
    }
    else
    {
        k-=b;
    }
    if(k<=c)
    {
        sum-=k;
    }
    else
    {
        sum-=c;
    }
    cout <<sum;
}

Measured memory_bytes: 3632