akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {

	 int n,p,ans=0;
	 bool gu=true;
	 cin>>n>>p;
	 vector<int>a(n);
	 for(int i=0;i<n;i++){
		 cin>>a[i];
		 if(a[i]%2!=0) gu=false;
	 }
	 if(gu==true){
		 if(p==0){
			 cout << fixed << setprecision(0) <<pow(2,n) << endl;
		 }else if(p==1){
			 cout<<"0"<<endl;
		 }
	 }else{
		 cout << fixed << setprecision(0) << pow(2,n-1)<< endl;
	 }

}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////


int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll a,b,c; cin >> a >> b >> c;

    if (c - a - b <= 0) {
        cout << "No" << ln;
        return 0;
    }
    ll K = c-a-b;
    if (a*b*4LL < K*K) {
        cout << "Yes" << ln;
    } else cout << "No" << ln;
}

Measured memory_bytes: 256
N, X = map(int, input().split())
m_list = [int(input()) for i in range(N)]
m_list = sorted(m_list)
x = X - sum(m_list)
flg = True
count = 0
while(flg):
    if x - m_list[0] >= 0 :
        x = x - m_list[0]
        count += 1
    else:
        flg = False
        break

print(count + N)

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

typedef struct{
	double x;
	double y;
}point;

void Printp(point a){
	printf("%lf %lf\n", a.x, a.y);
}

void koch(int d, point p, point q){
	if(d==0) return;
	
	point s, u, t;
	//calculation
	s.x=(2*p.x+q.x)/3.0;
	s.y=(2*p.y+q.y)/3.0;
	t.x=(p.x+2*q.x)/3.0;
	t.y=(p.y+2*q.y)/3.0;
		
	double ang=M_PI*60/180.0;
	u.x=(t.x-s.x)*cos(ang) - (t.y-s.y)*sin(ang) +s.x;
	u.y=(t.x-s.x)*sin(ang) + (t.y-s.y)*cos(ang) +s.y;
	
	koch(d-1, p, s);
	Printp(s);
	koch(d-1, s, u);
	Printp(u);
	koch(d-1, u, t);
	Printp(t);
	koch(d-1, t, q);
}

int main(){
	int n;
	scanf(" %d", &n);
	
	point s1,s2;
	s1.x=0; s1.y=0;
	s2.x=100; s2.y=0;
	
	Printp(s1);
	koch(n, s1, s2);
	Printp(s2);
}



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

int main() {
  int x;
  cin >> x;
  if (x == 7 ||
      x == 5 ||
      x == 3) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a;
	scanf("%d", &a);
	int h = a / 60 / 60;
	int m = (a - h * 60 * 60) / 60;
	int s = (a - h * 3600) - (m * 60);
	printf("%d:%d:%d\n", h, m, s);
	return 0;
}



Measured memory_bytes: 2044
uses math;
var
        l,r,i,j,o,p:longint;
begin
        read(l,r);
        if r-l>2020 then writeln(0) else
        begin
                o:=maxlongint;
                for i:=l to r do
                        for j:=i+1 to r do
                        o:=min(o,i*j mod 2019);
                writeln(o);
        end;
end.

Measured memory_bytes: 128
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void main()
{
    auto nq = readln.split.to!(int[]);
    auto N = nq[0];
    auto Q = nq[1];

    long r = (N.to!long-2)^^2;

    auto lms = new int[](N+1);
    int min_w = N;
    auto bms = new int[](N+1);
    int min_v = N;
    foreach (_; 0..Q) {
        auto q = readln.split.to!(int[]);
        auto x = q[1];
        if (q[0] == 1) {
            if (x < min_w) {
                while (min_w > x) {
                    lms[--min_w] = min_v - 2;
                }
            }
            r -= lms[x];
        } else {
            if (x < min_v) {
                while (min_v > x) {
                    bms[--min_v] = min_w - 2;
                }
            }
            r -= bms[x];
        }
    }
    writeln(r);
}

Measured memory_bytes: 5208
m,k = map(int,input().split())
if k>=2**m:
    print(-1)
    exit()
if m == 1:
    if k == 0:
        print(0,0,1,1)
    else:
        print(-1)
    exit()
ans = [0 for _ in range(2**(m+1))]
for i in range(2**m):
    if i < k:
        ans[i] = i
        ans[2**(m+1)-2-i] = i
    if i == k:
        continue
    if i > k:
        ans[i-1] = i
        ans[2**(m+1)-i-1] = i
ans[2**m-1] = k
ans[2**(m+1)-1] = k
print(*ans,sep=" ")

Measured memory_bytes: 15252
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
const ll inf = (ll)(1e18),mod = (ll)(1e9+7), MX= 100001; 
#define n_l '\n'
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); } 
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl

 

void solve(){
    int n,m; cin>>n>>m;
    cout<<max(n-2*m,0)<<endl;

    return;
}

int main()
{
    int T = 1;
    // cin>>T;
    while(T--){
        solve();
    }

    return 0;
}

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

