akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        String s = "";
        for(int i = 0; i < 3; i++){
            s += sc.next();
        }
        System.out.println(Integer.parseInt(s) % 4 == 0 ? "YES" : "NO");
        
        
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
            return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 21076
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(), M = sc.nextInt(), total=0;
    int A[] = new int[M];
    for(int i=0; i<M; i++) {
      A[i] = 0;
    }
    
    for(int j=0; j<N; j++) {
      int L = sc.nextInt();
      for(int k=0; k<L; k++) {
        int f = sc.nextInt();
        A[f-1] ++;
      }
    }
    
    for(int l=0; l<M; l++) {
      if(A[l] == N) {
        total++;
      }
    }
    System.out.println(total);
  }
}

Measured memory_bytes: 38460
#coding:utf-8

if __name__ == "__main__":
    S = input()
    N = len(S)
    if S[0] == "0":
        Sn = [int(S[n]) for n in range(N)]
    else:
        Sn = [(int(S[n])+1)%2 for n in range(N)]

    total0 = 0
    total1 = 0

    # 0101...
    for n in range(N):
        # n文字目は(n%2)になってほしい
        if Sn[n] != n%2:
            total0 += 1
    # 1010...
    for m in range(N):
        # n文字目は((n+1)%2)になってほしい
        if Sn[m] != (m+1)%2:
            total1 += 1

    print(min(total0, total1))

Measured memory_bytes: 3956
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=200200,P=1000000007;
int i,j,k,n,m,ch,ff,l,r,sum;
int f[N];
struct cc { int x,y;} A[N],B[N];
void R(int &x) {
	ff=x=0;ch=getchar();
	while (ch<'0' || '9'<ch) { if (ch=='-') ff=1;ch=getchar();}
	while ('0'<=ch && ch<='9') x=x*10+ch-'0',ch=getchar();
	if (ff) x=-x;
}
bool cmpx(const cc &a,const cc &b) {
	if (a.x==b.x) return a.y<b.y;
	return a.x<b.x;
}
bool cmpy(const cc &a,const cc &b) {
	if (a.y==b.y) return a.x<b.x;
	return a.y<b.y;
}
int main() {
	R(n);
	for (i=1;i<=n;i++) R(A[i].x),R(A[i].y);
	sort(A+1,A+n+1,cmpy);
	for (i=1;i<=n;i++) A[i].y=i;
	sort(A+1,A+n+1,cmpx);
	for (i=1;i<=n;i++) A[i].x=i;
	B[0].y=0;B[n+1].x=n+1;
	for (i=1;i<=n;i++) B[i].y=max(B[i-1].y,A[i].y);
	for (i=n;i;i--) B[i].x=min(B[i+1].x,A[i].y);
	f[0]=1;l=0;r=0;sum=1;
	for (i=1;i<=n;i++) {
		while (r<B[i].y) r++,sum=(sum+f[r])%P;
		while (l<B[i].x-1) sum=(sum+P-f[l])%P,l++;
		f[B[i].y]=(f[B[i].y]+sum)%P;
		sum=(sum+sum)%P;
	}
	printf("%d\n",f[n]);
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
    ll n;cin>>n;
    if(n%2==1){
        cout<<"0"<<endl;
        return 0;
    }
    ll five=0;
    ll tmp=10;
    while(n>=tmp){
        ll a=n/tmp; 
        five+=a;
        tmp*=5;
    }
    cout<<five<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int W,a,b;
int main(){
    cin>>W>>a>>b;
    if(b>=a&&b<=a+W)cout<<0<<"\n";
    else if(b>a+W)cout<<b-a-W<<"\n";
    else cout<<a-b-W<<"\n";
    return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int[] count = new int[100];
		int max = 0;
		while(scan.hasNext()){
			int a = scan.nextInt();
			count[a-1]++;
		}

		for(int i = 0; i < 100; i++){
			if(count[i] > max){
				max = count[i];
			}
		}
		for(int i = 0; i < 100; i++){
			if(count[i] == max){
				System.out.printf("%d\n", i+1);
			}
		}
	}
}

Measured memory_bytes: 26352
# -*- coding: utf-8 -*-

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

s = 0
a = sum(l)
ans = float('inf')

for i in range(0, n-1):
    s += l[i]
    a -= l[i]
    ans = min(ans, abs(s-a))

print(ans)


Measured memory_bytes: 24932
#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, m;
    cin >> n >> m;
    vector<P> p(m);
    rep(i,m) cin >> p[i].first >> p[i].second;
    rep(x,1000) {
        int keta = 1;
        int nx = x/10;
        //vector<型名> 変数名(要素数,値);
        vector<int> d(1,x%10);
        while(nx){
            keta++;
            //push_backはvector d内の末尾にnx%10を追加する
            d.push_back(nx%10);
            nx /= 10;
        }
        if (keta != n) continue;
        bool ok = true;
        reverse(d.begin(),d.end());
        rep(i,m){
            if (d[p[i].first-1] != p[i].second) ok = false;
        }
        if (ok) {
            cout << x << "\n";
            return 0;
        }
    }
    cout << "-1" << "\n";
    return 0;
}

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

