akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
int main(void){
	char w[101];
	scanf("%s",w);
	int l=strlen(w);
	int al[26]={0};
	for(int i=0;i<l;i++){
		al[w[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		if(al[i]%2==1){
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	
	return 0;
}

Measured memory_bytes: 128
import math
n = int(input())
m = []
ds = []

for i in range(n):
  m.append(list(map(int, input().split())))

for i in range(n):
  for j in range(i+1, n):
    ds.append(math.sqrt((m[i][0]-m[j][0])**2+(m[i][1]-m[j][1])**2))
ps = math.factorial(n)

print(sum(ds)*(n-1)/len(ds))

Measured memory_bytes: 3064
import java.util.*;

public class Main {
static long nCr(long n, long r) {
    long ans = 1L;
    for (int i=1;i<=r;i++) {
        ans = ans*(n-i+1)/i;
    }
    return ans;
}
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        Long[] x = new Long[N];
        for (int i=0;i<N;i++) {
            x[i] = Long.parseLong(sc.next());
        }
        Arrays.sort(x, (o1, o2)->Long.compare(o2, o1));
        long val = x[A-1];
        int before = 0;
        int after = 0;
        for (int i=0;i<A;i++) {
            if (x[i]==val) before++;
        }
        for (int i=A;i<N;i++) {
            if (x[i]==val) after++;
        }

        // mean
        long sum = 0L;
        for (int i=0;i<A;i++) {
            sum += x[i];
        }
        double mean = (double)sum/A;
        System.out.println(mean);
        // System.out.println(nCr(3, 1));
        // count
        if (x[0]!=val) {
            System.out.println(nCr(before+after, before));
        } else { // x[0]==val
            long ans = 0L;
            for (int i=0;i<=B-A;i++) {
                ans += nCr(before+after, before+i);
            }
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 27988
#include<stdio.h> 
#define MAX 100001
 
typedef struct Card{
  char mark;
  int num;
  int index;
}c;
 
int n;
 
int Partition(c A[],int p,int r){
  c t,u;
  int i,j,s;
  s=A[r].num;
  i=p-1;
  for(j=p;j<=r-1;j++){
    if(A[j].num<=s){
      i++;
      t=A[i];      
      A[i]=A[j];
      A[j]=t;
    }
  }
  u=A[i+1];        
  A[i+1]=A[r];
  A[r]=u;
  return i+1;
}
 
void QuickSort(c Q[],int p,int r){
  int q;
  if(p<r){
    q=Partition(Q,p,r);
    QuickSort(Q,p,q-1);
    QuickSort(Q,q+1,r);
  }
}
 
int JudgeStability(c K[],int n){
  int i;
  for(i=1;i<n;i++){
    if((K[i-1].num==K[i].num) && (K[i-1].index>K[i].index)){
      return 0; 
    } 
  }
  return 1;
}
 
int main(){
  int i;
  c P[MAX];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %c %d",&P[i].mark,&P[i].num);
    P[i].index = i;
  }
 
  QuickSort(P,0,n-1);
  if(JudgeStability(P,n)==1) printf("Stable\n");
  else if(JudgeStability(P,n)==0) printf("Not stable\n");
  for(i=0;i<n;i++){
    printf("%c %d\n",P[i].mark,P[i].num);
  }
  return 0;
}

Measured memory_bytes: 1780
#include<iostream>
#include<string.h>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

queue<int> que;
queue<int> q;

int main()
{
  int n,l;
  int i,j,k;
  char str[105][105]={};
  int ord[100]={};
  int used[100]={};
  cin>>n>>l;

  rep(i,n)
    scanf("%s",str[i]);

  int min;
 
  rep(j,n-1){
    rep(i,n)
      if(used[i]==0){
	min=i;
	break;
      }
    for(i=1;i<n;i++){
      if(used[i]==0 && strcmp(str[min],str[i])>0)
	min=i;
    }
    ord[j]=min;
    used[min]=1;
  }
  rep(i,n)
    if(used[i]==0)
      break;
  ord[n-1]=i;


  rep(i,n)
    printf("%s",str[ord[i]]);
  puts("");
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func count(s []string, i, j int) int {
	count := 0

	l1 := len(s) - 1
	l2 := len(s[i]) - 1

	if i != 0 {
		if s[i-1][j] == '#' {
			count++
		}
		if j != 0 {
			if s[i-1][j-1] == '#' {
				count++
			}
		}
		if j != l2 {
			if s[i-1][j+1] == '#' {
				count++
			}
		}
	}
	if i != l1 {
		if s[i+1][j] == '#' {
			count++
		}
		if j != 0 {
			if s[i+1][j-1] == '#' {
				count++
			}
		}
		if j != l2 {
			if s[i+1][j+1] == '#' {
				count++
			}
		}
	}
	if j != 0 {
		if s[i][j-1] == '#' {
			count++
		}
	}
	if j != l2 {
		if s[i][j+1] == '#' {
			count++
		}
	}

	return count
}

func main() {
	var h, w int
	fmt.Scan(&h, &w)

	s := make([]string, h)
	for i := 0; i < h; i++ {
		fmt.Scan(&s[i])
	}

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if s[i][j] == '#' {
				fmt.Print(string(s[i][j]))
			} else {
				fmt.Print(count(s, i, j))
			}
		}
		fmt.Println()
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
#define uint unsigned int


using namespace std;

const int MAXN = 100;

char mat[MAXN + 1][MAXN + 1];

int main() {
#ifdef HOME
    ifstream cin("A.in");
    ofstream cout("A.out");
#endif
    int i, n, m;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n >> m;
    for(i = 1; i <= n; i++) {
    	cin >> (mat[i] + 1);
    }
   	deque<pair<int, int>> Q;
   	int dl[] = {1, 0}, dc[] = {0, 1};
   	vector<vector<int>> dst(n + 1, vector<int>(m + 1, 1e9));
   	vector<vector<bool>> vis(n + 1, vector<bool>(m + 1));
   	Q.push_back({1, 1}), dst[1][1] = (mat[1][1] == '#');

   	while(Q.size()) {
   		auto cur = Q.front();
   		Q.pop_front();
   		if(vis[cur.first][cur.second]) {
   			continue;
   		}
   		vis[cur.first][cur.second] = 1;
   		for(i = 0; i < 2; i++) {
   			int l = cur.first + dl[i], c = cur.second + dc[i];
   			if(l > 0 && l <= n && c > 0 && c <= m) {
   				int cst = (mat[l][c] == '#' && mat[cur.first][cur.second] == '.');
   				if(dst[l][c] > dst[cur.first][cur.second] + cst) {
   					dst[l][c] = dst[cur.first][cur.second] + cst;
   					if(cst == 0) {
   						Q.push_front({l, c});
   					}
   					else {
   						Q.push_back({l, c});
   					}
   				}
   			}
   		}
   	}
   	cout << dst[n][m];

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef pair<string,ll> si;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
#define sort(a) sort(a.begin(),a.end());
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define mp make_pair
#define F first
#define S second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define nl "\n"
const int MOD = 1e9+7;
const ld PI = 3.1415926535898;
const ll LLMAX = LLONG_MAX;
#define N (int)1e6+1

int main()
{
	ios
	int n,k;
	cin>>n>>k;
	int a[n+1];
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int price[n+1]={0};
	for(int i=2;i<=n;i++)
	{
		price[i]=INT_MAX;
		for(int j=1;j<=k;j++)
		{
			if(i-j>0)
				price[i]=min(price[i],abs(a[i]-a[i-j])+price[i-j]);
			else
				break;
		}
	}
	cout<<price[n]<<nl;
}

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

int main() {
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		int x = i * 108;
		int y = x / 100;
		if(y == n)
		{
			cout<<i;
			return 0;
		}
	}
	
	cout<<":(";
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
sys.setrecursionlimit(10**7)

n,m=map(int,input().split())
XY=[tuple(map(int,input().split())) for i in range(m)]
G=[[] for i in range(n)]
for x,y in XY:
  x-=1; y-=1
  G[x].append(y)

dp = [-1]*n

def rec(node):
  if dp[node] != -1: return dp[node]
  result = 0
  for vi in G[node]:
    result= max(result,rec(vi)+1)
    dp[node] = result
  return result


for i in range(n):
  if dp[i] == -1:
      rec(i)
print(max(dp))

Measured memory_bytes: 164744
import math
while 1:
    n=int(raw_input())
    if n==-1:
        break
    r=1.0
    th=0.0
    for i in xrange(n-1):
        r=(r**2+1)**(1.0/2)
        th+=math.asin(1/r)
    print("%.2f"%(r*math.cos(th)))
    print("%.2f"%(r*math.sin(th)))

Measured memory_bytes: 6804
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Program
{
    internal static void Main(string[] args) {
        var inp = ReadLine().Replace(" ","");
        var d = Math.Sqrt(double.Parse(inp));
        if (d == (int)d) {
            WriteLine("Yes");
        } else {
            WriteLine("No");
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long

using namespace std;

const int MAXN = 500;

struct Train {
    int c, s, f;
}v[MAXN + 1];

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int n, i, j;
    ios::sync_with_stdio(false);
    cin >> n;
    for(i = 1; i < n; i++) {
        cin >> v[i].c >> v[i].s >> v[i].f;
    }
    for(i = 1; i <= n; i++) {
        int ans = 0;
        for(j = i; j < n; j++) {
            ans = max(ans, v[j].s);
            ans = ((ans + v[j].f - 1) / v[j].f) * v[j].f;
            ans += v[j].c;
        }
        cout << ans << endl;
    }
    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a,b;

  scanf("%d %d",&a,&b);

  if (a > b){

    printf("a > b\n");

      }

  if (a < b){

    printf("a < b\n");

      }

  if (a == b){

    printf("a == b\n");

  }

  return 0;

}
  

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

/*------------------------------------*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N;
    string S;
    cin>>N>>S;
    int cnt = 0;
    rep(i,N-2){
        if(S.substr(i,3) == "ABC")cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll ;
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 const ll inf=1e9+7;
string a,b,c;

queue<char>q[3];


void scan(int n)
{
	char c;
	while((c=getchar() )!='\n')
		{
			q[n].push(c);
		}
}
int main()
{
    fast;
    
    scan(0);
    scan(1);
    scan(2);
    

	ll k=0;
	while(!q[k].empty())
	{
		char c=q[k].front();
		q[k].pop();
		
		k=c-'a';
	}
	

  cout<<char(k +'A');
  
    
   
}

		
	
	
	
	


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>//cout << fixed からの cout << setprecision(n) << 小数　によって小数を整数部分含めてn桁表示できるようにする
#include <cctype>
#include <unordered_map>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  int n;
  cin >> n;
  vector<int> h(n,0);
  vector<int> cost(n,INF);
  for(int i = 0; i < n; i++) cin >> h[i];
  cost[0] = 0;
  cost[1] = abs(h[1]-h[0]);
  if (n == 2) cout << cost[1] << endl;
  else{
  for(int i = 2; i < n; i++){
    cost[i] = min(cost[i-2] + abs(h[i] - h[i-2]),cost[i-1] + abs(h[i] - h[i-1]));
    }
    cout << cost[n-1] << endl;
  }

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main() {
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	int wmax = a*100, smax = 0;
	for (int ia = 0; ia * a * 100 <= f; ia++) {
		for (int ib = 0; (ib*b + ia*a) * 100 <= f; ib++) {
			for (int ic = 0; ic*c + (ia*a + ib*b) * 100 <= f; ic++) {
				if ((ia*a + ib * b)*e < ic*c)break;
				for (int id = 0; id*d + ic*c + (ia*a + ib*b) * 100 <= f; id++) {
					if ((ia*a + ib * b)*e< ic*c + id*d)break;
					if ((100 * smax)*((ia*a + ib * b) * 100 + ic * c + id * d) <= (100 * (ic*c + id * d))*(wmax+smax)) {
						wmax = (ia * a + ib * b) * 100;
						smax = ic * c + id * d;
					}
				}
			}
		}
	}
	cout << wmax + smax << " " << smax << endl;
	return 0;
}

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

using namespace std;

int main()
{
    long long tam, i;
    string S;
    cin >> S;
    tam=S.size();
    string ese[tam];
    for(i=0; i<tam; i++)
    {
        ese[i]=S[i];
    }
    sort (ese, ese+tam);
    for(i=0; i<tam-1; i++)
    {
        if(ese[i]==ese[i+1])
        {
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include<iomanip>
using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,y;
  cin>>n>>y;
  for(int i=0;i<n+1;i++)
  {
    for(int j=0;j<n+1-i;j++)
    {
      if(y==i*10000+j*5000+(n-i-j)*1000)
      {
        cout<<i<<" "<<j<<" "<<n-i-j<<endl;
        return 0;
      }
    }
  }
  cout<<-1<<" "<<-1<<" "<<-1;

  return 0;

}


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

using namespace std;

int main() {
	int n, m; scanf("%d %d", &n, &m);
	vector<int> h(n);
	for (int i = 0; i < n; ++i) scanf("%d", &h[i]);
	vector<vector<int>> graph(n);
	for (int i = 0; i < m; ++i) {
		int x, y; scanf("%d %d", &x, &y);
		--x; --y;
		graph[x].push_back(y);
		graph[y].push_back(x);
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		bool valid = true;
		for (int v : graph[i]) if (h[v] >= h[i]) valid = false;
		if (valid) ++ans;
	}
	printf("%d\n", ans);
	return 0;
}


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

int main(){
  double N, T, A;
  cin >> N >> T >> A;
  vector<double> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  double temp = 10000;
  int ans = 0;
  for(int j=0; j<N; j++){
    if(abs(temp - A) > abs((T- vec.at(j)* 0.006) - A)){
      ans = j;
      temp = T - vec.at(j)*0.006;
    }
  }
  cout << ans + 1<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int arr[maxn], n;
map<int, int> mp;
int main(void) {
    scanf("%d", &n);
    for(int i = 0; i < n; ++i) {
        scanf("%d", arr + i);
        mp[arr[i]]++;
    }
    int ans = 0;
    for(auto it = mp.begin(); it != mp.end(); ++it) {
        if(it->second & 1) ans++;
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 5376
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main() {
  int64_t N;
  cin >> N;
  int64_t result = 0;
  for (int64_t i = 1; i <= N; i++) {
    int64_t term = i * (N / i) * (1 + N / i) / 2;
    result += term;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3188
#include <iostream>
#include <cctype>
#include <string>
using namespace std;


int main()
{

  string word;

  
    
  getline( cin, word );
      // cout << word <<  endl;

      for( int i = 0; i < word.size(); i++ )
	{

	  if( isupper(word[i]) )
         word[i] = tolower(word[i]); 
      //  cout << word; 
     
	else  if( islower(word[i]) )
       word[i] = toupper(word[i]);
	}
      cout << word << endl;

      //  if( word == '\n' ) break;
    


  return 0;

}

Measured memory_bytes: 1180
/*

*/
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N; cin >> N;
  int P[N]; for (int i = 0; i < N; i++) cin >> P[i];
  int Q[N]; for (int i = 0; i < N; i++) cin >> Q[i];

  // 大きさNの順列を生成
  int P_[N], Q_[N];
  for (int i = 0; i < N; i++) {
    P_[i] = i + 1;
    Q_[i] = i + 1;
  }

  // Pが辞書順で何番目に小さいか調べる
  int a = 1;
  do {
    bool ok = true;
    for (int i = 0; i < N; i++) {
      if (P[i] != P_[i]) {
        ok = false;
        break;
      }
    }
    if (ok) break;
    a++;
  } while (next_permutation(P_, P_ + N));

  // Qが辞書順で何番目に小さいか調べる
  int b = 1;
  do {
    bool ok = true;
    for (int i = 0; i < N; i++) {
      if (Q[i] != Q_[i]) {
        ok = false;
        break;
      }
    }
    if (ok) break;
    b++;
  } while (next_permutation(Q_, Q_ + N));

  int ans = max(a, b) - min(a, b);
  cout << ans << endl;

  return 0;
}

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

int main(){
    int N; cin >> N;
    ll A[200200];
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    int rr=0, l=0; //A[rr]からA[l-1]まで和を取る
    ll ans=0;
    ll xor_sum=0;
    ll sum=0;
    for(rr=0; rr<N; rr++){
        while( l <N && (xor_sum^A[l])  == sum+A[l] ){ 
            xor_sum ^=A[l]; sum +=A[l];
            l++;
        }
        ans +=l-rr;
        xor_sum ^= A[rr]; sum -=A[rr];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    vector<int> a(n + 1, x), b(m + 1, y + 1);
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for(int i = 1; i <= m; i++) {
        cin >> b[i];
    }
    bool peace = false;
    for(int z = x; z <= y; z++) {
        peace |= *max_element(a.begin(), a.end()) < z and z <= *min_element(b.begin(), b.end());
    }
    cout << (peace ? "No War" : "War") << endl;
    return 0;
}


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

using ll = long long;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, ar, r;
	cin >> n;
	ar = (n-1)*n>>1;
	cout << ar-(n>>1) << "\n";
	r = n - (n&1);
	for (int i=1; i<=n; i++) {
		for (int j=i+1; j<=n; j++) {
			if (j == r-i+1) continue;
			cout << i << " " << j << "\n";
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>

#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

using namespace std;

int main(){
	int a[5];
	int k;
	bool ans=true;
	rep(i,0,5){
		cin >> a[i];
	}
	cin >> k;
	rep(i,0,5){
		rep(j,0,5){
		if(k<a[i]-a[j]){
			ans = false;
		}
		}
	}
	if(!ans){
		cout << ":(" << endl;
	}else{
		cout << "Yay!" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const int mod = 1e9+7;
const int N = 1e5+5;
//int a[N];

int main()

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

    int n, ans;

    cin >> n;

    double arr[n], avg = 0, mini = INT_MAX;

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

        cin >> arr[i];
        avg += arr[i];
    }

    avg/=n;

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

        double diff = abs(arr[i]-avg);

        if (diff < mini) {

            mini = diff;
            ans = i;
        }
    }

    cout << ans;

    return 0;
}


//long long vs int
//pow function (+0.5)
//read carefully: overflow, constraints, etc...


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>

int main(){
  int a,b,c;
  std::cin>>a>>b>>c;
  std::cout<<(a==b?c:(b==c?a:b))<<std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cerr<<#x<<"="<<x<<"\n"
typedef long long ll;
template<typename T>
void print_to(std::ostream &os,const char *,const char *tail,const T &fst){
  os<<fst<<tail;
}
template<typename Fst,typename... Rst>
void print_to(std::ostream &os,const char *del,const char *tail,const Fst &fst,const Rst &... rst){
  os<<fst<<del;
  print_to(os,del,tail,rst...);
}
template<typename Iter>
void print_to_(std::ostream &os,const char *del,const char *tail,Iter bgn,Iter end){
  for(Iter it=bgn;it!=end;){
    os<<*it;
    if(++it!=end)os<<del;
    else os<<tail;
  }
}
template<typename Fst,typename... Rst>
void println(const Fst &fst,const Rst &... rst){
  print_to(std::cout,"\n","\n",fst,rst...);
}
template<typename Fst,typename... Rst>
void print(const Fst &fst,const Rst &... rst){
  print_to(std::cout," ","\n",fst,rst...);
}
template<typename Iter>
void println_(Iter bgn,Iter end){
  print_to_(std::cout," ","\n",bgn,end);
}
using namespace std;
//const ll MOD=(ll)1e9+7;
const ll inf=(ll)1e14;
const int dy[]={1,0,-1};
const int dx[]={1,0,-1};
int n,m,h,w;
string s;
ll dp[101][101];
int e[1001],f[1001],g[1001];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1=freopen("in","r",stdin);
  //stream2=freopen("out","w",stdout);
  if(stream1==NULL)return 0;
  //if(stream2==NULL)return 0;
#endif
  cin>>n>>m;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      dp[i][j]=inf;
    }
  }
  for(int i=0;i<n;i++)dp[i][i]=0;
  for(int i=0;i<m;i++){
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    dp[a][b]=c;
    dp[b][a]=c;
    e[i]=a;
    f[i]=b;
    g[i]=c;
  }
  for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      if(dp[i][k]==inf)continue;
      for(int j=0;j<n;j++){
        if(dp[k][j]==inf)continue;
        dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
      }
    }
  }
  int ans=0;
  for(int i=0;i<m;i++){
    if(dp[e[i]][f[i]]<g[i])ans++;
  }
  print(ans);
#ifdef LOCAL_DEFINE
  cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}






Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
	int n;
	string abc = "abcdefghijklmnopqrstuvwxyz";
	string abcc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string aa = abcc + abc + abcc + abc;
	int sz = aa.size();
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		vector<int> k(n);
		for (int i = 0; i < n; i++) {
			cin >> k[i];
		}
		string s;
		cin >> s;
		int c = 0;
		for (int i = 0; i < s.size(); i++) {
			for (int j = sz - 1; j >= 0; j--) {
				if (aa[j] == s[i]) {
					cout << aa[j - k[c]];
					c++;
					c %= n;
					break;
				}
			}
		}
		cout << endl;
	}
	return 0;
}

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

using namespace std;

int main(){
    int  S;
    cin >> S;
    int first = S/100;
    int second = S%100;
    if ((first== 0 || 13<=first) &&(second== 0 || 13<=second)) cout << "NA" << endl;
    if ((1<=first && first <=12) && (second== 0 || 13<=second)) cout <<"MMYY" << endl;
    if ((1<=second && second <=12) && (first== 0 || 13<=first)) cout <<"YYMM" << endl;
    if ((1<=first && first <=12) && (1<=second && second <=12)) cout << "AMBIGUOUS" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 500000
#define SENTINEL 2000000000

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

void merge(int A[], int n, int left, int mid, int right)
{
  int i, j, k;
  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 = 0;
  j = 0;
  for (k = left; k < right; k++)
  {
    cnt++;
    if (L[i] <= R[j])
    {
      A[k] = L[i++];
    }
    else
    {
      A[k] = R[j++];
    }
  }
}

void mergeSort(int A[], int n, int left, int right)
{
  if (left + 1 < right)
  {
    int mid = (left + right) / 2;
    mergeSort(A, n, left, mid);
    mergeSort(A, n, mid, right);
    merge(A, n, left, mid, right);
  }
}

int main()
{
  int A[MAX], n, i;
  cnt = 0;

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

  mergeSort(A, n, 0, n);

  for (i = 0; i < n; i++)
  {
    if (i)
      printf(" ");
    printf("%d", A[i]);
    //printf("%d",A[1000000-100]);
  }
  printf("\n");
  printf("%d\n", cnt);

  return 0;
}


Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long int ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef std::vector<ll> vll;
typedef std::vector<vi > vvi;
typedef std::vector<vll > vvll;
typedef std::pair<int,int> ii;
typedef std::pair< ll, ll > lp;
typedef std::vector<ii> vii;
typedef std::vector<vii > vvii;

#define pb push_back 
#define PB pop_back
#define pf push_front
#define PF pop_front
#define mp make_pair
#define ub(a,b) upper_bound(all(a),b)
#define lb(a,b) lower_bound(all(a),b)
#define bs(a,b) binary_search(all(a),b)
#define mem(a,b) memset(a,b,sizeof(a))
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define in1(a,n) F(i,1,n)cin>>a[i]
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<endl
#define ff first
#define ss second
#define F(i,a,b) for (ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define rep(i,n) F(i,0,n-1)
#define clr(a) (a).clear()
#define rz resize
#define sqr(a) ((a) * (a))
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin() ,(a).rend()
#define endl '\n'

#define mod 1000000007

ll add(ll a, ll b){return (a%mod + b%mod)%mod;}
ll sub(ll a , ll b){return (a%mod - b%mod + mod)%mod;}
ll mul(ll a, ll b){return (a%mod * b%mod)%mod;}
ull poww(ull a,ull b){ull res=1;while(b){if(b&1){res*=a;}a=a*a;b>>=1;}return res;}
ll poww(ll a,ll b,ll MOD){ll res=1;while(b){if(b&1){res*=a;res%=MOD;}a=a*a;a%=MOD;b>>=1;}return res;}

#define dbg(x) cout<<#x<<" :: "<<x<<endl;
#define dbg2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define dbg3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define dbg4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;

//end of template

bool isPrime(ll n) 
{ 
    // Corner cases 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}

int main(int argc, char const *argv[])
{
	crap;
	ll n, m;
	cin >> n;
	ll fac = 0LL;
	ll ans = 0LL, ans2 = 0LL;
	for (ll i = 1LL; i*i <=n ; i++){
		if (n % i == 0){
			fac = i;
			m = n/fac - 1;
			if (m > 0){
				if (n%m == n/m){
					ans += m;
				}
			}
			if ( i*i != n){
				fac = n/i;
				m = n/fac - 1;
				if (m > 0){
					if (n%m == n/m){
						ans += m;
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 764
# -*- coding: utf-8 -*-
"""
http://abc068.contest.atcoder.jp/tasks/arc079_a

"""

def solve(routes, N):
    result = 'IMPOSSIBLE'
    to_middle = set()           #  島1から渡ることのできる島
    from_middle = set()         #  島Nへ渡ることのできる島
    for f, t in routes:
        if f == 1:
            to_middle.add(t)
        elif t == N:
            from_middle.add(f)

    if to_middle & from_middle:
        result = 'POSSIBLE'
    return result



def main():
    N, M = map(int, input().split())
    routes = []
    for _ in range(M):
        routes.append([int(x) for x in input().split()])
    result = solve(routes, N)
    print(result)


if __name__ == '__main__':
    main()

Measured memory_bytes: 46456
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<cstring>

using namespace std;

int main()
{
	int s, w;

	scanf("%d %d", &s, &w);

	if (s <= w)
	{
		printf("unsafe\n");
	}

	else
	{
		printf("safe\n");
	}

	return 0;
}


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

#define PRINT "print"
#define REVER "reverse"
#define REPLA "replace"

int main(){
	int a,b,q,i,j,k;
	char tmp;
	char comm[20],str[1001],p[1001];
	
	scanf("%s %d",str,&q);
	for(i=0;i<q;i++){
		scanf("%s",comm);
		if(strcmp(comm,PRINT) == 0){
			scanf("%d %d",&a,&b);
			for(j=a;j<=b;j++){
				printf("%c",str[j]);
			}
			printf("\n");
		}else if(strcmp(comm,REVER) == 0){
			scanf("%d %d",&a,&b);
			while(a<b){
				tmp = str[a];
				str[a] = str[b];
				str[b] = tmp;
				a++;
				b--;
			}
		}else if(strcmp(comm,REPLA) == 0){
			scanf("%d %d %s",&a,&b,p);
			for(j=a;j<=b;j++){
				str[j] = p[j-a];
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1004
// https://atcoder.jp/contests/abc160/tasks/abc160_e
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<int> va(A), vb(B), vc(C);
    for (auto &x : va)
        cin >> x;
    for (auto &x : vb)
        cin >> x;
    for (auto &x : vc)
        cin >> x;

    // 降順ソート
    sort(ALLR(va));
    sort(ALLR(vb));
    sort(ALLR(vc));

    vector<int> ans;
    REP(i, X) { ans.emplace_back(va[i]); }
    REP(i, Y) { ans.emplace_back(vb[i]); }

    // 昇順ソート
    sort(ALL(ans));

    // 無色の添字
    int idx = 0;
    for (auto x : ans) {
        // 暫定解より無色の価値が大きければ、入れ替える
        if (x > vc[idx]) {
            break;
        }
        if (++idx >= (int)vc.size()) {
            break;
        }
    }

    cout << accumulate(ans.begin() + idx, ans.end(), 0LL) +
                accumulate(vc.begin(), vc.begin() + idx, 0LL)
         << endl;
    return 0;
}


Measured memory_bytes: 4852
#include<stdio.h>
void insertionSort(int A[], int N);
int main(void){
	int n[100];
	int i, r;
	scanf("%d", &i);
	for (r = 0; r < i; r++){
		scanf("%d", &n[r]);
	}
	for (r = 0; r < i; r++){
		if (r != i - 1){ printf("%d ", n[r]); }
		else{
			printf("%d\n", n[r]);
		}
	}
	insertionSort(n, i);

	return 0;
}
	void insertionSort(int A[], int N){
		int i, j, v, r;
		for (i = 1; i < N; i++){
			v = A[i];
			j = i - 1;
			while (j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
				A[j + 1] = v;
			}
			for (r = 0; r < N; r++){
				if (r != N - 1){ printf("%d ", A[r]); }
				else{
					printf("%d\n", A[r]);
				}
			}

		}
		return;
	}

Measured memory_bytes: 600
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define dump(o) { cerr << #o << " " << o << endl; }
#define dumpc(o) { cerr << #o; for (auto &e : (o)) cerr << " " << e; cerr << endl; }
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

signed main() {
	string s; cin >> s; s += "__";
	for (int i = 0; i < s.size() - 2; i++) {
		if (s[i] == s[i + 1]) {
			cout << i + 1 << " " << i + 2 << endl;
			break;
		}
		else if (s[i] == s[i + 2]) {
			cout << i + 1 << " " << i + 3 << endl;
			break;
		}
		else if (i == s.size() - 3) {
			cout << "-1 -1" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

int main() {
    auto comp = [](const string &a, const string &b) { if (a.size() == b.size()) return a < b; return a.size() < b.size(); };
    std::map<string, int, decltype (comp) > m(comp);
    int N, num;
    string str;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> str >> num;
        if (m.find(str) != m.end()) m[str] += num;
        else m.insert({str, num});
    }
    for (auto it = m.begin(); it != m.end(); it++) {
        std::cout << it->first << " " << it->second << std::endl;
    }
    return 0;
}



Measured memory_bytes: 3108
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    S = input().rstrip()
    flag1 = True if 0 < int(''.join(S[:2])) <= 12 else False
    flag2 = True if 0 < int(''.join(S[2:])) <= 12 else False
    
    if flag1 and flag2: print('AMBIGUOUS')
    elif flag1 and not flag2: print('MMYY')
    elif not flag1 and flag2: print('YYMM')
    else: print('NA')

if __name__ == '__main__':
    main()

Measured memory_bytes: 4072
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<bitset>
#include<stack>
#include<cassert>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define mem(x,y) memset(x,y,sizeof x)
#define sqr(x) ((x)*(x))
//debug
#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...)
#endif
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
const int INF=2e9;
const db eps=1e-12;
template<typename T>
inline void read(T &x) {
  x=0; int f=1; char ch=getchar();
  while( (ch<'0' || ch>'9') && ch!='-') ch=getchar(); if(ch=='-') {f=-1; ch=getchar();}
  while(ch>='0' && ch <='9') x=x*10+ch-'0',ch=getchar();
  x*=f;
}
//==========================head template==========================
const int N=2010;
int n,K;
int head[N],nxt[N<<1],to[N<<1],lst=1;
inline void adde(int x,int y) {
  nxt[++lst]=head[x]; to[lst]=y; head[x]=lst;
}
bool vis[N];
int Dfs(int u,int dis) {
  int ret=0;
  vis[u]=1;
  for(int i=head[u];i;i=nxt[i])
    if(!vis[to[i]]) {
      int v=to[i];
      ret+=Dfs(v,dis+1);
    }
  return ret+(dis>K/2);
}
inline int Check(int u) {
  mem(vis,0);
  return Dfs(u,0);
}
inline int Work(int u,int v) {
  int ret=0;
  mem(vis,0); vis[v]=1;
  ret=Dfs(u,0);
  mem(vis,0); vis[u]=1;
  ret=ret+Dfs(v,0);
  return ret;
}
signed main() {
  read(n); read(K);
  for(int i=1;i<n;i++) {
    int x,y; read(x); read(y);
    adde(x,y); adde(y,x);
  }
  int ans=n+1;
  if(!(K&1))
    for(int i=1;i<=n;i++)
      ans=min(ans,Check(i));
  else
    for(int i=1;i<n;i++)
      ans=min(ans,Work(to[i<<1],to[i<<1|1]));
  printf("%d\n",ans);
  return 0;
}


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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> a(N+1);
    for (int i = 0; i < N; i++)
    {
        int b;
        cin >> b;
        a[b]++;
    }

    int cnt = 0;
    for (int i = 1; i <= N; i++)
    {
        if(a[i] > 0) cnt++;
    }
    sort(a.begin(), a.end());

    int ans = 0;
    if(cnt <= K) cout << "0" << endl;
    else
    {
        for (int i = cnt; i > K; i--)
        {
            auto c = lower_bound(a.begin(), a.end(), 1);
            ans += a[c - a.begin()];
            a[c - a.begin()] = 0;
        }
        cout << ans << endl;
    }

}

Measured memory_bytes: 1024
while True:
    H,W=map(int,input().split())
    if H==W==0:
        break
    if W%2==0:
        if H%2==0:
            for i in range(H//2):
                print("#."*(W//2))
                print(".#"*(W//2))
        else:
            for i in range(H//2):
                print("#."*(W//2))
                print(".#"*(W//2))
            print("#."*(W//2))
    else:
        if H%2==0:
            for i in range(H//2):
                print("#."*(W//2),"#",sep="")
                print(".#"*(W//2),".",sep="")
        else:
            for i in range(H//2):
                print("#."*(W//2),"#",sep="")
                print(".#"*(W//2),".",sep="")
            print("#."*(W//2),"#",sep="")
    print()


Measured memory_bytes: 5620
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main(){

	vector<int>number(3);
  
  	for(int i; i<3; i++){
 		cin >> number.at(i);
    }
  
	sort(number.begin(), number.end());  	
  	
  	for(int i=0; i<3; i++){
    	if(i<2) cout << number.at(i) << " ";
      	if(i==2) cout << number.at(i) << endl; 
    }
  	return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
typedef bool boolean;
 
const int N = 1e3 + 5;
 
int W, H, A, B;
 
int main() {
    scanf("%d%d%d%d", &W, &H, &A, &B);
    for (int i = 0; i < W; i++) {
        for (int j = 0; j < H; j++) {
            putchar('0' ^ (i < B) ^ (j < A));
        }
        putchar('\n');
    }
    return 0;
}

Measured memory_bytes: 1280
while True:
    a,op,b = input().split()
    if op == "?":
        break
    if op == "+":
        print(int(a)+int(b))
    elif op == "-":
        print(int(a)-int(b))
    elif op == "*":
        print(int(a)*int(b))
    elif op == "/":
        print(int(a)//int(b))


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

int main(void){
    int a, b;
    cin >> a >> b;
    
    int n;
    if(b == 100){
        n = a * 1000 + b;
    }else if(b >= 10){
        n = a * 100 + b;
    }else{
        n = a * 10 + b;
    }
    
    if((int)sqrt(n) * (int)sqrt(n) == n){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}


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


int main(){
	int n, m;
	int k;
	int dummy;
	std::map<int, int>foods;
	int count = 0;
	
	std::cin>>n>>m;
	for(int i = 0; i < n ; ++i ){
		std::cin>>k;
		for(int j= 0; j<k; ++j){
			std::cin>>dummy;
			foods[dummy]++;
			}
		}
	for(int i = 0; i < m + 1; ++i){
		if(foods[i] == n) count++;
		}
	std::cout<<count<<'\n';
	
	
	return 0;
	}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

signed main(){
	int N;
	cin>>N;
	for(int i=1;i<=N;i++){
		int s=floor((double)i*1.08);
		if(s==N){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<":("<<endl;
	return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
import numpy as np
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

D = ni()
c = na()
s = [na() for _ in range(D)]
#out = [ni() for _ in range(D)]
sat = 0
last = [0] * 26

for d in range(D):
    li = []
    for k in range(26):
        last_t = last.copy()
        sat_t = sat
        j = k
        last_t[j] = d + 1
        for i in range(26):
            sat_t -= (d + 1 - last_t[i]) * c[i]
        sat_t += s[d][j]
        li.append(sat_t)
    sat = max(li)
    day = np.argmax(li)
    last[day] = d + 1
    print(day+1)


Measured memory_bytes: 26768
#include <bits/stdc++.h>
using namespace std;
int main(){
	map<int,long long> sum, to;
	int n, a; cin >> n >> a;
	sum[0] = 1;
	for(int i = 0; i < n; i++){
		int x; cin >> x; x -= a;
		to = sum;
		for(auto e : sum) to[e.first + x] += e.second;
		sum = to;
	}
	cout << sum[0] - 1 << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

using ll = long long;
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define tc() int t; cin>>t; while(t--)
#define print(n) cout<<n<<"\n"
#define inp(n) int n; cin>>n
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define maxn 1000010
#define mod 1e9+7
#define ff  first
#define ss  second
#define fora(var, start, end) for(int var = start; var < end; var++)
int main()
{
    fast();
    ll h,n,sum=0;
    cin>>h>>n;
    vector<ll> v(n);
    fora(i,0,n){cin>>v[i]; sum+=v[i];}
    ((h>sum)?print("No"):print("Yes"));
    return 0;
}

Measured memory_bytes: 1024
N = int(input())
a = [0 for i in range(N)]
for i in range(N):
    a[i] = int(input())
dp = [0 for i in range(N + 1)]
dp[0] = 0
for i in range(N):
    dp[i + 1] = (dp[i] + a[i]) % 2
if dp[i] == 1:
    print("first")
elif dp[i] == 0:
    if a[i] % 2 == 0:
        flag = 0
        for i in range(N):
            if a[i] % 2 == 1:
                flag = 1
        if flag == 1:
            print("first")
        else:
            print("second")
    else:
        print("first")

Measured memory_bytes: 7856
#include <iostream>

using namespace std;

int main(void)
{
	int a,b,max;
	char name;

	while( cin >> a >> b && a != 0 && b != 0 ){
		max = a + b;
		name = 'A';

		for( int i = 0;i < 4;i++ ){
			cin >> a >> b;
			if( max < a + b ){
				max = a + b;
				name = 'B' + i;
			}
		}

		cout << name << " " << max << endl;
	}

	return 0;
}

Measured memory_bytes: 0
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
start = a1[0]
result = []
for i in range(n):
    aa = i+1
    result.append(sum(a1[:n-i]) + sum(a2[n-aa:]))
print(max(result))

Measured memory_bytes: 9188
h, w, n = map(int, input().split())
in_way = []
for _ in range(n):
  in_way.append(list(map(int, input().split())))
in_way.sort()
way_count = 0
for x in in_way:
  if x[0] > x[1] + way_count:
    print(x[0]-1)
    break
  elif x[0] == x[1] + way_count:
    way_count+=1
else:
  print(h)

Measured memory_bytes: 52712
#include <iostream>
#include <vector>
#define INF 1<<30
#define WHITE 0
#define GRAY 1
#define BLACK 2
int G[2001][2001];
using namespace std;
int n;

void prim(int *d, int *pi){
    int color[n];
    int u = 0;
    for (int i = 0; i < n; i++){
        d[i] = pi[i] = INF;
        color[i] = WHITE;
    }
    d[0] = 0;
    while (1){
        int mincost = INF;
        for (int i = 0; i < n; i++){
            if (color[i] != BLACK && d[i] < mincost){
                mincost = d[i];
                u = i;
            }
        }
        if (mincost == INF) break;
        color[u] = BLACK;
        for (int v = 0; v < n; v++){
            int w = G[u][v];
            if (w == -1) continue;
            else if (color[v] != BLACK && w < d[v]){
                pi[v] = u;
                d[v] = w;
            }
        }
    }
}

int main(int argc, char* argv[]) {
    cin >> n;
    int d[n], pi[n], sum = 0;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            cin >> G[i][j];
        }
    }
    prim(d, pi);
    for (int i = 0; i < n; i++) sum += d[i];
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 3528
import           Data.Function (on)
import           Data.List     (nub)
import           Data.Maybe    (mapMaybe)

main :: IO ()
main = do
  s <- getLine
  t <- getLine
  putStrLn $ if f s t then "Yes" else "No"

f :: String -> String -> Bool
f = (==) `on` normalize

normalize :: Eq a => [a] -> [Int]
normalize xs = mapMaybe (flip lookup table) xs
  where
    table = zip (nub xs) [0..]


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

#define EVEN	0
#define ODD		1

ll a[502][502];

void solve_abc109_d() {
	ll H, W;
	ll ans = 0;

	cin >> H >> W;

	ll tmp;
	ll k = 0;
	rep(i, 502) {
		rep(j, 502) {
			a[i][j] = 0;
		}
	}
	rep1(i, H) {
		rep1(j, W) {
			cin >> a[i][j];
		}
	}


	vector<P> ans_old, ans_new;
	rep1(i, H) {
		if (i != H) {
			rep1(j, W) {
				if (a[i][j] % 2 == 1) {
					a[i][j]--;
					a[i + 1][j]++;
					ans_old.push_back(make_pair(i, j));
					ans_new.push_back(make_pair(i + 1, j));
				}
			}
		}
		else {
			rep1(j, W - 1) {
				if (a[i][j] % 2 == 1) {
					a[i][j]--;
					a[i][j + 1]++;
					ans_old.push_back(make_pair(i, j));
					ans_new.push_back(make_pair(i, j + 1));
				}
			}
		}
	}

	cout << ans_old.size() << "\n";
	rep(i, ans_old.size()) {
		cout << ans_old[i].first << " " << ans_old[i].second << " " << ans_new[i].first << " " << ans_new[i].second << "\n";
	}
}


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

	solve_abc109_d();

	return 0;
}


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

int main() {
    int32_t n;
    cin >> n;
    int32_t a[3 * n];
    
    for (int32_t i = 0; i < 3 * n; i++) {
        cin >> a[i];
    }
    sort(a, a + 3 * n);

    int64_t answer = 0;
    for (int32_t i = 1; i <= n; i++) {
        answer += a[3 * n - 2 * i];
    }
    cout << answer << endl;

    return 0;
}


Measured memory_bytes: 1408