akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <queue>
#include <iomanip>
#include <iterator>

#define MOD 1000000007
#define INF 1000000001

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


template <class T>
ostream &operator<<(ostream &o, const vector<T>&obj) {
    o << "["; for (int i = 0; i < (int)obj.size(); ++i) o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U>&obj) {
    o << "(" << obj.first << ", " << obj.second << ")"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const map<T, U>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const set<T>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const queue<T>&obj) {
    queue<T> obj_cp = obj;
    bool first = true;
    o << "{";
    while (!obj_cp.empty()) { o << (!first ? ", " : "") << obj_cp.front(); obj_cp.pop(); first = false; }
    o << "}"; return o;
}

void print() {
    cout << "\n";
}
template<class Head, class... Body>
void print(Head head, Body... body) {
    cout << head << " ";
    print(body...);
}


int main(int argc, char const *argv[]) {
    int N;
    cin >> N;
    set<string> items;
    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        items.insert(s);
    }
    cout << items.size() << endl;
    return 0;
}


Measured memory_bytes: 19228
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL

typedef long long ll;
typedef pair<ll, ll> P;

//法
#define MOD 1000000007

//ａをbで割る
long long mod_div(long long a,long long b){
	if(a % b == 0)return a/b;
	long long tmp = MOD - 2,c = b,ret = 1;
	while(tmp > 0){
		if(tmp & 1){
			ret *= c;ret %= MOD;
		}
		c *= c;c %= MOD;tmp >>= 1;
	}
	return a*ret%MOD;
}

//階乗の上限
#define MAX_K 333333
vector<long long> kaijo(MAX_K);
long long combination(long long n, long long r){
    if(n < r || n < 0 || r < 0)
        return 0;
	if(kaijo[0] != 1){
		kaijo[0] = 1;
		for(long long i = 1;i < MAX_K;i++)kaijo[i] = (kaijo[i-1] * i) % MOD;
	}
    long long ret = kaijo[n];
	long long tmp = (kaijo[r] * kaijo[n-r]) % MOD;
    return mod_div(ret,tmp);
}

int main()
{
  /* 素数生成 */
  vector<bool> isprime(100000, true);
  isprime[0] = isprime[1] = false;
  for (int i = 2; i < isprime.size(); i++) {
    if (isprime[i] == true) {
      for (int j = 2 * i; j < 100000; j += i) {
        isprime[j] = false;
      }
    }
  }
  vector<int> prime;
  for (int i = 1; i < 100000; i++) {
    if (isprime[i] == true) prime.push_back(i);
  }

  int N, M;
  cin >> N >> M;
  vector<int> cntexp(100000, 0);
  int isMprime = 0;

  int Mt = M;
  for (int i = 0; i < prime.size() && prime[i] <= M; i++) {
    while (Mt % prime[i] == 0) {
      Mt /= prime[i];
      cntexp[prime[i]]++;
    }
  }
  if (Mt != 1) isMprime = 1;

  ll ans = 1;
  for(int i = 0; i < prime.size() && prime[i] <= M; i++) {
    if (cntexp[prime[i]] != 0) {
      ans = (ans * combination(cntexp[prime[i]] + N - 1, cntexp[prime[i]])) % MOD;
    }
  }
  ans = (ans * combination(isMprime + N - 1, isMprime)) % MOD;
  cout << ans << endl;

	return 0;
}



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

int main(){
          int n,m;
          int i,j;
          while(1){
                    int sc;
                    int ans=0;
                    cin >> n >>m;
                    if(!n&&!m) break;
                    vector <int>sum(n);
                    for(i=0;i<m;i++){
                              for(j=0;j<n;j++){
                                        cin >> sc;
                                        sum[j]+=sc;
                              }
                    }
                    for(i=0;i<n;i++)ans = max(ans, sum[i]);
                    cout <<ans<<endl;
          }
}


Measured memory_bytes: 3104
n = gets.to_i
prices = []
n.times { prices << gets.to_i }

memo = -1_000_000_001
tmp_max = 0

prices.reverse.each_cons(2) do |n, m|
  tmp_max = n if [tmp_max, n].max > tmp_max
  memo = tmp_max - m if tmp_max - m > memo
end

puts memo

Measured memory_bytes: 12060
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "Yes" : "No";
}

int abs(int x){
    return x >= 0 ? x : -x;
}

int main(){
    int n; cin >> n;
    int c[n+10];
    ll bmax = 0;

    rep(i,n){
        int a,b; cin >> a >> b;
        bmax += b;
        c[i] = a+b;
    }
    sort(c,c+n);
    reverse(c,c+n);

    ll ans = 0;

    for(int i=0 ; i < n ; i += 2){
        ans += c[i];
    }

    cout << ans-bmax << endl;

}

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
using namespace std;

int s[10];
int N;
int init=0;
void search(int i,int max){
  if(i==N){
    if(init==0)init=1;
    else printf("\n");
    for(int v=0;v<N;v++)printf("%c",'a'+s[v]);
    return;
  }
  for(int v=0;v<=max+1;v++){
    s[i]=v;
    if(v>max)search(i+1,v);
    else search(i+1,max);
  }
}