int main(){
  int a, b, c, n1, n2, n3;
  cin>>a>>b>>c;
  if(a<b){
    n1 = a;
    n2 = b;
  }
  else{
    n1 = b;
    n2 = a;
  }
  if(c<n1){
    n3 = n2;
    n2 = n1;
    n1 = c;
  }
  else if(c<n2){
    n3 = n2;
    n2 = c;
  }
  else{
    n3 = c;
  }
  cout<<n1<<" "<<n2<<" "<<n3<<endl;
  return 0;
}



Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 109
int a[N],n,k,s,t,tot;
int vis[300009];
ll C[N][N],D[N][N];
int main() 
{
	cin>>n>>k>>s>>t;	
	for (int i=0;i<=n;i++) D[i][0]=C[i][0]=1;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=i;j++) 
		{
			C[i][j]=C[i-1][j]+C[i-1][j-1];
			D[i][j]=D[i][j-1]+C[i][j]; 
		}
	for(int i=1,x;i<=n;i++) 
	{
		scanf("%d",&x);
		if ((x&s)==s && (x&t)==x)
			a[++tot]=x;
	} 
	t^=s;
	int cnt=0;
	for(int j=0;j<18;j++)
		if(t>>j&1) cnt++;
	//printf("%d %d\n",cnt,tot);
	for(int i = 1; i <= tot; i++) 
	{
		int val=1,sum=0;
		for(int j=0;j<18;j++) 
		{
			if((a[i]>>j&1) && (t>>j&1)) sum+=val;
			if(t>>j&1) val*=2;
		}
		a[i]=sum;
	}
	ll ans=0;
	for(int i=0;i<(1<<cnt);i++) vis[i]=0;
	for(int t=0;t<(1<<cnt);t++) 
	{
		int s=1;
		for(int j=0;j<cnt;j++)
			if(t>>j&1) s*=-1;
		ll sum=0;
		for(int i=1;i<=tot;i++) 
		{
			sum-=D[vis[a[i]&t]][min(vis[a[i]&t],k)];
			vis[a[i]&t]++;
			sum+=D[vis[a[i]&t]][min(vis[a[i] & t],k)];
		}
		for(int i=1;i<=tot;i++)
			vis[a[i]&t]--;
		ans+=s*sum;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4960
using System;

namespace TP1_10_B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            double a = double.Parse(str[0]);
            double b = double.Parse(str[1]);
            double c = double.Parse(str[2]);

            double h = b * Math.Sin(c * Math.PI / 180 );
            double l = a + b + Math.Sqrt((Math.Pow(a, 2) + (Math.Pow(b, 2) - 2 * a * b * Math.Cos(c * Math.PI / 180))));
            double area = a * h / 2;

            Console.WriteLine("{0:F8}", area);
            Console.WriteLine("{0:F8}", l);
            Console.WriteLine("{0:F8}", h);
        }
    }
}

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

using namespace std;
#define int long long
#define N 666666
int f[N];
int getf(int v){
	if(v==f[v]){
		return f[v];
	}else{
		f[v]=getf(f[v]);
	}
	return f[v];
}
int merge(int u,int v){
	int t1=getf(u);
	int t2=getf(v);
	if(t1!=t2){
		f[t2]=t1;
	}
}
int n,m;

signed main(){
	cin>>n>>m;
	for(int i=0;i<=n;i++) f[i]=i;
	for(int i=1;i<=m;i++){
		int x,y,z;
		cin>>x>>y>>z;
		merge(x,y); 
	} 
	int tot=0;
	for(int i=1;i<=n;i++)
		if(i==f[i]) tot++;
	cout<<tot;
	return 0;
}

Measured memory_bytes: 1024
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (ll &e : a)
        cin >> e;
    ll ans = 0;
    for (ll i = 0; i < n; i++)
        for (ll j = i + 1; j < n; j++)
            for (ll k = j + 1; k < n; k++)
            {
                ll v[3] = {a[i], a[j], a[k]};
                sort(v, v + 3);
                if (v[0] != v[1] && v[1] != v[2] && v[0] + v[1] > v[2])
                    ans++;
            }
    cout << ans;
}

Measured memory_bytes: 3660
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define popb pop_back()
#define ll long long
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define forn(x) for(int i=1;i<=x;i++) 
#define sforn(x, y) for(int i=1;i<=x;i++)for(int j=1;j<=y;j++)
#define pii pair<int, int>
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

/*
    LOL KEK CHEBUREK
 
    PIHALITI
 
 */
vector<pii> p;
int main(){ speed;
    int n;
    cin >> n;
    for(int i=1;i<=n;i++){
        int x, y;
        cin >> x >> y;
        p.pb(mp(x, y));
    }

    double ans = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            ans += sqrt((p[i].F-p[j].F) *(p[i].F-p[j].F)  + (p[i].S-p[j].S) *(p[i].S-p[j].S)); 
        }
    }
    cout <<fixed << setprecision(10) << ans / n << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int id[12];

bool check(){
  int cd = id[11];
  int sum = 0;
  REP(i,11){
    int q;
    int n = 11-i;
    if(n<=6){
      q = n+1;
    }else{
      q = n-5;
    }
    sum += id[i]*q;
  }
  int amari = sum%11;
  int res = 0;
  if(amari <= 1){
    res = 0;
  }else{
    res = 11-amari;
  }
  return res==cd;
}

