akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x); i<=(y); i++)
#define per(i,x,y) for (int i=(x); i>=(y); i--)
#define ll long long
#define ull unsigned long long
#define ld long double
#define inf 1000000000
#define INF 1000000000000000000ll
#define pii pair<int,int>
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define sqr(x) ((x)*(x))
#define y1 y1_
#define cmin(x,y) (x)=(y)<(x)?(y):(x)
#define cmax(x,y) (x)=(y)>(x)?(y):(x)
#define mset(x,y) memset((x),(y),sizeof(x))
#define mcpy(x,y) memcpy((x),(y),sizeof(y))
using namespace std;
const ld pi=acos(-1);
const ld eps=1e-8;
//////////////////////// header files ////////////////////////
ll read(){
	char ch=getchar(); ll x=0; int op=1;
	for (; !isdigit(ch); ch=getchar()) if (ch=='-') op=-1;
	for (; isdigit(ch); ch=getchar()) x=(x<<1)+(x<<3)+ch-'0';
	return x*op;
}
void write(ll a){
	if (a<0) putchar('-'),a=-a;
	if (a>=10) write(a/10); putchar(a%10+'0');
}
////////////////////////// fast i/o //////////////////////////
#ifdef mod
ll ksm(ll x,ll p){
	ll ret=1;
	for (; p; p>>=1,x=x*x%mod) if (p&1) ret=ret*x%mod;
	return ret;
}
ll getinv(ll x){ return ksm(x,mod-2); }
#else
ll ksm(ll x,ll p){
	ll ret=1;
	for (; p; p>>=1,x=x*x) if (p&1) ret=ret*x;
	return ret;
}
#endif
//////////////////////////// qpow ////////////////////////////
#define N 200005
int n; ll a[N],ans;
map<ll,int> Mp;
//#define local
int main(){
#ifdef local
	freopen("test.in","r",stdin); freopen("test.out","w",stdout);
#endif
	n=read(); Mp[0]=1;
	rep (i,1,n){
		a[i]=a[i-1]+read();
		ans+=Mp[a[i]]; Mp[a[i]]++;
	}
	cout<<ans<<endl;
	return 0;
}
// sample data:
/*

*/

// rest:
/*

*/

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

#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
#define endl '\n'
// #define int long long

typedef pair<int,int> pii;
const int N = 1e2+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int n, l[N], x;
int32_t main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> n >> x;
	for(int i=0; i<n; i++) cin >> l[i];
	int cnt = 1;
	int cur = 0;
	for(int i=1; i<=n; i++){
		cur += l[i-1];
		if (cur <= x) cnt++;
		else {
			cout << cnt << endl;
			return 0;
		}
	}
	cout << cnt << endl;
	return 0;
}


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

int snuck[110];

int main(){
    int n,k,ans=0;
    cin>>n>>k;
    
    while(k--){
        int d;
        cin>>d;
        while(d--){
            int a;
            cin>>a;
            snuck[a]=1;
        }
    }
    
    for(int i=1;i<=n;i++)
        if(snuck[i]!=1)
            ans++;
            
    cout<<ans<<"\n";
    return 0;
}

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

int main() {
    int n, d;
    cin >> n >> d;
    cout << (n - 1) / (2 * d + 1) + 1 << endl;
}


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

signed main(void)
{
	int n, q;
	cin >> n;
	ll sum;
	map<ll, ll> mp;
	sum = 0;

	rep(i, n) 
	{
		ll a;
		cin >> a;
		mp[a]++;
		sum += a;
	}
	cin >> q;
	rep (i, q)
	{
		int b, c;
		cin >> b >> c; 
		sum -= b * mp[b];
		sum += c * mp[b];
		mp[c] += mp[b];
		mp[b] = 0;
		cout << sum << endl;
	}
	return 0;
}


Measured memory_bytes: 9520
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define FORR(i,a,b) for (int i = b - 1; i >= a; --i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,0,n)