main(){
  scanf("%d",&N);
  search(0,-1);
}

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

//Do not get frustrated over WA. Check for edge cases and runtime errors :)
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, k;
    cin >> n >> k;
    if (abs(n - k) > n) cout << n;
    else if (k == 1 || n == k) cout << 0;
    else {
        cout << min(n % k, abs(n % k - k));
    }
    return 0;
}


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

#ifdef MYDEBUG
#define dbp(x) cout<<#x<<": "<<x<<endl
#define dbp2(x,y) cout<<#x<<","<<#y<<": "<<x<<","<<y<<endl
#define dbp3(x,y,z) cout<<#x<<","<<#y<<","<<#z<<": "<<x<<","<<y<<","<<z<<endl
#define dbp4(w,x,y,z) cout<<#w<<","<<#x<<","<<#y<<","<<#z<<": "<<w<<","<<x<<","<<y<<","<<z<<endl
#else
#define dbp(x)
#define dbp2(x,y)
#define dbp3(x,y,z)
#define dbp4(w,x,y,z)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define all(x) x.begin(), x.end()
#define rep(i, from, to) for(int i=from; i<to; ++i)

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
	out << "[";
	size_t last = v.size() - 1;
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i];
		if (i != last)
			out << ",";
	}
	out << "]";
	return out;
}

struct edge {
	int from, to, cost;
	edge(int from, int to, int cost) {
		this->from = from;
		this->to = to;
		this->cost = cost;
	}
	bool operator<(const edge& e) const {
		return this->cost < e.cost;
	}
	bool operator>(const edge& e) const {
		return e < *this;
	}
	bool operator>=(const edge& e) const {
		return !(*this < e);
	}
	bool operator<=(const edge& e) const {
		return !(*this > e);
	}
};

typedef struct edge edge;
typedef pair<int, int> P;
const int MAXV = 100100;
const int INF = 1e9 + 10000;
vector<edge> g[MAXV];
int V, E, r;
int d[MAXV];

