akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main{
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if(c >= a && c <= b){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35632
#!/usr/bin/env python3
n = int(input())
s = [int(input()) for _ in range(n)]
s_5 = [s[i] for i in range(n) if s[i] % 10 != 0]
# maxはsumから5の倍数ならそのまま、10の倍数ならminの5の倍数をひく
sum_s = sum(s)
s_5.sort()
#print(s_5)
if sum_s % 10 != 0:
    print(sum_s)
else:
    if len(s_5) == 0:
        print(0)
    else: print(sum_s - s_5[0])

Measured memory_bytes: 3060
//GRL_1C
#include <iostream>
#include<algorithm>
#include <vector>
#include <climits>
using namespace std;
 

static const int MAX=100;
static const long long INF=(1LL<<32);
int n;
long long d[MAX][MAX];

void floyd(){
 for(int k=0;k<n;k++){
  for(int i=0;i<n;i++){
   if(d[i][k]==INF) continue;
   for(int j=0;j<n;j++){
    if(d[k][j]==INF) continue;
    d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
   }
  }
 }
}

int main(){
 int e,u,v,c;
 cin>>n>>e;
 for(int i=0;i<n;i++){
  for(int j=0;j<n;j++){
   d[i][j]=((i==j) ? 0:INF);
  }
 }
 for(int i=0;i<e;i++){
  cin>>u>>v>>c;
  d[u][v]=c;
 }

 floyd();

 bool negative=false;
 for(int i=0;i<n;i++) if(d[i][i]<0) negative=true;
 if(negative){
  cout<<"NEGATIVE CYCLE"<<endl;
 }else{
  for(int i=0;i<n;i++){
   for(int j=0;j<n;j++){
    if(j) cout<<" ";
    if(d[i][j]==INF) cout<<"INF";
    else cout<<d[i][j];
   }
   cout<<endl;
  }
 }
 return 0;
}

Measured memory_bytes: 1232
#include <cstdio>
#include <algorithm>
#include <cstring>

#define NMAX (100000 + 7)

using namespace std;
int n, v[NMAX];
char s[NMAX];
bool p;

void init()
{
    for(int i = 1; i<= n; ++i) v[i] = 0;
}
bool build()
{
    for(int i = 3; i<= n; ++i)
    {
        if(s[i-1] == 'o' && v[i-1] == 1)
        {
            v[i] = v[i-2];
            continue;
        }
        if(s[i-1] == 'o' && v[i-1] == 2)
        {
            v[i] = 3 - v[i-2];
            continue;
        }
        if(s[i-1] == 'x' && v[i-1] == 1)
        {
            v[i] = 3 - v[i-2];
            continue;
        }
        v[i] = v[i-2];
    }
    for(int i = 2; i<= n-1; ++i)
    {
        if(s[i] == 'o' && v[i] == 1 && v[i-1] != v[i+1]) return 0;
        if(s[i] == 'o' && v[i] == 2 && v[i-1] == v[i+1]) return 0;
        if(s[i] == 'x' && v[i] == 1 && v[i-1] == v[i+1]) return 0;
        if(s[i] == 'x' && v[i] == 2 && v[i-1] != v[i+1]) return 0;
    }
    if(s[1] == 'o' && v[1] == 1 && v[2] != v[n]) return 0;
    if(s[1] == 'o' && v[1] == 2 && v[2] == v[n]) return 0;
    if(s[1] == 'x' && v[1] == 1 && v[2] == v[n]) return 0;
    if(s[1] == 'x' && v[1] == 2 && v[2] != v[n]) return 0;
    if(s[n] == 'o' && v[n] == 1 && v[1] != v[n-1]) return 0;
    if(s[n] == 'o' && v[n] == 2 && v[1] == v[n-1]) return 0;
    if(s[n] == 'x' && v[n] == 1 && v[1] == v[n-1]) return 0;
    if(s[n] == 'x' && v[n] == 2 && v[1] != v[n-1]) return 0;
    return 1;
}
void afisare()
{
    for(int i = 1; i<= n; ++i)
    {
        if(v[i] == 1) printf("S");
        if(v[i] == 2) printf("W");
    }
    printf("\n");
}

int main()
{
    scanf("%d", &n);
    scanf("%s", s+1);
    init();
    v[1] = 1;
    v[2] = 1;
    p = build();
    if(p == 1)
    {
        afisare();
        return 0;
    }
    init();
    v[1] = 1;
    v[2] = 2;
    p = build();
    if(p == 1)
    {
        afisare();
        return 0;
    }
    init();
    v[1] = 2;
    v[2] = 1;
    p = build();
    if(p == 1)
    {
        afisare();
        return 0;
    }
    init();
    v[1] = 2;
    v[2] = 2;
    p = build();
    if(p == 1)
    {
        afisare();
        return 0;
    }
    printf("-1\n");
    return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  
  int total = 0;
  
  if (A>B){
    total = A*2-1;
  }
  else if (A<B){
    total = B*2-1;
  }
  else {
    total = A*2; 
  }

 cout << total <<endl;  
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner reader = new Scanner(System.in);
        String s = "Christmas";
        switch (reader.nextInt()) {
            case 22:
                s += " Eve";
            case 23:
                s += " Eve";
            case 24:
                s += " Eve";
        }
        System.out.println(s);
        reader.close();
    }
}

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

int main(int argc, const char * argv[]) {
    int n, m;
    int a, b;
    int map[50][50];
    int sum;
    
    cin >> n >> m;
    
    fill(map[0], map[50], 0);
    
    for (int i = 0; i < m; i++) {
        
        cin >> a >> b;
        
        map[a-1][b-1]++;
        map[b-1][a-1]++;
    }
    
    for (int i = 0; i < n; i++) {
        sum = 0;
        for (int j = 0; j < n; j++) {
            sum += map[i][j];
        }
        cout << sum << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { cout << "ERROR" << num << endl; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};

struct K {
  int n1, n2;
  K(int i, int j): n1(i), n2(j) {}
  // the operator < defines the operation used in map
  friend bool operator < (const struct K &k1, const struct K &k2);
};

inline bool operator < (const struct K &k1, const struct K &k2) {
  return k1.n1 < k2.n1 || (k1.n1==k2.n1 && k1.n2<k2.n2);
}

void test() {
  map<K, int> m;
  map<K, int>::iterator it;
  K k1(1, 1);
  m.insert(make_pair(k1, 2)); // insert the value
  it = m.find(k1);
  if (it!=m.end()) cout << it->second << endl;  // fetch the value
}

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

    int N;
    cin >> N;
    vector<int> L(N);
    rep(i,N) cin >> L[i];

    sort(L.begin(), L.end());
    int total = 0;
    for(int i = 0; i < N; i++){
      for(int j = i+1; j < N; j++){
        int a = L[i];
        int b = L[j];
        int c_min = b-a;
        int c_max = a+b;
        int cnt = lower_bound(L.begin()+j,L.end(),c_max)-1
        -upper_bound(L.begin()+j,L.end(),c_min);
        total += cnt;
        //printf("a=%d, b=%d, cnt=%d\n", a, b, cnt);
        //cout << *(lower_bound(L.begin()+j,L.end(),c_max)-1) << endl;
        //cout << *(upper_bound(L.begin()+j,L.end(),c_min)) << endl;
      }
    }
    cout << total << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  ll a[n];
  rep(i,n) R a[i];
  ll s=0;
  rep(i,n) s^=a[i];
  if(s) pr("No");
  else pr("Yes");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void){
  int n;
  scanf("%d", &n);
  int i;
  
  for(i = 0; i < n; i++){
    char c;
    scanf("%c", &c);
    if(c == 'Y'){
      printf("Four\n");
      return 0;
    }
  }
  printf("Three\n");
  return 0;
}

Measured memory_bytes: 128
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1'000'000'000'000'000'000ll;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
int main()
{
    fast();
    string s,t;
    cin>>s>>t;
    ll i,j,n=s.length(),m=t.length();
    ll dp[n+1][m+1];
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=m;j++)
        {
            if(i==0 or j==0)
                dp[i][j]=0;
            else if(s[i-1]==t[j-1])
                dp[i][j]=dp[i-1][j-1]+1;
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    ll index=dp[n][m];
    //cout<<index;
    char ans[index+1];
    ans[index]='\0';
    i=n;j=m;
    while(i>0 and j>0)
    {
        if(s[i-1]==t[j-1])
        {
            ans[index-1]=s[i-1];
            i--;j--;index--;
        }
        else if(dp[i-1][j]>dp[i][j-1])
            i--;
        else
            j--;
    }
    cout<<ans;
}

Measured memory_bytes: 70656
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
typedef long long int ll;
using namespace std;

int n,m;
const int limit=50;
int a[limit];
int b[limit];

bool graph[limit][limit];//つなげてるかメモ
bool visited[limit];

void dfs(int v){
	visited[v] = true;
	for(int v2=0; v2<n; v2++){
		if(graph[v][v2] == false) continue;
		if(visited[v2] == true) continue;
		dfs(v2);
	}
}

int main()
{
	cin >> n >> m;
	for(int i=0; i<m; i++){
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		graph[a[i]][b[i]] = true;
		graph[b[i]][a[i]] = true;
	}

	int ans=0;

	for(int i=0; i<m; i++){
	//橋それぞれについて
		
		graph[a[i]][b[i]] = false;
		graph[b[i]][a[i]] = false;

		for(int j=0; j<n; j++){
			visited[j] = false;
		}

		dfs(0);
		
		bool bridge = false;
		for(int j=0; j<n; j++){
			if(visited[j] == false){
				bridge = true;
			}
		}
		if(bridge){
			ans++;
		}
		graph[a[i]][b[i]] = true;
		graph[b[i]][a[i]] = true;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
# D - Cake 123

import heapq
import itertools
from collections import defaultdict

x, y, z, k = map(int, input().split())

A = list(int(a) for a in input().split())
B = list(int(b) for b in input().split())
C = list(int(c) for c in input().split())

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

hq = []
hqAns = []
d = defaultdict(int)

heapq.heappush(hq, ((A[0]+B[0]+C[0])*-1,(0,0,0)))
d[(0,0,0)] = 1

while len(hqAns)<k :
    val, key = heapq.heappop(hq)
    heapq.heappush(hqAns, val)
 
    if d[(key[0]+1, key[1], key[2])]==0 and key[0]+1 < x:
        heapq.heappush(hq, ((A[key[0]+1]+B[key[1]]+C[key[2]])*-1, ((key[0]+1, key[1], key[2]))))
        d[(key[0]+1, key[1], key[2])] = 1

    if d[(key[0], key[1]+1, key[2])]==0 and key[1]+1 < y:
        heapq.heappush(hq, ((A[key[0]]+B[key[1]+1]+C[key[2]])*-1, ((key[0], key[1]+1, key[2]))))
        d[(key[0], key[1]+1, key[2])] = 1
 
    if d[(key[0], key[1], key[2]+1)]==0 and key[2]+1 < z:
        heapq.heappush(hq, ((A[key[0]]+B[key[1]]+C[key[2]+1])*-1, ((key[0], key[1], key[2]+1))))
        d[(key[0], key[1], key[2]+1)] = 1

for i in range(k):
    print(heapq.heappop(hqAns)*-1)

'''
# ans.2 #

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

hq = []
for i in range(x):
    for j in range(y):
        for l in range(z):
            if (i+1)*(j+1)*(l+1)<=k:
                heapq.heappush(hq, (A[i]+B[j]+C[l])*-1)
            else:
                break

for _ in range(k):
    print(heapq.heappop(hq)*-1)

'''

'''

# ans.1 #

hq = []
for i, j in itertools.product(A, B):
    heapq.heappush(hq, (i+j)*-1)

AB = []
while len(hq)>0 and len(AB)<=k:
    AB.append(heapq.heappop(hq)*-1)

hq = []
for i, j in itertools.product(AB, C):
    heapq.heappush(hq, (i+j)*-1)

for _ in range(k):
    print(heapq.heappop(hq)*-1)

'''


Measured memory_bytes: 5500
#include <stdio.h>

int main(void)
{
	int i,j, pt, sum[2]={0};
	
	for(j=0; j<2; j++)
	for(i=0; i<4; i++)
	{
		scanf("%d", &pt);
		sum[j] += pt;
	}
	if(sum[0] > sum[1])
		 printf("%d\n", sum[0]);
	else printf("%d\n", sum[1]);

	return 0;
}

Measured memory_bytes: 592
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

//Napoleon's Grumble
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			char[] s = sc.nextLine().toUpperCase().replaceAll("[^A-Z]", "").toCharArray();
			Set<String> set = new HashSet<String>();
			Set<String> odd = new HashSet<String>();
			Set<String> even = new HashSet<String>();
			int n = s.length;
			for(int i=0;i<n;i++){
				int left = i-1;
				int right = i+1;
				String pre = ""+s[i];
				while(left>=0&&right<n&&s[left]==s[right]){
					set.add(pre);
					pre = s[left--]+pre+s[right++];
				}
				if(pre.length()>2)odd.add(pre);
				if(i+1==n||s[i]!=s[i+1])continue;
				left = i-1;
				right = i+2;
				pre = s[i]+""+s[i+1];
				while(left>=0&&right<n&&s[left]==s[right]){
					set.add(pre);
					pre = s[left--]+pre+s[right++];
				}
				if(pre.length()>2)even.add(pre);
			}
			boolean h = true;
			for(String t:odd){
				if(!set.contains(t)){
					if(!h)System.out.print(" ");
					h = false;
					System.out.print(t);
				}
			}
			for(String t:even){
				if(!set.contains(t)){
					if(!h)System.out.print(" ");
					h = false;
					System.out.print(t);
				}
			}
			System.out.println();
		}
	}

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

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<string>
#include<map>

using namespace std;
const int INF = 1<<30;
typedef long long int ll;

int main(){
  int n;cin>>n;int m=0; //odd
  for(int i=0;i<n;i++){
    int a;cin>>a;m+=(a%2);
  }
  cout<<pow(3, n)-pow(2, n-m)<<endl;
}


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

#define FOR(i,a,b) for(i=a;i<=b;i++)
#define FOD(i,b,a) for(i=a;i>=b;i--)
#define pa pair<int,int>
#define fi first
#define se second
#define task "x"

typedef long long ll;
const ll M=1e6+1;
const ll N=1e4+1;
using namespace std;
ll i, j, n, a[M], ans = 0;

void input()
{
    cin >> n;

    FOR(i,1,n) cin >> a[i];
    FOR(i,2,n)
    {
     if(a[i]<a[i-1]) {ans +=a[i-1]-a[i];a[i] = a[i-1];}
    }
    cout<<ans;
}

int main()
{
  	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	if(fopen(task".inp","r"))
        {
 	  freopen(task".inp","r",stdin);
 	  freopen(task".out","w",stdout);
	}
	input();

   return 0;
}


Measured memory_bytes: 5160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;

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

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
   struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
  int main(){
      lint n,q;
      cin>>n>>q;
      UnionFind tree(n);
      rep(i,q){
         lint a,b,c;
         cin>>a>>b>>c;
         if(a==0)tree.unite(b,c);
        else if(tree.same(b,c))cout<<1<<endl;
        else cout<<0<<endl;
      }
    }
     
  



Measured memory_bytes: 3204
import sys
sys.setrecursionlimit(100000)


def process():
    for data in get_dataset():
        H = len(data)
        W = len(data[0])
        field = create_field(H, W)
        print search(H, W, data, field)


def search(H, W, data, field):
    count = 0
    for i in xrange(H):
        for j in xrange(W):
            if field[i][j] == 0:
                continue
            _search(i, j, H, W, data[i][j], data, field)
            count += 1
    return count


def _search(i, j, H, W, cell, data, field):
    field[i][j] = 0
    for a in xrange(i-1, i+2):
        if -1 < a < H:
            pass
        else:
            continue
        for b in xrange(j-1, j+2):
            if -1 < b < W:
                pass
            else:
                continue

            if a != i and b != j:
                continue

            if field[a][b] == 0:
                continue
            if cell == data[a][b]:
                _search(a, b, H, W, cell, data, field)
    return


def create_field(H, W):
    field = []
    for i in xrange(H):
        raw = []
        for j in xrange(W):
            raw.append(1)
        field.append(raw)
    return field


def get_dataset():
    dataset = []
    while True:
        line = raw_input().rstrip().split()
        H = int(line[0])
        if H == 0:
            break

        data = []
        for i in xrange(H):
            data.append(raw_input().rstrip())
        dataset.append(data)
    return dataset

process()

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

using namespace std;

long long a[1000];
long long b[1000][1000];
long long c[1000000];

int main(){
  long long i,N,K,S=0,L;
  long long T,f=0,j,k;
  cin >> N >> K;
  for (i=0;i<N;i++) {
    cin >> a[i];
    S+=a[i];
  }
  L=0;
  T=1;
  while (S>0) {
    S/=2;
    L++;
    T*=2;
  }
  for (k=0;k<N;++k) {
    for (i=0;i<=k;++i) {
      for (j=i;j<=k;j++) {
        b[i][k]+=a[j];
      }
      //cout << b[i][k] << " ";;
    }
  }

  j=0;
  while (j<K && T!=1) {
    T/=2;
    j=0;
    for (k=0;k<N;++k) {
      for (i=0;i<=k;++i) {
        if (b[i][k]>=T) {
          b[i][k] = b[i][k] & (T-1);
          c[j]=b[i][k];
          j++;
        }
      }
    }
  }
  f+=T;

  while (T!=1) {
    T/=2;
    k=0;
    for (i=0;i<j;i++) {
      if (c[i]>=T) {
        k++;
      }
    }

    if (k>=K) {
      k=0;
      for (i=0;i<j;i++) {
        if (c[i]>=T) {
          c[k]=c[i] & (T-1);
          k++;
        }
      }
      j=k;
      f+=T;
    }
    for (i=0;i<j;i++) {
      if (c[i]>=T) {
        c[i]= c[i] & (T-1);
      }
    }
  }
  cout << f << endl;
  return 0;
}


Measured memory_bytes: 10112
// #include "knapsack_1.h"
#include <iostream>
// #include <iterator>

#include <vector>

struct Item {
    int weight;
    int value;

    Item(int w, int v)
        : weight{w}
        , value{v}
    {
    }
};

using Memo = std::vector<std::vector<long long>>;

long long helper(const std::vector<Item>& items,
                 int capacity,
                 size_t pos,
                 Memo& memo)
{
    if (capacity < 0)
        return 0;
    if (pos >= items.size())
        return 0;

    auto& cached = memo[pos][capacity];
    if (cached != -1) {
        return cached;
    }

    long long skipping{helper(items, capacity, pos + 1, memo)};
    if (items[pos].weight > capacity) {
        cached = skipping;
        return skipping;
    }
    long long taking{helper(items,
                            capacity - items[pos].weight,
                            pos + 1,
                            memo)};
    cached = std::max(skipping, items[pos].value + taking);
    return cached;
}

long long max_value(const std::vector<Item>& items, int capacity)
{
    Memo memo(items.size(), std::vector<long long>(capacity + 1, -1));
    auto ans = helper(items, capacity, 0, memo);
    return ans;
}

int main(int argc, char *argv[])
{
    int n, capacity;
    std::cin >> n >> capacity;
    std::vector<Item> items;
    items.reserve(n);

    for (int i = 0; i < n; ++i) {
        int weight, value;
        std::cin >> weight >> value;
        items.emplace_back(weight, value);
    }
    std::cout << max_value(items, capacity) << std::endl;
    return 0;
}


Measured memory_bytes: 79484
#!/usr/bin/env python3
#ABC118 B

n,m = map(int,input().split())
s = [list(map(int,input().split())) for _ in range(n)]
c = [0 for _ in range(m)]
for i in range(n):
    for j in range(1,s[i][0]+1):
        c[s[i][j]-1] += 1
ans = 0
for i in range(m):
    if c[i] == n:
        ans += 1
print(ans)


Measured memory_bytes: 38256
from collections import deque 

n = int(input())

preroots = []
preroots_appd = preroots.append

for i in range(n-1):
    preroots_appd(list(map(int,input().split())))
    
roots = [[] for x in range(n+1)]

for i in preroots:
    roots[i[0]].append((i[1],i[2]))         
    roots[i[1]].append((i[0],i[2]))     
         
QK = list(map(int,input().split()))         
query = []

query_appd = query.append
for i in range(QK[0]):
    query_appd(list(map(int,input().split())))
        
    
distfrom_K = [-1 for x in range(n+1)]
distfrom_K[QK[1]] = 0          

q = deque()
q.append(QK[1])

while(len(q)):
    currentNode = q.popleft()
    for i in roots[currentNode]:
        if distfrom_K[i[0]] != -1:continue
        distfrom_K[i[0]] = distfrom_K[currentNode] + i[1]
        q.append(i[0])

for i in query:
    print(distfrom_K[i[0]]+distfrom_K[i[1]])

Measured memory_bytes: 81532
H, W = list(map(int, input().split()))
d = [[0 for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j, x in enumerate(list(input())):        
        if x == "#":
            s = 0
        else:
            s = 1
        d[i][j] = s

# 自分より左のOKマスの数
L = [[0 for _ in range(W)] for _ in range(H)]
# 自分より右のOKマスの数
R = [[0 for _ in range(W)] for _ in range(H)]
# 自分より上のOKマスの数
U = [[0 for _ in range(W)] for _ in range(H)]
# 自分より下のOKマスの数
D = [[0 for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        # for L
        if d[i][j]:
            if j == 0:
                L[i][j] = 1            
            else:
                L[i][j] = L[i][j-1] + 1
        else:
            L[i][j] = 0
        
        # for R
        rj = W - j - 1
        if d[i][rj]:
            if rj == W-1:
                R[i][rj] = 1            
            else:
                R[i][rj] = R[i][rj+1] + 1
        else:
            R[i][rj] = 0
        
        # for U        
        if d[i][j]:
            if i == 0:
                U[i][j] = 1            
            else:
                U[i][j] = U[i-1][j] + 1
        else:
            U[i][j] = 0
     
        # for D
        di = H - i - 1
        if d[di][j]:
            if di == H-1:
                D[di][j] = 1            
            else:
                D[di][j] = D[di+1][j] + 1
        else:
            D[di][j] = 0

m = 0
for i in range(H):
    for j in range(W):
        m = max(m, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)
print(m)

Measured memory_bytes: 203912
first_line = gets
count,max_time = first_line.split(' ')
count = count.to_i
max_time = max_time.to_i

data = []

count.times{|c|
  line = gets
  cost,time = line.split(' ')
  cost = cost.to_i
  time = time.to_i
  data << {cost: cost, time: time}
}

data.sort_by! {|d|
  d[:time]  
}

accepted_data = []

data.reverse_each {|d|
  if d[:time]<=max_time
    accepted_data << d
  end
}

if accepted_data.size < 1
  puts 'TLE'
else
  accepted_data.sort_by! {|d| d[:cost]}
  puts accepted_data[0][:cost]
end


Measured memory_bytes: 1788
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
using namespace std;

int inf = 2147483647;
int64_t inf64 = 9223372036854775807;
int MOD = 1e+7;

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

  int N, T;
  cin >> N >> T;
  vector<int> t(N);
  rep(i,N) cin >> t[i];

  int res = 0;
  rep(i,N-1) {
    int diff = t[i+1] - t[i];
    if(diff < T) res += diff;
    if(diff >= T) res += T;
  }
  res += T;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1024
from fractions import gcd
n,k = map(int,input().split())
a = list(map(int,input().split()))
m = max(a)
g = min(a)
for t in a:
  g = gcd(g,t)

if k%g == 0 and k <= m:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

Measured memory_bytes: 16240
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (n, x) = (v[0], v[1] as i64);
    let l = read_vec::<i64>();
    let mut ans = 1;
    let mut cur_pos = 0;
    for i in 0..n {
        cur_pos += l[i];
        if cur_pos > x {
            break;
        }
        ans += 1;
    }
    println!("{:?}", ans);
    /*
    let (x, a) = (v[0], v[1]);
    if x < a {
        println!("0");
    } else {
        println!("10");
    }
    */
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define int long long
signed main()
{
    IOS
    int n,k; cin>>n>>k;
    if(k == 1)
    {
      cout<<0;
      return 0;
    }
    int diff = n-k;
    cout<<diff<<endl;
    return 0;
}

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

int main() {
  int n,m; cin >> n >> m;
  vector<int> ans(n,0), check(n,0);

  for(int i = 0;i < m;i++) {
    int c,s; cin >> s >> c;

    if(check[s-1] == 0) {
      ans[s-1] = c;
      check[s-1]++;
    } else{
      if(ans[s-1] != c) {
        ans[0] = -1;
      }
    }

  }

  if(ans[0] == 0) {
    if(n > 1) {
      if(check[0] != 0) {
        cout << -1 << endl;
        return 0;
      }
    } else {
      cout << 0 << endl;
      return 0;
    }
  }

  if(ans[0] == -1) {
    cout << -1 << endl;
    return 0;
  }

  int sum = 0;
  for(int i = 0;i < n;i++) {
    if(check[i] == 0) {
      if(i == 0) { sum += pow(10,n-1); }
    }
    sum += ans[i] * pow(10,n-i-1);
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	int pn = 1;
	if (ci - cn + 16 > cm) {
		if ((ct = getcha()) == '-') { pn = -1; ct = getcha(); }
		A = ct - '0';
		while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';;
		return pn * A;
	}
	else {
		if ((ct = *ci++) == '-') { pn = -1; ct = *ci++; }
		A = ct - '0';
		while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';;
		return pn * A;
	}
}

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


	int N = getint();
	int S[100000];
	rep(i, N) S[i] = getint();

	ll kotae = 0;
	rep1(ab, N / 2 - 1) {
		int n = ab;
		ll kari = 0;
		if ((N - 1) % n) {
			while (n + ab < N - 1) {
				kotae = max(kotae, (kari += S[n] + S[N - 1 - n]));
				n += ab;
			}
		}
		else {
			while (n + n < N - 1) {
				kotae = max(kotae, (kari += S[n] + S[N - 1 - n]));
				n += ab;
			}
		}
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 768
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define dbg(x) cout<<#x"="<<x<<endl

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;

#define INF 1000000000

int main(){
  while(true){
    int n;
    cin >> n;
    if(n==0)break;
    if(n==3){ cout << 1 << endl; continue; }

    int res=0;
    int a=1,b=2,s=1; // s = sum [a,b)
    while(b<n){
      while(s<n){
	s += b;
	b++;
      }
      if(s==n){
	res++;
	s+=b;
	b++;
      }
      
      while(s>n){
	s -= a;
	a++;
      }
      if(s==n){
	res++;
	s-=a;
	a++;
      }
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 1160
function main(input) {
  const temp = input.trim().split('\n')

  n = parseInt(temp[0], 10)
  v = temp[1].split(' ').map((n) => parseInt(n, 10))
  c = temp[2].split(' ').map((n) => parseInt(n, 10))

  let answer = 0
  for (let i = 0; i < n; i++) {
    let t = v[i] - c[i]
    if (t > 0) {
      answer += t
    }
  }
  console.log(answer)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 29548
import sys
readline = sys.stdin.buffer.readline


class SegmentTree:
    def __init__(self, N, func, I):
        self.N = N
        self.sz = 2**(N-1).bit_length()
        self.func = func
        self.I = I
        self.seg = [I] * (self.sz * 2)

    def assign(self, k, x):
        self.seg[k + self.sz] = x

    def build(self):
        for i in reversed(range(1, self.sz)):
            self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])

    def update(self, k, x):
        k += self.sz
        self.seg[k] = x
        while k > 1:
            k >>= 1
            self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])

    def query(self, a, b):
        L = self.I
        R = self.I
        a += self.sz
        if b == self.N:
            b = self.sz + self.sz
        else:
            b += self.sz
        while a < b:
            if a & 1:
                L = self.func(L, self.seg[a])
                a += 1
            if b & 1:
                b -= 1
                R = self.func(self.seg[b], R)
            a >>= 1
            b >>= 1
        return self.func(L, R)


def main():
    def gcd(a, b):
        while b:
            a, b = b, a % b
        return a
    N = int(readline())
    L = map(int, readline().split())
    seg = SegmentTree(N, gcd, 0)
    for i, n in enumerate(L):
        seg.assign(i, n)
    seg.build()
    ans = 1
    for i in range(N):
        ans = max(ans, gcd(seg.query(0, i), seg.query(i+1, N)))
    print(ans)


main()

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

int main() {
  vector<int> vec = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << vec.at(k-1) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    string S;
    cin>>S;
    if(S.size()==1) {
        cout<<S<<endl;
    }
    else {
        int counter=0;
        bool ok=true;
        for(int i=1; i<S.size(); i++) {
            if(S[i]!='9') ok=false;
        }
        if(ok) {
            counter+=(S.size()-1)*9;
            counter+=S[0]-'0';
        }
        else {
            counter+=(S.size()-1)*9;
            counter+=S[0]-'1';
        }
        cout<<counter<<endl;
    }
}

Measured memory_bytes: 256
#include <functional>
#include <iostream>
#include <queue>
#include <vector>

#define int long long

using namespace std;


int n, m, s;
vector<int> G[51];
int a[51][51];
int b[51][51];
int c[51];
int d[51];

const int INF = 9999999999999;

signed main() {
    cin >> n >> m >> s;
    
    for (int i = 0; i < m; i++) {
        int u, v, x, y;
        cin >> u >> v >> x >> y;
        u--;
        v--;
        G[u].push_back(v);
        G[v].push_back(u);
        a[u][v] = a[v][u] = x;
        b[u][v] = b[v][u] = y;
    }

    for (int i = 0; i < n; i++) {
        cin >> c[i] >> d[i];
    }   

    using P = pair<int, pair<int, int>>;
    priority_queue<P, vector<P>, greater<P>> que;

    static int dist[51 * 51 + 1][51];
    for (int i = 0; i <= 51 * 51; i++) {
        for (int j = 0; j < 51; j++) {
            dist[i][j] = INF;
        }
    }

    if (s > 51 * 51) {
        s = 51 * 51;    
    }
    dist[s][0] = 0;

    que.push(P(0, {s, 0}));

    while (!que.empty()) {
        P p = que.top();
        que.pop();

        int current_time = p.first;
        int x_v = p.second.second;

        if (dist[p.second.first][p.second.second] > p.first) {
            continue;
        }

        // cerr << "v: " << p.second.second << ", s: " << p.second.first << ", t: " << p.first << endl;

        for (int i = 1; ; i++) {
            int ns = p.second.first + c[x_v] * i;
            if (ns > 51 * n) {
                break;
            }
            int t = current_time + d[x_v] * i;
            if (t < dist[ns][x_v]) {
                dist[ns][x_v] = t;
                que.push(P(t, {ns, x_v}));
            }
        }

        for (auto u : G[x_v]) {
            int x_s = p.second.first;

            int cost = a[x_v][u];

            if (x_s >= cost) {
                int t = current_time + b[x_v][u];
                if (t < dist[x_s - cost][u]) {
                    dist[x_s - cost][u] = t;
                    que.push(P(t, {x_s - cost, u}));
                }
            }
        }
    }

    for (int i = 1; i < n; i++) {
        int x_min = INF;
        for (int j = 0; j <= 51 * 51; j++) {
            x_min = min(x_min, dist[j][i]);
        }
        cout << x_min << endl;
    }

    return 0;
}

Measured memory_bytes: 53420
// finish date: 2018/04/15

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000
#define pii pair<int,int>


int main() {
    int N;
    cin >> N;
    vi a(N);
    rep(i, N) cin >> a[i];
    sort(a.begin(), a.end());
    double half = a[N - 1] / 2.0;
    double mi = INF;
    int miIndex = 0;
    rep(i, N - 1) {
        if (abs(half - a[i]) < mi) {
            mi = abs(half - a[i]);
            miIndex = i;
        }
    }
    cout << a[N - 1] << " " << a[miIndex] << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define precise(i) cout<<fixed<<setprecision(i)
#define codejam cout<<"Case #"<<ii+1<<": ";
#define impossible cout<<"IMPOSSIBLE"<<endl;
#define error(s) throw runtime_error(s)
#define log loga
// std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
// int myRand(int R) {
// 	int val=rng() % R;
//       assert(val>=0);
//       return val;
// }
using namespace std;
const long double PI = atan(1.0)*4;
const int64_t INF=3e18;
const int32_t LOG=21;
const int32_t MOD=MOD1;

int32_t main()
{ 
      getFaster;
      int tests=1;
      //cin>>tests;
      rep(ii,0,tests)
      {
           int n;
           cin>>n;
           n%=1000;
           n=(1000-n)%1000;
           cout<<n<<endl; 
      }
      return 0;                         
}

/*
 TIPS:
 1.) Check for corner cases (like 0 is exception case)
 2.) Check for global memory sizes,memory refreshments and its complexity 
 3.) Check for sorting criteria (if used 1-based indexing)
 4.) Check for numbers overflow (while multiplying and doing MOD)
 5.) Check for typecasting issues like int to float( while dividing numbers)
*/

Measured memory_bytes: 3608
#include <cmath>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

#include <map>

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;

int n;
map<int, int> a;

int m;

void input() {
  a.clear();

  cin >> n;

  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;

    a[t]++;
  }
  
  cin >> m;
}

void solve() {
  string ans = "YES";

  while (m--) {
    int t;
    cin >> t;

    a[t]--;

    if (a[t] < 0)
      ans = "NO";
  }
  
  cout << ans << '\n';
}

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

  cout.precision(16);
  cout << fixed;

  int _times = 1;

#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  _times = 4;
#endif

  // cin >> _times;

  while (_times--) {
    input();
    solve();
  }
}


Measured memory_bytes: 12920
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	//文字列から10進数に変換するときはparseIntを使います
	var n = parseInt(input[0], 10);
    var ptotal=0;pbox=0;
	for(i=1;i<=n;i++){
        var p = parseInt(input[i], 10);
         ptotal+=p;
        if(pbox<=p){ pbox=p;}
   
    }
    console.log(ptotal-pbox/2);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <stack>
#include <cmath>
#include <time.h>
using namespace std;

#define LL long long 
#define clr(x) memset(x,0,sizeof(x))
#define eps 1e-6
#define PI 3.1415926535897932384626433832795028          
#define MAXN 105

struct color
{
	double a,b,c;

}e[105];

double d[105][105];

int check[1005];

int main()
{
	int n,m;
	while(scanf("%d%d",&n,&m)!=EOF)
	{
		for(int i=0;i<n;i++)
			scanf("%lf%lf%lf",&e[i].a,&e[i].b,&e[i].c);

		for(int i=0;i<n;i++)
		{
			for(int j=i+1;j<n;j++)
			{
			    d[i][j]=(e[i].a-e[j].a)*(e[i].a-e[j].a)+(e[i].b-e[j].b)*(e[i].b-e[j].b)+(e[i].c-e[j].c)*(e[i].c-e[j].c);
				//printf("%lf\n",d[i][j]);
			}
		}
		double s=0,min=0;
		
		clr(check);

		for(int i=n-m;i<n;i++)
		{
			check[i]=1;
		}
		//s=0;
			//for(int i=0;i<n;i++)
			//	printf("%d",check[i]);
			//printf("\n");
			for(int i=0;i<n;i++)
			{   
				if(check[i])
				{
					for(int j=i+1;j<n;j++)
					{
						if(check[j])
							s+=d[i][j];
					}
				}
			}
			//printf("%d\n",s);
			if(s>min)
				min=s;
		while(next_permutation(check,check+n))
		{
			s=0;
			//for(int i=0;i<n;i++)
				//printf("%d",check[i]);
			//printf("\n");
			for(int i=0;i<n;i++)
			{   
				if(check[i])
				{
					for(int j=i+1;j<n;j++)
					{
						if(check[j])
							s+=d[i][j];
					}
				}
			}
			//printf("%d\n",s);
			if(s>min)
				min=s;
		}		
		printf("%lf\n",min);
	}
	return 0;
}

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

using namespace std;

bool caldist(vector<int> v1,vector<int> v2)
{

	int dist=0;
	for(int i=0;i<v1.size();i++)
	{
		dist+=abs((v1[i]-v2[i])*(v1[i]-v2[i]));
	}

	int res=sqrt(dist);

	if(res*res==dist)
		return true;

	return false;
}


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

	vector<int> v[n+5];

	int x;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<d;j++)
		{	
			cin>>x;
			v[i].push_back(x);
		}
	}

	int cnt=0;

	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			if(caldist(v[i],v[j]))
				cnt++;
		}
	}

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

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
int main(void) {
	//A
	/*
	int a, b;
	std::cin >> a;
	std::cin >> b;
	if (b%a == 0) {
		std::cout << a + b;
	}
	else {
		std::cout << b-a;
	}
	*/

	//B
	/*
	int n, m, k, x;
	std::cin >> n;
	std::cin >> m;
	int table[31] = { 0 };
	for (int i = 0; i < n; i++) {
		std::cin >> k;
		for (int j = 0; j < k; j++) {
			std::cin >> x;
			table[x]++;
		}
	}
	int result = 0;
	for (int i = 0; i < m+1; i++) {
		if (table[i] == n)result++;
	}
	std::cout << result << "\n";
	std::cout << "";
	*/

	//C
	int Euclidean(int,int);
	int n;
	int a,b;
	std::cin >> n;
	std::cin >> a;
	std::cin >> b;
	a = Euclidean(a,b);
	for (int i = 0; i < n-2; i++) {
		std::cin >> b;
		a = Euclidean(a, b);
	}
	std::cout << a << "\n";
}

int Euclidean(int a, int b) {
	int c,tmp;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}
	while (a%b != 0) {
		c = a%b;
		a = b;
		b = c;
	}
	return b;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <tuple>
#include <algorithm>
#include <array>
using namespace std;
using ll = long long;
#define rep(i,n) for(decltype(n) i=0; i<n; ++i)
inline constexpr ll Inf = (1ULL << 62) -1;

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

int main() {
    ll N;
    cin >> N;
    string c;
    cin >> c;
    ll left = 0;
    ll right = c.size()-1;
    ll i=0;
    for (; ;) {
        while (c[left] == 'R') {
            ++left;
            if (left >= c.size())
                break;
        }
        while (c[right] != 'R') {
            --right;
            if (right <= left)
                break;
        }
        if (left < right)
            ++i;
        if (right <= left)
            break;
        ++left;
        --right;
    }
    ll ans=i;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3388
#include <iostream>
using namespace std;
int main(){
    int n,a[50],b[50],c[50],ans=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }for(int i=0;i<n;i++){
        cin>>b[i];
        ans+=b[i];
    }for(int i=0;i<n-1;i++){
        cin>>c[i];
    }
    for(int i=0;i<n;i++){
        if(i!=0&&a[i]-a[i-1]==1){
            ans+=c[a[i-1]-1];
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

int main() {
  
  int ans;
  char a,b,c;
  cin >> a >> b >> c;
  
  if (a == '1')
    ans ++;
    
  if (b == '1')
    ans ++;

  if (c == '1')
    ans ++;
    
    
  cout << ans << endl;
}


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


int m1, d1, m2, d2;

void Main() {
  cin >> m1 >> d1;
  cin >> m2 >> d2;

  if (m1 == m2) cout << 0 << endl;
  else cout << 1 << endl;
}

int main() {
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include <iomanip>
using namespace std;


int main(void){
    int N;
    cin >> N;
    map <string,int> result;
    for(int i =0; i < N; i++){
        string tmp;
        cin >> tmp;
        result[tmp]++;
    }

    int ac,wa,tle,re;
    cout << "AC x " << result["AC"] << endl;
    cout << "WA x " << result["WA"] << endl;
    cout << "TLE x " << result["TLE"] << endl;
    cout << "RE x " << result["RE"] << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
const int MAX_CNT=11;
int cnt[MAX_CNT];
int n,w,idx,maxCnt,minIdx,maxIdx,tmp;
long double d;

int main(){ _;
  while(cin>>n>>w,(n|w)!=0){
    REP(i,MAX_CNT)cnt[i]=0;
    maxCnt=maxIdx=0;
    minIdx=1<<27;
    REP(i,n){
      cin>>tmp;
      idx=tmp/w;
      cnt[idx]++;
      maxCnt=max(maxCnt,cnt[idx]);
      minIdx=min(minIdx,idx);
      maxIdx=max(maxIdx,idx);
    }
    d=0;
    for(int i=0;i<maxIdx;i++){
      d+=cnt[i]*(maxIdx-i);
    }
    d/=maxIdx*maxCnt;
    d+=0.01;
    printf("%.16Lf\n",d);
  }
}

Measured memory_bytes: 1220