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

ll mod=1e9+7;


int main() {
    int n;
    cin >> n;
    int ain;
    vector<int> b={0,0,0};
    ll ans=1;
    for (int i=0;i<n;i++) {
        cin >> ain;
        int m=0;
        for (int j=0;j<3;j++) {
            if (ain==b[j]) {
                if (m==0) b[j]++;
                m++;
            }
        }
        ans*=m;
        ans=ans%mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n = input()

for i in range(n):
    maxL = 0
    cx = 0
    cy = 0
    maxx = 0
    maxy = 0

    while True:
        dx, dy = map(int, raw_input().split())
        if dx == 0 and dy == 0:
            break
        cx += dx
        cy += dy
        d = cx ** 2 + cy ** 2
        if maxL < d or (d == maxL and cx > maxx):
            maxL = d
            maxx, maxy = cx, cy

    print maxx, maxy

Measured memory_bytes: 6344
"""
n snukes
k kinds of snacks


the following di snukes have


"""
import collections

n, k = map(int, raw_input().split(' '))

cc = collections.Counter()
for i in range(k):
	d = int(raw_input())
	for u in map(int,raw_input().split(' ')): cc[u] +=1

count = 0
for u in range(1,n+1):
	if cc[u] == 0: count+=1
print count

Measured memory_bytes: 70156
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vi a(n), b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];

    vi diff(n);
    rep(i, n) diff[i] = a[i] - b[i];
    sort(diff.begin(), diff.end());
    int neg = lower_bound(diff.begin(), diff.end(), 0) - diff.begin();
    ll neg_sum = 0;
    rep(i, neg) {
        neg_sum += diff[i];
    }
    int ans = neg;
    for (int i = n-1; i >= 0 ; --i) {
        if (neg_sum >= 0) {
            break;
        }
        if (diff[i] <= 0) {
            ans = -1;
            break;
        } else {
            neg_sum += diff[i];
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	boolean check(int[] q) {
		for (int i = 0; i < q.length; i++) {
			if (q[i] == 1) {
				// i の証言をしらべる
				for (int j = 0; j < A[i]; j++) {
					if (q[x[i][j]] != y[i][j]) {
						return false;
					}
				}
			}
		}
		return true;
	}

	int N;
	int[] A;
	int[][] x, y;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		N = sc.nextInt();

		A = new int[N];
		x = new int[N][];
		y = new int[N][];

		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			x[i] = new int[A[i]];
			y[i] = new int[A[i]];
			for (int j = 0; j < A[i]; j++) {
				x[i][j] = sc.nextInt() - 1;
				y[i][j] = sc.nextInt();
			}
		}

		sc.close();

		int ans = 0;
		for (int i = 0; i <= (2 << N); i++) {
			int[] q = new int[N];
			for (int j = 0; j < N; j++) {
				q[j] = (i >> j) & 0x01;
			}
			if (check(q)) {
				ans = Math.max(ans, cnt(q));
			}
		}

		out.println(ans);
	}

	int cnt(int[] a) {
		int result = 0;
		for (int n : a) {
			if (n == 1) {
				result++;
			}
		}
		return result;
	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


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

typedef long long ll;
const ll MOD = 1000000007;

using namespace std;

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

    int h, w;
    cin >> h >> w;
    vector<vector<char> > a(h, vector<char>(w));
    vector<vector<int> > ans(h, vector<int>(w, 0));
    ans[0][0] = 1;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) cin >> a[i][j];
    }
    for (int r = 0; r < h; r++) {
        for (int i = r, j = 0; i >= 0 && j < w; i--, j++) {
            if (i + 1 < h && a[i + 1][j] == '.') ans[i + 1][j] = ((ll)ans[i + 1][j] + (ll)ans[i][j]) % MOD;
            if (j + 1 < w && a[i][j + 1] == '.') ans[i][j + 1] = ((ll)ans[i][j + 1] + (ll)ans[i][j]) % MOD;
        }
    }
    for (int c = 1; c < w; c++) {
        for (int i = h - 1, j = c; i >= 0 && j < w; i--, j++) {
            if (i + 1 < h && a[i + 1][j] == '.') ans[i + 1][j] = ((ll)ans[i + 1][j] + (ll)ans[i][j]) % MOD;
            if (j + 1 < w && a[i][j + 1] == '.') ans[i][j + 1] = ((ll)ans[i][j + 1] + (ll)ans[i][j]) % MOD;
        }
    }
    cout << ans[h - 1][w - 1];

    return 0;
}

Measured memory_bytes: 5248
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#define GYOU_MAX 256