int dijkstra() {
	//edge???from, to, cost?????????(??????????????????)
	//g?????£??\?????????vector<edge> g[MAXV]
	//d[MAXV]?????????????????§??????????????¢
	//pair<Distance, Vertex> P???<?§????????????????????????¢,????????????>
	//typedef??????P(0,start)??¨??????????????????????????????

	//??¢?????´?????????
	//d????????????INF??§fill
	//d[start]=0 ?§????????????¢???0???
	//while(!que.empty())??§?????\???????????????????????§?????????
	//que.top()??§??????????????????v???????????????, pop()???????????????
	//v?????????????????????e???????????????????????´??°
	//if(d[e.to] > d[e.from] + e.cost) ????????´??°
	//	d[e.to] = d[e.from] + e.cost
	//	que.push(P(d[e.to], e.to);

	fill(d, d + MAXV, INF);
	priority_queue<P, vector<P>, greater<P> > que;
	d[r] = 0;
	que.push(P(0, r));
	while (!que.empty()) {
		P p = que.top();
		que.pop();
		int v = p.second;
		for (size_t i = 0; i < g[v].size(); ++i) {
			edge e = g[v][i];
			if (d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
	for (int i = 0; i < V; ++i) {
		if (d[i] == INF) {
			cout << "INF" << endl;
		} else {
			cout << d[i] << endl;
		}
	}
	return 0;
}

void solve() {
	cin >> V >> E >> r;
	rep(i,0,E)
	{
		int s, t, d;
		cin >> s >> t >> d;
		g[s].push_back(edge(s, t, d));
	}
	dijkstra();
}

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

Measured memory_bytes: 15424
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	cout << "ABC" << n << endl;
	return 0;
}


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

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

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

int main(){
	int a[30]={0};
	int n;
	while(cin>>n,n){
		rep(i, n){
			cin>>a[i];
		}
		int sum =32;
		int pos = 0;
		while(true){
			int ich =(sum-1)%5;
			sum -=ich;
			if(sum<=0){
				break;
			}
			cout <<sum<<endl;
			sum-=a[pos];
			if(sum<=0){
				break;
			}
			pos =(pos+1)%n;
			cout <<sum<<endl;
		}
		cout <<0<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
#define maxn 200010
#define mod 1000000007
#define INV 500000004
using namespace std;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f; 
}
struct P{
    int a,b;
}p[maxn];
int n;
int f[4010][4010];
int ans;
int quick_pow(int x,int p)
{
    int an=1,po=x;
    while(p)
    {
        if(p&1)  an=1ll*an*po%mod;
        po=1ll*po*po%mod;
        p>>=1;
    }
    return an;
}
int fac[100010],inv[100010];  
int C(int x,int y)
{
    return 1ll*fac[x]*inv[y]%mod*inv[x-y]%mod;
}
int main()
{
    n=read();
    for(int i=1;i<=n;i++)  p[i].a=read(),p[i].b=read();
    for(int i=1;i<=n;i++)  f[2001-p[i].a][2001-p[i].b]++;
    for(int i=1;i<=4001;i++)
      for(int j=1;j<=4001;j++)  f[i][j]=((f[i-1][j]+f[i][j-1])%mod+f[i][j])%mod;
    for(int i=1;i<=n;i++)  ans=(ans+f[p[i].a+2001][p[i].b+2001]%mod)%mod;
    fac[0]=1;
    for(int i=1;i<=100000;i++)  fac[i]=1ll*fac[i-1]*i%mod;
    inv[100000]=quick_pow(fac[100000],mod-2);
    for(int i=99999;i>=0;i--)   inv[i]=1ll*inv[i+1]*(i+1)%mod;
    for(int i=1;i<=n;i++)  ans=(ans-C(2*p[i].a+2*p[i].b,2*p[i].a)+mod)%mod;
    cout<<1ll*ans*INV%mod<<endl;
    return 0;
}

Measured memory_bytes: 65280
/// Zhupengfei 2018
/// Hereby declare: this program is in public domain.

/// Solution for problem: Soundhound E
#include <bits/stdc++.h>

#ifdef LOCAL
#pragma GCC poison printf // To avoid fastio problems
#pragma GCC poison scanf
#endif

using namespace std;

struct rec{
	int v, s;
};

int limit[100001]={};
bool flag[100001]={};
bool v[100001]={};
int value[100001]={};
vector<rec> sons[100001]={}; 
int n, m;
int minx=0, maxx=1e9;

void check(int, int);

void dfs(int x, int c, int parent) {
	v[x]=1;
	for(const auto& it: sons[x]) {
		if(v[it.v] && it.v!=parent) { // loop found, can calc determined x
			bool tobeflag=!flag[x];
			int tobelimit=it.s-limit[x];
			if(tobeflag==flag[it.v] && tobelimit!=limit[it.v]) {
				cout<<0<<endl;
				exit(0);
			} else if(tobeflag==flag[it.v]) continue; // useless loop
			int decidex;
			if(!tobeflag) { //to be is false
				decidex=(-tobelimit+limit[it.v])/2;
			} else {
				decidex=(tobelimit-limit[it.v])/2;
			}
			value[1]=decidex;
			if(value[1]<=0) {
				cout<<0<<endl;
				exit(0);
			}
			memset(v, 0, sizeof(v));
			check(1, 0);
			cout<<1<<endl;
			exit(0);
		} else if(it.v!=parent) { // normal
			flag[it.v]=!flag[x];
			limit[it.v]=it.s-limit[x];
			if(flag[it.v]) {
				maxx=min(maxx, limit[it.v]);
			} else {
				minx=max(minx, -limit[it.v]);
			}
			if(minx>=maxx) {
				cout<<0<<endl;
				exit(0);
			}
			dfs(it.v, c+1, x);
		}
	}
}

void check(int u, int parent) { // I have decided the x! I'm super powerful!
	v[u]=1;
	for(const auto& it: sons[u]) {
		if(v[it.v] && it.v!=parent) {
			int tobevalue = it.s-value[u];
			if(tobevalue!=value[it.v]) {
				cout<<0<<endl;
				exit(0);
			}
		}else if(it.v!=parent){
			value[it.v]=it.s-value[u];
			if(value[it.v]<=0) {
				cout<<0<<endl;
				exit(0);
			} else {
				check(it.v, u);
			}
		}
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin>>n>>m;
	int u, v, s;
	for(int i=1;i<=m;i++) {
		cin>>u>>v>>s;
		sons[u].push_back({v, s});
		sons[v].push_back({u, s});
	}
	flag[1]=false; // false: positive, true: negative
	dfs(1, 1, 0);
	cout<<maxx-minx-1<<endl;
	return 0;
}


Measured memory_bytes: 15360
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <vector>
#define CL(a) memset(a,0,sizeof(a))
#define cl(a,b) memset(a,(b),sizeof(a))
#define For(i,a,b) for(i=a;i<b;i++)
#define LL long long 
using namespace std;
const int maxn = 1e5 + 100;
struct Point{
	int L,R;
	bool operator < (const Point& a)const
	{
		if(R==a.R) return L<a.L;
		return R<a.R;
	}
}a[maxn]; 
int main()
{
	int m,n;
	cin>>n>>m;
	int st=1e6;
	for(int i=0;i<m;i++)
	{
		scanf("%d%d",&a[i].L,&a[i].R);
		a[i].R--;
		st = min(st,a[i].R);	
	}	
	sort(a,a+m);
	int ans = 1;
	for(int i=1;i<m;i++)
	{
		if(a[i].L<=st) continue;
		st = a[i].R;
		ans++;
	}
	cout<<ans<<endl;
	
	
	return 0;
}

Measured memory_bytes: 1024
package main

import (
    "fmt"
    "os"
    "bufio"
)

func exchangeUpperAndLower(text string) string {
    b := []byte(text)

    for i:=0; i<len(b); i++ {
        if (b[i] >= 0x41 && b[i] <= 0x5a) || (b[i] >= 0x61 && b[i] <= 0x7a) {
            b[i] ^= 0x20
        }
        // fmt.Printf("%x ", b[i])
    }

    return fmt.Sprintf("%s", b)
}

func main() {
    // 一行読み込む
    stdin := bufio.NewScanner(os.Stdin)
    stdin.Scan()
    text := stdin.Text()

    ex_text := exchangeUpperAndLower(text)
    fmt.Println(ex_text)

}


Measured memory_bytes: 1124
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int dollar = sc.nextInt();
        if(canBuy(dollar)) System.out.println("Yes");
        else System.out.println("No");
    }
    public static boolean canBuy(int dollar) {
        if(dollar == 0) return true;
        if(dollar < 0) return false;
        return canBuy(dollar - 4) || canBuy(dollar - 7) || canBuy(dollar - 11);
    }
}


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

int main() {

    ll n, k;
    cin>>n>>k;
    if(n==0)
        cout<<0<<endl;
    else if(k==1)
        cout<<0<<endl;
    else if(n==k)
        cout<<0<<endl;
    else if(n<k)
    {
        if(n> k-n)
            cout<<k-n<<endl;
        else
            cout<<n<<endl;
    }
    else
    {
        n = n%k;
        if(n> k-n)
            cout<<k-n<<endl;
        else
            cout<<n<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <utility>
#include <iomanip>

#define rep(i,n) for(int i=0;i< (n);++i)
typedef long long ll;

using namespace std;


int main(){
    int N,W;
    
    cin>>N>>W;
    
    ll d[N+1][W+1];
    
    rep(i,N+1)rep(j,W+1)d[i][j]=0;
    
    ll w,v;
    
    for(int i=1;i<=N;++i){
        cin>>w>>v;
        
        for(ll j=1;j<=W;++j){
            if(j<w){
                d[i][j]=d[i-1][j];
                
            }else{
                d[i][j]=max(d[i-1][j-w]+v,d[i-1][j]);
            }
            
        }
        
    }
    
    cout<<d[N][W]<<endl;
}


Measured memory_bytes: 82296
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

s = k()
mod = 10**9 + 7
dp = [0]*(s+1)
dp[0] = 1
x = 0
for i in range(1,s+1):
    if i >= 3:
        x += dp[i-3]
    dp[i] = x

print(dp[s]%mod)

Measured memory_bytes: 10584
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
#define MOD 1000000007
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> p;
typedef vector<int> vi;
set <int> st;
ll a,b,c;

int main(int argc,char const* argv[])
{
  cin >> a >> b >> c;
  if(a%2==0 || b%2 == 0 || c%2 ==0)
    {
      cout << 0 << endl;
      return 0;
    }
  else
    {
      ll tmp=min(a*b,b*c);
      tmp=min(tmp,a*c);
      cout << tmp << endl;
      return 0;
    }
}


Measured memory_bytes: 256
import math                                                                                                                                                  
                                                                                                                                                             
N = int(input())                                                                                                                                             
CN = 6                                                                                                                                                       
                                                                                                                                                             
TC = [0] * (CN-1)                                                                                                                                            
for i in range(CN-1):                                                                                                                                        
    TC[i] = int(input())                                                                                                                                     
                                                                                                                                                             
                                                                                                                                                             
time = CN - 1                                                                                                                                                
                                                                                                                                                             
min_TC = min(TC)                                                                                                                                             
print(4+ math.ceil(N/min_TC))

Measured memory_bytes: 3060
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();    
        final int N = r.i();
        final Resto[] list = new Resto[N];
        for(int i = 0; i < N; i++){
            String[] temp = r.ss();
            String city = temp[0];
            int p = Int(temp[1]);
            list[i] = new Resto(i+1, city, p);
        }
        Arrays.sort(list, (x, y) -> {
            int a = x.city.compareTo(y.city);
            if(a != 0)
                return a;
            return -x.p+y.p;
        });
        for(Resto res : list)
            println(res.id);
    }
    static class Resto{
        final int id;
        final String city;
        final int p;
        Resto(int i, String c, int pt){
            id = i;
            city = c;
            p = pt;
        }
    }

    static void print(Object o){
        System.out.print(o.toString());
    }

    static void println(Object o){
        System.out.println(o.toString());
    }

    static int Int(String s){
        return Integer.parseInt(s);
    }

    static long Long(String s){
        return Long.parseLong(s);
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }

        String s() throws IOException{
            return readLine();
        }

        String[] ss() throws IOException{
            return s().split(" ");
        }

        int i() throws IOException{
            return Int(s());
        }

        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }

        long l() throws IOException{
            return Long(s());
        }

        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long(ss[j]);            
            return ll;
        }
    }
}


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

