akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vishal Burman
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BCommonRaccoonVsMonster solver = new BCommonRaccoonVsMonster();
        solver.solve(1, in, out);
        out.close();
    }

    static class BCommonRaccoonVsMonster {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int h = in.nextInt();
            int n = in.nextInt();
            int a[] = new int[n];
            int sum = 0;
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                sum += a[i];
            }
            if (sum >= h)
                out.println("Yes");
            else
                out.println("No");
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
  string a,b;
  cin>>a;
  rep(i,a.size()){
    if(a.at(i)=='0')
      b+='0';
  if(a.at(i)=='1')
    b+='1';
  if(a.at(i)=='B'){
    if(b.size()>0)
    b.pop_back();
    }
  }
  cout<<b;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
class Sieve: #区間[2,n]の値の素因数分解 前処理O(nloglogn)素因数分解O(logn)
    def __init__(self,n=1):
        self.primes=[]
        self.f=[0]*(n+1) #ふるい（素数ならその値）
        self.f[0]=self.f[1]=-1
        for i in range(2,n+1): #素数リスト作成
            if self.f[i]: continue
            self.primes.append(i)
            self.f[i]=i
            for j in range(i*i,n+1,i):
                if not self.f[j]:
                    self.f[j]=i  #最小の素因数を代入
    def is_prime(self, x):
        return self.f[x]==x
    def prime_fact(self,x): #素因数分解 {2:p,3:q,5:r,...}
        fact_dict=dict()
        while x!=1:
            p=self.f[x]
            fact_dict[p]=fact_dict.get(p,0)+1
            x//=self.f[x]
        return fact_dict
class Sieve2: #√nまでの素因数で試し割り 前処理O(√nloglogn+√n/logn)
    def __init__(self,n):
        self.primes=[]
        self.f=[0]*(int(n**0.5)+1) #ふるい（素数ならその値）
        self.f[0]=self.f[1]=-1
        for i in range(2,int(n**0.5)+1): #素数リスト作成
            if self.f[i]: continue
            self.primes.append(i)
            self.f[i]=i
            for j in range(i*i,int(n**0.5)+1,i):
                if not self.f[j]:
                    self.f[j]=i  #最小の素因数を代入
    def prime_fact(self,x): #素因数分解 {2:p,3:q,5:r,...}
        fact_dict=dict()
        for p in self.primes:
            if p*p>x:break
            while x%p==0:
                x//=p
                fact_dict[p]=fact_dict.get(p,0)+1
        if x>1:fact_dict[x]=fact_dict.get(x,0)+1
        return fact_dict

def main():
    n=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    p_lis={}
    Prime=Sieve2(10**6+5)
    for a in A:
        f=Prime.prime_fact(a)
        for key in f:
            p_lis[key]=max(p_lis.get(key,0),f[key])
    lcm=1
    for key in p_lis:
        lcm=(lcm*pow(key,p_lis[key],mod))%mod
    ans=0
    for a in A:
        b=lcm*pow(a,mod-2,mod)%mod
        ans=(ans+b)%mod
    print(ans)


if __name__ == '__main__':
    main()



Measured memory_bytes: 4596
import numpy as np
r1 = list(map(int, input().split()))
r2 = list(map(int, input().split()))
r3 = list(map(int, input().split()))

N = int(input())

bs = []
for i in range(N):
    bs.append(int(input()))

card_nums = r1 + r2 + r3

bingo_list = set()
for b in bs:
    if b in card_nums:
        index = card_nums.index(b)
        bingo_list.add(index)

bingo_candidates = [
    [0,1,2], [3,4,5], [6,7,8],
    [0,3,6], [1,4,7], [2,5,8],
    [0,4,8], [2,4,6]
]


def main():
    for bingo_candidate in bingo_candidates:
        result = set(bingo_candidate) & bingo_list

        if len(result) == 3:
            print("Yes")
            return
        else:
            continue
    print("No")

main()
# if (3 in bingo_list.sum(axis=1)) or (3 in bingo_list.sum(axis=0)):
#     print('Yes')
# elif np.diag(bingo_list).sum() == 3:
#     print('Yes')
# else:
#     print('No')
    


Measured memory_bytes: 12440
import java.util.Scanner;

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

		s = sc.nextLine();

		String array[] = s.split("");

		if(array[0].equals("7") || array[1].equals("7") || array[2].equals("7")){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}

	}
}

Measured memory_bytes: 27008
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

manzoku = sum(b)

for i in range(n - 1):
    if a[i] + 1 == a[i + 1]:
        manzoku += c[a[i] - 1]
print(manzoku)