int main(void)
{
	int N;
	scanf("%d", &N);
	
	char W[100][11];
	for (int i = 0; i < N; i++) {
		scanf("%s", W[i]);
	}
	int sta = 0;

	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			//printf("%s %s\n", W[i], W[j]);
			if (W[i][strlen(W[i]) - 1] != W[i + 1][0]) {
				printf("No\n");
				return 0;
			}

			if(strcmp(W[i],W[j])==0){
				printf("No\n");
				return 0;
			}
		}
	}

	
	printf("Yes\n");
	

	return 0;
}

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
#define int long long
// #define pow mypow

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9+5;
const int MOD = 1e9+7;

int n, d;
int32_t main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n >> d;
	int ans = 0;
	while(n--){
		int x, y; cin >> x >> y;
		if (x*x + y*y <= d*d) ans++;
	}
	cout << ans << endl;
	
	return 0;
}


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

int main() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int dp[n];
    dp[0] = 0; // if you dont move you burn nothing
    dp[1] = abs(a[1] - a[0]);

    for (int i = 2; i < n; i++) {
        dp[i] = min(dp[i - 2] + abs(a[i] - a[i - 2]), dp[i - 1] + abs(a[i] - a[i - 1]));
    }

    cout << dp[n - 1] << endl;

    return 0;
}

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

int main()
{
    int n,m;
    cin>>n>>m;
    int arr[m];
    long long sum=0;
    for(int i=0;i<m;i++)cin>>arr[i];

    for(int i=0;i<m;i++)sum+=arr[i];

    if(sum>n)cout<<-1<<endl;
    else cout<<n-sum<<endl;

    return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int,int> P;

int main() {
    ll N,K;cin >> N >> K;
    ll p,r,s;cin >> s >> p >> r;
    string T;cin >> T;
    int X[N] = {};
    ll res = 0;
    for (int i = 0;i < N;i++){
        if (X[i] != 1) {
            if (T[i] == 's') res += s;
            else if (T[i] == 'p') res += p;
            else res += r;
            if (i + K < N){
                if (T[i + K] == T[i]) X[i + K] =1; 
            }
        }
    }
    cout << res << endl;
}

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

int main() {
  int x;
  cin >> x;
  
  int amax = x / 500;
  int bmax = (x % 500) / 5;
  
  cout << amax * 1000 + bmax * 5 << endl;

  return 0;
}

Measured memory_bytes: 3624
#include <iostream>

using namespace std;

const bool O = true, X = false;

const bool A[4] = {
    O, O,
    O, O
};

const bool B[4] = {
    O,
    O,
    O,
    O
};

const bool C[4] = {
    O, O, O, O
};

const bool D[6] = {
    X, O,
    O, O,
    O, X
};

const bool E[6] = {
    O, O, X,
    X, O, O
};

const bool F[6] = {
    O, X,
    O, O,
    X, O
};

const bool G[6] = {
    X, O, O,
    O, O, X
};

bool matched(const bool map[8][8], const bool* pattern, const int h, const int w) {
    for (int i = 0; i < 8 - h + 1; i++) {
        for (int j = 0; j < 8 - w + 1; j++) {
            bool unmatched = false;
            for (int a = 0; a < h; a++) {
                for (int b = 0; b < w; b++) {
                    if (map[i + a][j + b] != pattern[a * w + b]) {
                        unmatched = true;
                        break;
                    }
                }
            }
            if (!unmatched) return true;
        }
    }
    return false;
}

int main(void) {
    bool map[8][8];
    char c;
    while (true) {
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                cin >> c;
                map[i][j] = (c == '1');
            }
        }
        if (cin.eof()) break;
        cin.ignore();
        char p;
        if      (matched(map, A, 2, 2)) cout << "A" << endl;
        else if (matched(map, B, 4, 1)) cout << "B" << endl;
        else if (matched(map, C, 1, 4)) cout << "C" << endl;
        else if (matched(map, D, 3, 2)) cout << "D" << endl;
        else if (matched(map, E, 2, 3)) cout << "E" << endl;
        else if (matched(map, F, 3, 2)) cout << "F" << endl;
        else if (matched(map, G, 2, 3)) cout << "G" << endl;
    }
    return 0;
}

Measured memory_bytes: 1136
import bisect

GG = [[] for i in range(26)]
L = [chr(i) for i in range(97, 123)]

s = input()
t = input()

N = len(s)
M = len(t)

for i in range(N):
	x = ord(s[i]) - 97
	GG[x].append(i)

for i in range(26):
	GG[i] = sorted(GG[i])


jud = [0] * 26
for i in range(26):
	if GG[i] != []:
		jud[i] = 1
j = "Y"
for i in range(M):
	if jud[ord(t[i]) - 97] == 0:
		j = "N"
		break