using namespace std;

typedef pair<int,int> P;
typedef long long ll; 

#define int ll


main(){
	int a,b,n;
	cin >> n >> a >> b;
	

	cout << min(a,b) << " " << max(0ll,(a+b)-n) << endl;

	return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define sc(x) scanf("%d", &x)
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define ALL(x) x.begin(), x.end()
#define SZ(x) ((int)x.size())
#define sqr(x) ((x)*(x))
#define ABS(x) ((x)>=0?(x):(-(x)))
#define fastio ios::sync_with_stdio(0),cin.tie(0)
template<class T>T gcd(T a, T b){return b?gcd(b, a%b):a;}
const int maxn = 1e5+10;
int a[maxn];
ll sum[maxn];
map<int, int> mp;

int main()
{
    int n, m; 
    sc(n); sc(m);
    for(int i = 1; i <= n ;i++){
        sc(a[i]);
        sum[i] = sum[i-1]+a[i];
    }
    ll ans = 0;
    mp[0] = 1;
    for(int i = 1; i <= n; i++){
        ans += mp[sum[i]%m];
        mp[sum[i]%m]++;
    }
    printf("%lld\n", ans);
    return 0;
}




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

//const int INF = 1001001001;
//const ll INF18 = 1000000000000000000;
const ll INF15 = 1000000000000000;

int main() {
	int n, x, t;
	cin >> n >> x >> t;

	int time = (n + x - 1)/x;
	int ans = time*t;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3620
N=int(input())
H_list=[int(thing) for thing in input().split(" ")]
ret=-1
cur=pow(10,9)
ret_list=[]
for h in H_list:
    if h<=cur:
        ret=ret+1
    else:
        ret_list.append(ret)
        ret=0
    cur=h
ret_list.append(ret)
print(max(ret_list))

Measured memory_bytes: 14252
#include<cstdio>

int main(){
    int n,k,s;
    scanf("%d%d%d",&n,&k,&s);
    for(int i = 1; i <= k; i++) printf("%d ",s);
    for(int i = k+1; i <= n; i++){
        if(s==1000000000) printf("1 ");
        else printf("%d ",s+1);
    }
    return 0;
}


Measured memory_bytes: 1280
#include<iostream>

using namespace std;

bool search(int* p);

int main(){
    int a[3];
    int a_size = sizeof(a)/sizeof(a[0]);
    for(int i=0;i<a_size;i++){
        cin >> a[i];
    }
    if(search(a)){
        cout << "YES";
    }else{
        cout << "NO";
    }    

}

bool search(int* p){
    if(*p==5 && *(p+1)==5 && *(p+2)==7)
        return 1;
    else if(*p==5 && *(p+1)==7 && *(p+2)==5)
        return 1;
    else if(*p==7 && *(p+1)==5 && *(p+2)==5)
        return 1;
    else
        return 0;       
}

Measured memory_bytes: 3040
N=int(input())

a = list(map(int, input().split()))

count=0
b=[0]*N

for i in range(N):
    if a[i]==i+1:
        b[i]=1
    
count = 0
ans = 0
    
for i in range(N):
    if b[i]==1:
        count+=1
    else:
        if count==1:
            count=2
        if count>0:
            ans+=count//2+count%2
            count=0

if count>0:
    if count==1:
        count=2
    ans+=count//2+count%2  

print(ans)

Measured memory_bytes: 14008
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n; cin>>n;
    ll ans=-INF;
    vi v(n);rep(i,n)cin>>v[i];
    for(int i=0; i<n;i++)
        for(int j=0; j<n;j++){
            if(i==j)continue;
            bool flag=true;
            string temp; temp=to_string(v[i]*v[j]);
            for(int k=0; k<temp.size()-1;k++){
                if((temp[k+1]-temp[k]!=1))flag=false;
            }
            if(flag)cmax(ans,v[i]*v[j]);
        }
    if(ans!=-INF)cout<<ans<<endl;
    else cout<<-1<<endl;
}

Measured memory_bytes: 3268
#include <stdio.h>
 
int main(){
  int n;
  scanf("%d", &n);
  int ans;
  if(n < 10){
    ans = n;
  }else if(n < 100){
    ans = 9;
  }else if(n < 1000){
    ans = 9 + n - 99;
  }else if(n < 10000){
    ans = 909;
  }else if(n < 100000){
    ans = 909 + n - 9999;
  }else{
    ans = 90909;
  }
  printf("%d\n", ans);
  return 0;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll a;
    double b;
    cin >> a >> b;
    b += 0.001;
    ll t = b*100;
    cout << a*t/100 << endl;

    return 0;
}

Measured memory_bytes: 3728
#include<stdio.h>
#include<string.h>
int main(){
  int i,j;
  int n,r[6];
  double h;
  memset(r,0,sizeof(r));
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%lf",&h);
    if(h<165)
      r[0]++;
    else if(h<170)
      r[1]++;
    else if(h<175)
      r[2]++;
    else if(h<180)
      r[3]++;
    else if(h<185)
      r[4]++;
    else
      r[5]++;
  }
  for(i=0;i<6;i++){
    printf("%d:",i+1);
    for(j=0;j<r[i];j++)
      printf("*");
    puts("");
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>

int main(){
    int n;
    std::cin >>n;
  int mh = 0;
  int c = 0;
  for(int i=0;i<n;++i){
    int a;
    std::cin >>a;
    if(mh <= a){
      c++;
      mh = a;
    }
  }
  
    std::cout << c << std::endl;
}

Measured memory_bytes: 256
// Author : Mohamed sameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
using namespace std ;
int main()
{
	int n, x, t;
	cin >> n >> x >> t;
	cout << (n + x - 1)/ x * t << '\n';
}


Measured memory_bytes: 3644
A,B,M = map(int,input().split())
 
a = list(map(int,input().split()))
b = list(map(int,input().split()))
 
ticket = []
 
while M>0:
    ticket.append(tuple(map(int, input().split())))
    M -= 1
 
lowest = min(a)+min(b)
 
for ele in ticket:
    t = a[ele[0]-1] + b[ele[1]-1] - ele[2]
    if t < lowest:
        lowest = t
print(lowest)

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

#define pb push_back
#define ff first
#define ss second

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

const int MAXN = 4 * 100 * 1000 + 17;

int n, a[4][MAXN], b[4][MAXN], p[MAXN], q[MAXN], fen[MAXN];
vector<int> v[2];

void add(int x) {
	for (; x <= n; x += x & (-x))
		fen[x]++;
}
int get(int x) {
	int res = 0;
	for (; x; x -= x & (-x))
		res += fen[x];
	return res;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 1; i <= 3; i++)
		for (int j = 1; j <= n; j++)
			cin >> a[i][j], b[i][j] = j * 3 + i - 3, p[b[i][j]] = j, q[b[i][j]] = i;
	for (int j = 1; j <= n; j++) {
		if (p[a[1][j]] != p[a[2][j]] || p[a[2][j]] != p[a[3][j]] || q[a[2][j]] != 2 || p[a[1][j]] % 2 != j % 2)
			return cout << "No" << endl, 0;
		v[j % 2].pb(j);
	}
	for (int k = 0; k < 2; k++) {
		int inv = 0;
		for (int i = v[k].size() - 1; i >= 0; i--)
			(inv += get(p[a[1][v[k][i]]])) %= 2, add(p[a[1][v[k][i]]]);
		int up = 0;
		for (int i = 0; i < v[1 - k].size(); i++)
			if (a[1][v[1 - k][i]] % 3 == 0)
				up++;
		if (up % 2 != inv % 2)
			return cout << "No" << endl, 0;
		for (int i = 1; i <= n; i++)
			fen[i] = 0;
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 14076
n = gets.to_i

class Node
  def initialize(index)
    @index = index
    @color = nil
    @connects = []
    @processed = false
  end

  def connect(node, w)
    @connects << {:node => node, :same => w % 2 == 0}
  end

  def connects
    return @connects
  end

  def color
    return @color
  end

  def set_color(color)
    @color = color
  end

  def processed
    @processed = true
  end

  def processed?
    return @processed
  end
end

nodes = Array.new(n) do |i|
  Node.new(i)
end

(n - 1).times do |i|
  u, v, w = gets.split.map(&:to_i)
  nodes[u - 1].connect(nodes[v - 1], w)
  nodes[v - 1].connect(nodes[u - 1], w)
end

nodes[0].set_color(0)
q = [nodes[0]]
while true
  t = q.shift
  break if t == nil
  next if t.processed?
  if t.color == nil
    q.push(t)
    next
  end
  t.processed

  t.connects.each do |c|
    if c[:same]
      c[:node].set_color(t.color)
    else
      c[:node].set_color((t.color + 1) % 2)
    end
    q.push(c[:node])
  end
end

nodes.each do |node|
  puts node.color
end

Measured memory_bytes: 81148
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    int n,cnt=0;
    string s;
    char c = '-';
    cin >> n >> s;
    for (auto ss : s) {
        if (c != ss)cnt++;
        c = ss;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 512
import java.io.*;
import java.util.*;
 
public class Main{
	
	public void solve(){
		int[] L = {5, 7, 5, 7, 7};
		
		while(true){
			int N = nextInt();
			if(N == 0) break;
			int[] len = new int[N];
			for(int i = 0; i < N; i++){
				len[i] = next().length();
			}
			
			LOOP:
			for(int i = 0; i < N; i++){
				int idx = i;
				for(int j = 0; j < L.length; j++){
					int sum = 0;
					while(idx < N && sum < L[j]){ sum += len[idx++]; }
					
					if(sum != L[j]){
						continue LOOP;
					}	
				}
				out.println(i + 1);
				break;
			}
		}
	}
	
	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

Measured memory_bytes: 24616
n = int(input())
nums = list(map(int,input().split()))
limit = 10**18
res = 1
i = 0
if 0 in nums:
    print(0)
    exit()
while i<n:
    res *= nums[i]
    i += 1
    if res > limit:
        res = -1
        break
print(res)

Measured memory_bytes: 21476
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1295

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
  int w, d, h;
  while (cin >> w >> d && w) {
    vector<int> W;
    vector<int> D;
    for (int i=0; i<w; i++) {
      cin >> h;
      W.push_back(h);
    }
    for (int i=0; i<d; i++) {
      cin >> h;
      D.push_back(h);
    }
    W.push_back(0);
    D.push_back(0);
    sort(W.begin(), W.end());
    reverse(W.begin(), W.end());
    sort(D.begin(), D.end());
    reverse(D.begin(), D.end());
    int i=0, j=0;
    int ans = 0;
    while (i != W.size() || j != D.size()) {
      if (W[i] == D[j]) {
	ans += W[i];
	i++; j++;
      } else if (W[i] < D[j]) {
	ans += D[j];
	j++;
      } else {
	ans += W[i];
	i++;
      }
    }
    cout << ans << endl;
  }
}

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

#define null				""
#define all(dat)			dat.begin(), dat.end()
#define over(msg)			cout << msg << endl, exit(0);
#define loop(i, to)			for (int i = 0; i < to; ++i)
#define cont(i, to)			for (int i = 1; i <= to; ++i)
#define foreach(i, dat)		for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long			num;

using namespace std;

int n, h[200005], w[200005];
num dp[200005], tr[200005], ans;

void inline upd(int id, num d) {
	while (id <= n) {
		tr[id] = max(tr[id], d);
		id += id & -id;
	}
}

num inline pre(int to) {
	num res = 0;
	while (to) {
		res = max(res, tr[to]);
		to -= to & -to;
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin >> n;
	cont (i, n) {
		cin >> h[i];
	}
	cont (i, n) {
		cin >> w[i];
	}
	cont (i, n) {
		dp[i] = pre(h[i]) + w[i];
		upd(h[i], dp[i]);
		ans = max(ans, dp[i]);
	}
	cout << ans << endl;
}


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

using namespace std;

int n, k, p[1010];

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

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

	sort(p, p + n);

	int price = 0;

	for (int i = 0; i < k; ++i) {
		price += p[i];
	}
	
	cout << price;
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) do{}while(0)
#endif





ll n, k;
const ll MOD = 1e9+7;

int main(){
	cin >> n >> k;
	
	vector<ll> vp;
	vector<ll> vm;
	rep(i,n){
		ll a;
		cin >> a;
		
		if ( a >= 0 )
			vp.push_back(a);
		if ( a < 0 )
			vm.push_back(-a);
	}
	
	int cp = k;
	int cm = 0;
	bool result_plus = true;
	if ( cp > SZ(vp) ){
		cp = SZ(vp);
		cm = k-cp;
		if ( cm & 1 ){
			if ( cp != 0 && cm != SZ(vm) ){
				cp--;
				cm++;
			}
			else {
				// この場合はどうしてもマイナスになってしまう
				result_plus = false;
			}
		}
	}
	
	if ( result_plus ){
		sort(vp.begin(),vp.end(),greater<ll>());
		sort(vm.begin(),vm.end(),greater<ll>());
		
		while ( cp >= 2 && cm <= SZ(vm)-2 && vp[cp-1]*vp[cp-2] < vm[cm]*vm[cm+1] ){
			cp -= 2;
			cm += 2;
		}
	}
	else {
		sort(vp.begin(),vp.end());
		sort(vm.begin(),vm.end());
		
		while ( cp >= 2 && cm < SZ(vm)-2 && vp[cp-1]*vp[cp-2] > vm[cm]*vm[cm+1] ){
			cp -= 2;
			cm += 2;
		}
	}
	
	ll result = 1;
	rep(i,cp)
		result = result * vp[i] % MOD;
	rep(i,cm)
		result = result * vm[i] % MOD;
	if ( !result_plus )
		result = (MOD-result)%MOD;
	
	cout << result << endl;
	
	return 0;
}




Measured memory_bytes: 5532
#include<bits/stdc++.h>
using namespace std;
#define EB emplace_back
#define F first
#define S second
#define SZ(a) ((int)(a).size())
typedef long long ll;
typedef pair<int,int> pii;
vector<pair<pii,int>> e;
void solve(int L)
{
    if (L == 1) {
        e = {{pii(1,2),0}};
        return;
    }
    if (L == 2) {
        e = {{pii(1,2),0},{pii(1,2),1}};
        return;
    }
    if (L == 3) {
        e = {{pii(1,2),0},{pii(1,2),1},{pii(1,2),2}};
        return;
    }
    solve(L/2);
    int n = 1;
    for (auto & p : e) {
        p.F.F++;
        n = max(n, ++p.F.S);
    }
    e.EB(pii(1,2),0);
    e.EB(pii(1,2),L/2);
    if (L%2)
        e.EB(pii(1,n),L-1);
}
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    int L;
    cin >> L;
    solve(L);
    int n = 1;
    for (const auto & p : e)
       n = max(n, p.F.S);
    cout << n << ' ' << SZ(e) << '\n';
    for (const auto & p : e)
        cout << p.F.F << ' ' << p.F.S << ' ' << p.S << '\n';
}


Measured memory_bytes: 256
let nats n =
  let rec loop i e =
    if i = 0 then 0 :: e
    else loop (i - 1) (i :: e) in
  loop n []


let inp_matrix : 'a array -> int -> int -> unit = fun a m n ->
  for i = 0 to m - 1 do
    for j = 0 to n - 1 do
      a.(i).(j) <- Scanf.scanf " %d" (fun x -> x)
    done
  done


let ins_all_positions x l =  
  let rec aux prev acc = function
    | [] -> (prev @ [x]) :: acc |> List.rev
    | hd::tl as l -> aux (prev @ [hd]) ((prev @ [x] @ l) :: acc) tl
  in
  aux [] [] l

let rec permutations = function  
  | [] -> []
  | x::[] -> [[x]] (* we must specify this edge case *)
  | x::xs -> List.fold_left (fun acc p -> acc @ ins_all_positions x p ) [] (permutations xs)

let rec pairs : 'a list -> ('a * 'a) list = function
    [] -> []
  | x :: xs -> List.map (fun y -> (x, y)) xs @ (pairs xs)


let () =
  let n = Scanf.sscanf (input_line stdin) "%d" (fun a -> a) in
  let a = Array.make_matrix n 2 0 in
  let () = inp_matrix a n 2 in
  let ps = pairs (nats (n - 1)) in
  let lens =
    List.map (fun (p1, p2) ->
        sqrt (float_of_int
                ((a.(p1).(0) - a.(p2).(0))
                 * (a.(p1).(0) - a.(p2).(0))
                 + (a.(p1).(1) - a.(p2).(1))
                   * (a.(p1).(1) - a.(p2).(1))))  
      ) ps in
  let ans = 2. *. (List.fold_left (fun sum len -> len +. sum) 0.0 lens)
            /. (float_of_int n)
  in
  print_float ans;
  print_newline ()


Measured memory_bytes: 384
N,M = list(map(int,input().split()))

lis = [0 for i in range(N)]

for a_i,b_i in [ map(int,input().split()) for _ in range(M) ]:
	lis[a_i-1] += 1
	lis[b_i-1] += 1

for x in lis:
	if x%2==1:
		print("NO")
		quit()
print("YES")

Measured memory_bytes: 49612
N,A,B,C = map(int,input().split(" "))
l = [ int(input()) for _ in range(N)]

def rec(idx,a,b,c):
    if idx == N:
        if a == 0 or b == 0 or c == 0:
            return float('inf')
        else:
            return abs(A-a) + abs(B-b) + abs(C-c)
    
    p1 = rec(idx+1,a,b,c)
    p2 = rec(idx+1,a+l[idx],b,c)
    if a != 0: p2 += 10 
    p3 = rec(idx+1,a,b+l[idx],c)
    if b != 0: p3 += 10
    p4 = rec(idx+1,a,b,c+l[idx])
    if c != 0: p4 += 10

    return min([p1,p2,p3,p4])

print(rec(0,0,0,0))


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

#define MAXN 100005
#define ll long long int 

int main(){
    int n;
    cin>>n;
    vector<ll> a(n);
    for(auto &x:a)cin>>x;
    vector<ll> pref(n);
    vector<ll> suf(n);
    pref[0]=a[0];
    suf[n-1]=a[n-1];
    for(int i=1;i<n;i++)pref[i]=a[i]^pref[i-1];
    for(int i=n-2;i>=0;i--)suf[i]=a[i]^suf[i+1];
    //for(int i=0;i<n;i++)cout<<pref[i]<<" "<<suf[i]<<"\n";
    ll t;
    for(int i=0;i<n;i++){
        cout<<(pref[i]^suf[i])<<" ";
    }
    cout<<"\n";
    return 0;
}


Measured memory_bytes: 7956
require 'set'
S = gets.chomp.chars
K = gets.to_i

set = Set.new
(0...(S.size)).each do |i|
  (i...([i + K, S.size].min)).each do |j|
    set.add(S[i..j].join(''))
  end
end
puts set.to_a.sort[K - 1]


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

int main() {
	int n;
	cin>>n;
	std::vector<int>v(n),p(n);
	for(int i=0;i<n;i++)
	cin>>v[i];
	p[0]=0;
	p[1]=abs(v[1]-v[0]);
	for(int i=2;i<n;i++)
	{
	p[i]=min(p[i-1]+abs(v[i]-v[i-1]),p[i-2]+abs(v[i]-v[i-2]));
	}
	cout<<p[n-1];
	return 0;
}

Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

    private void solve(FastScanner sc) {
        char[] s = sc.next().toCharArray();
        boolean b1 = false, b2 = false;
        for (char c : s) {
            if (c == 'C') b1 = true;
            if (b1 && c =='F') b2 = true;
        }
        System.out.println(b2 ? "Yes" : "No");
    }

    /*
     * template
     */

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        new Main().solve(sc);
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int bufLen = 0;

        private boolean hasNextByte() {
            if (ptr < bufLen) {
                return true;
            } else {
                ptr = 0;
                try {
                    bufLen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (bufLen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
            return hasNextByte();
        }

        String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 8276
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <limits.h>
 
#define YesNo(b) ((b) ? "Yes" : "No")
#define YESNO(b) ((b) ? "YES" : "NO")

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;


int f(int A, int B)
{
    int w[] = {1, 2, 3};
    for (size_t i = 0; i < 3; i++)
    {
        if (w[i] != A && w[i] != B)
            return w[i];
    }

}

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

    cout << f(A,B) << endl;
}

Measured memory_bytes: 256