Measured memory_bytes: 3064
n = int(input())
a = 1
b = [0]*(n+1)
for i in range(2, int(n**(1/2))+1):
    for j in range(2, int(n/i)+1):
        if i <= j:
            b[i*j] += 1
for i in range(2, n+1):
    if int(i**(1/2))**2 == i:
        a += i*(b[i]*2+1)
    else:
        a += i*(b[i]*2+2)
print(a)

Measured memory_bytes: 146708
#include<stdio.h>

int main(void)
{
  int n,i,c=0;
  scanf("%d",&n);

  int p[n];
  for(i=0;i<n;i++)
    scanf("%d",&p[i]);

  for(i=0;i<n;i++)
    if(p[i]!=i+1)
      c++;

  if(c<=2)
    printf("YES\n");

  else
    printf("NO\n");

  return 0;
}


Measured memory_bytes: 1628
#include <stdio.h>
int main(void){
    int h,m,s,sum,sum1;
    for(;scanf("%d %d %d",&h,&m,&s),s!=-1;){
        sum=7200-h*3600-m*60-s;
        sum1=sum*3;
        printf("%02d:%02d:%02d\n",sum/3600,sum%3600/60,sum%60);
        printf("%02d:%02d:%02d\n",sum1/3600,sum1%3600/60,sum1%60);
    }
    return 0;
}

Measured memory_bytes: 612
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
char a[110];
int main()
{
	cin>>a;
	int t=1;
	for(int i=0;i<=105;i++)
	{
		if(a[i]=='C')
		{
			for(int j=i+1;j<=105;j++)
			{
				if(a[j]=='F')t=0;
			}
		}
	}
	if(t==1)printf("No");
	else printf("Yes");
}

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


using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    unsigned long long int n,a,b,c;
    cin>>n;
    unsigned long long int dp[3][3]={};
    while(n--)
    {
        cin>>a>>b>>c;
        dp[0][0]=max(dp[1][1]+a,dp[1][2]+a); //cout<<max(dp[1][1],dp[1][2])<<" ";
        dp[0][1]=max(dp[1][2]+b,dp[1][0]+b); //cout<<max(dp[1][2],dp[1][0])<<" ";
        dp[0][2]=max(dp[1][0]+c,dp[1][1]+c); //cout<<max(dp[1][0],dp[1][1])<<endl;
        dp[1][0]=dp[0][0];
        dp[1][1]=dp[0][1];
        dp[1][2]=dp[0][2];
    }
    //for(int i=0;i<=n;i++) cout<<dp[0][0]<<" "<<dp[0][1]<<" "<<dp[0][2]<<endl;
    cout<<max(dp[0][0],max(dp[0][1],dp[0][2]))<<endl;
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
from sys import stdin
import numpy as np
#import math
#from functools import reduce
    
#N, M = [int(x) for x in stdin.readline().rstrip().split()]
N = int(input())
#S = list(input())

def append_str(W, N):
    w_new = []
    for w in W:
        kind = len(set(w))
        for i in range(kind+1):
            w_new.append(w+alphabets[i])
    return w_new
    

seed = 'a'
alphabets = ['a', 'b','c','d','e','f','g','h','i','j']

#長さNの文字列に含まれる文字の種類はN以下
for n in range(N):
    if n == 0:
        w = [seed]
    else:
        w = append_str(w, n+1)
    
for buf in w:
    print(buf)

Measured memory_bytes: 22056
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	ll a,b,c;
	cin>>a>>b>>c;
	if(a<=b)cout<<1<<endl;
	else if(b<=c)cout<<-1<<endl;
	else cout<<1+2*((a-c-1)/(b-c))<<endl;
}




















Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 200005;

int n, a[MAX_N];