int main() {
	int D, T, S;
	cin >> D >> T >> S;

	if (S * T >= D) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3600
H,W,N=gets.split.map &:to_i
y,x=gets.split.map &:to_i
S=gets
T=gets
U=D=y-1
L=R=x-1
N.times{|i|
S[i]=='L'&&L-=1
S[i]=='R'&&R+=1
S[i]=='U'&&U-=1
S[i]=='D'&&D+=1
(L<0||R>=W||U<0||D>=H)&&(puts"NO";exit)
T[i]=='L'&&R>0&&R-=1
T[i]=='R'&&L<W-1&&L+=1
T[i]=='U'&&D>0&&D-=1
T[i]=='D'&&U<H-1&&U+=1
}
puts"YES"

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

int main(){
  int N,A,B,C,D; cin >> N >> A >> B >> C >> D;
  A--; B--; C--; D--;
  string S; cin >> S;
  
  //.マス #岩
  //岩は居れない
  //右に1か2マス動かせる
  
  //C<Dのとき、Bを先にDに動かしAをCに動かせばよい
  //単にB-D,A-C間に岩がソロであればよい
  
  //D<Cのとき、AはBを越さなければならない→Bの岩化
  //A-C間にBがソロの岩であれるような場所があればよい
  
  //A-C間チェック
  bool ac=true;
  for(int i=A;i<C;i++){
    if(S[i]=='#'&&S[i+1]=='#'){
      ac=false;
      break;
    }
  }
  if(ac==false){
    cout << "No" << endl;
    return 0;
  }
  
  //CD場合分け
  if(C<D){
    bool bd=true;
    for(int i=B; i<D; i++){
      if(S[i]=='#'&&S[i+1]=='#'){
        bd=false;
        break;
      }
    }
    if(bd==false){
      cout << "No" << endl;
    }else{
      cout << "Yes" << endl;
    }
  }else{
    //A-B-D-C
    //BをB-Dの空マスに置くことは可能
    //置いたとき前後が空であることが必要十分
    bool bd2=true;
    for(int i=B; i<=D; i++){
      if(S[i-1]=='.'&&S[i]=='.'&&S[i+1]=='.'){
        bd2=false;
        break;
      }
    }
    if(bd2==false){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 640
n,k=map(int,input().split())
h=list(map(int,input().split()))
d=[float('inf')]*n
d[0]=0
for i in range(n-1):
    for j in range(1,min(k+1,n-i)):
        d[i+j]=min(d[i+j],d[i]+abs(h[i+j]-h[i]))
print(d[-1])

Measured memory_bytes: 55136
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real()*a.real() + a.imag()*a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
#include <bits/stdc++.h>
using namespace std;


void solve(long long N){
	cout << (N + 110) / 111 * 111 << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


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

int main() {
	string s;
	getline(cin,s); 
	string t;
	
	for(int i=0;i<s.size()-1;i++)
	{
	    if(i==0)
	    {
	        t+=toupper(s[i]);
	    }
	    else if(s[i]==' ')
	    {
	        t+=toupper(s[i+1]);
	    }
	} 
	cout<<t<<endl;
	return 0;
}

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

const int N = 100005;

int q;
int fs[N], ft[N];
string s, t;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	string s, t; cin >> s >> t;
	int ns = s.size();
	int nt = t.size();

	// numA - numB
	for (int i = 1; i <= ns; ++i) fs[i] = fs[i-1] + (s[i-1] == 'A' ? +1 : -1);
	for (int i = 1; i <= nt; ++i) ft[i] = ft[i-1] + (t[i-1] == 'A' ? +1 : -1);

	// can swap two positions: AB -> AAA -> ABBA -> BBBBA -> BA
	// relevant: modulo 3

	cin >> q;
	while(q--) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		int S = fs[b] - fs[a - 1];
		int T = ft[d] - ft[c - 1];
		int dif = (T - S);
		if (dif % 3 == 0) printf("YES\n"); else printf("NO\n");
	}
}

Measured memory_bytes: 1744
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		String s = sc.next();
		
		String[] a = {"a","e","i","o","u"};
		
		for(String str : a) {
			if(str.equalsIgnoreCase(s)) {
				out.println("vowel");return;
			}
		}
		
		out.println("consonant");
		
	}

	public static int gcd(int a, int b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static int lcm(int a, int b) {
		return (a * b) / gcd(a, b);
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 20948
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


sx, sy, gx, gy = LI()
n = I()
circles = [[sx, sy, 0]] + LIR(n) + [[gx, gy, 0]]
G = [[0] * (n + 2) for _ in range(n + 2)]
for i in range(n + 2):
    for j in range(i + 1, n + 2):
        G[i][j] = G[j][i] = \
        max(0, ((circles[i][0] - circles[j][0]) ** 2 + (circles[i][1] - circles[j][1]) ** 2) ** 0.5 - circles[i][2] - circles[j][2])


def dijkstra(graph, start=0):
    que = [(0, start)]
    dist = [INF] * (n + 2)
    dist[start] = 0
    while que:
        min_dist, u = heappop(que)
        if min_dist > dist[u]:
            continue
        for v, c in enumerate(graph[u]):
            if dist[u] + c < dist[v]:
                dist[v] = dist[u] + c
                heappush(que, (dist[u] + c, v))
    return dist


print(dijkstra(G, start=0)[-1])

Measured memory_bytes: 124636
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
typedef long long ll;

const int MAXN = 1000*1000 + 7;
const int SS = 1<<20;
const int MOD = 1000*1000*1000 + 7;

int dp[MAXN][3];
int n;

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

	int T;
	//cin >> T;
	T = 1;
	while(T--)
	{
		cin >> n;
		int pot10 = 1;
		for(int i=1; i<=n; i++)
		{
			dp[i][0] = (dp[i][0] + pot10)%MOD; // zawiera 0
			dp[i][1] = (dp[i][1] + pot10)%MOD; // zawiera 9
			dp[i][2] = (dp[i][2] + dp[i-1][1])%MOD; // dokladam 0
			dp[i][2] = (dp[i][2] + dp[i-1][0])%MOD; // dokladam 9

			dp[i][0] = ((ll)dp[i][0] + (ll)9*(ll)dp[i-1][0])%MOD;
			dp[i][1] = ((ll)dp[i][1] + (ll)9*(ll)dp[i-1][1])%MOD;
			dp[i][2] = ((ll)dp[i][2] + (ll)8*(ll)dp[i-1][2])%MOD;
			pot10 = ((ll)pot10 * (ll)10)%MOD;
		}
		cout << dp[n][2] << '\n';
	}
	return 0;
}


Measured memory_bytes: 15288
def isPrime( x ):
	if 2 == x or 3 == x:
		return True
	if 0 == x&1:
		return False
	i = 3 
	while  i*i <= x:
		if 0 == x%i:
			return False
		i += 1
	return True


n = int( raw_input( ) )
nums = []
while 0 < n:
	nums.append( int( raw_input( ) ) )
	n -= 1
cnt = 0
for num in nums:
	if isPrime( num  ):
		cnt += 1

print( cnt )

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

int solve() {
	int n;
	cin >> n;
	cout << (n + 999) / 1000 * 1000 - n << '\n';
	return 0;
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
	
	int t = 1;
	// cin >> t;
	while (t--) solve();
	return 0;
}

Measured memory_bytes: 3636
def knapsack(N,W,wv):
  #初期化
  inf=float("inf")
  dp=[[-inf for i in range(W+1)] for j in range(N+1)]
  for i in range(W+1): dp[0][i]=0

  #DP
  for i in range(N):
    for w in range(W+1):
      if wv[i][0]<=w: #dp[i][w-wv[i][0]]の状態にi番目の荷物が入る可能性がある
        dp[i+1][w]=max(dp[i][w-wv[i][0]]+wv[i][1], dp[i][w])
      else: #入る可能性はない
        dp[i+1][w]=dp[i][w]
  return dp[N][W]

if __name__ == "__main__":
  N, W = map(int, input().split())
  wv = [list(map(int, input().split())) for i in range(N)]
  ans = knapsack(N, W, wv)
  print(ans)

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1777777777ll
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read(a,n) rep(i,n)cin>>a[i]

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li a[100100];
li b[100100];

int main() {
    li na, nb, m;
    cin >> na >> nb >> m;
    read(a, na);
    read(b, nb);

    li ma = *min_element(a, a + na);
    li mb = *min_element(b, b + nb);
    li res = ma + mb;
    rep(i, m) {
        li x, y, c;
        cin >> x >> y >> c;
        x--;
        y--;
        res = min(res, a[x] + b[y] - c);
    }
    cout << res << endl;


    return 0;
}


Measured memory_bytes: 1792
num = int(input())

cards = [int(x) for x in input().split()]

res = sum(cards)
res2 = 0

judge = float("inf")

if num == 2:
    judge = abs(cards[0]-cards[1])
else:
    for i in range(0, len(cards)):
        res -= cards[i]
        res2 += cards[i]
        div = abs(res - res2)
        judge = div if div < judge and i != len(cards)-1 else judge

print(judge)

Measured memory_bytes: 24956
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
#include <cctype>
#include <stdio.h>
#include <cstdlib>
using namespace std;

int main(){
    int n,a,b;
    cin >> n >> a >> b;
    cout << min(n*a,b);
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int i;
    int hillsdata[10];
    int max[3] = {0, 0, 0};

    for (i = 0; i < 10; i++){
        scanf("%d", &hillsdata[i]);
    }

    for (i = 0; i < 10; ++i)
    {
        if (max[0] <= hillsdata[i]){
            max[2] = max[1];
            max[1] = max[0]; 
            max[0] = hillsdata[i];
        }
        else if (max[1] <= hillsdata[i]){
            max[2] = max[1];
            max[1] = hillsdata[i];
        }
        else if (max[2] <= hillsdata[i]){
            max[2] = hillsdata[i];
        }
    }

    printf("%d\n%d\n%d\n", max[0], max[1], max[2]);
    return (0);
} 

Measured memory_bytes: 600
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    static final Scanner     sc = new Scanner(System.in);
    static final PrintStream so = System.out;
    
    public static void main(String[] args) {
        so.println(ni() < ni() ? 0 : 10);
    }

    private static int ni() {
        return sc.nextInt();
    }

    private static long nl() {
        return sc.nextLong();
    }

    private static String ns() {
        return sc.next();
    }

    private static char[] nsToChars() {
        return sc.next().toCharArray();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0);
    }

    private static long[] nlongs(int n, int padding) {
        long[] a = new long[padding + n];
        for (int i = 0; i < n; i++)
            a[padding + i] = ni();
        return a;
    }
}


Measured memory_bytes: 23124
/*

This Submission is to determine how many 120/240 min const. delivery point there are.

//info
120 req. steps <= 5
*/
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 1000000007
#define seg_size 262144
#define REP(a,b) for(long long a = 0;a < b;++a)

unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(min((double)1.0, max((double)-1.0, cosine)));
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		double now_length = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa - now_min >= eps||(abs(goa - now_min) <= eps&&(abs(a[i] - a[starter]) - now_length) >= eps)) {
					now_min = goa;
					now_go = i;
					now_length = abs(a[i] - a[starter]);
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
int main() {
	long long n;
	cin >> n;
	cout << n * (n - 1LL) / 2LL << endl;
}

Measured memory_bytes: 256
// Author -- Frame

#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<iostream>
#include<queue>

#define lowbit(x) ((x)&(-x))
#define Finline __inline__ __attribute__ ((always_inline))
#define DEBUG printf("Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;

const int inf=0x3f3f3f3f,Inf=0x7fffffff;
const ll INF=0x7fffffffffffffff;
const double eps=1e-10;

uint seed=19260817;
const uint _RAND_MAX_=4294967295u;
Finline uint Rand(){return seed=seed*998244353u+1000000007u;}

template <typename _Tp>_Tp gcd(const _Tp &a,const _Tp &b){return (!b)?a:gcd(b,a%b);}
template <typename _Tp>Finline _Tp abs(const _Tp &a){return a>0?a:-a;}
template <typename _Tp>Finline _Tp max(const _Tp &a,const _Tp &b){return a<b?b:a;}
template <typename _Tp>Finline _Tp min(const _Tp &a,const _Tp &b){return a<b?a:b;}
template <typename _Tp>Finline void chmax(_Tp &a,const _Tp &b){(a<b)&&(a=b);}
template <typename _Tp>Finline void chmin(_Tp &a,const _Tp &b){(a>b)&&(a=b);}
template <typename _Tp>Finline bool _cmp(const _Tp &a,const _Tp &b){return abs(a-b)<=eps;}
template <typename _Tp>Finline void read(_Tp& x)
{
    register char ch(getchar());
    bool f(false);
    while(ch<48||ch>57) f|=ch==45,ch=getchar();
    x=ch&15,ch=getchar();
    while(ch>=48&&ch<=57) x=(((x<<2)+x)<<1)+(ch&15),ch=getchar();
    if(f) x=-x;
}
template <typename _Tp,typename... Args>Finline void read(_Tp &t,Args &...args)
{
    read(t);read(args...);
}
Finline int read_str(char *s)
{
    register char ch(getchar());
    while(ch==' '||ch=='\r'||ch=='\n') ch=getchar();
    register char *tar=s;
    *tar=ch,ch=getchar();
    while(ch!=' '&&ch!='\r'&&ch!='\n'&&ch!=EOF) *(++tar)=ch,ch=getchar();
    return tar-s+1;
}

const int N=100005;
int fa[N];
int a[N];
int id[N];
std::vector<int> v[N];
int find(const int &x){return x==fa[x]?x:fa[x]=find(fa[x]);}
int b[N];
Finline bool cmp(const int &a,const int &b)
{
	return ((int)v[a].size()>1?v[a][1]:Inf)<((int)v[b].size()>1?v[b][1]:Inf);
}
std::priority_queue<int,std::vector<int>,std::greater<int> > q;
int main()
{
	int n,m;
	read(n,m);
	for(int i=1;i<=n;++i) read(a[i]),fa[i]=i;
	int x,y;
	for(int i=1;i<=m;++i)
	{
		read(x,y);
		++x,++y;
		fa[find(x)]=find(y);
	}
	int cnt=0;
	for(int i=1;i<=n;++i)
	{
		if(fa[i]==i)
		{
			id[i]=++cnt;
		}
	}
	for(int i=1;i<=n;++i)
	{
		v[id[find(i)]].push_back(a[i]);
	}
	int minn=Inf,pos=0;
	for(int i=1;i<=cnt;++i)
	{
		std::sort(v[i].begin(),v[i].end());
		if(v[i][0]<minn)
		{
			minn=v[i][0];
			pos=i;
		}
	}
	std::swap(v[1],v[pos]);
	for(int i=2;i<=cnt;++i) b[i]=i;
	std::sort(b+2,b+cnt+1,cmp);
	for(auto it:v[1])
	{
		q.push(it);
	}
	ll ans=0;
	for(int i=2;i<=cnt;++i)
	{
		if(q.empty())
		{
			printf("Impossible\n");
			return 0;
		}
		x=q.top();
		q.pop();
		ans+=x+v[b[i]][0];
		for(int j=1;j<(int)v[b[i]].size();++j)
		{
			q.push(v[b[i]][j]);
		}
	}
	printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 7296
//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef vector<ll> vi;
typedef vector<long long> vl;
typedef pair<ll, ll> pi;
typedef vector<pair<ll, ll>> vpi;

//const long long INF = 1LL << 55;

#define itn ll
#define endl '\n'
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(ll i = 0;i < n;i++)
#define rep(i,n) for(ll i = 0;i < n;i++)
#define flush fflush(stdout)
#define rrep(i,n) for(ll i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, ll mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

int n,m; // number of vertices
vector<int> adj[100010]; // adjacency list of graph
vector<bool> visited;
vector<int> ans;
map<int,int> new_graph;
void dfs(int v) {
    visited[v] = true;
    for (int u : adj[v]) {
        if (!visited[u])
            dfs(u);
    }
    ans.push_back(v);
}

void topological_sort() {
    visited.assign(n, false);
    ans.clear();
    for (int i = 0; i < n; ++i) {
        if (!visited[i])
            dfs(i);
    }
    reverse(ans.begin(), ans.end());
}

void input(){
    cin >> n >> m;
    rep(i,n-1+m){
        int a,b;cin >> a >> b;
        a--,b--;
        adj[a].push_back(b);
    }
    topological_sort();
    for(int i = 0;i < n;i++){
        new_graph[ans[i]] = i;
    }
}

int main(void){
    input();

    vector<pair<int,int>> par(n,pair<int,int>(-1,-1));

    rep(i,n){
        for(auto j : adj[i]){
            if(par[j].second < new_graph[i]){
                par[j] = pair<int,int>(i,new_graph[i]);
            }
        }
    }

    rep(i,n){
        cout << par[i].first + 1 << endl;
    }

}

Measured memory_bytes: 15352
def main():
    K = input()
    D = int(input())
    L = len(K)
    dp = [[[0, 0] for _ in range(D)] for _ in range(L+1)]
    mod = 10 ** 9 + 7
    dp[0][0][1] = 1
    for i in range(L):
        d = int(K[i])
        for j in range(D):
            for k in range(10):
                dp[i+1][(j + k) % D][0] += dp[i][j][0]
                dp[i+1][(j + k) % D][0] %= mod
                if k < d:
                    dp[i+1][(j + k) % D][0] += dp[i][j][1]
                    dp[i+1][(j + k) % D][0] %= mod
                elif k == d:
                    dp[i+1][(j + k) % D][1] += dp[i][j][1]
                    dp[i+1][(j + k) % D][1] %= mod
    print((sum(dp[-1][0]) + mod - 1) % mod)



if __name__ == '__main__':
    main()


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

/// easy access -------------
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
typedef pair<int,int> pi;
typedef tuple<int, int, int> tp;
typedef vector<vector<int>> vv;
///-------------------------

int main()
{
    Phuong_; /// <3333
    string s;
    cin >> s;
    string t;
    cin >> t;
    int n = (int) s.length();
    int m = (int) t.length();
    int maxx=0;
    for(int i=0; i<=(n-m); ++i){
        int dem=0;
        for(int j=0; j<m; ++j){
            if (s[i+j]==t[j]) dem++;
        }
        maxx = max(maxx,dem);
    }
    cout << m-maxx;
    return 0;
}


Measured memory_bytes: 3572
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    K = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    s=input()
    ls=len(s)
    tot=pow(26,ls+K,mod)
    N=ls+K

    def extgcd1(a0,b0):#計算量log(b0),フェルマーの小定理より早い
        u,v,a,b=1,0,a0,b0
        while b: t=a//b; a-=t*b; a,b=b,a; u,v=v,u-t*v
        if a!=1: return -1#互いに素じゃない
        return u%b0
    
    maxn=N
    fact=[1]*(maxn+1)#NはnCrの最大のn
    ifact=[1]*(maxn+1)
    x=1
    for i in range(2,maxn+1):
        x=(x*i)%mod
        fact[i]=x
        ifact[i]=extgcd1(x,mod)
    

    def comb(n,r): return (fact[n]*ifact[r]%mod)*ifact[n-r]%mod
    
    pows=[pow(25,i,mod) for i in range(N+1)]

    for i in range(0,ls):
        tot-=comb(ls+K,i)*pows[ls+K-i]
        tot%=mod
    print(tot)




if __name__ == "__main__":
    main()

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

using namespace std;

const int MAXN = 1e5 + 5;
const int inf = 1e9;

int niz[MAXN], DP[MAXN], n, k;

int main()
{
	cin >> n >> k;
	for(int i = 0; i < n; i++)
		cin >> niz[i];
	DP[0] = 0;
	for(int i = 1; i < k; i++)
	{
		DP[i] = abs(niz[i] - niz[0]);
	}
	for(int i = k; i < n; i++)
	{
		int ret = inf;
		for(int j = i - k; j < i; j++)
		{
			ret = min(ret, DP[j] + abs(niz[j] - niz[i]));
		}
		DP[i] = ret;
	}
	cout << DP[n - 1];
	return 0;
}

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

int main() {
  int X,Y,Z; cin >> X >> Y >> Z;
  X -= 2*Z;
  int cnt = 0;
  while(1) {
    if ( X - Y >= 0 ){
    X -=Y;
    cnt++;
    X -= Z;
    } else {
      break;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main() {
	int N, M; cin >> N >> M; 
	int L = -114514; int R = 114514;  
	for(int i = 0; i < M; i++){
		int l, r; cin >> l >> r; 
		L = max(L, l); R = min(R, r); 
	}
	if(L <= R) cout << R - L + 1 << endl; 
	else cout << 0 << endl; 
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d %d', $type, $cnt);
$nums = array_map('intval', explode(' ', trim(fgets(STDIN))));
rsort($nums);
$max = $nums[0];
$sum = array_sum($nums);
$list = [];
for ($i=0; $i < $type; $i++) { 
    if ($nums[$i] >= $sum / (4 *$cnt)) {
        $list[] = $nums[$i];
        unset($nums[$i]);
    }
}
echo count($list) >= $cnt ? 'Yes' : 'No';

Measured memory_bytes: 16132
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
	int n, m, k; cin >> n >> m >> k;
	int pre_a[n + 1] = {};
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		pre_a[i + 1] = pre_a[i] + x;
	}
	int pre_b[m + 1] = {};
	for (int i = 0; i < m; i++) {
		int x; cin >> x;
		pre_b[i + 1] = pre_b[i] + x;
	}
	int ans = 0;
	int j = m;
	for (int i = 0; i < n + 1; i++) {
		int ex = k - pre_a[i];
		if (ex >= 0) {
			while (j >= 0 and pre_b[j] > ex) --j;
			ans = max(ans, i + j);
		}
	}
	cout << ans << "\n";
}

Measured memory_bytes: 6684
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YNL = {False: 'No', True: 'Yes'}
YNU = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    st = S()
    Q = I()
    queries = []
    # print(st[0])
    # s = [st[i] for i in range(len(st))]
    s = deque()

    for i in range(len(st)):
        s.append(st[i])

    for i in range(Q):
        queries.append(list(MS()))

    op = True

    for i in range(Q):
        query = queries[i]
        if len(query) == 1:
            op = not op
        else:
            if (query[1] == '1' and op is True) or (query[1] == '2' and op is False):
                s.appendleft(query[2])
            elif (query[1] == '1' and op is False) or (query[1] == '2' and op is True):
                s.append(query[2])
            else:
                exit(-1)
                return

    # print(op)
    if op is True:
        print(''.join(s))
    else:
        n = []
        while len(s):
            n.append(s.pop())
        print(''.join(n))


if __name__ == '__main__':
    main()


Measured memory_bytes: 118232
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 main():
    n,k = readInts()
    ans = 0
    # 1/N * (1/2 + 1/4 + ...)
    for i in range(1,n+1):
        prob = 1
        nk = i # 特典
        while nk < k:
            nk *= 2
            prob /=2
        ans += prob
    # 最後に 1/N
    ans /= n
    print(ans)
if __name__ == '__main__':
  main()


Measured memory_bytes: 5276
# -*- coding: utf-8 -*-
def main():
    A,B,K = input().split()
    #まず高橋くんのクッキーを食べる
    wkKA = int(K) - int(A)
    if wkKA > 0:
        wkKB =  int(B) - wkKA
        if wkKB > 0:
            print(0, wkKB)
        else:
            print(0, 0)
    else:
        print(int(A)-int(K), B)

main()


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

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

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> h;
	rep(i, n) {
		int x;
		cin >> x;
		h.push_back(x);
	}

	vector<bool> isGood(n, true);

	rep(i, m) {
		int a, b;
		cin >> a >> b;
		if (h[a - 1] > h[b - 1]) isGood[b - 1] = false;
		else if (h[a - 1] == h[b - 1]) { isGood[a - 1] = false; isGood[b - 1] = false; }
		else isGood[a - 1] = false;
	}

	int ans = 0;
	rep(i, n) {
		if (isGood[i]) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3928
#include<stdio.h>

int main() {

	int a, b, c;

	for (a = 1; a <= 9; a++)
	{
		for (b = 1; b <= 9; b++)
		{
			printf("%dx%d=%d\n", a, b, a * b);
		}
	}

	return 0;
}

Measured memory_bytes: 1812
x, y = map(int, input().split())

n = (2*y - x) // 3
m = (2*x - y) // 3

if (x + y) % 3 != 0 or n < 0 or m < 0:
    print(0)
    exit()


def cmb(n,r):
    mod = 10**9+7
    ans = 1
    for i in range(r):
        ans *= n-i
        ans %= mod
    for i in range(1,r+1):
        ans *= pow(i,mod-2,mod)
        ans %= mod
    return ans


print(cmb(n+m, n))

Measured memory_bytes: 38768
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a[][] = new int[2][2];
        a[0][0] = in.nextInt();
        a[0][1] = in.nextInt();
        a[1][0] = in.nextInt();
        a[1][1] = in.nextInt();
        
        int attack = 0;
        int defence = 1;
        while (true) {
            a[defence][0] -= a[attack][1];
            if (a[defence][0] <= 0) {
                if (attack == 0) {
                    System.out.println("Yes");
                    return;
                } else {
                    System.out.println("No");
                    return;
                }
            }
            attack = (attack + 1) % 2;
            defence = (defence + 1) % 2;
        }
    }
}



Measured memory_bytes: 35832
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;
const LL mo=1e9+7;
const int INF=1e9;
LL fac[200001],inv[200001];
int n,x,y,fa[200001],p[200001];
vector <int> v[200001],id[200001],ans[200001];
struct data {
    int c,w;
}a[200001];
bool cmp(int x,int y) {
    int ux,vx;
    if (v[x].size()==0) ux=INF;else ux=v[x][0];
    if (v[y].size()==0) vx=INF;else vx=v[y][0];
    return ux<vx;
}
LL mul(LL x,LL y) {
    if (y==0) return 1;
    LL now=mul(x,y/2);
    now=now*now%mo;
    if (y%2) return now*x%mo;
    return now;
}
void pre() {
    fac[0]=1;
    for (int i=1;i<=n;i++) fac[i]=fac[i-1]*i%mo;
    inv[n]=mul(fac[n],mo-2);
    for (int i=n-1;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mo;
}
int getf(int x) {
    if (fa[x]==x) return x;
    fa[x]=getf(fa[x]);
    return fa[x];
}
void unio(int u,int v) {
    int fu=getf(u),fv=getf(v);
    if (fu==fv) return;
    fa[fu]=fv;
}
int main() {
    scanf("%d%d%d",&n,&x,&y);
    pre();
    for (int i=1;i<=n;i++) {
        scanf("%d%d",&a[i].c,&a[i].w);
        v[a[i].c].push_back(a[i].w);
        id[a[i].c].push_back(i);
    }
    for (int i=1;i<=n;i++)
        sort(v[i].begin(),v[i].end());
    for (int i=1;i<=n;i++) fa[i]=p[i]=i;
    sort(p+1,p+n+1,cmp);
    for (int i=1;i<=n;i++) {
        if (v[i].size()==0) continue;
        int wx=max(x-v[i][0],y-v[p[1]][0]);
        if (i==p[1])
            if (v[p[2]].size()>0) wx=max(x-v[i][0],y-v[p[2]][0]);
            else wx=x-v[i][0];
        int lx=0,rx=v[i].size()-1;
        while (lx<rx) {
            int mid=(lx+rx+1)/2;
            if (v[i][mid]<=wx) lx=mid;
            else rx=mid-1;
        }
        for (int j=0;j<lx;j++) unio(id[i][j],id[i][j+1]);
    }
    int wx=y-v[p[1]][0];
    int lx=1,rx=n;
    while (lx<rx) {
        int mid=(lx+rx+1)/2;
        int now;
        if (!v[p[mid]].size()) now=INF;
        else now=v[p[mid]][0];
        if (now<=wx) lx=mid;
        else rx=mid-1;
    }
    for (int i=1;i<lx;i++) unio(id[p[i]][0],id[p[i+1]][0]);
    for (int i=1;i<=n;i++) ans[getf(i)].push_back(a[i].c);
    LL ansx=1;
    for (int i=1;i<=n;i++) {
        if (getf(i)!=i) continue;
        sort(ans[i].begin(),ans[i].end());
        ansx=ansx*fac[ans[i].size()]%mo;
        for (int j=0;j<ans[i].size();) {
            int kx=j;
            while (ans[i][j]==ans[i][kx]&&kx<ans[i].size()) kx++;
            ansx=ansx*inv[kx-j]%mo;
            j=kx;
        }
    }
    printf("%lld\n",ansx);
    return 0;
}

Measured memory_bytes: 34816
# coding: utf-8
# A - Fifty-Fifty

s = input()
c = []
dict = {}
for i in s:
    if i in dict:
        dict[i] +=1
    else:
        dict[i] = 1
        c.append(i)

if dict[c[0]] == 4:
    print("No")
elif dict[c[0]] == dict[c[1]] == 2 and len(dict) == 2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(9);
  for(int i=0;i<9;i++)
    cin>>a.at(i);
  vector<bool> c={0,0,0,0,0,0,0,0,0};
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    int b;
    cin>>b;
    for(int ia=0;ia<9;ia++)
      if(b==a.at(ia))
        c.at(ia)=1;
  }
  bool bc=0;
  for(int i=0;i<3;i++)
    if((c.at(i)&&c.at(3+i)&&c.at(6+i))||(c.at(3*i)&&c.at(3*i+1)&&c.at(3*i+2)))
      bc=1;
  if((c.at(0)&&c.at(4)&&c.at(8))||(c.at(2)&&c.at(4)&&c.at(6)))
    bc=1;
  cout<<(bc?"Yes":"No")<<endl;
}

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

int main()
{
	int n;
	bool f = 1;
	vector<int> t, x, y;

	cin >> n;

	t.assign(n + 1, 0);
	x.assign(n + 1, 0);
	y.assign(n + 1, 0);

	for (int i = 1; i <= n; i++)
		cin >> t[i] >> x[i] >> y[i];

	for (int i = 1; i <= n; i++) {
		int L ;
		L = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
		if (t[i] - t[i - 1] < L || (t[i] - t[i - 1] - L) % 2 != 0)
			f = 0;
	}

	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 1408
import sys

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
A = []
B = []
C = []
for mm in range(M):
    tmpa, tmpb = MAP()
    A.append(tmpa)
    B.append(tmpb)
    tmpc = LIST()
    c = 0
    for cc in tmpc:
        c += 2**(cc-1)
    C.append(c)

dp = [[inf] * (2**N) for _ in range(M+1)]
dp[0][0] = 0
for i in range(M):
    for j in range(2**N):
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        dp[i+1][j | C[i]] = min(dp[i+1][j | C[i]], dp[i][j] + A[i])
if dp[M][2**N-1] == inf:
    print(-1)
else:
    print(dp[M][2**N-1])


Measured memory_bytes: 135004
#include<stdio.h>
int main()
{
	int N,T,c,t,min=1001,i;
	scanf("%d%d",&N,&T);
	for(i=0;i<N;i++)
	{scanf("%d%d",&c,&t);
  	 
	if(t<=T){if(c<min)min=c;}
	}

		if(min>1000)printf("TLE\n");
		else printf("%d\n",min);
		return 0;

 } 

Measured memory_bytes: 128
import java.util.*;

public class Main {
		public static void main(String[] args) {
			
			Scanner sc = new Scanner(System.in);
			
			int M1 = sc.nextInt();
			int D1 = sc.nextInt();
			int M2 = sc.nextInt();
			int D2 = sc.nextInt();
			
			if(M1 != M2) {
				System.out.println(1);
			}else {
				System.out.println(0);
			}
			
}
}

Measured memory_bytes: 23252
import math

while 1:
    d, e = map(int, input().split())
    if d == 0:
        break

    ans = 1e9
    for i in range(d):
        x = i
        y = d - x
        dist = math.sqrt(x**2 + y**2)
        ans = min(ans, abs(dist - e))

    print(ans)



Measured memory_bytes: 5676
from sys import stdin

n = int(stdin.readline().rstrip())

nums = [int(x) for x in stdin.readline().rstrip().split()]

for i in nums:
    if i % 2 == 0:
        if (i % 3 != 0) and (i % 5 != 0):
            print("DENIED")
            break
else:
    print("APPROVED")


Measured memory_bytes: 2940
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
#include <vector>
//#include <string>
//typedef long long LL;
using namespace std;

int main(){
    int n;
    int m;
    int tmp_a;
    int tmp_k;
    int ans=0;
    cin >> n >> m;
    vector<int> a_list(m, 0);
    for(int i=0; i<n; i++){
        cin >> tmp_k;
        for(int j=0; j<tmp_k; j++){
            cin >> tmp_a;
            tmp_a--;
            a_list[tmp_a]++;
        }
    }
    for(int i=0; i<m; i++){
        if(a_list[i]==n){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256