int main(){
  string S,T; cin >> S >> T;
  for(int i=0; i<S.size(); i++){
    if(S==T){
      cout << "Yes" << endl;
      return 0;
    }else{
      S=S[S.size()-1]+S.substr(0,S.size()-1);
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include<algorithm>
#include<algorithm>
#define L long long
#include<string.h>
#include <math.h>
using namespace std;
int n;
long long area;
int a [60]={2,3,13,23,43,53,73,83,103,113,163,173,193,223,233,263,283,293,313,353,373,383,433,443,463,503,523,563,593,613,643,653,673,683,733,743,773,823,853,863,883,953,983,1013,1033,1063,1093,1103,1123,1153,1163,1193,1213,1223,1283,1303,1373};
int  main()
{
       while(cin>>n)
       {
           for(int i=0;i<n-1;i++)
            cout<<a[i]<<' ';
           cout<<a[n-1]<<endl;
       }

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
using vs = vector<string>;
template <typename T>
using ost = tree<T, null_type, less<T>, rb_tree_tag,
    tree_order_statistics_node_update>;
#define forn(i,n) for(int i=0; i<int(n); ++i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ff first
#define ss second

int main() {
    ios::sync_with_stdio(false);
    int n, c;
    cin >> n >> c;
    vi xs(n);
    for (int& x:xs) cin >> x;
    sort(all(xs));
    int ans = 0;
    for (int x:xs) {
        if (x>c) return cout << ans << '\n', 0;
        ans++, c-=x;
    }
    ans -= c>0;
    cout << ans << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

int main(void){
  string str;
  cin >> str;

  if(str[0] == str[2]){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>

int main(){
    int x,y;
    
    while(scanf("%d %d",&x,&y) && (x != 0 || y != 0)){
        if(x > y) std::swap(x,y);
        printf("%d %d\n",x,y);
    }
    
    return 0;
}



Measured memory_bytes: 3192
N = gets.to_i
A = gets.split(" ").map(&:to_i)
ans = 1
flag = true

if A.include?(0)
    puts 0
else
    N.times do |i|
        ans *= A[i]
        if ans > 10**18
            flag = false 
            break
        end
    end
    
    if flag == true 
        puts ans
    else
        puts -1
    end
end

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

const double pi  = 2 * acos(0.0);
const double eps = 1e-8;

#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<29)
#define INFLL (1LL<<61)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef int Cost;
struct Edge {
  int src, dst; Cost cost;
  Edge(int s, int d, Cost c) : src(s), dst(d), cost(c) {}
};
typedef vector<Edge>  Edges;
typedef vector<Edges> Graph;
typedef vector<Cost>  Array;
typedef vector<Array> Matrix;

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

int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  char a, b;
  cin >> a >> b;
  if (a == 'H') cout << b << endl;
  else cout << (b == 'D' ? 'H' : 'D') << endl;
}

Measured memory_bytes: 256
N, Y = map(int,input().split())

def calc():
    for i in range(N+1):
        for j in range(N-i+1):
            if Y == 10000*i + 5000*j + 1000*(N-i-j):
                return (i, j, (N-i-j))
    
    return (-1, -1, -1)

a, b, c = calc()

print("{} {} {}".format(a, b, c))

            



Measured memory_bytes: 38768
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        double h = Double.parseDouble(sc.next());
        double m = Double.parseDouble(sc.next());
        double res = Math.sqrt(
                Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b * Math.cos(Math.abs((h + m / 60) / 12 - m / 60) * 2 * Math.PI));
        System.out.println(res);  
    }
}

Measured memory_bytes: 27080
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{
  public static long a[] = new long[51];
  public static long b[] = new long[51];
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);

    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");
    int n = Integer.parseInt(sl[0]);
    long x = Long.parseLong(sl[1]);
    a[0] = 1;
    b[0] = 1;
    for(int i = 0; i < 50; i++)
    {
      a[i + 1] = 3 + 2 * a[i];
      b[i + 1] = 1 + 2 * b[i];
    }

    System.out.println(cal(n, x));

  }

  public static long cal(int n, long x)
  {
    if(n == 0)
    {
      return x > 0 ? 1 : 0;
    }

    if(x <= 1)
    {
      return 0;
    }
    if(x >= a[n] - 1)
    {
      return b[n];
    }
    if(x == a[n - 1] + 1)
    {
      return b[n - 1];
    }
    if(x == a[n - 1] + 2)
    {
      return b[n - 1] + 1;
    }



    if(x <= a[n - 1] + 1)
    {
      return cal(n - 1, x - 1);
    }
    else
    {
      return cal(n - 1, x - a[n - 1] - 2) + b[n - 1] + 1;
    }
  }

}

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

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

ll mod = 1e9 + 7;
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; }
const ll inf = 1ll << 60;
int jmax = 100100;

int gcd(int a, int b) {
    int small = min(a, b);
    int big = max(a, b);
    int temp;
    while(small != 0) {
        temp = small;
        small = big % small;
        big = temp;
    }
    return big;
}

int main() {
    int n;
    scanf("%d", &n);
    int a, b;
    scanf("%d", &a);
    rp(i, 0, n-1) {
        scanf("%d", &b);
        a = gcd(a, b);
    }
    printf("%d", a);
    return 0;
}

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

int main() {
  int x, y;
  cin >> x >> y;
  vector<int> grp = {0,1,3,1,2,1,2,1,1,2,1,2,1};
  if(grp.at(x) == grp.at(y)) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3584
from math import sqrt
n = int(input())
xy = [list(map(int,input().split())) for _ in range(n)]

result = 0
for i in range(n):
 for j in range(n):
  if i != j:
   result += sqrt((xy[i][0]-xy[j][0])*(xy[i][0]-xy[j][0])+(xy[i][1]-xy[j][1])*(xy[i][1]-xy[j][1]))

print(result/n)   





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

int main() {
    int N,K;
    cin>>N>>K;
    cout<<N+1-K<<endl;
return 0;}
/*compile
g++ code.cpp
./a.out
run*/

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<algorithm>
#define all(c) c.begin(),c.end()
#define H 21
using namespace std;
typedef pair<int,int> P;
int y[2][6]={{0,7,7,7,7,14},{0,7,7,7,7,14}},x[2][6]={{7,0,7,14,21,7},{36,29,36,43,50,36}};
vector<string> s;
vector<string> rot(vector<string> t){
	vector<string> u(7,"");
	//285992
	//626685
	
	
	
	for(int i=0;i<7;i++){
		for(int j=0;j<7;j++){
			u[i]+=t[j][6-i];
			if(u[i][j]=='|'){
				u[i][j]='-';
			}else if(u[i][j]=='-'){
				u[i][j]='|';
			}
		}
	}
	
	return u;
}
int dig(vector<string> f){
	int a=0,b=0;
	for(int i=0;i<7;i++){
		for(int j=0;j<7;j++){
			if(f[i][j]=='|'){
				a++;
			}else if(f[i][j]=='-'){
				b++;
			}
		}
	}
	if(a==2&&b==1){//1 7
		if(f[1][3]=='-'){
			return 7;
		}else{
			return 1;
		}
	}else if(a==2&&b==3){//2 3 5
		if(f[4][2]=='|'){
			return 2;
		}else if(f[2][2]=='|'){
			return 5;
		}else{
			return 3;
		}
	}else if(a==3&&b==1){
		return 4;
	}else if(a==3&&b==3){//6 9
		if(f[2][4]=='|'){
			return 9;
		}else{
			return 6;
		}
	}else{
		return 8;
	}
	
}
int cal(P a,int num){
	vector<string> f(7);
	for(int i=0;i<7;i++){
		f[i]=s[a.second+i].substr(a.first,7);
		reverse(all(f[i]));
		
		
	}
	if(num==1){
		f=rot(f);
	}else if(num==3){
		f=rot(f);f=rot(f);f=rot(f);
	}else if(num==5){
		vector<string> t=f;
		for(int j=0;j<7;j++){
			f[j]=t[6-j];
		}
	}
	/*for(int i=0;i<7;i++){
		cout<<f[i]<<endl;
	}*/
	//cout<<dig(f)<<endl;
	
	return dig(f);
}
int main(){
	s.resize(H);
	while(cin>>s[0],s[0][0]!='0'){
		for(int i=1;i<H;i++){
			cin>>s[i];
		}
		vector<int> m(6),o(6);
		for(int i=0;i<6;i++){
			m[i]=cal(P(x[0][i],y[0][i]),i);
		}
		for(int i=0;i<6;i++){
			o[i]=cal(P(x[1][i],y[1][i]),i);
		}
		int win=0,lose=0;
		for(int i=0;i<6;i++){
			for(int j=0;j<6;j++){
				if(m[i]>o[j]){
					win++;
				}else if(m[i]<o[j]){
					lose++;
				}
				//cout<<m[i]<<" "<<o[j]<<" "<<win<<" "<<lose<<endl;
			}
		}
		//cout<<win<<" "<<lose<<endl;
		if(win>=lose)
			cout<<"HIGH"<<endl;
		else
			cout<<"LOW"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1196
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<ctime>
#include<cstdlib>
#define ll long long
using namespace std;
const ll mod=1e9+7;
ll a[123456],jc[123456],inv[123456];
ll n,m,k,ans1,ans2;
int read()
{
	int f=0,c=1;	char ch=getchar();
	while((ch<'0')||(ch>'9'))	{	if(ch=='-') c=-1;	ch=getchar();	}
	while((ch>='0')&&(ch<='9'))	{	f=f*10+ch-'0';	ch=getchar();	}
	return c*f;
}
ll ksm(ll a,ll x)
{
	ll ans=1;
	for(;x;x>>=1,a=a*a%mod) if(x&1) ans=ans*a%mod;
	return ans;
}
bool cmp(ll x,ll y) { return x>y; }
ll C(ll n,ll m)
{
	if(m>n||n<0||m<0) return 0;
	ll x=jc[n]*inv[m]%mod*inv[n-m]%mod;
//	cout<<n<<" "<<m<<" "<<x<<" "<<jc[n]<<" "<<inv[m]<<" "<<inv[n-m]<<endl;
	return x;
}
ll work()
{
	ll ans=0,x;
	for(ll i=1;i<=n;++i)
	{
		x=(a[i]%mod+mod)%mod;
		ans=( ans+x*C(n-i,k-1) ) %mod;
	}
	return ans;
}
int main()
{
//	freopen("test.in","r",stdin);
//	freopen("test.out","w",stdout);
	n=read(); k=read();
	jc[0]=inv[0]=1;//³õÊ¼»¯! 
	for(ll i=1;i<=100010;++i) jc[i]=jc[i-1]*i%mod;
	inv[100010]=ksm(jc[100010],mod-2);
	for(ll i=100009;i;--i) inv[i]=inv[i+1]*(i+1)%mod;
	for(ll i=1;i<=n;++i) a[i]=read();
	sort(a+1,a+n+1,cmp);
	ans1=work();//max
	sort(a+1,a+n+1);
	ans2=work();//min
	cout<<( (ans1-ans2) %mod +mod ) %mod;
	return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

vector<pair<int,int> > vp;
vector<vector<int> > edge;
vector<int> used;

void dfs(int now,int cnt,int fs){
  if(fs==0)vp[now].first=cnt;
  else vp[now].second=cnt;
  used[now]++;
  for(int i=0;i<(int)edge[now].size();i++){
    if(used[edge[now][i]]!=fs+1)dfs(edge[now][i],cnt+1,fs);
  }
  return;
}

int main(){
  int n,i;
  cin >> n;
  vp.resize(n);
  edge.resize(n);
  used.resize(n,0);
  for(i=0;i<n-1;i++){
    int a,b;
    cin >> a >> b;
    edge[a-1].push_back(b-1);
    edge[b-1].push_back(a-1);
  }
  dfs(0,0,0);
  dfs(n-1,0,1);
  int cnt = 0;
  for(i=0;i<n;i++){
    if(vp[i].first<=vp[i].second)cnt++;
  }
  if(n>=2*cnt)cout << "Snuke" << endl;
  else cout << "Fennec" << endl;
  return 0;
}


Measured memory_bytes: 11520
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <vector>
#include <iterator>
#include <algorithm>
#include <cmath>
#include <limits>
#include <numeric>

using namespace std;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

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

    int32_t res1 = A + B,res2 = A - B,res3 = A * B;

    if(res1 > res2){
        if(res1 > res3){
            cout<< res1 << endl;
        }else{
            cout<< res3 << endl;            
        }
    }else{
        if(res2 > res3){
            cout<< res2 << endl;
        }else{
            cout<< res3 << endl;            
        }
    }

	return 0;
}



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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

signed main(){
    vint v(5);
    rep(i,5)cin>>v[i];
    int k;cin>>k;
    if(v[4]-v[0]>k)cout<<":("<<endl;
    else cout<<"Yay!"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace ::std;
int main(){
    int count=0;
    char memo[100];
for(int i=0;i<100;i++)
cin>>memo[i];
for(int i=0;i<sizeof(memo)/sizeof(*memo);i++){
if(i%2==0&&memo[i]=='L')//奇数番目
{
    count++;
}
if(i%2==1&&memo[i]=='R'){
    count++;
}
}
if(count==0)
cout<<"Yes";
else 
cout<<"No";
}


Measured memory_bytes: 256
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int tmp;
    int a, b;
    char o;
    cin >> a >> o >> b;
    if (o=='+') cout << a+b << endl;
    else cout << a-b << endl;
    
    //cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

typedef complex<int> Point;

int cross(Point a,Point b)
{
	return imag(conj(a)*b);
}

bool in(Point p,Point t[])
{
	int c[3];
	rep(i,3)
		c[i]=cross(t[(i+1)%3]-t[i],p-t[i]);
	return count_if(c,c+3,bind2nd(less<int>(),0))%3==0;
}

int main()
{
	int n;
	cin>>n;
	rep(tc,n){
		Point t[3],m,w;
		rep(i,3)
			cin>>real(t[i])>>imag(t[i]);
		cin>>real(m)>>imag(m)>>real(w)>>imag(w);
		bool inm=in(m,t);
		bool inw=in(w,t);
		puts(inm!=inw?"OK":"NG");
	}
	
	return 0;
}

Measured memory_bytes: 852
fun c86(args: Array<String>) {
    val numList =
            listOf(listOf(0, 0, 0)).plus(args.drop(1).map { it.split(" ").map { it.toInt() } })

    val ans = (0..numList.size - 2).all {
        val (t, x, y) = numList[it]
        val (nt, nx, ny) = numList[it + 1]
        nt - t >= Math.abs((nx + ny) - (x + y))
                && (nt - t) % 2 == Math.abs((nx + ny) - (x + y)) % 2
    }
    println(if (ans) "Yes" else "No")
}

fun main(args: Array<String>) {
    c86(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

Measured memory_bytes: 75444
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int ctoi(const char c) {
    if ('0' <= c && c <= '9') return (c - '0');
    return -1;
}
vector<int> input(int n) {
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }
    return vec;
}
void output(vector<int> vec) {
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    return;
}
vector<vector<int>> input(int n, int m) {
    vector<vector<int>> table(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> table. at(i).at(j);
        }
    }
    return table;
}
void output(vector<vector<int>> table) {
    for (int i = 0; i < table.size(); i++) {
        for (int j = 0; j < table.at(0).size(); j++) {
            cout << table.at(i).at(j) << " ";
        }
        cout << endl;
    }
}
long long perm(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long perm = 1;
    for (int i = n; i > n - r; i--) {
        perm *= i;
    }
    return perm;
}
long long comb(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long comb = perm(n,r);
    for (int i = r; i > 0; i--) {
        comb /= i;
    }
    return comb;
}
long long homo(int n, int r) {
    return comb(n + r - 1, n - 1);
}
long long fact(int n) {
    long long fact = 1;
    for (int i = n; i > 0; i--) {
        fact *= i;
    }
    return fact;
}
int gcd(int a, int b)
{
    if (a % b == 0)
    {
        return(b);
    }
    else
    {
        return(gcd(b, a % b));
    }
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int main() {
  int n,m,x,cnt1=0,cnt2=0;
  cin >> n >> m >> x;
  vector<int> a=input(m);
  for(int i=0;i<m;i++){
    if(x<a[i]){
      cnt1++;
    }
    if(x>a[i]){
      cnt2++;
    }
  }
  cout << min(cnt1,cnt2) << endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
using pp=pair<int,pair<int,int>>;
#define MAX 1000000
#define MOD 1000000007
#define INF 1000000000

int main(){
  int N,X,T;
  cin>>N>>X>>T;
  cout<<((N-1)/X+1)*T<<endl;
}


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

using namespace std;

int main() {
  int K, X;
  cin >> K >> X;
  bool first = true;
  auto begin = X - K + 1;
  auto last = X + K - 1;
  for (int i = begin; i <= last; ++i) {
    if (first) first = false;
    else cout << " ";
    cout << i;
  }
  cout << endl;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
s = input()

ans = 0
count = 1
for i in range(n-1):
    if s[i] == s[i+1]:
        ans += 1
    else:
        count += 1

for i in range(k):
    if count >= 3:
        count -= 2
        ans += 2
    elif count == 2:
        count -= 1
        ans += 1
    elif count == 1:
        break

print(ans)

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

#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef tuple<ll,ll> Pll;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/10;
const ll MOD = 1e9+7;


template <ll mod>
struct ModCombination{
    ll N;
    vector<ll> fact,inv,finv;

    ModCombination(ll n):N(n){
        fact.assign(n+1, 1);
        inv.assign(n+1, 1);
        finv.assign(n+1,1);
        for(int i=1;i<n;i++){
            fact[i+1] = fact[i]*(i+1)%mod;
            inv[i+1] = inv[mod%(i+1)]*(mod-mod/(i+1))%mod;
            finv[i+1] = finv[i]*inv[i+1]%mod;
        }
    }

    ll Comb(ll n,ll k){
        if(k<0||n<k)return 0;
        return (fact[n]*finv[k]%mod)*finv[n-k]%mod;
    }
};

ll mod_pow(ll x,ll e){
  return e? e&1? x*mod_pow(x,e-1)%MOD:mod_pow(x*x%MOD,e/2):1;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N,A,B,C;cin>>N>>A>>B>>C;
  ModCombination<MOD> comb(2*N);
  ll ans = 0;
  for(ll M=N;M<2*N;M++){
    ans = (ans+comb.Comb(M-1,N-1)*((mod_pow(A,N)*mod_pow(B,M-N)%MOD+mod_pow(B,N)*mod_pow(A,M-N)%MOD)%MOD)%MOD*M%MOD*mod_pow(mod_pow(100-C,M+1),MOD-2)%MOD)%MOD;
  }
  ans = ans*100%MOD;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
using namespace std;
const int maxn=5e5+5;
typedef long long ll;
const int mod=1e9+7; 
inline ll fpm(ll a,ll p){
	ll res=1;
	while(p){
		if (p&1) res=res*a%mod;
		a=a*a%mod;
		p/=2;
	}
	return res;
}
ll fac[maxn],inv[maxn];
inline void init(){
	fac[0]=inv[0]=1;
	for (int i=1;i<=(1<<17);i++){
		fac[i]=fac[i-1]*i%mod;
		inv[i]=fpm(fac[i],mod-2);
		//cout<<"print fac inv "<<fac[i]<<' '<<inv[i]<<endl;
	}
}
inline ll getc(int n,int m){
	if (n<m||n<0||m<0) return 0;
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
ll dp[21][(1<<17)];
int a[maxn];
int n,m;
inline int get1(int s){
	int cnt=0;
	for (int i=0;i<=n-1;i++){
		if ((s>>i)&1) cnt++;
	}
	return cnt;
}
int main(){
	cin>>n>>m;
	for (int i=1;i<=m;i++){
		scanf("%d",&a[i]);
	}
	init();
	dp[m+1][0]=1;
	for (int i=m;i>=1;i--){
		for (int s=0;s<=(1<<n)-1;s++){
			dp[i][s]=(dp[i][s]+dp[i+1][s])%mod;
			for (int k=0;k<=n-1;k++){
				if ((s>>k)&1){
					int s1=s;
					s1-=(1<<k);
					dp[i][s]=(dp[i][s]+dp[i+1][s1]*getc((1<<n)-s1-a[i],(1<<k)-1)%mod*fac[(1<<k)]%mod)%mod;
				}
			}
		}
	}
	ll ans=0;
	for (int s=0;s<=(1<<n)-1;s++){
		ll tp=(1<<n)-s-1;
		if (get1(s)%2==0){
			ans=(ans+dp[1][s]*fac[tp]%mod)%mod;
		}
		else ans=(ans+mod-dp[1][s]*fac[tp]%mod)%mod;
	}
	ans=ans*fpm(2,n)%mod;
	//cout<<ans<<endl;
	cout<<ans<<endl;
}

Measured memory_bytes: 13976
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};



int main(){
    ll n;
    cin>>n;
    ll ans=10000000001;
    for(ll i=1;i<=sqrt(n);i++){
        if(n%i==0){
            ll m=n/i;
            ll a=0;
            while(m>0){
                m/=10;a++;
            }
            ans=min(ans,a);
        }
    }
    cout<<ans<<endl;

return 0;
}


Measured memory_bytes: 256
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

def pdw(n):
    i=2
    t=[]
    ta = t.append
    while i*i<=n:
        while n%i==0:
            n//=i
            ta(i)
        i+=1
    if n>1:ta(n)
    return t
a,b = map(int,input().split())
g = gcd(a,b)
if g==1:
    print(1)
else:
    a = pdw(g)
    ans = set(a)
    print(len(ans)+1)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	int a[100001];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	int minn=1e9;
	for(int i=0;i<n-k+1;i++){
		int d=a[i+k-1]-a[i];
		if(d<minn){
			minn=d;
		}
	}
	cout<<minn<<endl;
}

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

int main()
{
	long long int cnt =0;
	long long int P=100;
	long long int x;
	cin>>x;
	while(P<x)
	{
		P+=P/100;
		cnt++;
	}
	cout<<cnt<<"\n";
	
	return 0;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
long long a,b,c;
void solve()
{
    long long mini=min(a,b),maxi=max(a,b);
    if (a+b>=c) cout<<b+c;
    else cout<<a+1+2*b;
    cout<<endl;
}
int main()
{
    while(cin>>a>>b>>c)
        solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define fi first
#define se second
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 1e6 + 5;
const ll LINF = 1e18 + 5;
constexpr int mod = 1e9 + 7;
int n, idx[N];
string s[N];
pii p[N];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n;
	for(int i=1; i<=n; i++) 
	{
		cin >> s[i];
		int pre = 0, mn = INF;
		for(int j=0; j<sz(s[i]); j++)
		{
			if(s[i][j]=='(') pre++;
			else pre--;
			if(pre<mn) mn = pre;
		}
		p[i] = {mn, pre};
	}
	iota(idx+1, idx+n+1, 1);
	sort(idx+1, idx+n+1, [](int a, int b) {
		if(p[a].se>=0&&p[b].se>=0) return p[a].fi>p[b].fi;
		else if(p[a].se>=0&&p[b].se<0) return true;
		else if(p[a].se<0&&p[b].se>=0) return false;
		else return p[a].fi-p[a].se<p[b].fi-p[b].se;
	});
	bool ok = 1;
	int pre = 0;
	string res;
	for(int i=1; i<=n; i++) res += s[idx[i]];
	for(int i=0; i<sz(res); i++)
	{
		if(res[i]=='(') pre++;
		else pre--;
		if(pre<0) ok = 0;
	}
	if(pre) ok = 0;
	if(ok) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 48232
#include <bits/stdc++.h>
#include <regex>
//#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define FOR(i, s, e) for (ll i = ll(s); i < ll(e); ++i)
#define REP(i, e) FOR(i, 0, e)
//#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
#define mkpr make_pair
#define AST(exp, msg) if(!(exp)){EPR((msg))} assert((exp));
#define TAST(exp, msg) if(!(exp)){EPR((msg))} while(!(exp)){}
#define EPR(msg) cerr << (msg) << endl;
using namespace std;
using ll = long long; using ull = unsigned long long;
//using vi = vector<int>; using vvi = vector<vi>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;
using vc = vector<char>; using vvc = vector<vc>;
using vs = vector<string>;
//using pii = pair<int, int>; 
using pll = pair<ll, ll>; using psl = pair<string, ll>;


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


  ll K, N; cin>>K>>N;
  vl A(N); REP(i,N) cin>>A[i];

  A.push_back(K + A[0]);
  EPR(A[N])
  
  ll dist = 0;
  FOR(i,1,N+1) {
    dist = max(dist, A[i] - A[i-1]);
  }
  EPR(dist)

  ll ans = K - dist;
  cout << ans << endl;


  return 0;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int a,b,c;

int main(){
	cin.sync_with_stdio(false);
	cin>>a>>b>>c;
	int time=0;
	while(1){
		time+=a;
		if(time>=c){
			time=c;
			break;
		}
		time+=b;
		while(time>c)c+=60;
		if(time%60==0){
			time=-1;
			break;
		}
	}
	cout<<time<<endl;
	return 0;
}

Measured memory_bytes: 3204
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    vector<int> vec(5);
    for (int i = 0; i < 5; i++)
    {
        cin >> vec[i];
    }
    int k;
    cin >> k;
    for (int i = 0; i < 5; i++)
    {
        for (int j = i; j < 5; j++)
        {
            if (vec[j] - vec[i] > k)
            {
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
}

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

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, a[100009];
long long b[100009];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	long long tmp = a[0];
	for (int i = 1; i < n; i++) {
		if (i % 2) tmp -= a[i];
		else tmp += a[i];
	}
	b[0] = tmp / 2;
	for (int i = 1; i < n; i++) {
		b[i] = a[i - 1] - b[i - 1];
	}
	for (int i = 0; i < n; i++) {
		cout << b[i] + b[i] << " ";
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,M;cin >> N >> M;
  vector<PII> v(N);
  vector<PII> w(M);
  rep(i,N)cin >> v[i].first >> v[i].second;
  rep(j,M)cin >> w[j].first >> w[j].second;
  for(PII &h : v){
    int move;
    int dist = MAX_I;
    rep(j,M){
      PII p = w[j];
      int d = abs(h.first-p.first) + abs(h.second-p.second);
      if(d<dist){
        dist = d;
        move = j;
      }
    }
    cout << move+1 << endl;

  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sync ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD  1000000007 
int powm(int base,int exp,int mod=MOD) {int ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
int32_t main()
{
	int count=0;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.length();i++)
	{
		if(t[i]==s[i])
			count++;
	}
	cout<<count<<endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		long[][] AB = new long[N][2];
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < 2; j++) {
				AB[i][j] = in.nextInt();
			}
		}
		Arrays.sort(AB, (x, y) -> Long.compare(x[1], y[1]));
		int sum = 0;
		String ans = "Yes";
		for (int i = 0; i < AB.length; i++) {
			sum += AB[i][0];
			if (sum > AB[i][1]) {
				ans = "No";
				break;
			}
		}
		System.out.println(ans);
		in.close();
	}
}

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

int main(){
    int n, m;
    cin >> n >> m;
    queue<int> q[n];
    while(m--){
        int a, b;
        cin >> a >> b;
        if(a == 0){
            cout << q[--b].front() << endl;
            q[b].pop();
        }else{
            int ind = 0;
            for(int i = 1; i < n; i++){
                if(q[ind].size() > q[i].size()) ind = i;
            }
            q[ind].push(b);
        }
    }
    return 0;
}


Measured memory_bytes: 3192
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

using System.Collections;

class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());

        var infoList = Enumerable.Range(0, N)
            .Select(n => Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray())
            .Select(arr => new { x = arr[0], y = arr[1], h = arr[2] })
            .ToArray();


        for(int cx = 0; cx <= 100; cx++)
        {
            for(int cy = 0; cy <= 100; cy++)
            {
               
                var HCand =
                    infoList
                    .Where(info => info.h != 0)
                    .Select(info => info.h + Math.Abs(info.x - cx) + Math.Abs(info.y - cy))
                    .Distinct();

                if (HCand.Any() && HCand.Take(2).Count() == 1)
                {
                    if(infoList
                    .Where(info => info.h == 0)
                    .Select(info => info.h + Math.Abs(info.x - cx) + Math.Abs(info.y - cy))
                    .All(h => HCand.First() <= h)
                     )
                    {
                        Console.WriteLine($"{cx} {cy} {HCand.First()}");
                        return;
                    }
                }
            }
        }
    }
    
}

Measured memory_bytes: 17632
#include <stdio.h>
#include <math.h>

#define Num 101

int x[Num],y[Num]; //global scope
int times;

void minkowski(int p);
void mugen(int a);

int main () {
    int i,p;
    
    scanf ("%d",&times); //the number of times
        
    for (i = 0;i < times;i ++) { //x,y read
        scanf ("%d",&x[i]);
    }
    for (i = 0;i < times;i ++) {
        scanf ("%d",&y[i]);
    }
    
    for (p = 1;p <= 3;p ++) {
        minkowski(p); //p = 1,2,3,infinite
    }
    mugen(i);
    
    return 0;
}

void minkowski(int p) {
    double bef2_d = 1;
    double bef_d = 0;
    double d = 1;
    int i,j;

    for (j = 0;j < times;j ++) {
        bef2_d = 1; //犯人はお前かーー！
        for (i = 0;i < p;i ++) {
            bef2_d *= (double) abs(x[j] - y[j]);
        }
        bef_d += bef2_d;
    }
    
    for (i = 0;i < p;i ++) { 
        d = pow(bef_d,1.0/p);
    }
        
    printf ("%f\n",d);
}

void mugen(int a) {
    int i;
    int mug_mink = abs(x[0] -y[0]);
    
    //printf ("%d\n%d\n",mug_mink,abs(x[0] -y[0]) );
    
    for (i = 1;i < times;i ++) {
        mug_mink = (mug_mink < abs(x[i] - y[i]) ) ? abs(x[i] - y[i]) : mug_mink;
        //printf ("%d\n",mug_mink);
    }
    printf ("%f\n", (double) mug_mink); //(double) ほんま命
}


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

using namespace std;
typedef long long ll;
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)

struct UnionFind{
    vector<ll> par,siz;

    UnionFind(ll N):par(N+1),siz(N+1,1){
        rep1(i,N) par[i]=i; //親を自分自身として初期化
    }

    ll root(ll x){
        if(par[x]==x){
            return x;
        }
        else{
            return  par[x]=root(par[x]);
        }
    }
    void unite(ll x,ll y){
        x=root(x);
        y=root(y);
        if(x==y) return;

        if(siz[x]<siz[y]) swap(x,y);
        
		siz[x]+=siz[y];
		par[y]=x;
    }
    bool same(ll x,ll y){
        return root(x)==root(y);
    }
    ll size(ll x){
        return siz[root(x)];
    }
};

int main(){
	//input
	ll N,M; cin>>N>>M;
	vector<ll> A(M+1);
	vector<ll> B(M+1);
	rep1(i,M) cin>>A[i]>>B[i];

	vector<ll> ans(M+1);
	ans[M]=N*(N-1)/2;

	UnionFind tree(N);
	rrep1(i,M){
		if(tree.same(A[i],B[i])) ans[i-1]=ans[i];
		else ans[i-1]=ans[i]-tree.size(A[i])*tree.size(B[i]);
		tree.unite(A[i],B[i]);
	}
	
	rep1(i,M) cout<<ans[i]<<endl;
}

Measured memory_bytes: 5248
import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[]data = new int[100001];
		int repeat = 0;
		int res = N;
		for(int i = 0 ; i<N; i++){
			int input = sc.nextInt();
			data[input]++;
		}
		for(int i = 0 ; i<data.length ; i++){
			if(data[i]>=2)repeat+=data[i]-1;
		}
		if(repeat%2 == 0){
		//	System.out.println("TEST");
			res-=repeat;
		}
		else {
			res-=repeat+1;
		//	System.out.println(repeat);
		//	System.out.println("Test");
		}
		System.out.println(res);
	}
}


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

using namespace std;

template<int mod> class modint {
public:
  int x;
  modint(): x(0) {}
  modint(int a) { x = a % mod; if (x < 0) x += mod; }
  modint &operator+=(modint that) { x = (x + that.x) % mod; return *this; }
  modint &operator-=(modint that) { x = (x + mod - that.x) % mod; return *this; }
  modint &operator*=(modint that) { x = (long long) x * that.x % mod; return *this; }
  modint &operator/=(modint that) { return *this *= that.inverse(); }
  modint operator-() { return modint(-this->x); }
  friend ostream& operator<<(ostream &out, modint m) { return out << m.x; }
  modint inverse() {
    int a = x, b = mod, u = 1, v = 0;
    while (b) { int t = a / b; a -= t * b; u -= t * v; swap(a, b); swap(u, v); }
    return modint(u);
  }
#define op(o, p) modint operator o(modint that) { return modint(*this) p that; }
  op(+, +=) op(-, -=) op(*, *=) op(/, /=)
#undef op
#define op(o) bool operator o(modint that) { return x o that.x; }
  op(==) op(!=) op(<) op(<=) op(>) op(>=)
#undef op
};

typedef modint<1000000007> mint;

map<int, int> prime_map(int mx) {
  mx = floor(sqrt(mx));
  vector<bool> f(mx + 1, true);
  int i = 2;
  while (i <= mx) {
    for (int j = i * 2; j <= mx; j += i) {
      f[j] = false;
    }
    while (i <= mx && !f[++i]);
  }
  map<int, int> ret;
  for (int i = 2; i <= mx; i++) {
    if (f[i]) ret[i] = 0;
  }
  return ret;
}

mint comb(int n, int m) {
  mint ret = 1;
  n = n - m;
  for (int i = 1; i <= m; i++) {
    ret *= n + i;
    ret /= i;
  }
  return ret;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  map<int, int> prime = prime_map(m);
  for (auto p: prime) {
    int num = p.first;
    while (m % num == 0) {
      m /= num;
      prime[num]++;
    }
  }
  if (m != 1) {
    prime[m] = 1;
  }
  mint ans = 1;
  for (auto p: prime) {
    if (p.second == 0) {
      continue;
    }
    ans *= comb(n + p.second - 1, p.second);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
n = gets.to_i
a = gets.split.map(&:to_i)
ans = 1
cs = [0, 0, 0]
a.each do |c|
    match = cs.count(c)
    ans *= match % 1000000007
    cs.each_with_index do |k, i|
        if k == c
            cs[i] += 1
            break
        end
    end
end
puts ans % 1000000007

Measured memory_bytes: 60888
#include<bits/stdc++.h>
#define nl                 "\n"
#define ll                 long long
#define pb                 push_back
#define pf                 push_front
#define np                 next_permutation
#define pp                 prev_permutation
#define sqr(x)             ((x)*(x))
#define pi                 acos(-1)
#define setprecision(x)    fixed<<setprecision((int)(x))
#define mem1(x)            memset(x,0,sizeof(x))
#define mem2(x)            memset(x,-1,sizeof(x))
#define all(x)             (x).begin(),(x).end()
#define rev(x)             reverse(all(x))
#define iota(x,a)          iota(all(x),a)
#define sorta(x)           sort(all(x))
#define sortd(x)           sort(all(x),greater<int>())
#define csort(x,c)         sort(all(x),c)
#define rsort(x)           sort(x.rbegin(),x.rend())
#define faster_io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define all_ele(x)         for(auto i:(x)){cout<<i<<' ';}cout<<nl;
#define multiple_test      int t; cin>>t; while(t--){solve();}
#define single_test        solve();
using namespace std;
//vector<vector<int>>p(sz,vector<int>(sz,val));
void solve()
{
   ll n;
   cin>>n;
   vector<ll>a(n);
   for(int i=0; i<n; i++)
        cin>>a[i];
   ll thaka=1000;
   for(int i=0; i<n-1; i++)
   {
       if(a[i]<a[i+1])
          {
              ll bundle=thaka/a[i];
              thaka=thaka%a[i];
              thaka+=(bundle*a[i+1]);
          }
   }
   cout<<thaka<<nl;
}
int main()
{
    faster_io;
    //multiple_test
    single_test
    return 0;
}




Measured memory_bytes: 3632