akhauriyash/Code-Regression huggingface dataset:
#include<ctime>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath> 
#include<cstring> 
#include<cassert>
#include<string>
#include<sstream>
#include<fstream>
#include<deque>
#include<queue>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<set>
#include<bitset>
#include<iomanip>
#include<utility>
#include<functional>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cwchar>
#include<cwctype>
#include<exception>
#include<locale>
#include<numeric>
#include<new>
#include<stdexcept>
#include<limits>
using namespace std;

#define ll long long
#define INF 1e9
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
#define pii pair<int,int>
#define sz(s) s.size()
#define all(s) (s.begin(),s.end())
inline void Fail(){
	printf("0");
	exit(0);
}

const int maxn=1000005;
int n,m,cnt;
vector<pii>edge[maxn];
vector<int>Nedge[maxn],all[maxn];
int p[maxn],in[maxn],dist[maxn];
bool vis[maxn];

vector<int>bfs(int v,int color){
	vector<int>path;
	queue<int>q;
	q.push(v);
	vis[v]=true;
	while(!q.empty()){
		int x=q.front();
		q.pop();
		path.push_back(x);
		for(int &i=p[x];i<edge[x].size();i++){
			pii y=edge[x][i];
			if(y.first!=color)break;
			if(!vis[y.second]){
				q.push(y.second);
				vis[y.second]=true;
			}
		}
	}
	rep(i,path.size())vis[path[i]]=false;
	return path;
}

int main(){
	scanf("%d%d",&n,&m);
	rep(i,m){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		a--;b--;
		edge[a].push_back(make_pair(c,b));
		edge[b].push_back(make_pair(c,a));
		all[c].push_back(a);
		all[c].push_back(b); 
	}
	rep(i,n)sort(edge[i].begin(),edge[i].end());
	cnt=n;
	REP(i,1000000){
		if(all[i].empty())continue;
		rep(j,all[i].size()){
			int x=all[i][j];
			if(in[x]==i)continue;
			vector<int>v=bfs(x,i);
			rep(k,v.size()){
				int y=v[k];
				in[y]=i;
				Nedge[cnt].push_back(y);
				Nedge[y].push_back(cnt);
			}
			cnt++;
		}
	}
	rep(i,maxn)dist[i]=-2;
	dist[0]=0;
	queue<int>q;
	q.push(0);
	while(!q.empty()){
		int x=q.front();
		q.pop();
		rep(i,Nedge[x].size()){
			int y=Nedge[x][i];
			if(dist[y]==-2){
				dist[y]=dist[x]+1;
				q.push(y);
			}
		}
	}
	printf("%d\n",dist[n-1]/2);
	return 0;
}

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

using namespace std;

void solve() {
    vector<int> vt(3); cin >> vt[0] >> vt[1] >> vt[2];
    sort(vt.begin(), vt.end());
    if (vt[0] == vt[1] && vt[2] != vt[0] || vt[0] != vt[1] && vt[1] == vt[2]) cout << "Yes";
    else cout << "No";
}

int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(20);
    solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/