if j == "N":
	print(-1)
else:
	v = -1
	ans = 0
	for i in range(M):
		x = ord(t[i]) - 97
		y = bisect.bisect_right(GG[x], v)

		if y == len(GG[x]):
			z = GG[x][0]
		else:
			z = GG[x][y]
		if z <= v:
			ans += N
		v = z


	print(ans + v + 1)

Measured memory_bytes: 46832
program pocker;
var a,b: longint;
begin
	readln (a,b);
	if (a=b) then
	writeln ('Draw')
	else
	if (a=1) then
	writeln ('Alice')
	else
	if (b=1) then
	writeln ('Bob')
	else
	if (a>b) then
	writeln ('Alice')
	else
	if (b>a) then
	writeln ('Bob');
	
	
end.

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


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long n,i,j,k,mod=1e9+7,ans=0;
    cin>>n;
    long long a[n+1],sum[n+1];
    sum[0]=0;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        sum[i]=sum[i-1]+a[i];
    }
    for(i=1;i<n;i++)
    {
        ans+=(a[i]*((sum[n]-sum[i])%mod))%mod;
        ans=ans%mod;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 6756
#include<bits/stdc++.h>
using namespace std;
#define fori(i,a,n) for(i=a;i<=n;i++)
#define ford(i,n,a) for(i=n;i>=a;i--)
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned long long ull;
ll n,i,ans;
int main()
{
	cin>>n;
	fori(i,1,n)
	if (i%3!=0&&i%5!=0) ans+=i;
	cout<<ans<<endl;
}

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

#define ll long long
#define ar array

int main() {

    ios::sync_with_stdio(false);
    
  	int a, b, x;
  	
  	cin >> a >> b >> x;
  	
  	if(a+b<x || a>x)
  		cout << "NO" <<endl;
  	else
  		cout << "YES" <<endl;
   
    return 0;
}

Measured memory_bytes: 256
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<complex>
#include<sstream>
#include<climits>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int MAX_N = 1000;
int N, M;
ll x[MAX_N], y[MAX_N], z[MAX_N];
ll sum[MAX_N];

int main() {
  cin >> N >> M;
  rep(i,N) cin >> x[i] >> y[i] >> z[i];

  ll ans = 0;
  for (int a = -1; a <= 1; a += 2) {
    for (int b = -1; b <= 1; b += 2) {
      for (int c = -1; c <= 1; c += 2) {
        for (int i = 0; i < N; ++i) {
          sum[i] = a*x[i] + b*y[i] + c*z[i];
        }
        sort(sum, sum+N);
        ll tmp = 0;
        for (int i = N-1; i >= N-M; --i) {
          tmp += sum[i];
        }
        ans = max(ans, tmp);
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
mt = [] #空リスト作成
try: #ここから下でエラーを検出する
    while True: #無限ループ
        mt.append(float(input())) #float型にして標準入力
except EOFError: #EOFErrorを検出する
    mt.sort() #小さい順並べる
    print(mt[-1] - mt[0]) #1番大きい数から一番小さい数の差を求める


Measured memory_bytes: 5576
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

int main()
{
	boost;
	int a;
	cin >> a;
	cout << a + a * a + a * a * a;
}


Measured memory_bytes: 3636
#include <cmath>
#include <queue>
#include <cstdio>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define N 200010
#define ll long long
using namespace std;
inline int read() 
{ 
    int x=0,f=1;char ch=getchar(); 
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} 
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} 
    return x*f; 
}
ll buc[30];
char a[N];
ll n,ans;
int main()
{
	scanf("%s",a+1);
	n=strlen(a+1);
	ans=(n-1)*n/2;
	for(int i=1;i<=n;i++)
	buc[a[i]-'a']++;
	for(int i=0;i<26;i++)
	ans-=buc[i]*(buc[i]-1)/2;
	cout<<ans+1;
}

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

int main() {
  int N, count = 0;
  cin >> N;
  
  vector<int> cards(N);
  
  for (int i = 0; i < N; i++) {
    cin >> cards.at(i);
  }
  
  sort(cards.begin(), cards.end());
  reverse(cards.begin(), cards.end());
  
  for (int j = 0; j < N; j++) {
    
    if (j % 2 == 0)
      count += cards.at(j);
    else
      count -= cards.at(j);
  
  }
  
  cout << count << endl;  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define L long long
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define pii pair<pi,int>
#define aa first
#define bb second
#define xx aa.aa
#define yy aa.bb
#define zz bb
#define mp make_pair
#define mpp(a,b,c) mp(mp(a,b),c)
using namespace std;
int n,m;
double x[500010],p;
int y[500010];
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j,k,l,r,w;
	scanf("%d%d",&n,&m);
	l=1;
	r=0;
	for(i=1;i<=n;i++)
	  {
	   scanf("%d%d",&j,&k);
	   if(i>1)
	     {
		  w=k;
		  while(w)
		    if(y[l]<=w)
		      {
			   w-=y[l];
			   p-=x[l]*y[l];
			   l++;
			  }
			else
			  {
			   y[l]-=w;
			   p-=x[l]*w;
			   w=0;
			  }
		 }
	   x[++r]=j;
	   y[r]=k;
	   p+=(L)j*k;
	   while(r>l && x[r]<x[r-1])
	     {
		  x[r-1]=(x[r]*y[r]+x[r-1]*y[r-1])/(y[r]+y[r-1]);
		  y[r-1]+=y[r];
		  r--;
		 }
	   printf("%.10lf\n",p/m);
	  }
	return 0;
}


Measured memory_bytes: 16384
#include<stdio.h>

int main()
{
  int A[100],N,i,j,key;
  scanf("%d",&N);
  for(i=0;i<N;i++) scanf("%d",&A[i]);
  for(j=0;j<N;j++){
    printf("%d",A[j]);
    if(j<N-1) printf(" ");
  }
  printf("\n");
  for(i=1;i<N;i++){
    key=A[i];
    j=i-1;
    while(j>=0 && A[j]>key){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=key;
    for(j=0;j<N;j++){
      printf("%d",A[j]);
      if(j<N-1) printf(" ");
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2144
parseInt(x) = parse(Int, x)
a=zeros(Int64,6)
ok=true
for i in 1:6
    a[i]=parseInt(readline())
end
for i in 1:5
    for j in 1:5
        if i>j
            if a[i]-a[j]>a[6]
                ok=false
            end
        end
    end
end
if ok
    println("Yay!")
else
    println(":(")
end

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

typedef long long ll;

int main(){
  ll i,n,num,len,p,l[100000];
  while(cin >> n,n){
    num = n; len = 0;
    for(i=0;i<n;i++){
      cin >> p; len += p;
    }

    for(i=0;i<n-1;i++)cin >> l[i];
    sort(l,l+n-1);

    for(i=n-2;i>=0;i--){
      if( (num-1)*(len+l[i]) < num*len )break;
      num--; len += l[i];
    }
    cout << num*len << endl;
  }
}
   

Measured memory_bytes: 1684
#include <stdio.h>

#define Mod 1000000007

long long div_mod(long long x, long long y, long long z)
{
	if (x % y == 0) return x / y;
	else return (div_mod((1 + x / y) * y - x, (z % y), y) * z + x) / y;
}

int main()
{
	int N, M, K;
	scanf("%d %d %d", &N, &M, &K);

	int i, L = N * M;
	long fact[200001], fact_inv[200001];
	for (i = 1, fact[0] = 1; i <= L; i++) fact[i] = fact[i-1] * i % Mod;
	for (i = L - 1, fact_inv[L] = div_mod(1, fact[L], Mod); i >= 0; i--) fact_inv[i] = fact_inv[i+1] * (i + 1) % Mod;
	
	long long ans = 0;
	for (i = 1; i <= M - 1; i++) ans += (long long)i * N * N * (M - i) % Mod;
	for (i = 1; i <= N - 1; i++) ans += (long long)i * M * M * (N - i) % Mod;
	ans = ans % Mod * fact[N*M-2] % Mod * fact_inv[N*M-K] % Mod * fact_inv[K-2] % Mod;
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K; cin >> N >> K;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    vector<ll> sum(N+1,0);
    rep(i,N) sum[i+1]=sum[i]+A[i];
    multiset<ll> s,dust;
    rep(i,N+1) rep2(j,i+1,N+1) s.insert(sum[j]-sum[i]);
    ll maxi=-1,ans=0,MAX=50;
    vector<ll> cnt(MAX,0);
    while(true){
        fill(all(cnt),0);
        bool ok=false;
        dust.clear();
        for (auto x:s){
            if (maxi!=-1&&!(x&1LL<<maxi)){
                dust.insert(x);
                continue;
            }
            rep(i,MAX) if (x&1LL<<i) ++cnt[i];
        }
        for (auto x:dust) s.erase(s.lower_bound(x));
        rep(i,MAX) if (cnt[i]>=K) maxi=i,ok=true;
        if (ok) ans|=1LL<<maxi,MAX=maxi;
        else break;
    }
    cout << ans << endl;
}

Measured memory_bytes: 42624
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
// #define N 1000005
#define ull unsigned long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define ull unsigned long long 
#define sc second
#define pb push_back
#define mp make_pair
#define sp <<" "
#define all(a) (a).begin(),(a).end()
#define fi(i,a,n) for(int i=a ; i<n ; i++)
#define fd(i,n,a) for(int i=n-1 ; i>=a ; i--)
#define r0 return 0;
#define ln "\n"
#define INF (int)1e15
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main(){
	 fast
    // int t;cin>>t;
    // while(t--){

    // }
    string s;cin>>s;
    int a=0;
    for(int i=0;i<s.size();i++){
        a+=(s[i]-'0');
    }
    if(a%9==0) cout<<"Yes"<<"\n";
    else cout<<"No"<<"\n";
	r0;
}
 

Measured memory_bytes: 3776
#include <iostream>
#define N 110

int t = 1;

int d[N], f[N];
int A[N][N];

void Depth(int id, int n){
  d[id] = t;
  t++;
  for(int i=1; i<=n; i++){
    if(A[id][i] == 1 && d[i] == 0){
      Depth(i, n);
    }
  }
  f[id] = t;
  t++;
}



int main(){
  for(int i=0; i<N; i++){
    d[i]=f[i]=0;
    for(int j=0; j<N; j++){
      A[i][j]=0;
    }
  }
  int n;
  std::cin >> n;
  for(int i=0; i<n; i++){
    int u, k, v;
    std::cin >> u >> k;
    for(int i=0; i<k; i++){
      std::cin >> v;
      A[u][v]=1;
    }
  }
  for(int i=1; i<=n; i++){
    if(d[i] == 0 && f[i] == 0){ Depth(i, n); }
  }
  for(int i=1; i<=n; i++){
    std::cout << i << " " << d[i] << " " << f[i] << std::endl;
  }

  return 0;
}



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

const int maxn = 100010;
int dp[maxn], n, k, a[maxn];

int main() {
	//freopen("demo.in", "r", stdin);
	//freopen("demo.out", "w", stdout);
	
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]); 
	memset(dp, 0x7f7f7f7f, sizeof(dp));
	dp[0] = 0;	
	for (int i = 1; i < n; i++)
		for (int j = 1; j <= min(i, k); j++)
			dp[i] = min(dp[i], dp[i-j] + abs(a[i] - a[i-j]));
	printf("%d\n", dp[n-1]);
	return 0;
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j

int main() {
  double t, x;
  cin >> t >> x;
  printf("%4f\n", t / x);
};


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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

int main(int argc, char* argv[]) {
  std::string S;
  std::cin >> S;

  if (S == "Sunny") {
    put("Cloudy");
    return 0;
  }

  if (S == "Cloudy") {
    put("Rainy");
    return 0;
  }

  if (S == "Rainy") {
    put("Sunny");
    return 0;
  }
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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;
}

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 256
# encoding: utf-8
S = list(map(int, list(input())))
N = len(S)

def ans(bits):
    term = 0
    ret = 0
    for i, Si in enumerate(S):
        term = term * 10 + Si
        bit = (bits >> i) % 2
        if bit == 1:
            ret += term
            term = 0
    ret += term
    # print("##", bits, ret)
    return ret

def acm(pos, bits):
    # end
    # print("#", pos, "{:010b}".format(bits))
    if pos == N - 1: return ans(bits)
    # branch
    return acm(pos + 1, bits) + acm(pos + 1, bits + (1 << pos))

print(acm(0, 0))
    

Measured memory_bytes: 3064
n,x = map(int,input().split())
a = list(map(int,input().split()))
aa = sorted(a)
nokori = x
cnt = 0
if x > sum(a):
         print(n-1)
else:
         for i in range(n):
                  if nokori >= aa[i]:
                           cnt +=1
                           nokori = nokori - aa[i]
         print(cnt)


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

vector<vector<int> > Solve(vector<int>& L, vector<int>& R, int K) {
	vector<vector<int> > ANS(1 << K, vector<int>(K));
	if (K == 1) {
		ANS[0] = L, ANS[1] = R;
		return ANS;
	}
	int D;
	for (int i = 0; i < K; i++) {
		if (L[i] != R[i]) {
			D = i;
			break;
		}
	}
	vector<int> Left, Mid, Right;
	for (int i = 0; i < K; i++) {
		if (i != D) Left.push_back(L[i]), Right.push_back(R[i]);
	}
	Mid = Left;
	Mid[0] = 1 - Mid[0];
	vector<vector<int> > VL = Solve(Left, Mid, K - 1), VR = Solve(Mid, Right, K - 1);
	for (int i = 0; i < 1 << (K - 1); i++) {
		for (int j = 0; j < K; j++) {
			if (j < D) ANS[i][j] = VL[i][j];
			if (j == D) ANS[i][j] = L[D];
			if (j > D) ANS[i][j] = VL[i][j - 1];
		}
	}
	for (int i = 0; i < 1 << (K - 1); i++) {
		for (int j = 0; j < K; j++) {
			if (j < D) ANS[i + (1 << (K - 1))][j] = VR[i][j];
			if (j == D) ANS[i + (1 << (K - 1))][j] = R[D];
			if (j > D) ANS[i + (1 << (K - 1))][j] = VR[i][j - 1];
		}
	}
	return ANS;
}

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	vector<int> L(N), R(N);
	for (int i = 0; i < N; i++) L[i] = A % 2, A /= 2, R[i] = B % 2, B /= 2;
	int COUNT = 0;
	for (int i = 0; i < N; i++) if (L[i] != R[i]) COUNT++;
	if (COUNT % 2 == 0) {
		cout << "NO" << endl;
		return 0;
	}
	cout << "YES" << endl;
	vector<vector<int> > V = Solve(L, R, N);
	for (int i = 0; i < (1 << N); i++) {
		int ANS = 0;
		for (int j = N - 1; j >= 0; j--) {
			ANS <<= 1;
			ANS += V[i][j];
		}
		cout << ANS << (i == (1 << N) - 1 ? '\n' : ' ');
	}
}

Measured memory_bytes: 39064
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

int N;
ll A[10000];
map<int, int>mp;

ll pw(ll x, int y) {
	ll a = 1;
	while (y) {
		if (y & 1)a = a*x%mod;
		x = x*x%mod;
		y /= 2;
	}
	return a;
}

ll modinv(ll x) {
	return pw(x, mod - 2);
}

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		int t = A[i];
		for (int i = 2; i*i <= t; i++) {
			if (t%i == 0) {
				int c = 0;
				while (t%i == 0) {
					t /= i;
					c++;
				}
				mp[i] = max(mp[i], c);
			}
		}
		if (t != 1) {
			mp[t] = max(mp[t], 1);
		}
	}
	ll a = 1;
	for (auto p : mp) {
		a *= pw(p.first, p.second);
		a %= mod;
	}
	ll res = 0;
	for (int i = 0; i < N; i++) {
		res += a*modinv(A[i]);
		res %= mod;
	}
	cout << res << endl;
}

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

long long gcd(long long A, long long B) {
    if (B == 0) return A;
    return gcd(B, A % B);
}

int main() {
    int A, B;
    cin >> A >> B;
    long long ans = A/gcd(A, B)*B;
    cout << ans << endl;
    return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<int>());
    if (s < t)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int n;
  cin>>n;
  int l[n], r[n];
  rep(i,n) cin>>l[i]>>r[i];
  int ans = 0;
  rep(i,n) {
    ans += r[i] - l[i] + 1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

typedef pair<ll, ll> P;
vec d;
struct edge {
    ll to, cost;
};
vector<vector<edge>> graph;

void dijkstra (ll s, ll V) {
    priority_queue<P, vector<P>, greater<P>> que;
    d.assign(V, inf);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top(); que.pop();
        ll v = p.second;
        if (d[v] < p.first) continue;
        for (edge e : graph[v]) {
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

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

    ll N, M;
    cin >> N >> M;
    graph.assign(N, vector<edge>());
    while (M--) {
        ll A, B;
        cin >> A >> B;
        A--; B--;
        graph[A].push_back({B, 1});
        graph[B].push_back({A, 1});
    }

    dijkstra(0, N);

    // Rep (i, N) {
    //     cout << d[i] << " \n"[i==N-1];
    // }

    cout << "Yes\n";

    Rep (i, N) {
        if (i == 0) continue;

        for (auto nv : graph[i]) {
            if (d[nv.to] == d[i]-1) {
                cout << nv.to+1 << "\n";
                break;
            }
        }
    }
}

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


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

  ll zmax = 0, zmin = 2 * 1e9, wmax = -1e9, wmin = 1e9;
  ll x, y;
  rep(i, n) {
    cin >> x >> y;
    zmax = max(zmax, x + y);
    zmin = min(zmin, x + y);
    wmax = max(wmax, x - y);
    wmin = min(wmin, x - y);
  }

  cout << max(zmax - zmin, wmax - wmin) << endl;
  
  return 0;
}


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

int main(void)
{
    int q;
    double x;

    while (scanf("%d", &q), q != -1){
        x = q / 2.0;
        while (0.00001 * q <= fabs(x * x * x - q)){
            x = x - (x * x * x - q) / (3 * x * x);
        }
        printf("%f\n", x);
    }

    return (0);
}

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

int main() {
  string s;
  cin >> s;
  int sum = 0;
  for (char x : s) sum += x - '0';
  if (stoi(s) % sum == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int i,j,k,count1=0,count2=0;
void ABC161();
void ABC162();
void ABC163();
void ABC164();

int main(){
    ABC163();
}

void ABC163(){
    int n,x;
    cin>>n;
    vector<int> vec(n,0);
    for(i=0;i<n-1;i++){
        cin>>x;
        vec[x-1]++;
    }
    for(i=0;i<n;i++){
        cout<<vec[i]<<endl;
    }
}

Measured memory_bytes: 3992
/*input

*/


// assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pii         pair<ll ,ll >
#define vpii        vector< pii >
#define vi          vector<ll >
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll )x.size()
#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 lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define debug(x)     cout << #x << " " << x << endl;
#define debug_p(x)   cout << #x << " " << x.F << " " << x.S << endl;
#define debug_v(x)   {cout << #x << " "; for (auto ioi : x) cout << ioi << " "; cout << endl;}
#define debug_vp(x)  {cout << #x << " "; for (auto ioi : x) cout << '[' << ioi.F << " " << ioi.S << ']'; cout << endl;}
#define debug_v_v(x) {cout << #x << "/*\n"; for (auto ioi : x) { for (auto ioi2 : ioi) cout << ioi2 << " "; cout << '\n';} cout << "*/" << #x << endl;}

const ll N = 2e5+5;
vvi adj;
vi col;
vi s(N,0);
vi ans;
ll tmr=0;
ll n;
vvi f(N,vi ());
vi tin(N,-1);
void dfs(ll u,ll p=-1)
{
	tin[u] = tmr++;

	s[u]=1;
	rep(i,0,sz(adj[u]))
	{
		ll ch = adj[u][i];
		if(ch==p) continue;
		dfs(ch,u);

		s[u]+=s[ch];

		ll w = s[ch];
		while(sz(f[col[u]]) && tin[f[col[u]].back()] > tin[u] ) w-=s[f[col[u]].back()],f[col[u]].pop_back();
		ans[col[u]]-=w*(w-1);
	}

	f[col[u]].pb(u);
	return ;
}

int solve()
{
	cin>>n;

	adj.assign(n,vi ());
	col.assign(n,0);
	ans.assign(n,n*(n-1));
	map<ll,ll> m;
	rep(i,0,n) cin>>col[i],col[i]--,m[col[i]]++;
	rep(i,0,n-1)
	{
		ll x,y;cin>>x>>y;
		x--,y--;
		adj[x].pb(y);
		adj[y].pb(x);
	}

	dfs(0);

	rep(i,0,n)
	{
		ll w = n;
		while(sz(f[i])) w-=s[f[i].back()],f[i].pop_back();
		ans[i]-=w*(w-1);
	}

	rep(i,0,n) cout<<ans[i]/2 + m[i]<<"\n";





	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

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

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	//cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}


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

using namespace std;

int main(){
        int N;
        cin>>N;
        vector <int> x(N);
        for(int i=0;i<N;i++){
                cin>>x[i];
        }
        vector <int> vx(N);
        vx=x;
        sort(vx.begin(), vx.end());
        int x1=vx[N/2];
        int x2=vx[(N-1)/2];
        //cout<<x1<<":"<<x2<<endl;
        for(int i=0;i<N;i++){
                if(x[i]>=x1)cout<<x2<<endl;
                else cout<<x1<<endl;
        }
        return 0;
}


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans=n;
  rep(i,n-1) {
    if(s[i]==s[i+1]) ans--;
  }

  cout << ans << endl;
}

Measured memory_bytes: 512
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End


/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cini(N);
    Cins(S);
    int tempContinuousNumber = 0;
    int deleteSlime = 0;
    rep(i,N){
        if(tempContinuousNumber==0 || S[i]!=S[i-1]){
            deleteSlime += max(tempContinuousNumber - 1,0);
            tempContinuousNumber = 0;
            tempContinuousNumber++;
            continue;
        }
        if(S[i]==S[i-1]){
            tempContinuousNumber++;
            continue;
        }
    }
    cout << N - deleteSlime - (tempContinuousNumber-1) << nn;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>

using namespace std;

typedef long long ll;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  string s;
  cin >> s;
  cout << s.substr(0, 3) << '\n';
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
void answer(vector<vector<int>> v){
    rep(i,3){
        rep(j,10){
            cout <<' '<< v.at(i).at(j) ;
        }
        cout << endl;
    }
    
}
void print(){
    rep(i,20) cout << "#" ;
    cout << endl;
}
int main() {
    int n,a,b,c,d;
    cin >> n;
    vector<vector<int>> A(3,vector<int>(10,0)),B(3,vector<int>(10,0)),C(3,vector<int>(10,0)),D(3,vector<int>(10,0));
    rep(i,n){
        cin >> a >> b >>c >> d;
        if(a==1) A.at(b-1).at(c-1) += d;
        else if(a==2) B.at(b-1).at(c-1) += d;
        else if(a==3) C.at(b-1).at(c-1) += d;
        else if(a==4) D.at(b-1).at(c-1) += d;
    }
    answer(A);
    print();
    answer(B);
    print();
    answer(C);
    print();
    answer(D);
    
    
}


Measured memory_bytes: 3140
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
#include<cstring>
#include<set>
// #include<stack>
// #include<queue>
using namespace std;
typedef long long ll;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll tmp1,tmp2;
const ll mod = 1e9+7;
const int INF = 1e9;
const ll INFLONG = 1e18;
vector<vector<ll>> vec(1000,vector<ll>(1000));
vector<ll> counter(1000,0);
vector<ll> check(1000,0);
int main(){
  ll n;
  cin >> n;
  rep(i,n){
    rep(j,n-1){
      cin >> vec[i][j];
    }
  }
  bool chan = true;
  ll cou = -1;
  while(chan){
    chan = false;
    rep(i,n){
      if(counter[i] < n-1){
        tmp1 = vec[i][counter[i]]-1;
        if(tmp1 < n && vec[tmp1][counter[tmp1]] == i+1 &&check[i]==0 && check[tmp1]==0){
          counter[i]++;counter[tmp1]++;
          check[i]=1;check[tmp1]=1;
          chan = true;
        }
      }
    }
    rep(i,n){
      check[i] = 0;
      //cout << counter[i] << " ";
    }
    //cout << endl;
    cou++;
  }
  bool can = true;
  rep(i,n){
    if(counter[i] == n-1){

    }else{
      can = false;
      break;
    }
  }
  if(can){
    cout << cou;
  }else{
    cout << -1;
  }
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	int K;
	cin >> K;
	if (K%2==0||K%10==5) {
		ce(-1);
		return 0;
	}
	if (K == 7 || K==1) {
		ce(1);
		return 0;
	}
	int ans = 1;
	ll k = 7;
	while (k!=0) {
		ans++;
		k = k * 10 + 7;
		k %= K;
	}
	ce(ans)
    return 0;
}



Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
/*メモ 
*/
int main(){
    int n;
    std::cin >> n;
    string s;
    std::cin >> s;
    std::vector<int> c(n),cc(n);
    if(s[0]=='#')c[0]=1;
    if(s[n-1]=='.')cc[n-1]=1;
    rep(i,n-1){
        c[i+1]=c[i];
        if(s[i+1]=='#')c[i+1]++;
    }
    irep(i,n-1){
        cc[i]=cc[i+1];
        if(s[i]=='.')cc[i]++;
    }
  //  rep(i,n)std::cout << cc[i] << std::endl;
    int ma=c[n-1];
    rep(i,n-1){
        ma=min(ma,cc[i+1]+c[i]);
    }
    ma=min(ma,cc[0]);
    std::cout << ma << std::endl;
}

Measured memory_bytes: 2180
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            var cin = new MyInputStream();

            var N = cin.ReadInt();
            var p = new int[N];
            int cnt = 0;
            for (int i = 0; i < N; ++i)
                p[i] = cin.ReadInt();

            for (int i = 0; i < N - 1; ++i)
            {
                if (p[i] == i + 1)
                {
                    int tmp = p[i]; p[i] = p[i + 1]; p[i + 1] = tmp;
                    cnt++;
                }
            }
            for (int i = N - 1; i > 1; --i)
            {
                if (p[i] == i + 1)
                {
                    int tmp = p[i]; p[i] = p[i - 1]; p[i - 1] = tmp;
                    cnt++;
                }
            }
            Console.WriteLine(cnt);
        }
    }

    public class MyInputStream
    {
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(char separator = ' ')
        {
            this.separator = separator;
            inputStream = new Queue<string>();
        }

        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = Console.ReadLine().Trim().Split(separator);
            for (int i = 0; i < tmp.Length; i++)
            {
                inputStream.Enqueue(tmp[i]);
            }
            return inputStream.Dequeue();
        }
        public string ReadLine() => Console.ReadLine();
        public int ReadInt() => int.Parse(Read());
        public long ReadLong() => long.Parse(Read());
        public double ReadDouble() => double.Parse(Read());
        public string r() => Read();
        public int ri() => ReadInt();
        public long rl() => ReadLong();
        public double rd() => ReadDouble();
    }
}


Measured memory_bytes: 20832