int main(){
  string s;
  cin>>s;
  int qu;
  REP(i,12){
    if(s[i]=='?'){
      qu = i;
      id[i] = -1;
    }else{
      id[i] = s[i]-'0';
    }
  }
  vi cand;
  REP(d,10){
    id[qu] = d;
    if(check())cand.push_back(d);
  }
  if(cand.size()==1){
    cout<<cand[0]<<endl;
  }else{
    cout<<"MULTIPLE"<<endl;
  }
  return 0;
}

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

int Bit(int x) {
	return 1 << x;
}

const int bit1 = Bit(2);
const int bit2 = Bit(1);
const int bit3 = Bit(0);

void pformula(int A, int B, int C, int D, int flg){
	char ope1 = (flg & bit1) != 0 ? '+' : '-';
	char ope2 = (flg & bit2) != 0 ? '+' : '-';
	char ope3 = (flg & bit3) != 0 ? '+' : '-';
	cout << A << ope1 << B << ope2 << C << ope3 << D <<"=7"<<endl;

}

int main(void) {
	int N;
	cin >> N;
	int A, B, C, D;
	A = N / 1000;
	N -= A * 1000;
	B = N / 100;
	N -= B * 100;
	C = N / 10;
	N -= C * 10;
	D = N;

	int answer;
	int flg = 0;
	for (flg; flg < 8; flg++) {
		answer = A;
		(flg & bit1) != 0 ? answer += B : answer -= B;
		(flg & bit2) != 0 ? answer += C : answer -= C;
		(flg & bit3) != 0 ? answer += D : answer -= D;
		if (answer == 7) {
			pformula(A, B, C, D, flg);
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 256
def resolve():
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())

    dist = abs(A - B)
    dist_b = dist + W*T
    # if B <= A and (B - W*T) < (-10)**9:
    #     dist_b = abs(A - (-10)**9)

    # elif B > A and (B + W*T) > 10**9:
    #     dist_b = abs(A - 10**9)

    if V*T >= dist_b:
        print("YES")
    else:
        print("NO")




if __name__ == "__main__":
    resolve()

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

#define ll long long int
#define watch(x) cout << (#x) << " is " << (x) << endl
#define f(i,x,n)  for(int i=x;i<n;i++)
#define FASTIO cin.tie(0); cout.tie(0);
#define eb(x) emplace_back(x)
#define mp(a,b) make_pair(a,b)
#define sz(a) int((a).size())
#define mod 1000000007
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)

//MIN-MAX
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))

//LCM
int lcm(int a, int b) {  return a * (b / __gcd(a, b)); }

//For sort by second
bool cmp(const pair<int,int> &a)
{ return a.first<a.second; }

//Tree
/* const int MAXN = 1e5 + 5;
vector<ll> adj[MAXN];*/

//ModPower
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}

int main()
{
	FASTIO;
	ll a,b,c;
	cin>>a>>b>>c;
	ll temp=a;
	ll zero=0;
	a=max(a-c,zero);
    c-=temp;
	if(c>0)
        b=max(b-c,zero);

    cout<<a<<" "<<b<<"\n";
	return 0;
}













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

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

void pre(){

}

void solve(){
    string s;
    cin>>s;
    if(s[2]==s[3] and s[4] == s[5])
        cout << "Yes";
    else cout << "No";

}