int A, B, K;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> A >> B >> K;
    rep(i, 0, K) {
        if (i % 2 == 0) {
            if (A % 2 == 1) A--;
            B += A / 2;
            A /= 2;
        } else {
            if (B % 2 == 1) B--;
            A += B / 2;
            B /= 2;
        }
    }
    cout << A << " " << B << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();   
        int N = r.i();
        long[] A = r.ll();
        for(int i = 0; i < N; i++)
            A[i] -= i+1;
        Arrays.sort(A);
        long ans = 0;
        long median = A[N/2];
        for(int i = 0; i < N; i++)
            ans += Math.abs(median-A[i]);
        print(ans);
    }
    static void print(Object o){
        System.out.println(o.toString());
    }
    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 Int(String s){
            return Integer.parseInt(s);
        }

        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 Long(String s){
            return Long.parseLong(s);
        }

        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: 47316
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
bool used[100001];
int main(){
	string s;
	cin>>s;
	int n=s.size();
	r(i,n){
		if(!i)continue;
		if(i)s.erase(s.end()-1);
		if(s.size()%2)continue;
		int f=0;
		r(i,s.size()/2)if(s[i]!=s[i+s.size()/2])f++;
		if(!f){
			cout<<n-i<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
//10/05/2020
#include<bits/stdc++.h>
#include<cmath>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define debug printf("Debug\n");
#define en '\n'


#define ll long long
#define ull unsigned long long

#define pi acos(-1.0)
#define mod 1000000007

#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define in_fre  freopen("in.txt", "r", stdin);
#define out_fre freopen("out.txt", "w", stdout);

struct Node{
    ll val,pos;
};

//Algos
template<typename T> using Pbds=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

//Number Theory
class NumberTheory{
public:
    ll n;
    bool chk[99999995];
    ll GetMod(ll x,ll m);
    ll BigMod (ll b,ll p,ll m){if (p == 0) return 1;if (p%2 == 0){ll s = BigMod(b,p/2,m);return ((s%m)*(s%m))%m;}return ((b%m)*(BigMod(b,p-1,m)%m))%m;}
    ll ModInv (ll b,ll m){return BigMod(b,m-2,m);}
    ll gcd(ll a,ll b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
    ll lcm(ll a,ll b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
    void sieve(ll x);
    bool IsPrime(ll x);
    bool IsPrime1(ll x){return !chk[x];}
};

/*Containers*/
vector<ll>v;
deque<ll>dq;
stack<ll>stk;
map<ll,ll>mp;
unordered_map<ll,ll>ump;
set<ll>st;
multiset<ll>mst;
unordered_set<ll>ust;
unordered_multiset<ll>umst;
priority_queue<ll,deque<ll>,greater<ll>>pq;
Pbds<ll>ost;


int main(){
    _fastio
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll ans=0;
    if(a<=k){
        ans+=a;
        k-=a;
    }
    else{
        ans+=k;
        k=0;
    }
    if(b<=k){
        k-=b;
    }
    else{
        k=0;
    }

    if(c<=k){
        ans-=c;
    }
    else{
        ans-=k;
        k=0;
    }

    cout<<ans<<en;


    return 0;
}

void NumberTheory::sieve(ll x){
    for(ll i=2;i*i<=x;){
        if(chk[i]==0){
            for(ll j=i*i;j<=x;j+=i){
                chk[j]=1;
            }
        }
        if(i==2) i++;
        else i+=2;
    }
}
bool NumberTheory::IsPrime(ll x){
    bool f=true;
    for(ll i=2;i*i<=x;i++){
        if(!x%i){
            f=false;break;
        }
    }
}
ll GetMod(ll x,ll m){
    if(x>=0) return x%m;
    else{
        ll y=abs(x)/m;x+=(y*m+m+m);
        return x%m;
    }
}


Measured memory_bytes: 3664
N, M = map(int, input().split())
PY = []
Y_to_i = dict()
for i in range(M):
    p, y = map(int, input().split())
    PY.append((p, y))
    Y_to_i[y] = i
PY.sort()
ans = [""]*M
now_p = PY[0][0]
idx = 1
for p, y in PY:
    if p != now_p:
        idx = 1
    now_p = p
    ans[Y_to_i[y]] = str(p).zfill(6) + str(idx).zfill(6)
    idx += 1
for a in ans:
    print(a)

Measured memory_bytes: 37940
n, a, b = map(int,input().split())
mod = 10**9+7

def rev(x):
    re = 10**9+5
    num = 1
    ix = x
    while re > 0:
        if re%2 == 1:
            num = (num*ix)%mod
        re //= 2
        ix = (ix**2)%mod
    return(num)

def kaijo(x):
    num = 1
    for i in range(1,x+1):
        num = (num*i)%mod
    return(num)

re = n
ans = 1
i2 = 2
while re > 0:
    if re%2 == 1:
        ans = (ans*i2)%mod
    re //= 2
    i2 = (i2**2)%mod
nca = 1
ncb = 1
for i in range(a):
    nca = (nca*(n-i))%mod
for i in range(b):
    ncb = (ncb*(n-i))%mod

ans -= 1
ans = (ans-(nca*rev(kaijo(a)))%mod)%mod
ans = (ans-(ncb*rev(kaijo(b)))%mod)%mod

print(ans)


Measured memory_bytes: 3064
n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
h = Hash.new(0)
a.each do |x|
  h[x] += 1
end
h = h.sort_by{|key, v| -v}
ans = 0
i = 0
h.each do |key, v|
  i += 1
  ans += v if i > k
end
puts ans

Measured memory_bytes: 40960
import sys

s = input()
n = len(s)
l = [0] * n
reverse_s = ''.join(list(reversed(s)))

for i in range(n):
	state = i
	count = 0
	while True:
		if s[state] == 'R' and s[state+1] == 'L':
			if count % 2 == 0:
				l[state] += 1
			else:
				l[state+1] += 1
			break
		elif s[state] == 'L' and s[state-1] == 'R':
			if count % 2 == 0:
				l[state] += 1
			else:
				l[state-1] += 1
			break
		elif s[state] == 'R' and s[state+1] == 'R':
			tmp = s.find('L',state,n) - state
			state += tmp
			count += tmp
		elif s[state] == 'L' and s[state-1] == 'L':
			tmp = reverse_s.find('R',n-state,n) - (n - state)
			state -= tmp
			count += tmp
		else:
			print('error')
			break

for i in range(n):
	sys.stdout.write(str(l[i]))
	if i != n-1:
		sys.stdout.write(" ")

Measured memory_bytes: 4968
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int H,W;cin >> H >> W;
    vector<string> S(H);
    rep(i,H)cin >> S[i];
    vector<vector<int> >hr_list(H,vector<int>()),ve_list(W,vector<int>());
    
    rep(i,H){
        int cnt=0;
        rep(j,W){
            if(S[i][j]=='.'){
                cnt++;
                if(j==W-1)hr_list[i].push_back(cnt);
            }
            else{
                if(cnt!=0)hr_list[i].push_back(cnt);
                cnt=0;
            }
        }
    }
    rep(i,W){
        int cnt=0;
        rep(j,H){
            if(S[j][i]=='.'){
                cnt++;
                if(j==H-1)ve_list[i].push_back(cnt);
            }
            else{
                if(cnt!=0)ve_list[i].push_back(cnt);
                cnt=0;
            }
        }
    }

    vector<vector<int> > tabh(H,vector<int>(W)),tabv(H,vector<int>(W));
    rep(i,H){
        int cnt=0;
        rep(j,W){
            if(S[i][j]=='.'){
                if(j==0)cnt++;
                tabh[i][j]=cnt;
            }else{
                if(j-1<0)cnt++;
                if(j-1>=0&&S[i][j-1]!='#')cnt++;
            }
        }
    }
    rep(i,W){
        int cnt=0;
        rep(j,H){
            if(S[j][i]=='.'){
                if(j==0)cnt++;
                tabv[j][i]=cnt;
            }
            else{
                if(j-1<0)cnt++;
                if(j-1>=0&&S[j-1][i]!='#')cnt++;
            }
        }
    }
    /*
    rep(i,H){
        rep(j,W)cout << tabh[i][j];
        cout << endl;
    }
    rep(i,H){
        rep(j,W)cout << tabv[i][j];
        cout << endl;
    }
    rep(i,H){
        for(auto x:hr_list[i])cout << x;
        cout << endl;
    }
    rep(i,W){
        for(auto x:ve_list[i])cout << x;
        cout << endl;
    }
    */
    int res=0;
    rep(i,H){
        rep(j,W){
            if(S[i][j]=='#')continue;
            res=max(res,hr_list[i][tabh[i][j]-1]+ve_list[j][tabv[i][j]-1]-1);
            //cout << i<< " "<<j<<" " <<  hr_list[i][tabh[i][j]-1]+ve_list[j][tabv[i][j]-1]-1 << endl;
        }
    }
    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 43904
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	int n;
	cin >> n;
	if (n < 1000) cout << "ABC\n";
	else cout << "ABD\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
#define ll long long
const double EPS = 1e-10;

int main (){
  ll k,a,b;
  ll ans=0;
  ll t=1;
  ll p=0;
  ll f=0;
  cin>>k>>a>>b;
  if(b-a<=2){
    cout<<k+1<<endl;
    return 0;
  }
  for(ll i=0;i<k;i++){
    if(p>0){
      p--;
      t+=b;
    }
    else if(t>=a){
      t-=a;
      p++;
    }
    else{
      f++;
      t++;
    }
  }
  if(p>0&&f>0){
    t++;
    t+=a;
  }
  cout<<t<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;

int main()
{
	int N;
	cin>>N;

	vector<int> H(N);
	for(int i=0; i<N; i++)
	{
		cin>>H[i];
	}

	int min_H = 1E9;
	for(int i=N-1; i>=0; i--)
	{
		if(min_H + 1 < H[i])
		{
			cout<<"No"<<endl;
			return 0;
		}
		min_H = min(min_H , H[i]);
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
using namespace std;
string a,b;
int main()
{
	cin>>a>>b;
	for(int i=0; i<max(a.length(),b.length()); i++)
	{
		if(i<a.length()) cout<<a[i];
		if(i<b.length()) cout<<b[i];
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] $) {
		Scanner sc = new Scanner(System.in);
		double n=sc.nextInt(),k=sc.nextInt();
		if(Math.ceil(n/2)<k) {
			System.out.println("NO");
		}else {
			System.out.println("YES");
		}
	}
}

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

using namespace std;

#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()

const int MX = (int)1e5 + 10;
const int mod = (int)1e9 + 7;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}


int main(){

    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(0);

    int n;
    cin >> n;

    map<char, ll> mp;
    while(n--){
        string s;
        cin >> s;
        mp[s[0]]++;
    }

    string march = "MARCH";

    ll res = 0;

    for(int i = 0; i < 3; ++i){
        for(int j = i + 1; j < 4; ++j){
            for(int k = j + 1; k < 5; ++k){
                res += mp[march[i]] * mp[march[j]] * mp[march[k]];
            }
        }
    }

    cout << res << endl;



    return 0;
}

Measured memory_bytes: 256
k=int(input())
a=[i for i in range(1,10)]

while True:
    #るんるん数の候補を、桁数ごとに積み上げます。まず１桁
    if k<=len(a):
        print(a[k-1])
        break
    """
    1桁に成果がなければ、kから１桁のlen(るんるん数リスト)を引いて、
    ２桁のリストを作ります。作り方は、元のるんるんリストのそれぞれの数を１０倍して、
    その１０の位と同じか隣接する値を加えたものをappend.
    以下同様
    """
    k-=len(a)
    old=[]
    old, a=a, old
    for x in old:
        for i in range(-1,2):
            d=x%10+i
            if d<0 or d>9:
                continue
            new_x=x*10+d
            a.append(new_x)

Measured memory_bytes: 11028
#include <bits/stdc++.h>
typedef long long ll;

int main(int argc, char const *argv[]) {
    char c;
    std::cin >> c;
    std::vector<char> v = {'a', 'i', 'u', 'e', 'o'};
    for (size_t i = 0; i < v.size(); i++) {
        if (v[i] == c) {
            std::cout << "vowel" << '\n';
            return 0;
        }
    }
    std::cout << "consonant" << '\n';
    return 0;
}


Measured memory_bytes: 256
n,m,k=map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a, b = [0], [0]

for i in range(n):
  a.append(a[i] + A[i])
for i in range(m):
  b.append(b[i] + B[i])
  
ans, j = 0, m

for i in range(n+1):
  if a[i] > k:
    break
  while b[j] > k - a[i]:
    j -= 1
  ans = max(ans, i + j)
  
print(ans)

Measured memory_bytes: 47372
#include<bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp> 
// using namespace boost::multiprecision;
// #define int cpp_int
using namespace std;

#define fastio 			ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int 			long long
#define ll 				long long
#define ld 				long double
#define vi 				vector<int>
#define pii 			pair<int,int>
#define vpii 			vector< pair<int,int> >
#define uset			unordered_set
#define umap 			unordered_map
#define maxpq 			priority_queue<int>
#define minpq			priority_queue<int,vi,greater<int>()>

#define all(v) 			v.begin(),v.end()
#define part(v,s,e)		v.begin()+s,v.begin()+e
#define rev(v)			reverse(v.begin(),v.end())
#define sz(x)			(int)x.size()
#define def(v)			memset(v,-1,sizeof(v));
#define def0(v)			memset(v,0,sizeof(v));
#define minv(a)			*min_element(all(a))
#define maxv(a)			*max_element(all(a))
#define sumv(a)			accumulate(all(a),0)

#define	lb				lower_bound
#define	ub				upper_bound
#define	desc			greater<int>()
#define	pb				emplace_back
#define	mp				make_pair
#define	F				first
#define	S				second

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";

#define gcd(a,b)		__gcd(a,b)
#define lcm(a,b)		(a/(__gcd(a,b)))*b

#define setbits(x) 		__builtin_popcountll(x)
#define zerobits(x)		__builtin_ctzll(x)

#define ip(v)	 		for(auto& i:v)	cin>>i;
#define op(v) 			for(auto i:v)	cout<<i<<" ";cout<<endl;
#define deb(x) 			cout <<"Value of " #x << " : " << x << endl;



void solve()
{	

	int n;
	cin>>n;

	ld ans=(n+1)/(2);
	cout<<(ans/(n*1.0))<<endl;

}	

int32_t main()
{

	fastio
	cout<<setprecision(15)<<fixed;



	int t=1;
	// cin>>t;
	
	for(int i=1;i<=t;i++)
	{
		// cout<<"Case "<<i<<" : "<<endl;
		solve();
	}
	
	#ifndef ONLINE_JUDGE	
		cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
	#endif

	return 0;
}

Measured memory_bytes: 256
N, K, Q = gets.split.map(&:to_i)
as = Q.times.map { gets.to_i }
a_to_count = Hash.new { 0 }
as.each do |a|
  a_to_count[a] += 1
end
N.times do |n|
  n += 1
  if Q - a_to_count[n] >= K
    puts 'No'
  else
    puts 'Yes'
  end
end


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

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

  int n;
  cin >> n;

  int mn = MAX, ans = 0;

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

    if (mn > p) {
      mn = p;
      ++ans;
    }
  }

  cout << ans << '\n';

  return (0);
}


Measured memory_bytes: 3608
//defalt
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
typedef pair<int, int> P_i;
typedef pair<double,double> P_d;
#define rep(i,n) for(int i=0;i<(n);++i)
#define alrep(i,j,n) for(int i=0;i<(n);++i)for(int j=i+1;j<(n);++j)
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int MOD=1e9+7;
const long long INF = 1LL << 60;
int gcd(int a,int b) { return b ? gcd(b,a%b) : a;}
int lcm(int a,int b) { return a/gcd(a,b)*b;}

signed main(){
  int A,B;
  cin >> A >> B;
  cout << lcm(A,B) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define all(a) (a).begin(), (a).end()
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define sz() size()
#define fr first
#define sc second
#define int long long
#define mp make_pair
#define rc(s) return cout<<s,0
#define rcc(s) cout<<s,exit(0)
using namespace std;
 

 
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    srand(chrono::steady_clock::now().time_since_epoch().count());
    int n;
    cin >> n;
    int x;
    if(n % 1000 == 0){
        x = n;
    }
    else{
        x = (n/1000 + 1)*1000;
    }
    cout << x - n << '\n';
}

Measured memory_bytes: 3648
#include<cstdio>
#include<iostream>
#include<fstream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define Set(a) memset(a,0,sizeof(a))
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define openf(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define re register
#define ri re int
#define il inline
typedef long long ll;
typedef unsigned long long ull;
template<typename T> inline T rd(T& x)
{
	T f=1;x=0;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(T)(c-'0');
	x*=f;
	return x;
}
ll rd(){ll x;rd(x);return x;}
const int inf=1<<30;

#include<map>
map<ll,int> m;
int main()
{
	int n=rd();ll ans=0;
	F(i,1,n)
	{
		ll a=rd();
		if(m.find(i-a)!=m.end()) ans+=m[i-a];
		++m[i+a];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 15940
package main

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

func main() {
	sc := NewScanner()
	_ = sc.NextInt()
	A := sc.Next()

	rList := map[int]int{}
	gList := map[int]int{}
	bList := map[int]int{}
	for i, v := range A {

		if v == 'R' {
			rList[i] = i
		} else if v == 'G' {
			gList[i] = i
		} else if v == 'B' {
			bList[i] = i
		}
	}
	cnt := 0
	for k, _ := range rList {
		for k2, _ := range gList {
			n := funcName(k, k2, bList)

			p := len(bList)

			if p > 0 {
				cnt += p - n
			}
		}
	}
	fmt.Println(cnt)

}

func funcName(k int, k2 int, bList map[int]int) int {
	cnt := 0

	if getCheck(bList, k2-k+k2) {
		cnt++
	}
	if (k2-k)%2 == 0 {
		if getCheck(bList, (k2+k)/2) {
			cnt++
		}
	}

	if getCheck(bList, k-(k2-k)) {
		cnt++
	}
	return cnt
}

func getCheck(bList map[int]int, d int) bool {
	_, ok := bList[d]
	return ok
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 2076
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




int main(){

    int N;
    cin >> N;
    vl a(N);
    in(N,a);
    
    vvl dp(7100,vl(7100,0));
    
    reps(aa,1,N+1){
        for (int i = 0; i+aa <= N; i++) {
            int j = aa+i;
            if((N-(j-i)) % 2 == 0){
                dp[i][j] = max(dp[i+1][j] + a[i], dp[i][j-1] + a[j-1]);
            }else{
                dp[i][j] = min(dp[i+1][j] - a[i], dp[i][j-1] - a[j-1]);
            }
        }
    }
    
 
    //outmat(dp);
    cout << dp[0][N] << endl;
    
    

    return 0;
}


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

using Data = tuple<int64_t, int64_t, int64_t>;

const int MAX_N = 1e3;
const int MAX_W = 1e4;
const int MAX_S = 1e4;

int64_t dp[MAX_W + MAX_S + 1];

int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int N;
    cin >> N;
    // (s + w, w, v)
    vector<Data> swv(N);
    for(int w = 0; w <= MAX_W + MAX_S; w++) {
        dp[w] = 0;
    }
    for(int i = 0; i < N; i++) {
        int64_t s, w, v;
        cin >> w >> s >> v;
        swv[i] = Data(s + w, w, v);
    }
    sort(swv.begin(), swv.end());
    for(int i = 0, b = 0; i < N; i++, b = i & 1) {
        int64_t s, w, v;
        tie(s, w, v) = swv[i];
        for(int W = s; W >= w; W--) {
            dp[W] = max(dp[W - w] + v, dp[W]);
        }
    }
    int64_t ans = 0;
    for(int w = 0; w <= MAX_S + MAX_W; w++) {
        ans = max(ans, dp[w]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int head[131072],last[262144],to[262144],cnt=0;
void add(int u,int v)
{
	cnt++;
	last[cnt]=head[u];
	head[u]=cnt;
	to[cnt]=v;
}
int deg[131072];
bool dfs(int u,int f)
{
	for(int i=head[u];i;i=last[i])
	{
		int v=to[i];
		if(v==f)
		{
			continue;
		}
		if(deg[v]==0)
		{
			continue;
		}
		if(deg[v]==4)
		{
			return true;
		}
		if(dfs(v,u))
		{
			return true;
		}
	}
	return false;
}
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	while(m--)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		add(u,v);
		add(v,u);
		deg[u]++;
		deg[v]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(deg[i]&1)
		{
			printf("No\n");
			return 0;
		}
	}
	int num4=0;
	for(int i=1;i<=n;i++)
	{
		if(deg[i]>=6)
		{
			printf("Yes\n");
			return 0;
		}
		if(deg[i]==4)
		{
			num4++;
		}
	}
	if(num4<2)
	{
		printf("No\n");
		return 0;
	}
	if(num4>2)
	{
		printf("Yes\n");
		return 0;
	}
	for(int i=1;i<=n;i++)
	{
		if(deg[i]==4)
		{
			deg[i]=0;
			break;
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(deg[i]==4)
		{
			if(dfs(i,0))
			{
				printf("Yes\n");
			}
			else
			{
				printf("No\n");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3328
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
k = I()
que = deque([])
for i in range(1,10):
    que.append(i)
if k <= 9:
    print(que[k-1])
    exit()
while que:
    num = que.popleft()
    if k == 1:
        print(num)
        exit()
    lo = num%10
    if 0 <= lo - 1:
        que.append(num*10 + lo-1)
    que.append(num*10 + lo)
    if lo + 1 <= 9:
        que.append(num*10 + lo + 1)
    k -= 1


Measured memory_bytes: 20128
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

po = input().split()[0]
n = len(po)
if po == po[::-1]:
    a = po[:n//2]
    b = po[n//2+1:]
    if a == a[::-1] and b == b[::-1]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

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

using namespace std;

int n;
int A[10];

int func(int p, int cont) {
    if (p == n) {
        if (cont == n)   return 0;
        else            return 1;
    }
    
    return func(p+1, cont+(A[p]-1)%2)
            + func(p+1, cont+(A[p])%2)
            + func(p+1, cont+(A[p]+1)%2);
}

int main() {
    cin >> n;

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

    cout << func(0, 0) << endl;

    return 0;
}

Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    ans = 0
    if n == 0 & x == 0:
        break
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            for k in range(j+1, n+1):
                if i + j + k == x:
                    ans += 1
    print(ans)



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

#define rep(i, N) for(int i = 0;i < N;i++)

typedef long long ll;

const int mod = 1e9 + 7;

using namespace std;



int main(void) {
	int H, W; cin >> H >> W;
	vector<string> A(H);
	rep(i, H)cin >> A[i];

	int cnt = 0;
	rep(i, H)rep(j, W) {
		cnt += (int)(A[i][j] == '#');
	}

	cout << (cnt == H + W - 1 ? "Possible" : "Impossible") << endl;

	return 0;
}

Measured memory_bytes: 3612
/* Author rumoisen */
/* date 2018/10/07 */
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
 
using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

void no(){cout<<"No"<<endl;exit(0);}
void yes(){cout<<"Yes"<<endl;exit(0);}

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;
using namespace std;
int main()
{  
    int n,d,x;
    cin>>n>>d>>x;
    int a[110];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int choco=0;
    for(int i=0;i<n;i++){
        for(int day=0;day*a[i]+1<=d;day++){
            choco+=1;
        }
    }
    cout<<choco+x<<endl;
}

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

int main(){
  int n, d, x, i, j;
  cin >> n;
  cin >> d >> x;
  int a[n];
  for(i = 0; i < n; i++) cin >> a[i];
  for(i = 0; i < n; i++){
    j = 0;
    while(a[i] * j + 1 <= d){
      x++;
      j++;
    }
  }
  cout << x << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
//#define int long long
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;
#define X first
#define Y second
#define all(o) o.begin(), o.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0)

int gcd(int x,int y){ return (!y ? x : gcd(y, x%y)); }

int32_t main(){
	IOS;
	string s;
	cin >> s;
	int ted = 0;
	ll ans = 0;
	for(int i=0; i<s.size(); i++){
		if(s[i] == 'W')
			ans += ted;
		else
			ted++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
string str1, str2, rem;
int n1, n2;
int main()
{
    cin>>str1>>str2>>n1>>n2>>rem;
    if(rem == str1) n1--;
    else if (rem == str2) n2--;
    cout<<n1<<" "<<n2<<"\n";
}

Measured memory_bytes: 256
N = int(input())
A = []
for _ in range(2):
    A.append(list(map(int, input().split())))


def dfs(i, j):
    if i == 1 and j == N - 1:
        return A[i][j]
    if i == 1:
        return dfs(i, j + 1) + A[i][j]
    if j == N - 1:
        return dfs(i + 1, j) + A[i][j]
    else:
        a1 = dfs(i + 1, j)
        a2 = dfs(i, j + 1)
        a = max(a1, a2)
        return a + A[i][j]


ans = dfs(0, 0)
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 55;
const int MAXM = 35;
const int MAXK = 510;
const int MAXQ = 200010;

char ch[MAXN][MAXN];
int n, m, d[MAXN][MAXN];
bool visit[MAXN][MAXN];

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

void bfs() {
    FOR(i,1,n)
        FOR(j,1,m) d[i][j] = 1000000000;
    queue<II> q;
    q.push(II(1,1));
    d[1][1] = 1;
    while (!q.empty()) {
        II r = q.front();
        q.pop();
        FOR(i,0,3) {
            int u = r.FI + dx[i];
            int v = r.SE + dy[i];
            if (u >= 1 && u <= n && v >= 1 && v <= m)
                if (ch[u][v] == '.') {
                    if (d[u][v] > d[r.FI][r.SE] + 1) {
                        d[u][v] = d[r.FI][r.SE] + 1;
                        q.push(II(u, v));
                    }
                }
        }
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> m;
    FOR(i,1,n) FOR(j,1,m) cin >> ch[i][j];
    bfs();
    if (d[n][m] == 1000000000) {
        cout << -1;
        return 0;
    }
    int black = 0;
    FOR(i,1,n) FOR(j,1,m) black += (ch[i][j] == '#');
    int white = n * m - black;
    int need = d[n][m];
    cout << white - need;
    return 0;
}

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

long long solve(long long N){
    if(N % 2 == 1)return 0;
    
    long long res = 0;
    N /= 2;
    while(N){
        res += N/5;
        N /= 5;
    }
    return res;
}



int main(){
    long long N; cin >> N;
    cout << solve(N) << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#include <iomanip>
#include <functional>
#define FOR(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
using namespace std;


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

	int N;

	cin >> N;

	cout << 180 * (N - 2) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, l, r) for (__typeof(l) i = (l); i <= (r); ++i)
#define per(i, r, l) for (__typeof(r) i = (r); i >= (l); --i)
using namespace std;
typedef long long ll;
const int mod = 998244353;
int read() {
	int f = 1, x = 0; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return f * x;
}
int qpow(int a, int b) { int res = 1; while (b) { if (b & 1) res = (ll)res * a % mod; a = (ll)a * a % mod; b >>= 1; } return res; }
 
int n, m; 
int main() {
	n = read(), m = read();
	vector <int> v(n);
	double sum = 0;
	for (int i = 0; i < n; ++i) v[i] = read(), sum += v[i];
	sum /= (double)(4 * m);
	sort (v.begin(), v.end());
	int now = 0;
	for (int i = n-1; i >= 0; --i) {
		if (now >= m) return puts("Yes"), 0;
		if (v[i] < sum) return puts("No"), 0;
		++now;
	} 
	puts(now >= m ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const long long MOD = 998244353;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846264338327950L


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> c(N);
    vector<vector<int>> A(N, vector<int>(M, 0));
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < M + 1; ++j) {
            if (j == 0)cin >> c[i];
            else cin >> A[i][j-1];
        }
    }
    int cost = INF;
    
    for (int bit = 0; bit < (1 << N); ++bit) {
        int temp_cost = 0;
        int a[13] = { 0 };
        for (int i = 0; i < N; ++i) {
            if (bit & (1 << i)) {
                temp_cost += c[i];
                for (int j = 0; j < M; ++j) {
                    a[j] += A[i][j];
                }
            }
        }
        bool understand=true;
        for (int i = 0; i < M; ++i) {
            if (a[i] < X)understand=false;
        }
        if(temp_cost!=0&&understand)cost = min(cost, temp_cost);
    }
    if(cost!=INF)cout << cost << endl;
    else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3608
import java.util.*;
 
class Main {
  
    public static void main(String[] args) {
      
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        Integer hebi[] = new Integer[N];
		int nam = Integer.parseInt(sc.next());
        int sam = 0;
      
      for(int i=0;i<N;i++){
        hebi[i] = Integer.parseInt(sc.next());
      }
		Arrays.sort(hebi, Collections.reverseOrder());
      
      for(int i = 0;i<nam;i++){
			sam += hebi[i];
      }

		System.out.print(sam);
    }
}

Measured memory_bytes: 21716
/*AOJ 0014*/

#include<iostream>
using namespace std;

double f(double x){
	return x*x;
}

int main(){

	int sum = 0;
	int d;

	while(cin>>d){
		sum = 0;

		for(int i=1;d*i<600;i++){
			sum += f(i*d)*d;

		}

		cout<<sum<<endl;

	}

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ull unsigned long long
#define lli long long int
#define pb push_back
#define all(x) x.begin(),x.end()
ll mob=1000000007;
using namespace std;
int main()
{ 
int k,a,b;
cin>>k>>a>>b;
if((b/k)*k>=a)
cout<<"OK";
else
cout<<"NG";


 
 



return 0;
}











Measured memory_bytes: 3636
#include <iostream>
using namespace std;
 
int main() {
    
    int D, T, S;
    cin >> D >> T >> S;
 
    
    double time = (double)D / S;
 
  
    if (T >= time) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3576
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>

using namespace std;

int main() {
    string n;
    cin >> n;
    char res[3];
    for (int i = 0; i < 3; i++)
    {
        res[i] = n[i];
        if (n[i] == '1') res[i] = '9';
        if (n[i] == '9') res[i] = '1';
    }
    string resstr(res, 3);
    cout << resstr << "\n";
    return 0;
}

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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    cout << input() * input() << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


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

#define ll long long

template<typename T> void drop(const T &x){cout<<x<<'\n';exit(0);}

void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> count(n);
  int a, b;
  for(int i=0; i<m; ++i) {
    cin >> a >> b;
    count.at(a-1)++; count.at(b-1)++;
  }
  for(int i=0; i<n; ++i) cout << count.at(i) << '\n';    
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T=1;
  //cin >> T;
  while(T--) solve();

  return 0;
}


Measured memory_bytes: 3644
n,m = map(int,input().split())
# ab = [list(map(int,input().split())) for i in range(m)]
v = [[] for i in range(n+1)]
# print(v)
for i in range(m):
    a,b = map(int,input().split())
    v[a].append(b)
    v[b].append(a)
while v[1]:
    temp = v[1].pop()
    if n in v[temp]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Measured memory_bytes: 38320
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val as = List.fill(n)(sc.nextLong())

  def solve(sgn: Int): Long = {
    var sum = 0L
    var ans = 0L
    if (sgn * as.head <= 0) {
      sum = sgn
      ans += as.head.abs + 1
    } else {
      sum = as.head
    }

    for (a <- as.tail) {
      if ((sum > 0 && sum + a >= 0) || (sum < 0 && sum + a <= 0)) {
        ans += (if (sum > 0) sum + a + 1 else -(sum + a - 1))
        sum = if (sum > 0) -1 else 1
      } else {
        sum += a
      }
    }
    ans
  }

  println(solve(1).min(solve(-1)))
}


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

typedef long long ll;

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    rep(i, N + 1) {
        rep(j, M + 1) {
            if (i * (M - j) + j * (N - i) == K) {
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
}

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

using namespace std;

int main()
{
  	int a, b;
  	cin >> a >> b;
  	if(a > b)swap(a, b);
  
  	for(int i = 0; i < b; i++)
    {
     	cout << a; 
    }
  
  	cout << '\n';
  
 	return 0; 
}

Measured memory_bytes: 256
s = input()
for i in range(len(s)+1):
    for j in range(len(s)-i+1):
        if [k for k in s[j:j+i]] == [k for k in s[j:j+i] if k=='A' or k=='G' or k=='C' or k=='T']:
            a=i
print(a)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
ll mod=1e9+7;
#define PI acos(-1)
struct edge{int from, to;};

int main(){
    int n;
    cin>>n;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(i*j==n){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256