bool possible(int cri)
{
    map<int,int> mp;
    int prv = 0;
    rep(i,n){
        if(a[i] <= prv){
            mp.erase(mp.upper_bound(a[i]), mp.end());
            rrep(j,a[i]+1){
                if(j == 0){
                    return false;
                }
                if(mp[j] < cri-1){
                    mp[j]++;
                    break;
                }else{
                    mp.erase(j);
                }
            }
        }
        prv = a[i];
    }
    return true;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    int flag = -1;
    rep(i,n){
        cin >> a[i];
        if(flag >= a[i]){
            flag = INF;
        }
        cmx(flag, a[i]);
    }
    if(flag != INF){
        cout << "1\n";
        return 0;
    }
    int l = 1, r = n;
    while(r-l>1){
        int mid = (l+r)/2;
        if(possible(mid)){
            r = mid;
        }else{
            l = mid;
        }
    }
    cout << r << "\n";
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

ll binomialCoeff(ll n, ll k) 
{ 
    ll C[k+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;  // nC0 is 1 
  
    for (ll i = 1; i <= n; i++) 
    { 
        // Compute next row of pascal triangle using 
        // the previous row 
        for (ll j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    map <int,int> m;
    for(int i=0;i<3;i++)
    {
        int x=nxt();
        m[x]+=1;
    }
    auto it=m.begin();
    if(it->second==1)
        cout<<it->first<<endl;
    else
    {
        it++;
        cout<<it->first<<endl;
    }
    
    
    return 0;   
}




 
 


Measured memory_bytes: 256
/*
[dp] B - Frog 2
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 1e5;
const int MAX_K = 100;
const int INF = 1e9;

int N, K;
int h[MAX_N];
int dp[MAX_N];

ll solve() {
    dp[0] = 0;

    for (int i = 1; i < N; i++) {
        dp[i] = INF;
        for (int k = 1; i - k >= 0 && k <= K; k++) {
            dp[i] = min(dp[i], dp[i - k] + abs(h[i] - h[i - k]));
        }
    }

    return dp[N - 1];
}
int main() {
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        cin >> h[i];
    }

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;
using namespace std;

int L[MAX/2+2],R[MAX/2+2];

llong merge(int A[],int n,int left,int mid,int right)
{
	int i,j,k;
	llong cnt=0;
	int n1=mid-left;
	int n2=right-mid;
	for(i=0;i<n1;++i)L[i]=A[left+i];
	for(i=0;i<n2;i++)R[i]=A[mid+i];
	L[n1]=R[n2]=SENTINEL;
	i=j=0;
	for(k=left;k<right;k++)
	{
		if(L[i]<=R[j])
		{
			A[k]=L[i++];
		}
		else
		{
			A[k]=R[j++];
			cnt+=n1-i;// =mid+j-k-1
		}
	}
	return cnt;
}

llong mergeSort(int A[],int n,int left,int right)
{
	int mid;
	llong v1,v2,v3;
	if(left+1<right)
	{
		mid=(left+right)/2;
		v1=mergeSort(A,n,left,mid);
		v2=mergeSort(A,n,mid,right);
		v3=merge(A, n, left, mid, right);
		return v1+v2+v3;
	}
	else return 0;
}

int main()
{
	int A[MAX],n,i;
	
	while(scanf("%d",&n)==1)
	{
		for(i=0;i<n;i++)scanf("%d",&A[i]);
		llong ans=mergeSort(A,n,0,n);
		printf("%lld\n",ans);
	}
	
}

Measured memory_bytes: 4316
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <tuple>
#include <cstring>
#include <map>
#include <iomanip>
#include <ctime>
#include <complex>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _ << " " <<
#define all(X) (X).begin(), (X).end()
#define len(X) (X).size()
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define Tiii tuple<int, int, int>
#define Tlll tuple<ll, ll, ll>

int main() {
    int n;
    cin >> n;
    string s[n];
    int t[n], sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> s[i] >> t[i];
        sum += t[i];
    }
    string x;
    cin >> x;
    for (int i = 0; i < n; i++) {
        sum -= t[i];
        if (s[i] == x) {
            cout << sum << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
import java.io.*;
class Main
{
public static void main(String args[])throws IOException
{
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
String str;
int xy[][]=new int[14][14];
int count=0,max=0;
while((str=input.readLine())!=null)
	{
	String str_ary[]=str.split(",");
	int x,y,size;
	x=Integer.parseInt(str_ary[0]);
	y=Integer.parseInt(str_ary[1]);
	size=Integer.parseInt(str_ary[2]);
	if(size==1)
	{
	xy[x+2][y+2]++;
	xy[x-1+2][y+2]++;
	xy[x+1+2][y+2]++;
	xy[x+2][y+1+2]++;
	xy[x+2][y-1+2]++;
	}
	if(size==2)
	{
	xy[x+2][y+2]++;
	xy[x-1+2][y+2]++;
	xy[x+1+2][y+2]++;
	xy[x+2][y+1+2]++;
	xy[x+2][y-1+2]++;
	xy[x+1+2][y+1]++;
	xy[x-1+2][y-1+2]++;
	xy[x-1+2][y+1+2]++;
	xy[x+1+2][y+1+2]++;
	}
	if(size==3)
	{
	xy[x+2][y+2]++;
	xy[x-1+2][y+2]++;
	xy[x+1+2][y+2]++;
	xy[x+2][y+1+2]++;
	xy[x+2][y-1+2]++;
	xy[x+1+2][y+1+2]++;
	xy[x+1+2][y-1+2]++;
	xy[x-1+2][y+1+2]++;
	xy[x-1+2][y-1+2]++;
	xy[x+2+2][y+2]++;
	xy[x+2][y+2+2]++;
	xy[x-2+2][y+2]++;
	
	xy[x+2][y-2+2]++;
	}

	
}
for(int i=2;i<12;i++)
	{
		for(int j=2;j<12;j++)
		{
		if(xy[i][j]==0)
		
	
		count++;
		if(max<xy[i][j])max=xy[i][j];
		
	
		}

	}	

System.out.println(count);
System.out.println(max);
}
}

Measured memory_bytes: 16924
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int h,w; cin>>h>>w; 
    int dx[4]={-1,1,0,0};
    int dy[4]={0,0,-1,1};
    int count=0;
    vector <vector <char>> a(h,vector <char> (w));
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++) {
            cin>>a[i][j];
            if(a[i][j]=='.') count++;
        }
    }
    vector <vector <int>> data(h,vector <int>(w,0));
    h--; w--;
    queue <pair <int,int> > q; //(ny,nx)
    pair <int,int> pa;
    pa = make_pair(0,0);
    q.push(pa);
    while(q.size()){
       // cout<<'*'<<endl;
        pair <int,int> p;
        p = q.front();
      //  cout<<p.first<<' '<<p.second<<endl;
        if(p.first==h&&p.second==w){
            cout<<count-1-data[h][w]<<endl;
            return 0;
        }
        q.pop();
        for(int i=0;i<4;i++){
            int ny=p.first+dy[i]; int nx=p.second+dx[i];
          //  cout<<ny<<' '<<nx<<endl;
            if(ny>=0&&ny<=h&&nx>=0&&nx<=w&&data[ny][nx]==0&&a[ny][nx]=='.'){
                pair <int,int> tmp;
                tmp=make_pair(ny,nx);
                q.push(tmp);
                data[ny][nx]=data[p.first][p.second]+1;
            }
        }
    }
    cout<<-1<<endl;
}


Measured memory_bytes: 256
A=list(input())
B=list(input())
C=list(input())
#print(A)
#print(len(A))
who=A[0]
A[0]="0"
while True:
    if who=="a":
        if A.count("0")==len(A):
            ans="A"
            break
        else:
             who = A[A.count("0")]
             A[A.count("0")]="0"
    elif who=="b":
        if B.count("0")==len(B):
            ans="B"
            break
        else:
            who = B[B.count("0")]
            B[B.count("0")]="0"
    elif who=="c":
        if C.count("0")==len(C):
            ans="C"
            break
        else:
            who = C[C.count("0")]
            C[C.count("0")]="0"
            
            
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 4005 + 5;
unordered_map<ll , ll>Q;
ll  arr[maxn];
int main()
{
    ios::sync_with_stdio(false);
    Q[0] = 0;
    for (ll i = 1 ; i <= 3981ll ; i++)
        Q[(ll)i*i*i*i*i] = i , Q[(ll)-i*i*i*i*i] = -i , arr[i] = i*i*i*i*i;
    ll x ; cin >> x;
    ll a = 0 , b = 0 ;
    for (int i = 1 ; i <= 3981 ; i++){
   //     cout << i << " " << arr[i] + x << " " << arr[i] - x << endl;
        if (Q.find(arr[i] + x) != Q.end()){
            a = Q[arr[i] + x];
            b = i;
            break;
        }
        else if (Q.find(arr[i] - x) != Q.end()){
            b = Q[arr[i] - x];
            a = i;
            break;
        }
    }
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 3976
//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
#define BIGP   1000000007
#define INF_I  std::numeric_limits<ll>::max()
#define INF_F  std::numeric_limits<float>::infinity()
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //
    ll N, W;
    cin >> N >> W;
    vector<vector<ll>> dp;
    dp.resize(N+1);
    rep(i, N+1)
    {
        dp[i].resize(100100, 0);
    }
    for (ll item = 0; item < N; ++item)
    {
        ll w, v;
        cin >> w >> v;
        for (ll wi = 0; wi <= W; ++wi)
        {
            chmax(dp[item + 1][wi], dp[item][wi]);
            if (wi + w <= W)
            {
                chmax(dp[item + 1][wi + w], dp[item][wi] + v);
            }
        }
    }
    ll h = dp[N][W];
    cout << h;
    //
    return 0;
}

Measured memory_bytes: 82076
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print1(a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=55;
//i_am_noob
int n,a[maxn],ans=0;
string str[maxn],str1;
bool bl=false;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	rep(n) cin >> str[i] >> a[i];
	cin >> str1;
	rep(n){
		if(bl) ans+=a[i];
		if(str[i]==str1) bl=true;
	}
	print1(ans);
	return 0;
}

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

using namespace std;

void Main()
{
    int x, y;
    cin >> x >> y;

    cout << x + y / 2;

    int c = x++ + ++y;
}

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

    //std::cout << std::fixed << std::setprecision(10);

#ifdef DEBUG_BUILD
    while (true)
    {
        Main();
        cout << std::endl;
    }
#endif

    Main();
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define mod 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);


int main()
{
	// cout<<INT_MAX;
	fast
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5])
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int D, N;

  cin >> D >> N;
  if( D == 0 ){
    if(N != 100)
      cout << N << endl;
    else
      cout << 101 << endl;
  } else if( D == 1 ){
    if(N != 100)
      cout << 100*N << endl;
    else
      cout << 10100 << endl;
  } else {
    if( N != 100)
      cout << 10000*N << endl;
    else
      cout << 1010000 << endl;
  }
  
  return 0;
}


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

int main() {
    int N, K, num=1;
    
    cin >> N >> K;

    for(int i=0;i<N;i++) {
        if(num < K) num *= 2;
        else num += K;        
    }

    cout << num << endl;
}

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

long long calc(const int A[],const int B[], int N) {
	long long sum = 0;
	for(int i=0; i<N; i++){
		sum += A[i] * B[i];
	}
	return sum;
}
 
int main(int argc, char const *argv[]) {
	int N, M, C, ret=0;

	cin >> N >> M >> C;

	int B[M], A[N][M];

	for(int i=0; i<M; i++) {
		cin >> B[i];
	}
	for(int i=0; i<N; i++) {
		for(int j=0; j<M; j++){
			cin >> A[i][j];
		}
	}


	for(int i=0; i<N; i++) {
		long long tmp =  calc(A[i], B, M) + C;
		if (tmp > 0){
			ret++;
		}
	}
 
	cout << ret;
 
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from heapq import heappush,heappop
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    def dijkstra(start,n,edges):
        d=[INF]*n
        used=[False]*n
        d[start]=0
        used[start]=True
        edgelist=[]
        for edge in edges[start]:
            heappush(edgelist,edge)
        while edgelist:
            minedge=heappop(edgelist)
            if used[minedge[1]]:
                continue
            v=minedge[1]
            d[v]=minedge[0]
            used[v]=True
            for edge in edges[v]:
                if not used[edge[1]]:
                    heappush(edgelist,(edge[0]+d[v],edge[1]))
        return d
    
    K=int(input())
    edges=[[] for _ in range(K)]
    for i in range(K):
        edges[i].append((1,(i+1)%K))
        edges[i].append((0,i*10%K))
    d=dijkstra(1,K,edges)
    print(d[0]+1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 84128
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*
    s.find_by_order(k) ---> returns iterator to the element at index(from 0) k
    s.order_of_key(val) ---> number of elements that are strictly smaller than the given value
*/
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int tc; cin >> tc; cin.ignore(); while(tc--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}
 
int main() {
	fast();
 
    /*NA – JEONG – MO – SA – JI – MI – DA – CHAE – TZU*/
    
    ll n, m;
    cin >> n >> m;
    vll a(m);
    string s = "";
    for(int i=0; i<n; i++){
        s+='.';
    }
    for(int i=0; i<m; i++){
        cin >> a[i].ff >> a[i].ss;
        a[i].ff--;
        s[a[i].ff] = ('0'+a[i].ss);
    }
    for(int i=0; i<m; i++){
        if(s[a[i].ff]-'0'!=a[i].ss){
            cout << -1 << endl;
            return 0;
        }
    }
    for(int i=0; i<n; i++){
        if(s[i]=='.'&&i){
            s[i] = '0';
        }
        else if(s[i]=='.'&&n>1){
            s[i] = '1';
        }
        else if(s[i]=='.'){
            s[i] = '0';
        }
    }
    if(s[0]=='0'&&n!=1){
        cout << -1 << endl;
        return 0;
    }
    cout << s << endl;
}

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

int main(){
  int a[] = {1,3,5,7,8,10,12},b[] = {4,6,9,11},c = 2,x,y;
  cin >> x >> y;
  char xf,yf;
  for(int i=0;i<7;i++){
    if(x==a[i])
      xf = 'a';
    if(y==a[i])
      yf = 'a';
  }
  for(int i=0;i<4;i++){
    if(x==b[i])
      xf = 'b';
    if(y==b[i])
      yf = 'b';
  }
  if(x==c)
    xf = 'c';
  if(y==c)
    yf = 'c';

  if(xf==yf)
    cout << "Yes" << "\n";
  else
    cout << "No" << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

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

Measured memory_bytes: 600
fun main(args: Array<String>) {
  val (n, z, w) = readLine()!!.split(" ").map { it.toInt() }
  val xs = readLine()!!.split(" ").map { it.toInt() }
  if (n == 1) {
    println(Math.abs(xs[0] - w))
    return
  }
  println(Math.max(Math.abs(xs[n - 2] - xs[n - 1]), Math.abs(xs[n - 1] - w)))
}


Measured memory_bytes: 38668
N,Q = map(int, input().split())
S = input().strip()
a = []
p = ""
c = 0
for i,v in enumerate(S):
    if p == 'A' and v == 'C':
        c += 1
    a.append(c)
    p = v

for i in range(Q):
    l,r = map(int,input().split())
    print(a[r-1] - a[l-1])



Measured memory_bytes: 11496
import sys
alphabet = [chr(ord('a') + i) for i in range(26)]
num_d = {}
for tmp_char in alphabet:
    num_d[tmp_char] = 0

input_str = sys.stdin.read()
input_str = list(input_str.lower())
for in_chr in input_str:
    if in_chr in alphabet:
        num_d[in_chr] += 1
        
for out_str in alphabet:
    print(out_str, " : ", num_d[out_str], sep="")


Measured memory_bytes: 5584
#include <bits/stdc++.h>
////////////////////////////////////////////////////////////
#define all(x) (x).begin(), (x).end() 
const int inf = 1e9;
const long long INF=1e15;
#define endl '\n'
#define rep(i, n) for(int i=0;i<(n);++i)
#define repp(i, a, b) for(int i=(a);i<=(b);++i)
#define pb push_back
#define eb emplace_back
#define fastio ios::sync_with_stdio(false);cin.tie(0); //cout.tie(0);

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

int solve() {
	ll n, k; cin>>n>>k;
	vll x(n); rep(i,n)cin>>x[i];
	ll ans = INF;
	sort(all(x));
	for(int i=0;i+k-1<n;i++) {
		// x[i], x[i+k-1]
		ll t = min( abs(0-x[i])+abs(x[i]-x[i+k-1]), abs(0-x[i+k-1])+abs(x[i]-x[i+k-1]));
		ans = min(ans, t);
	}
	cout << ans;
}

int main() {
	fastio;
	solve();
}



Measured memory_bytes: 1024
#include<stdio.h>
int main(void){
    int k,a,b;
    scanf("%d",&k);
    scanf("%d %d",&a,&b);
    int i,x;
    x=0;
    for(i=1;x<a;++i){
        x=k*i;
    }
    if(x<=b){
        printf("OK\n");
    }else{
        printf("NG\n");
    }
    return 0;
}

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

int main() {

    int k;
    cin >> k;
    queue<pair<string, int>> q;
    rep(i,9){
        pair<string, int> p;
        p.first = to_string(i+1);
        p.second = i+1;
        q.push(p);
    }

    rep(i,k-1){
        pair<string, int> current = q.front();
        q.pop();
        // cout << current.first << endl;
        int curmod = current.second % 10;
        if(curmod != 0){
            pair<string, int> next1;
            // char nc = current.first.at(current.first.size()-1) - 1;
            next1.first = current.first + to_string(curmod-1);
            next1.second = curmod-1;
            // cout << next1.first << " " << next1.second << endl;
            q.push(next1);
        }

        pair<string, int> next2;
        // char nc = current.first.at(current.first.size()-1);
        next2.first = current.first + to_string(curmod);
        next2.second = curmod;
        q.push(next2);
        
        if(curmod != 9){
            pair<string, int> next3;
            // char nc = current.first.at(current.first.size()-1) + 1;
            next3.first = current.first + to_string(curmod+1);
            next3.second = curmod+1;
            // cout << next1.first << " " << next1.second << endl;
            q.push(next3);
        }
    }
    cout << q.front().first << endl;

    return 0;
}



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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (b % 2 == 0) return (pow(a * a, b / 2, m) % m); else return (pow(a * a, b / 2) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

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

const string A = "AKIHABARA";
string S;

int main(){
   cin >> S;
   string B = "KIHBR";
   set<string> s = {
      "KIHBR", "AKIHBR", "KIHABR", "AKIHABR", "KIHBAR", "AKIHBAR", "KIHABAR", "AKIHABAR",
      "KIHBRA", "AKIHBRA", "KIHABRA", "AKIHABRA", "KIHBARA", "AKIHBARA", "KIHABARA", "AKIHABARA"
   };
   auto e = s.find(S);
   cout << ((e != s.end()) ? "YES" : "NO") << endl;
}


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

int n, m, k;
const int MXN = 100005;

int par[MXN], gs[MXN];

int parent(int n) {
	if (n == par[n]) return n;
	return par[n] = parent(par[n]);
}

void setup() {
	for (int i=0; i<MXN; i++) {
		par[i] = i;
		gs[i] = 1;
	}
}

bool arc(int a, int b) {
	return parent(a) == parent(b);
}

void conn(int a, int b) {
	int ax = parent(a);
	int bx = parent(b);
	if (ax == bx) return;
	par[ax] = bx;
	gs[bx] += gs[ax];
}

int main() {
	
	cin >> n >> m >> k;
	
	int inc[n+1];
	memset(inc, 0, sizeof inc);
	
	int blocks[n+1];
	memset(blocks, 0, sizeof blocks);
	
	setup();
	
	for (int i=0; i<m; i++) {
		int a, b;
		cin >> a >> b;
		conn(a, b);
		inc[a]++;
		inc[b]++;
	}
	
	for (int i=0; i<k; i++) {
		int a, b;
		cin >> a >> b;
		if (arc(a, b)) {
			blocks[a]++;
			blocks[b]++;
		}
	}
	
	for (int i=1; i<=n; i++) {
		cout << gs[parent(i)] - blocks[i] - inc[i] - 1 << ' ';
	}
	cout << endl;
	
}


Measured memory_bytes: 2944
#include<iostream>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define ALL(c) (c).begin(), (c).end()
#define dump(a) cerr << #a << "=" << (a) << endl

template<class T> void chmin(T &t, T f) { if (t > f) t = f; } //t=min
template<class T> void chmax(T &t, T f) { if (t < f) t = f; } //t=max

using namespace std;

int N;
int W,H;
int S,T;

// 1オリジン
struct Point {
	int w;
	int h;
};

vector<Point> ps;

int main() {
	while(cin >> N && N) {
		cin >> W >> H;

		ps.clear();
		int w=0,h=0;
		rep(i,N) {
			cin >> w >> h;
			Point p;
			p.w = w; p.h = h;
			ps.push_back(p);
		}
		cin >> S >> T;

		int cnt=0;
		int rect_h=0,rect_w=0;
		int max_cnt=0;
		REP(h,1,H+1) {
			REP(w,1,W+1) {
				cnt=0;
				rect_w = w + S - 1;
				rect_h = h + T - 1;
				rep(i,ps.size()) { //tree search
					if (w <= ps[i].w && ps[i].w <= rect_w
						&& h <= ps[i].h && ps[i].h <= rect_h) {
						cnt++;		
					}
				}
				chmax(max_cnt,cnt);
			}
		}
		cout << max_cnt << endl;
	}

	return 0;
}

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

int main(void) {
	int A, B, C;
	cin >> A >> B >> C;
	
	if (((A==B) && (B!=C))
		|| ((A==C) && (B!=C))
		|| ((B==C) && (A!=C))) {
			cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
  return 0;
}


Measured memory_bytes: 256
import Foundation
 
let abc = readLine()!.componentsSeparatedByString(" ")
let k = Int(readLine()!)!
let a = Int(abc[0])!
let b = Int(abc[1])!
let c = Int(abc[2])!
 
var m = max(a, b, c)
var m2: Int = m
for i in 0..<k {
    m2 *= 2
}
 
var m3: Int = 0
if m == a {
    m3 = m2 + b + c
} else if m == b {
    m3 = m2 + a + c
} else if m == c {
    m3 = m2 + a + b
}
 
print("\(m3)")

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 入力

		String s = sc.next();
		String t = sc.next();
				// 判定
		if(t.matches(s + ".")){
			System.out.print("Yes");
  		}else{
			System.out.print("No");
		}
	}
}


Measured memory_bytes: 38556
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
using namespace std;
#define ll long long
#define pb push_back
#define pll pair<ll,ll> 
#define mll map<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0; i<n; i++)
#define All(x,v) for(auto x:v)
#define arrin(a,n) ll a[n]; rep(i,n) cin>>a[i]
#define vi vector<int>
#define nl "\n"
#define print(arr) All(x,arr) cout<<x<<" "; cout<<nl
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define ing(m,ad) rep(i,m){ int u,v; cin>>u>>v; u--;v--; ad[u].pb(v); ad[v].pb(u);}
#define vdsort(v) sort(v.begin(),v.end(),greater<int>())
#define F first
#define S second
#define mod 1000000007
const int MAXN=100001;
int spf[MAXN];
int gcd(int x, int y){ return y?gcd(y,x%y):x; }

void precal(){  
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++)  spf[i] = i; 
    for (int i=4; i<MAXN; i+=2) spf[i] = 2; 
    for (int i=3; i*i<MAXN; i++) { 
        if (spf[i] == i) 
            for (int j=i*i; j<MAXN; j+=i) 
                if (spf[j]==j)  spf[j] = i; 
    } 
} 
vector<int> getFactorization(int x){
    vector<int> ret; 
    while (x != 1) { 
        ret.push_back(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
}

ll exp(ll n, ll m){
    ll a = 1;
    while (m){
        if (m & 1) a = (a * n % mod) % mod;
        m /= 2;
        n = (n*n) % mod;
    }
    return a;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    // freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    ll n,t=1;
    // cin>>t;
    while(t--){
        cin>>n;
        ll dp[n+1][3];
        rep(i,3) dp[0][i]=0;
        rep(i,n){
            int a,b,c;
            cin>>a>>b>>c;
            dp[i+1][0]=a+max(dp[i][1],dp[i][2]);
            dp[i+1][1]=b+max(dp[i][0],dp[i][2]);
            dp[i+1][2]=c+max(dp[i][1],dp[i][0]);
        }
        cout<<max(dp[n][0],max(dp[n][1],dp[n][2]))<<nl;
    }
    return 0;
}

Measured memory_bytes: 5524
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;

class Solve
{
	const int mod = 1000000007;
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		var p = Console.ReadLine().Split().Select(int.Parse).ToArray();

		int cnt = 0;
		string ans = "YES";
        for(int i = 0; i < N; i++)
		{
			if (p[i] != i + 1) { cnt++; }
		}
		if (cnt > 2) { ans = "NO"; }

		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13396
#include<stdio.h>

int A[44];



int fib(int i){
  int v;
 

  if(i<2){
    return 1;
  }
  if(A[i]!=NULL){
    return A[i];
  }
 
    v = fib(i-1)+fib(i-2);
    A[i] = v;
    return v;
  
}






main(){

  int x;

  scanf("%d",&x);

  printf("%d\n",fib(x));

  return 0;
}

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

int main(){
//srandom((unsigned long)time(NULL));

int n;
cin>>n;
//vector<int> a;
vector<int> cont;
for(int i=0;i<9;i++){
    cont.emplace_back(0);
}
for(int i=0;i<n;i++){
    int x;
    cin>>x;
    if(x<400)cont[0]++;
    if(400<=x && x<800)cont[1]++;
    if(800<=x && x<1200)cont[2]++;
    if(1200<=x && x<1600)cont[3]++;
    if(1600<=x && x<2000)cont[4]++;
    if(2000<=x && x<2400)cont[5]++;
    if(2400<=x && x<2800)cont[6]++;
    if(2800<=x && x<3200)cont[7]++;
    if(3200<=x)cont[8]++;
}
int ans=0;
for(int i=0;i<8;i++){
    if(cont[i]!=0)ans++;
}
int mx=0;
mx=ans;
if(cont[8]!=0){
    mx=ans+cont[8];
}
if(ans==0)ans=1;
cout<<ans<<" "<<mx<<endl;



return 0;
}

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

int main(void)
{
	int A, B;
	cin >> A >> B;

	vector<int> table(13, 0);
	for(int i=0; i<13; i++)
		table[i] = i;
	table[0] = 13;

	string ret;
	if(A == B)
		ret = "Draw";
	else if(table[A-1] > table[B-1])
		ret = "Alice";
	else
		ret = "Bob";

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
N=int(input())
*A,=map(int, input().split())
M=10**3

P=[]
isp=[True]*M
for n in range(2,M):
    if isp[n]==False: continue
    P.append(n)
    for m in range(n*n, M, n):
        isp[m]=False

from collections import defaultdict
D=[defaultdict(int) for _ in range(N)]
for i in range(N):
    a=A[i]
    for p in P:
        while a>1:
            if a%p==0:
                D[i][p]+=1
                a//=p
            else:
                break
        else:
            break
    if a>1:
        D[i][a]+=1

d=defaultdict(int)
for i in range(N):
    for k,v in D[i].items():
        d[k] = max(d[k], v)
gcd=1
for k,v in d.items():
    gcd*=k**v

print(sum([gcd//a for a in A])%(10**9+7))


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

namespace AtCoder
{
	public class Program
	{
		static void Main(string[] args)
		{
			string b = Console.ReadLine();

			switch (b) {
			case "A":
				Console.WriteLine("T");
				break;
			case "C":
				Console.WriteLine("G");
				break;
			case "T":
				Console.WriteLine("A");
				break;
			case "G":
				Console.WriteLine("C");
				break;
			}
		}
	}
}

Measured memory_bytes: 11092
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i32,
        x: [[i32; 2]; n]
    }

    let mut p = Vec::new();

    for x_item in x.iter() {
        p.push([x_item[0] - x_item[1], x_item[0] + x_item[1]])
    }
    p.sort_by(|a, b| a[1].cmp(&b[1]));

    let mut count: u32 = 1;
    let mut base = p[0];

    for i in 1..n {
        if p[i as usize][0] >= base[1] {
            count += 1;
            base = p[i as usize];
        }
    }

    println!("{}", count);
}


Measured memory_bytes: 10612