int main(){
    #ifdef ONLINE_JUDGE
    freopen("input00.txt","r",stdin);
    #endif
    IOS;
    pre();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np

def S(): return sys.stdin.readline().rstrip().split(' ')
def Ss(): return list(S())
def I(): return _I(Ss())
def Is(): return list(I())
def _I(ss): return map(int, ss) if len(ss) > 1 else int(ss[0])

a = I()
print(a + a*a + a*a*a)

Measured memory_bytes: 27028
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,i = LI()
print(n-i+1)


Measured memory_bytes: 38256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
using namespace std;
using ll = long long;
const ll mod = 1e9+7;
int main(){
  ll n,maximum=0,x;
  cin >> n;
  ll count = 0;
  for(int i=0;i<n;i++){
    cin >> x;
    if(x >= maximum){
      count ++;
      maximum = x;
    }
  }
  cout << count;
}


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

int main(){
	int N,D;
	cin >> N >> D;
	vector<vector<int> > x(N,vector<int>(D));
	for(int i=0;i<N;i++) {
		for(int j=0;j<D;j++) {
			cin >> x[i][j];
		}
	}
	int ans = 0;

	for(int i=0;i<N;i++) {
		for(int j=i+1;j<N;j++) {
			int sum = 0;
			for(int k=0;k<D;k++) {
				sum += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
			}
			for(int k=1;k*k<=sum;k++) {
				if(k*k==sum) {
					ans++;
					break;
				}
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int d[500005];
char S[500005];
ll ans;

int main(void) {
    scanf("%s", S);
    int n = strlen(S);
    d[0] = 0;
    int i = 0;
    while (i < n) {
    	if (S[i] == '>') {
    		int s = i;
    		int cnt = 0;
    		while (S[i] == '>' && i < n) {
    			i++;
    			cnt++;
    		}

    		d[s+cnt] = 0;
    		for (int j = s + cnt - 1; j > s; j--) {
    			d[j] = d[j+1]+1;
    		}
    		d[s] = max(d[s], cnt);
    		
    	} else {
    		d[i+1] = d[i]+1;
    		i++;
    	}
    }

    REP(i, 0, n+1) ans += (ll)d[i];


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

	return 0;
}


Measured memory_bytes: 2688
s = input()
am = s[0]+s[1]
pm = s[2]+s[3]
p = ["01","02","03","04","05","06","07","08","09","10","11","12"]
if am in p and pm in p:
    print("AMBIGUOUS")
elif am in p and pm not in p:
    print("MMYY")
elif am not in p and pm in p:
    print("YYMM")
elif am not in p and pm not in p:
    print("NA")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll  long long
#define ull unsigned long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd double
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#define boost ios_base::sync_with_stdio(0)
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n)    for(ll i=0;i<n;++i)
#define ren(i,n)    for(ll i=n-1;i>=0;i--)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end();
#define sc(x) scanf("%lld",&x)
#define clr(x,val) memset(x,val,sizeof(x))
#define pr(x) printf("%lld\n",x) 
#define gc getchar
#define pdd pair<dd,dd>
#define prec(x) cout<<fixed<<setprecision(x)
using namespace std;
ll a[200005];

int main(){
   ll n,k;
   cin>>n>>k;
   for(ll i=1;i<=n;i++)cin>>a[i];
   for(ll i=k+1;i<=n;i++){
   	  if(a[i]>a[i-k])cout<<"Yes\n";
   	  else cout<<"No\n";
   }
   	  
   
   
   
   
   
}
	
 
    

Measured memory_bytes: 5188
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=998244353
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    C=[0]*100001
    D=list(map(int,input().split()))
    if(D[0]!=0):
        print(0)
        return
    for d in D:
        C[d]+=1
    if(C[0]!=1):
        print(0)
        return
    for i in range(100000):
        if(C[i]==0 and C[i+1]!=0):
            print(0)
            return
    i=C.index(0)
    C=C[:i]
    ans=1
    for i in range(1,len(C)):
        ans*=C[i-1]**C[i]
        ans%=MOD
    print(ans)
resolve()

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

int main() {
    int N;      //カードの枚数
    cin >> N;   //カードの枚数を入力
    int a[N];   //カードに書かれた数
    int A = 0;  //アリスの得点
    int B = 0;  //ボブの得点
    int C = 0;  //全カードの合計

    //カードの数字を入力
    for(int i = 0; i < N; i++) {
        cin >> a[i];
    }

    //全カードの合計を求める
    for(int i = 0; i < N; i++) {
        C += a[i];
    }

    //配列aを昇順にソート
    sort(a, a + N);

    //アリスの得点を求める
    for(int i = N-1; 0 <= i; i -= 2) {
        A += a[i];
    }
    
    //ボブの得点を求める
    B = C - A;

    //アリスとボブの点差を出力
    cout << A - B << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;

int par[100010];
int ranks[100010];

void init(int n){
  for(int i=0;i<n;i++){
    par[i]=i;
    ranks[i]=0;
  }
}

int find(int x){
  if(par[x]==x){
    return x;
  }else{
    return par[x]=find(par[x]);
  }
}

void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y){
    return ;
  }
  if(ranks[x]<ranks[y]){
    par[x]=y;
  }
  else{
    par[y]=x;
  }
  if(ranks[x]==ranks[y]){
    ranks[x]++;
  }
}

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


int main(){
int N,M,p,x,y;
vector<int> v;
cin>>N>>M;
for(int i=0;i<N;i++){
  cin>>p;
  v.push_back(p);
}
init(N);
for(int j=0;j<M;j++){
  cin>>x>>y;
  unite(x,y);
}
int ans=0;
for(int i=0;i<N;i++){
  if(same(i+1,v[i])){
    ans+=1;
  }
}
cout<<ans<<"\n";
return 0;
}


Measured memory_bytes: 1528
//45
#include<iostream>
#include<algorithm>

using namespace std;

struct S{
  int n,p,i;
  bool operator<(S a)const{
    if(n!=a.n){
      return n>a.n;
    }else if(p!=a.p){
      return p<a.p;
    }else{
      return i<a.i;
    }
  }
};

int main(){
  for(int n,p,r;cin>>n>>p>>r,n|p|r;){
    S t[50]={{}};
    for(int i=0;i<n;i++){
      t[i].i=i+1;
    }
    int nw[51][11]={{}};
    while(r--){
      int ti,pi,tm;
      char mes[10];
      cin>>ti>>pi>>tm>>mes;
      if(mes[0]=='W'){
	nw[ti][pi]++;
      }else{
	t[ti-1].n++;
	t[ti-1].p+=tm+1200*nw[ti][pi];
      }
    }
    sort(t,t+n);
    for(int i=0;i<n;i++){
      cout<<t[i].i<<' '<<t[i].n<<' '<<t[i].p<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1192
L, R = map(int, input().split())

R = min(R, L+(2019)) # 長さを制限しても同じ
MOD = 2019
ans = 2018

for i in range(L, R): # iはLからR-1まで
    for j in range(i+1, R+1): # jはi+1からRまで
        n = (i*j)%MOD
        ans = min(n, ans)

print(ans)



Measured memory_bytes: 2940
from functools import lru_cache


@lru_cache(maxsize=None)
def multi(ms):
    """Matix multiplication. returns minimum number of scalar
    multiplications to compute all matrix multiplications.

    >>> multi(((30, 35), (35, 15), (15, 5), (5, 10), (10, 20), (20, 25)))
    15125
    """
    size = len(ms)
    if size <= 1:
        return 0
    elif size == 2:
        r1, c1 = ms[0]
        r2, c2 = ms[1]
        return c1 * r1 * c2

    costs = []
    for i in range(size-1):
        cost = ms[i][1] * ms[0][0] * ms[-1][1]
        costs.append(multi(ms[:i+1]) + multi(ms[i+1:]) + cost)

    return min(costs)


def run():
    n = int(input())
    ms = []

    for i in range(n):
        m = tuple([int(x) for x in input().split()])
        ms.append(m)

    print(multi(tuple(ms)))


if __name__ == '__main__':
    run()



Measured memory_bytes: 8300
#include <iostream>
#include <set>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;


int main() {
    int N, L; cin >> N >> L;
    vector<int> C(N);
    vector<int> T(N);
    
    for(int i=0; i<N; i++)
        cin >> C[i] >> T[i];
    
    int ans = 10000;
    for(int i=0; i<N; i++)
        if(T[i] <= L) ans = min(ans, C[i]);

    if(ans == 10000) cout << "TLE" << endl;
    else cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

struct M{int e,a;};

int main(void){
	
	int x,y,z,n;
	double dp[51][5001];
	M in;
	map<int,M>m;
	
	while(cin >> x >> y >> z,x|y|z){
		vector<int>v(x);
		m.clear();
		
		for(int i=0;i<x;i++)cin >> v[i];
		for(int i=0;i<z;i++){
			cin >> n >> in.e >> in.a;
			m[n]=in;
		}
		
		fill(dp[0],dp[51],0);
		dp[0][0]=1;
		
		for(int i=0;i<y;i++){
			for(int j=0;j<5001;j++){
				for(int k=0;k<x;k++){
					int nx=i+v[k];
					if(m[nx].e==1)dp[min(y,nx+m[nx].a)][j]+=dp[i][j]/x;
					else if(m[nx].e==2)dp[nx][j+m[nx].a]+=dp[i][j]/x;
					else if(m[nx].e==3)dp[nx][max(0,j-m[nx].a)]+=dp[i][j]/x;
					else dp[min(y,nx)][j]+=dp[i][j]/x;
				}
			}
		}
		double ans=0;
		for(int j=0;j<5001;j++)ans+=dp[y][j]*j;
		
		cout << (int)ans << endl;
	}
	
return 0;
}

Measured memory_bytes: 3188
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;

int N, K;
int x[100100];

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> N >> K;
    for (int i = 0; i < N; i++)
        cin >> x[i];

    int ans = 1e9;
    for (int i = 0; i + K <= N; i++)
    {
        int cc = x[i], cd = x[i+K-1];
        ans = min (ans, abs (cc) + abs (cd) + min (abs(cc), abs(cd)));
        if (cc * (long long) cd > 0)
            ans = min (ans, max (abs (cc), abs (cd)));
    }
    cout << ans << "\n";
}

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

int t8s_force_scan_int()
{
	int n;

	if (scanf("%d", &n) == EOF)
	{
		printf("expected int input but got EOF");
		exit(-1);
	}

	return n;
}

int t8s_force_read_int_array(size_t count, int** arr)
{
	*arr = (int*) malloc(count * sizeof(int));

	if (arr == NULL)
		return -1;

	for (int i=0; i<count;i++)
	{
		int n;
		scanf("%d ", &n);
		*(*arr+i) = n;
	}

	return 0;
}

void log(int* arr, int count)
{
	for (int i=0; i<count;i++)
	{
		printf("%d", arr[i]);
		if (i < count-1 )
			printf(" ");
	}
	printf("\n");
}

int main()
{
	size_t count = t8s_force_scan_int();

	int* arr;

	if (t8s_force_read_int_array(count, &arr) < 0)
		exit(-1);

	log(arr, count);
	for (int i=1; i<count;i++)
	{
		int v = arr[i];
		int j = i - 1;
		while (j>=0 && arr[j] > v)
		{
			arr[j+1] = arr[j];
			j--;
		}
		arr[j+1] = v;
		log(arr, count);
	}

	free(arr);

	return 0;
}


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

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define PI 3.14159265359
#define sz(c) (int)c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vll vector<ll>
#define vpint vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define fr(it, a, b) \
    for (int it = (a); it < (b); it++)
#define tr(con, it) \
    for (auto it = con.begin(); it != con.end(); it++)
#define present(con, ele) (con.find(ele) != con.end())
#define cpresent(con, ele) (find(all(con), ele) != con.end())
#define maximum(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
#define minimum(a, b, c) (a < b ? (a < c ? a : c) : (b < c ? b : c))
typedef long long ll;
typedef long double lf;
typedef unsigned long long lu;
const ll mod = 1e9 + 7;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string t;
    cin >> t;
    fr(i, 0, len(t))
    {
        if (t[i] == '?')
        {
            t[i] = 'D';
        }
    }
    cout << t << endl;
    return 0;
}

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

int g[10][10];

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  int n;cin>>n;
  for(int i=1;i<=n;i++){
    string s = to_string(i);
    g[s[0]-'0'][s[s.size()-1]-'0']++;
  }

  ll ans=0;
  for(int i=1;i<=9;i++){
    ans += g[i][i] * g[i][i];
    for(int j=i+1;j<=9;j++){
      ans += g[i][j] * g[j][i] * 2;
    }
  }
  cout<<ans<<endl;

  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int dp[100010];
int32_t main() {
    ios::sync_with_stdio(false);cin.tie(0);
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=1;i<=k;i++)
    {
        for(int j=0;j<n;j++)
            if(i>=a[j])
                dp[i]|=(1^dp[i-a[j]]);
    }
    if(dp[k])
        cout<<"First";
    else
        cout<<"Second";
    return 0;
}

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

int main()
{
    long long n,sum=0;
    cin>>n;
    long long i;
    for(i=1;i<=n;i++)
    {
        if(i%15==0)
            continue;
        else if(i%5==0 || i%3==0)
        {
            continue;
        }
        else
        {
            sum+=i;
        }
        
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3676
def dfs(u):
    global time
    color[u] = 'Gray'
    time += 1
    d[u] = time
    for v in range(1, n+1):
        if data[u][v] == 0:
            continue
        if color[v] == 'White':
            dfs(v)
    color[u] = 'Black'
    time += 1
    f[u] = time


n = int(input())
A = [list(map(int, input().split()))for _ in range(n)]
data = [[0]*(n+1) for _ in range(n+1)]
color = ['White']*(n+1)
d = [None]*(n+1)
f = [None]*(n+1)
time = 0
for i in A:
    for j in i[2:]:
        data[i[0]][j] = 1

for u in range(1, n+1):
    if color[u] == 'White':
        dfs(u)
for i in range(1, n+1):
    print('{} {} {}'.format(i, d[i], f[i]))


Measured memory_bytes: 5772
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
using namespace std;
typedef long long ll;
#define rep(i, N) for(ll (i)=0;(i)<(N);(i)++)

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  int index;
  rep(i, n) {
    cin >> a[i];
  }
  int it = 0;
  int ans = 0;
  while(it < n){
    if(it == 0) it += k;
    else it += k - 1;
    ans++;
  }
  cout << ans << endl;
}


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

int main(){
    int N;
    cin>>N;
    vector<tuple<string,int,int>> sp(N);
    for(int i=0;i<N;i++){
        string s; int p; cin>>s>>p;
        sp[i]=make_tuple(s,-p,i+1);
    }
    sort(sp.begin(),sp.end());
    for(int i=0;i<N;i++)
        cout<<get<2>(sp[i])<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;

    int first = (s[0]-'0') * 10 + (s[1]-'0'), second = (s[2]-'0') * 10 + (s[3]-'0');
    string format;
    if (0 < first && first < 13) {
        if (0 < second && second < 13) format = "AMBIGUOUS";
        else format = "MMYY";
    }
    else {
        if (0 < second && second < 13) format = "YYMM";
        else format = "NA";
    }
    
    cout << format << endl;

}

Measured memory_bytes: 256
#include<cstdio>
#define max(a,b) ((a)>(b)?(a):(b))
using namespace std;
int A,B,t;
int main(){
	scanf("%d%d",&A,&B);
	t=max(A+B,A-B);
	t=max(t,A*B);
	printf("%d\n",t);
	return 0;
}

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

#define lli long long int
#define ld long double
#define DEFO(n) lli n = 0;
#define MAX_L lli max = 9000000000000000000;
#define MIN_L lli min = 9000000000000000000;
#define MAX_D ld max = 4500;
#define MIN_D ld min = -4500;
#define LLI(n) \
  lli n;       \
  cin >> n;
#define LD(n) \
  ld n;       \
  cin > n;
#define LLIV(a, n)            \
  vector<lli> a(n);           \
  for (lli i = 0; i < n; i++) \
  {                           \
    cin >> a.at(i);           \
  };
#define LLIV2(a, b, n)         \
  vector<lli> a(n), b(n);      \
  for (lli i = 0; i < n; i++)  \
  {                            \
    cin >> a.at(i) >> b.at(i); \
  };
#define LDV(a, n)             \
  vector<ld> a(n);            \
  for (lli i = 0; i < n; i++) \
  {                           \
    cin >> a.at(i);           \
  };
#define STR(n) \
  string n;    \
  cin >> n;
#define SUM(n) accumulate(n.begin(), n.end(), 0);
#define SORT(n) sort(n.begin(), n.end());
#define REVE(n) reverse(n.begin(), n.end());
#define yes              \
  cout << "Yes" << endl; \
  return 0;
#define no              \
  cout << "No" << endl; \
  return 0;
#define none            \
  cout << "None" << endl; \
  return 0;
#define C45(n) (n + 1) / 2
#define OUT(n) cout << n << endl;
#define SRC(n, c)                    \
  for (lli i = 0; i < s.size(); i++) \
  {                                  \
    if (s.at(i) == c)                \
    {                                \
      n++;                           \
    }                                \
  };
//こぴー
/*#define ZISYO(s, S)                  \
  for (lli i = 0; i < s.size(); i++) \
  {                                  \
    S.at(i) = s.at(i);               \
  }                                  \
  Sort(S) Reve(S) for (lli i = 0; i < s.size(); i++) { s.at(i) = S.at(i); };
*/

//素数
bool IsPrime(lli num)
{
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  long double sqrtNum = sqrt(num);
  for (lli i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)
      return false;
  }
  return true;
}
//各桁の和
lli KSum(lli n)
{
  lli sum = 0;
  if (n < 0)
    return 0;
  while (n > 0)
  {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

//数値反転
bool KReve(lli n)
{
  int reverse = 0;
  int remaind;
  int tmp = n;
  while (tmp != 0)
  {
    remaind = tmp % 10;
    reverse = reverse * 10 + remaind;
    tmp /= 10;
  }
  if (reverse == n)
    return true;
  else
    return false;
}

int main(void)
{
  ios::sync_with_stdio(false);
  LLI(n)LLI(m)LLIV2(a, b, m)
  map<lli, lli> root;
  for(lli i  = 0;i < m;i++) {
    if(root.count(a[i])) {
      root[a[i]]++;
    }
    else {
      root[a[i]] = 1;
    }
    if (root.count(b[i]))
    {
      root[b[i]]++;
    }
    else
    {
      root[b[i]] = 1;
    }
  }
  for(lli i  = 1;i <= n;i++) {
    OUT(root[i])
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int a, b, i;

    while (scanf("%d", &a) != EOF){
        scanf("%d", &b);

        i = 1;
        a += b;

        while (a >= 10){
            a /= 10;
            i++;
        } 

        printf("%d\n", i);
    }

    return (0);
}



Measured memory_bytes: 1976
class UnionFind:
    def __init__(self, n):
        self.parent = [ -1 for _ in range(n) ]
        self._size = n
    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x != y:
            if self.parent[y] < self.parent[x]:
                x, y = y, x
            self.parent[x] += self.parent[y]
            self.parent[y] = x
            self._size -= 1
    def same(self, x, y):
        return self.root(x) == self.root(y)
    def root(self, x):
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.root(self.parent[x])
            return self.parent[x]
    def size(self, x):
        return -self.parent[self.find(x)]

n, m = map(int, input().split())
tree = UnionFind(n)

for i in range(m):
    x, y, z = map(int, input().split())
    x -= 1; y -= 1;
    tree.unite(x, y)

print(tree._size)

Measured memory_bytes: 5472
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <stdio.h>
#include <unistd.h>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
#define PI 3.14159265359

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int main() {
  int h, w, n;
  cin >> h >> w >> n;
  vector<int> v(n);
  rep (i, n) {
    cin >> v[i];
  }
  int ans[h][w];
  int color = 0;
  int count = 0;
  rep (i, h) {
    if (i % 2 == 0) {
      rep (j, w) {
        if (count >= v[color]) {
          color++;
          count = 0;
        }
        ans[i][j] = color + 1;
        count++;
      }
    } else {
      for (int j = w - 1; j >= 0; j--) {
        if (count >= v[color]) {
          color++;
          count = 0;
        }
        ans[i][j] = color + 1;
        count++;
      }
    }
  }

  rep (i, h) {
    rep (j, w) {
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int arr[100005], seg[4 * 100005];
int gcd(int a, int b)
{
	if (a * b == 0)
		return a? a: b;
	while (a % b != 0) {
		a = a % b;
		swap(a, b);
	}
	return b;
}
void build(int index, int left, int right)
{
	if (left == right) {
		seg[index] = arr[left];
		return;
	}
	int mid = (left + right) / 2;
	build(2 * index, left, mid);
	build(2 * index + 1, mid + 1, right);
	seg[index]= gcd(seg[2 * index], seg[2 * index + 1]);
}
int query(int index, int left, int right, int lo, int hi)
{
	if (lo > hi)
		return 0;
	if (lo <= left && right <= hi)
		return seg[index];
	int mid = (left + right) / 2;
	if (hi <= mid)
		return query(2 * index, left, mid, lo, hi);
	if (lo > mid)
		return query(2 * index + 1, mid + 1, right, lo, hi);
	return gcd(query(2 * index, left, mid, lo, hi), query(2 * index + 1, mid + 1, right, lo, hi));
}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i)
		cin >> arr[i];
	build(1, 1, n);
	int ans = 1;
	for (int i = 1; i <= n; ++i) 
		ans = max(ans, gcd(query(1, 1, n, 1, i - 1), query(1, 1, n, i + 1, n)));
	cout << ans << '\n';
	return 0;
}

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

int main(){
    string s,t;
    cin>>s>>t;
    int lens=s.length();
    int flg=1;
    for(int i=0;i<lens;i++){
        if(s[i]!=t[i]) {
            flg=0;
            break;
        }
    }
    if(flg==1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(_v) for(auto _x:_v){cout<<_x<<" ";}cout<<endl
#define printVS(_vs) for(auto _x : _vs){cout << _x << endl;}
#define printVV(_vv) for(auto _v:_vv){for(auto _x:_v){cout<<_x<<" ";}cout<<endl;} cout << endl;
#define printP(_p) cout << _p.first << " " << _p.second << endl
#define printVP(_vp) for(auto _p : _vp) printP(_p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;

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

    int H, W;
    cin >> H >> W;
    vector<vector<string>> s(H, vector<string>(W));
    rep(i, H) rep(j, W) cin >> s[i][j];

    rep(i, H) {
        rep(j, W) {
            if (s[i][j] == "snuke") {
                cout << char('A' + j) << i + 1 << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    var S = next()
    while (S.isNotEmpty()) {
        if (S.startsWith("dreameraser")) S = S.drop(11)
        else if (S.startsWith("dreamerase")) S = S.drop(10)
        else if (S.startsWith("dreamer")) S = S.drop(7)
        else if (S.startsWith("dream")) S = S.drop(5)
        else if (S.startsWith("eraser")) S = S.drop(6)
        else if (S.startsWith("erase")) S = S.drop(5)
        else break
    }
    println(if (S.isEmpty()) "YES" else "NO")
}

Measured memory_bytes: 116548
#include <iostream>
#include <string>
using namespace std;
int main() {
  string S;
  cin >> S;
  if (S[0] != 'A') {
    cout << "WA" << endl;
    return 0;
  }
  int c = -1;
  for (int i=1; i<S.size(); i++) {
    if ('A' <= S[i] && S[i] <= 'Z') {
      if (S[i] != 'C') {
        c = -1; break;
      }
      if (i < 2 || i >= S.size() - 1) {
        c = -1; break;
      }
      if (c != -1) {
        c = -1; break;
      }
      c = i;
    }
  }
  if (c == -1) cout << "WA" << endl;
  else cout << "AC" << endl;
}

Measured memory_bytes: 256
import java.util.*;

import static java.lang.System.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        long ans = 0;
        for (int i = 0; i < 1 << S.length() - 1; i++) {
            int start = 0;
            for (int j = 0; j < S.length() - 1; j++) {
                if (((i >> j) & 1) == 1) {
                    String num = S.substring(start, j + 1);
                    ans += Long.parseLong(num);
                    start = j + 1;
                }
            }
            String num = S.substring(start, S.length());
            ans += Long.parseLong(num);
        }

        out.println(ans);
    }
}

Measured memory_bytes: 21972
#ARC061 C 沢山の数式
S=input()
def bubunwa(S):
    total=int(S)
    for i in range(1,len(S)):
        total=total+int(S[:i])*(2**(len(S[i:])-1))+bubunwa(S[i:]) 
#(2**(len(S[i:])-1))は分割数
    return total
print(bubunwa(S))
#最終的な答え

Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
N = int(input())
T, A = map(int,input().split())
li_H = list(map(int, input().split()))
index = 0
min = 1000000
for i in range(N):
     temp = abs(T-li_H[i]*0.006 - A)
     if temp < min:
         index = i+1
         min = temp
print(index)

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

const int maxn = 1e2 + 10;

int n, a[maxn];

int dp[10000 + 10];

int main ()
{
	cin >> n;

	for (int i = 1; i <= n; ++i)
		cin >> a[i];

	dp[0] = 1;

	for (int i = 1; i <= n; ++i)
		for (int j = 10000; j >= a[i]; j--)
			dp[j] |= dp[j - a[i]];

	int ans = 0;
	for (int i = 1; i <= 10000; ++i)
		if (dp[i] && i % 10 != 0)
			ans = i;

	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
L,N,*x=`dd`.split.map &:to_i
y=[r=0]+x.map{|e|L-e}.reverse
x=[0]+x
sx=[0]
sy=[0]
N.times{|i|sx<<sx[i]+x[i+1];sy<<sy[i]+y[i+1]}
1.upto(N){|i|
	j=N-i
	k=[i-1,j].min
	r=[r,x[i]+2*(sx[i-1]-sx[i-k-1]+sy[j]-sy[j-k-(j>k ? 1 : 0)])].max
}
N.times{|i|
	j=N-i
	k=[i,j-1].min
	r=[r,y[j]+2*(sx[i]-sx[i-k-(i>k ? 1 : 0)]+sy[j-1]-sy[j-k-1])].max
}
p r

Measured memory_bytes: 30960
n,p = map(int,input().split())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
ans = 1
for i,j in factorization(p):
  if j >= n:
    ans *= i**(j//n)
print(ans)

Measured memory_bytes: 9480
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

vector<Int> dx{ 1,0,-1,0 };
vector<Int> dy{ 0,1,0,-1 };

vector<vector<Int>> seen;
vector<vector<char>> s;
Int black, white;

Int H, W;
void dfs(Int x, Int y) {
	seen[x][y] = 1;
	if (s[x][y] == '#')black++;
	else white++;

	for (Int i = 0; i < 4; i++) {
		Int nx = x + dx[i];
		Int ny = y + dy[i];
		if (nx < 0 || nx >= H || ny < 0 || ny >= W)continue;
		if (s[x][y] == s[nx][ny])continue;
		if (seen[nx][ny])continue;
		dfs(nx, ny);
	}
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	cin >> H >> W;

	seen.resize(H, vector<Int>(W, 0));

	s.resize(H, vector<char>(W));
	for (Int i = 0; i < H; i++) {
		for (Int j = 0; j < W; j++) {
			cin >> s[i][j];
		}
	}

	Int ans = 0;
	for (Int i = 0; i < H; i++) {
		for (Int j = 0; j < W; j++) {
			if (seen[i][j])continue;
			if (s[i][j] == '.')continue;
			black = 0;
			white = 0;
			dfs(i, j);
			ans += black * white;
		}
	}

	cout << ans << "\n";
}

Measured memory_bytes: 9216
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define rep(i, l, r)  for(int i = l; i <= r; i++)
#define PII pair<int,int>
using namespace std;
const int inf = 0x3f3f3f3f;
const int mod = 1000000007;
const int maxn = 1000005;
inline int read(){
    int x=0,f=1;char c=getchar();
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=getchar()) x=x*10+c-'0';
    return x*f;
}
const double PI = 3.14159;

int a[maxn];
int main() {
    int n =read();
    rep(i, 1, n-1) {
      int w = read();
      a[w]++;
    }
    rep(i, 1, n) {
      cout << a[i] << endl;
    }
}


Measured memory_bytes: 4340