akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
int main() {
	int a,b,c,d;

	std::cin >> a>>b>>c>>d;

	if ((a + b) == (c + d)) {
		std::cout << "Balanced" << std::endl;
	}
	else {
		if (a + b > c + d) {
			std::cout << "Left" << std::endl;
		}
		else {
			std::cout << "Right" << std::endl;
		}
	}
	
}


Measured memory_bytes: 256
def modpow(x, n, p):
    res = 1
    while n > 0:
        if n & 1:
            res = res * x % p
        x = x * x % p
        n >>= 1
    return res

MOD = pow(10, 9) + 7

k = int(input())
s = input()

n = len(s)

fact = [1 for _ in range(n + k + 1)]
p25 = [1 for _ in range(n + k + 1)]
for i in range(1, n + k + 1):
    fact[i] = fact[i - 1] * i % MOD
    p25[i] = p25[i - 1] * 25 % MOD

inv = [1 for _ in range(n + k + 1)]
inv[n + k] = modpow(fact[n + k], MOD - 2, MOD)
for i in range(n + k - 1, -1, -1):
    inv[i] = inv[i + 1] * (i + 1) % MOD

ans = modpow(26, n + k, MOD)
for i in range(n):
    ans -= fact[n + k] * inv[i] % MOD * inv[n + k - i] % MOD * p25[n + k - i] % MOD
    if ans < 0:
        ans += MOD

print(ans)

Measured memory_bytes: 213712
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<set>
using namespace std;

char a[105];
int b[105];

int main(){
    while(scanf("%s",a)!=EOF){
        getchar();
            int j=0;
        for(int i=0;a[i]!='\0';i++){
            if(a[i]=='0')
                b[j++]=0;
            else
                if(a[i]=='1')
                b[j++]=1;
            else{
                if(j>0)
                    j--;
            }
        }
        for(int i=0;i<j;i++)
        printf("%d",b[i]);
    printf("\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int c[1000006];
vector<int> V;
set<int> S;
multiset<int> T;

int N, A[200005];

int dp[200005];

int num[1000006];

int main(void) {
	cin >> N;
	int Am = 0;
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
		V.push_back(A[i]);
		S.insert(A[i]);
		T.insert(A[i]);
		Am = max(Am, A[i]);
		num[A[i]]++;
	}

	//sort(V.begin(), V.end());

	

	for(auto y: V){
		if (c[y] >= 1) { c[y] = 2; }
		else if (c[y] >= 0) { c[y]++;
		for (long long int j = y*2; j <= Am; j+=y) {
			c[(int) j] = -1;
		}
		}
	}

	for (auto y : T) {

	}

	int ans = 0;

	for (int i = 1; i <= N; i++) {
		//if (T.count(A[i]) >= 2) { continue; }
		if (c[A[i]] == 1) { ans++; }
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 30316
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

M1,D1=get_i
M2,D2=get_i
if M1 !=M2
  puts "1"
else
  puts "0"      
end

Measured memory_bytes: 1788
import java.util.*;

public class Main{
    static int n;
    static int[] a;
    static long[] rsw;
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        n = sc.nextInt();
        a = new int[n];
        rsw = new long[n+1];
        
        long sum = 0;
        for(int i=0; i<n; i++){
            a[i] = Integer.parseInt(sc.next());
            sum += a[i];
            rsw[i+1] = sum;
        }
        
        long ans = 1L<<60;
        
        //まんなか
        for(int i=2; i<n-1; i++){
            long s1 = rsw[i];
            long s2 = sum - rsw[i];
            
            long d1 = calcD(0, i, s1);
            long d2 = calcD(i, n, s2);
            
            long max = Math.max(s1+d1, s2+d2)/2;
            long min = Math.min(s1-d1, s2-d2)/2;
            
            ans = Math.min(ans, max-min);
        }
        
        System.out.println(ans);
    }
    
    public static long calcD(int f, int r, long s){
        long res = 1L<<60;
        int ins1 = bsl(rsw[f] + s/2);
        if(ins1>0){
            res = Math.min(res, calcRes(f, r, ins1));
        }
        
        int ins2 = bsu(rsw[f] + s/2);
        if(ins2<n){
            res = Math.min(res, calcRes(f, r, ins2));
        }
        
        return res;
    }
    
    public static long calcRes(int f, int r, int ins){
        return Math.abs((rsw[ins]-rsw[f])-(rsw[r]-rsw[ins]));
    }
    
    public static int bsl(long val){
        int ok = 0;
        int ng = n;
        for(int i=0; i<30; i++){
            int mid = (ok+ng)/2;
            if(rsw[mid]<=val){
                ok = mid;
            }else{
                ng = mid;
            }
        }
        return ok;
    }
    
    public static int bsu(long val){
        int ok = n;
        int ng = 0;
        for(int i=0; i<30; i++){
            int mid = (ok+ng)/2;
            if(rsw[mid]>val){
                ok = mid;
            }else{
                ng = mid;
            }
        }
        return ok;
    }
}


Measured memory_bytes: 61516
#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main(){
   string s;
   while(cin>> s){
      //string tmp;
      //while(s.size()!=1){
         //for(int i=0;i<s.size()-1;i++){
            //tmp.push_back((s[i]-'0')+(s[i+1]-'0')%10);
            //cout<< tmp << endl;
            //cout << to_string((s[i]-'0')+(s[i+1]-'0')%10) << endl;
         //}
         //s.clear();
         //s=tmp;
      //}
      //cout << s << endl;
      int a[10][10];
      for(int i=0;i<10;i++) {a[0][i]=s[i]-'0';}
      for(int i=1;i<10;i++){
         for(int j=0;j<10-i;j++){
            a[i][j]=(a[i-1][j]+a[i-1][j+1])%10;
            //if(i==1)cout << a[i][j] << endl;
         }
      }
      cout << a[9][0] << endl;
   }
}

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

typedef long long ll;
ll const mod = 1e9+7;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    vector<vector<int>> dp(n+1,vector<int>(k+1,0));
    for (int i = 0;i < n;++i) cin >> a[i];
    dp[0][0] = 1;
    for (int i = 0;i < n;++i) {
        vector<int> sums(k+2,0);
        for (int j = 0;j < k+1;++j) sums[j+1] = (sums[j]+dp[i][j])%mod;
        for (int j = 0;j < k+1;++j) dp[i+1][j] = (sums[j+1]-sums[max(0,j-a[i])])%mod;
    }
    cout << (dp[n][k]+mod)%mod << endl;
    return 0;
}

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

int main(){
 
  long long N,i,res,a;
  cin >> N;
  map<int,int> m;

  res = 0;
  for(i=0;i<N;i++){
    cin >> a;
    res += m[i-a];
    m[i+a]++;
  }
  
  cout << res << "\n";

  return 0;
}

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

int N;

int main(){
	cin >> N;
	int a,mi = 1e9,ma = 0;
	map<int,int> m;
	for(int i=0;i<N;i++){
		cin >> a;
		m[a]++;
		mi = min(mi,a);
		ma = max(ma,a);
	}
	if(ma-mi>=2){
		cout << "No" << endl;
	}else if(mi==ma){
		if(ma==N-1 || m[mi]/2>=mi){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}else{
		int a = m[mi];
		if(a<ma && 2*(ma-a)<=m[ma] ){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 4992
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
#ifdef LOCAL
#define debug(x) cerr << #x << ": " << x << endl
#else
#define debug(x)
#endif
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

int N, A[100];
signed main(){
	cin >> N;
	rep(i, N) cin >> A[i];
	bool flg = true;
	rep(i, N)
		if(A[i]%2 == 0 && A[i]%3 != 0 && A[i]%5 != 0) flg = false;
	if(flg) cout << "APPROVED" << endl;
	else cout << "DENIED" << endl;
}

Measured memory_bytes: 256
a, b, x = gets.chomp.split.map(&:to_f)

if x > (a*a*b)/2
  ans = Math.atan((2*(a*a*b-x))/(a*a*a))
else
  ans = Math.atan((a*b*b)/(2*x))
end

print (ans*180)/Math::PI

Measured memory_bytes: 1916
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a - b >= c) P(0);
  else P(c - (a - b));
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
#define reps(i,j,n) for(int i = (j) ; i < (n) ; ++i )
#define rep(i,j) reps(i,0,j)
#define INF (1 << 30)
int dp[3001][3001];
int main(){
  int a[3001],b[3001];
  int ans = 0,N,T,S;
  cin >> N >> T >> S;
  reps(i,1,N+1) cin >> a[i] >> b[i];
  reps(i,1,N+1) reps(j,1,T+1){
    dp[i][j] = max(dp[i][j-1],dp[i-1][j]);
    int dis = j - b[i] ;
    if( dis >= 0 && (S <= dis || j <= S)){
      dp[i][j] = max(dp[i][j] , dp[i-1][dis] + a[i]);
    }
    ans = max(dp[i][j] , ans);
  }
  cout << ans << endl;
}

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

using namespace std;

int a[1005] , n , k;

int main() 
{
   int s = 0;
   cin >> n >> k;
   for(int i = 1 ; i <= n ; i++)
    cin >> a[i];
    sort(a + 1 , a + n + 1);
    for(int i = 1 ; i <= k ; i++)
        s += a[i];
    cout << s << "\n";
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>


using namespace std;
string yn(bool a)
{
  if (a){return "Yes";}
  else{return "No";}
}
int gcd(int p,int q)
{
  if(p>q)swap(p,q);
  if(p==0)return q;
  else return gcd(q/p,p);
}

int main()
{
  ios::sync_with_stdio(false);
  int N;
  cin>>N;
  vector<int> h(N);

  for (size_t i = 0; i < N; i++) {
    cin>>h[i];
  }
  vector<int> dp(N);
  dp[0]=0;
  dp[1]=abs(h[1]-h[0]);
  for (size_t i = 0; i < N-2; i++) {
    dp[i+2]=min(dp[i+1]+abs(h[i+2]-h[i+1]),dp[i]+abs(h[i+2]-h[i]));
    //cout<<i+2<<' '<<dp[i+2]<<endl;
  }
  cout<<dp[N-1]<<endl;
    return 0;
}

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

using namespace std;

int main() {
 	int n, k;
  	cin >> n >> k;
  	int ans = 0;
  	for (int i = 0; i < n; i++) {
      	int x;
      	cin >> x;
      	if (x >= k) ans++;
    }
  	cout << ans << 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 int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> p(n);
	rep(i,n) cin >> p[i];
	int ans = 0;
	rep(i,n-2){
		if((p[i] < p[i+1] && p[i+1] < p[i+2]) || 
		(p[i] > p[i+1] && p[i+1] > p[i+2])) ++ans;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<pair<int,int>> work;
    for(int i=0; i<n; i++){
        int a,b;
        cin >> a >> b;
        pair<int, int> p = make_pair(a,b);
        work.push_back(p);
    }
    sort(work.begin(), work.end());
    priority_queue<ll> money;
    int count=0;
    ll ans=0;
    for(int i=1; i<=m; i++){
        //m-i日目の仕事を決める。
        if(count < n){
            while(work.at(count).first==i){
            money.push((ll)work.at(count).second);
            count++;
            if(count == n) break;
            }
        }
        if(money.empty()) continue;
        ans += money.top();
        money.pop();
    }
    cout << ans << endl;
}


Measured memory_bytes: 5584
#include<iostream>
#include<algorithm>

using namespace std;
#define INFTY 2000000000
#define N 9900
#define MAX 9900

int v,e,D[N][N],s[N],t[N],d[MAX],minv = INFTY,r[N][N];

int main(){
    
    cin >> v >> e;

    for(int i = 0;i < v;i++){
        for(int j = 0;j < v;j++){
            if(i != j)D[i][j] = INFTY;
            else D[i][j] = 0;
        }
    }
    
    for(int i = 0;i < e;i++){
        cin >> s[i] >> t[i] >> d[i];
        D[s[i]][t[i]] = d[i];
    }
        
    
    for(int k  = 0;k < v;k++){
        for(int i = 0;i < v;i++){
            if(D[i][k] == INFTY)continue;
            for(int j = 0;j < v;j++){
                if(D[k][j] == INFTY)continue;
                D[i][j] = min(D[i][j],D[i][k] + D[k][j]);
            }
        }
    }
    
	bool a = true;

	for(int i = 0; i < v; i++){
		    if(D[i][i] < 0){
			    a = false;
			    break;
		}
	}
    
    if(!a)cout << "NEGATIVE CYCLE" << endl;
    else{
        for(int i  = 0;i < v;i++){
            if(D[i][0] == INFTY)cout << "INF";
            else cout << D[i][0];
            for(int j = 1;j < v;j++){
                if(D[i][j] == INFTY)cout << " " << "INF";
                else cout << " " << D[i][j];
            }
            cout << endl;
        }
    }
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<ll,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void print() { cout << "\n"; }
template <class T, class... Args>
void print(const T &x, const Args &... args) { cout << x << " "; print(args...);}
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n,m;
  cin >> n >> m;
  vector<int> cnt(n,0);
  rep(i,m) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    cnt[a]++;
    cnt[b]++;
  }
  bool ok = true;
  rep(i,n) {
    if (cnt[i]%2 == 1) ok = false;
  }
  cout << (ok ? "YES" : "NO") << endl;
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<bits/stdc++.h>
#include<cmath>

using namespace std;
  
int main(){
    long long int N,K;
    cin>>N>>K;
    if(K !=0){
        long long int d=N/K;
        long long int e=(N-d*K);
        long long int f=(d+1)*K-N;
        if(e<=f){
        	N=e;
        	cout<<N;
        }else{
        	N=f;
        	cout<<N;
        }

    }else{
    	cout<<N;
    }




}

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

int get(int n){
    int mi=INT_MAX;
    for(int i=0;i<n;i++){
        int a;cin>>a;
        mi=min(mi,a);
    }
    return mi;
}
int main(){
    int a=get(3);
    int b=get(2);

    cout<<a+b-50<<endl;
    return 0;
}

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

using namespace std;

#define sqr(x) ((x) * (x))
#define pb push_back
#define mp make_pair
#define ins insert
#define er erase
#define bg begin()
#define ed end()
#define f first
#define s second
#define fin(name) freopen(name, "r", stdin)
#define fout(name) freopen(name, "w", stdout)
#define files(name) fin(name".in"); fout(name".out")
#define enter cout << "\n"
#define space cout << " "
#define endl "\n"
#define fi(st,n) for (int i = (st); i <= (n); ++i)
#define fj(st,n) for (int j = (st); j <= (n); ++j)
#define fk(st,n) for (int k = (st); k <= (n); ++k)
#define fq(st,n) for (int q = (st); q <= (n); ++q)
#define fw(st,n) for (int w = (st); w <= (n); ++w)
#define ff(i, st, n) for (int (i) = (st); (i) <= (n); ++(i))
#define ei(st,n) for (int i = (st); i >= (n); --i)
#define ej(st,n) for (int j = (st); j >= (n); --j)
#define ek(st,n) for (int k = (st); k >= (n); --k)
#define ef(i, st, n) for (int (i) = (st); (i) >= (n); --(i))
#define ri(st,n) for (int i = (st); i < (n); ++i)
#define rj(st,n) for (int j = (st); j < (n); ++j)
#define rk(st,n) for (int k = (st); k < (n); ++k)
#define rq(st,n) for (int q = (st); q < (n); ++q)
#define rf(i, st, n) for (int (i) = (st); (i) < (n); ++(i))
#define clean(a) memset((a),0,sizeof (a))
#define sync ios_base::sync_with_stdio(0);cin.tie(0)
#define y1 dsklmlvmd

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int inf = (int)1e9;
const dbl eps = (dbl) 1e-8;
const int mod = (int) 1e9 + 7;
const int maxn = (int) 1e5 + 5;
//const dbl M_PI = (dbl)2 * (dbl)acos(0);

//cout<<fixed<<setprecision(10);
//srand(time(0));

ll d[3003][3003][2], n, m;

int main() {
//    fin("t.in");
    sync;
    cin >> n >> m;
    clean(d);
    fi(0, n) {
        d[0][i][0] = 1;
    }
    fi(0, m - 1) {
        fj(0, n) {
            fk(0, 1) {
                int tok;
                if (j > 0) {
                    tok = k | (j == 1);
                    d[i + 1][j][tok] = (d[i + 1][j][tok] + d[i][j][k]) % mod;
                    d[i + 1][j - 1][tok] = (d[i + 1][j - 1][tok] + d[i][j][k]) % mod;
                }
                if (j < n) {
                    tok = k | (j == 0);
                    d[i + 1][j][tok] = (d[i + 1][j][tok] + d[i][j][k]) % mod;
                    d[i + 1][j + 1][tok] = (d[i + 1][j + 1][tok] + d[i][j][k]) % mod;
                }
            }
        }
    }
    ll ans = 0;
    fj(0, n) {
        ans += d[m][j][1];
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 141184
import collections
from functools import reduce

n = int(input())
S = input()

c = collections.Counter(list(S))
ans = c['R'] * c['G'] * c['B']

for i in range(n):
    for j in range(i + 1, n):
        if 2 * j - i <= n - 1 and S[i] != S[j] and S[j] != S[2 * j - i] and S[2 * j - i] != S[i]:
            ans -= 1

print(ans)

Measured memory_bytes: 74668
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define mod llint(1e9+7)

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(llint a, llint b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

//aのb乗をmodで割った余りを求める
llint power(llint a, llint b) {
	if (b == 1)return a;
	if (b == 0)return 1;
	llint tmp = power(a, b / 2);
	tmp *= tmp;
	tmp %= mod;
	if (b % 2 == 1) {
		tmp *= a;
		tmp %= mod;
	}
	return tmp;
}

int main() {
	int n;
	cin >> n;
	cout << (n - 1) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main() {
 
  int k1,i,a,n,f;
  char m[5],kara;
 
  scanf("%d",&n);
 
 
  k1 = 0;
  f = 0;
  for(i=0;i<n;i++) {
    scanf("%s %d",m,&a);
    // printf("%c %d\n",m[0],a);
 
    if(m[0] == '(') {
      k1 += a;
    } else k1 -= a;
 
    if(k1 < 0 && f == 0) {
      f = 1;
    }
 
  }
 
  if(k1 == 0 && f == 0) printf("YES\n");
  else printf("NO\n");
 
  return 0;
 
}

Measured memory_bytes: 584
get;$_=grep /\#/,lines;$_=$_>>.comb;$/=map ->$a {(map ->$b {$_[$b][$a]},^$_).join},^$_[0];$!=grep /\#/,$/;map ->$a {say (map ->$b {$![$b].comb[$a]},^$!).join},^$![0].chars

Measured memory_bytes: 82492
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include <utility>
#include<map>
#include<functional>
#include<climits>
using namespace std;
using ll = long long;
const int mod = 1000000007;

int main() {
	ll n=0, a[100000], b[100000],suma=0,sumb=0,difm=0,ans=0;
	vector<ll> difp;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		suma += a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
		sumb += b[i];
	}
	for (int i = 0; i < n; i++) {
		if (a[i] - b[i] > 0)difp.push_back(a[i] - b[i]);
		else if (a[i] - b[i] < 0) {
			difm += (b[i] - a[i]);
			ans++;
		}
	}
	sort(difp.begin(), difp.end());
	if (suma < sumb) {
		cout << -1 << endl;
		return 0;
	}
	ll memo = difp.size() - 1;
	while (memo >= 0) {
		if (difm <= 0)break;
		ans++;
		difm -= difp[memo];
		memo--;
	}
	cout << ans << endl;

}


Measured memory_bytes: 2428
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }

int main(){
	ll d ; cin >> d ;
	vll c(26) ;
	for(auto &i:c) cin >> i ;
	vvll di(d,vll(26)) ;
	for(auto &i:di) for(auto &j:i) cin >> j ;
	vll last(26,-1) ;
	ll sum = 0 ;
	for(int i=0;i<d;i++){
		ll mx = -INF ;
		ll contest = -1 ;
		ll dec = 0 ;
		for(int j=0;j<26;j++){
			dec += c.at(j)*(i-last.at(j)) ;
		}
		for(int j=0;j<26;j++){
			if(ll tmp=di.at(i).at(j)-dec+c.at(j)*(i-last.at(j));tmp>=mx){
				if(contest=-1||c.at(j)>c.at(contest)){
					contest = j ;
					mx = tmp ;
				}
			}
		}
		cout << contest+1 << endl ;
		sum += mx ;
		// ll t ; cin >> t ;
		// t-- ;
		// last.at(t) = i ;
		// sum += di.at(i).at(t) ;
		// for(int j=0;j<26;j++){
			// sum -= c.at(j)*(i-last.at(j)) ;
		// }
		//cout << sum << endl ;
	}
}

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

int h[100005] = { 0 };
int main()
{
	char c,d;
	int n, q;
	cin >> n >> q;
	cin >> d;
	for (int i = 2; i <= n;i++) {
		cin >> c;
		if (c == 'C'&&d == 'A')h[i]++;
		h[i] += h[i - 1];
		d = c;
	}
	int a, b;
	for (int i = 1; i <= q; i++) {
		cin >> a >> b;
		cout << h[b]-h[a] << endl;
	}
}


Measured memory_bytes: 1280
[S, T] = [str(i) for i in input().split()]
[A, B] = [int(i) for i in input().split()]
[U] = [str(i) for i in input().split()]

if (U==S):
    print(str(A-1) + " " + str(B))
else:
    print(str(A) + " " + str(B-1))

Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int a,p,z;
	scanf("%d",&a);
	scanf("%d",&p);
	z=((a*3)+p)/2;
	if(z>0){
		printf("%d\n",z);
	}
	else{
		z=0;
		printf("%d\n",z);
	}
	return 0;
}

Measured memory_bytes: 128
def comb(n, k):
    if k > n // 2:
        return comb(n, n - k)
    numer = 1
    denom = 1
    for i in range(k):
        numer *= n - i
        denom *= k - i
    return numer // denom


def main():
    N, P = list(map(int, input().split()))
    A = list(map(int, input().split()))
    # 合計を2で割ったあまりが0となるパターンを数える
    cnt_even_bag = len([a for a in A if a % 2 == 0])
    cnt_odd_bag = N - cnt_even_bag
    cnt_even_pattern = 2 ** cnt_even_bag
    cnt_odd_pattern = 0
    for c in range(1, cnt_odd_bag + 1, 2):
        cnt_odd_pattern += comb(cnt_odd_bag, c)
    cnt_even = cnt_even_pattern * cnt_odd_pattern
    if P == 1:
        print(cnt_even)
    else:
        print(2 ** N - cnt_even)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9088
Module Module1

    Sub Main()

        Dim S As String = Console.ReadLine()
        Dim l(3) As String
        Dim i As Integer

        For i = 1 To Len(S) Step 2
            If Mid(S, i, 1) = "L" Then
                Console.WriteLine("No")
                Exit Sub
            End If
            If i <= Len(S) AndAlso Mid(S, i + 1, 1) = "R" Then
                Console.WriteLine("No")
                Exit Sub
            End If
        Next

        Console.WriteLine("Yes")

        'Console.ReadLine()

    End Sub

End Module


Measured memory_bytes: 20432
while True:
    words, type_ = input().split()
    if type_ == "L":
        if "_" in words:
            words = words.split("_")
            words = words[0] + "".join([w[0].upper() + w[1:] for w in words[1:]])
        else:
            words = words[0].lower() + words[1:]
    elif type_ == "U":
        if "_" in words:
            words = words.split("_")
            words = "".join([w[0].upper() + w[1:] for w in words])
        else:
            words = words[0].upper() + words[1:]
    elif type_ == "D":
        indices = [i for i, w in enumerate(words) if w.isupper()] + [len(words)]
        if words[0].islower():
            indices.insert(0, 0)
        words = "_".join([words[indices[i]].lower() + words[indices[i]+1: indices[i+1]] for i in range(len(indices) - 1)])
    else:
        break
    print(words)




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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int N;
    cin >> N;
    int ans = 100;
    int num;
    for (int i = 0; i < N; i++) {
        cin >> num;
          int cnt = 0;

        while (num % 2 == 0) {
            num /= 2;
            cnt++;
        }
        if (ans > cnt) {
            ans = cnt;
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
import numpy as np
N, M = map(int, input().split())
K = [list(map(int, input().split()))[1:] for _ in range(M)]
P = list(map(int, input().split()))
C = 0
for x in range(2**N):
    X = [x// (2**n) % 2 for n in range(N)]
    X = np.array(X)
    c = 0
    for m in range(M):
        l = np.array(K[m])-1
        if sum(X[l]) % 2 == P[m]:
            c += 1
    if c == M:
        C += 1
print(C)

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

A = list(map(int,input().split()))
A.sort(reverse=True)
BC = []
for _ in range(M):
    B, C = (int(x) for x in input().split())
    BC.append([B, C])
BC = sorted(BC, key=lambda x: -x[1])

index = 0

ans = 0

while index < M and len(A) and A[-1] < BC[index][1]:
    b, c = BC[index]
    count = 0
    while len(A) and A[-1] < c and count < b:
        A.pop()
        ans += c
        count += 1
    index += 1
print(sum(A)+ans)

Measured memory_bytes: 100052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    ll a,b,c,x,y; cin>>a>>b>>c>>x>>y;
    ll res=a*x+b*y;
    for(ll i=1; i<=max(x, y); i++){
        ll tmp=a*max(x-i, 0ll) + b*max(y-i, 0ll) + c*2*i;
        chmin(res, tmp);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <bitset>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int N;
  cin >> N;
  int count = 0;
  for (int i = 1; i <= N; i++) {
    if ((int)to_string(i).size() % 2 == 1) {
      count++;
    }
  }
  cout << count << endl;
}

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

int main() {
int count;
int high = -1000000;
int low = 1000000;
double sum  = 0;
cin >> count;
int array[count] = {};
for (int i = 0; i < count; i++) {
 cin >> array[i];
} for (int i = 0 ; i < count; i++) {
if (array[i] < low) {
 low = array[i];
} if (array[i] > high) {
high = array[i];
} sum += array[i];
}
cout <<fixed<<setprecision(0) << low << " " << high << " " << sum << endl;
return 0;
}


Measured memory_bytes: 3284
#include <bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define fi  first
#define se second
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define dub(x) cerr<<#x<<" "<<x;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define forn(i,n) for(int i = 0;i <(int)(n);++i)
#define fora(i,a,b) for(int i = (int)(a); i<=(int) (b); ++i)

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a,b,c;
    cin>>a>>b>>c;
    if((a+b+c) >=22)
    	cout<<"bust\n";
    else
    	cout<<"win\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
 
int main()
{
    int n;
    cin >> n;
 
    vector<ll> numCnt(100100);
    ll sum = 0;
    rep (i, n)
    {
        int a;
        cin >> a;
        numCnt[a]++;
        sum += a;
    }
 
    int q;
    cin >> q;
 
    vector<ll> ans(q + 1);
    ans[0] = sum;
    rep (i, q)
    {
        int b, c;
        cin >> b >> c;
 
        ans[i + 1] = ans[i] - numCnt[b] * b + numCnt[b] * c;
        numCnt[c] += numCnt[b];
        numCnt[b] = 0;
    }
 
    rep (i, q)
        cout << ans[i + 1] << endl;
    return 0;
}

Measured memory_bytes: 4756
N, M = [int(x) for x in input().split(" ")]
digits = [-1] * N
flag = False
for i in range(M):
    s, c = [int(x) for x in input().split(" ")]
    if (digits[s-1] == -1 or digits[s-1] == c):
        digits[s-1] = c
    else:
        flag = True
        break
if (flag):
    print(-1)
elif (N != 1 and digits[0] == 0):
    print(-1)
else:
    for i in range(N):
        if (digits[i] != -1):
            print(digits[i], end="")
        else:
            if (i != 0 or N == 1):
                print(0, end = "")
            else:
                print(1, end="")
    print()

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}
template<class T> bool lcmp(const pair<T, T>& l, const pair<T, T>& r) {
  return l.first < r.first;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  int p = 0, r = 0;
  F0R(i, N) {
    int h;
    cin >> h;
    if (h > p) r += h - p;
    p = h;
  }
  cout << r;
}
#endif


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int n,mx=0;
    cin>>n;
    vector<string> s(n),ans;
    unordered_map<string,int> mp;
    for (int i = 0; i < n; i++)
    {
        cin>>s[i];
        if(mp.find(s[i])==mp.end())
        {
            mp.emplace(s[i],1);
        }
        else
        {
            mp[s[i]]++;
        }
    }
    for (auto i = mp.begin(); i != mp.end(); i++)
    {
        mx=max(mx,i->second);
    }
    for (auto i = mp.begin(); i != mp.end(); i++)
    {
        if(i->second==mx)
        {
            ans.push_back(i->first);
        }
    }
    sort(all(ans));
    for (int i = 0; i < ans.size(); i++)
    {
        cout<<ans[i]<<endl;
    }
        
    return 0;
}

Measured memory_bytes: 28612
//                        DushtuBunny
//                        Rahul Halder    
//    Indian Institute of Engineering Science & Technology,Shibpur


#include <bits/stdc++.h>

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll int64_t
#define f first
#define se second
#define LB lower_bound
#define UB upper_bound
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpll vector<pair<ll,ll>>
#define pll pair<ll,ll>
const unsigned int MOD = 1000000007;

using namespace std;

int32_t main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    IOS;
    int T;
    // cin>>T;
    T=1;

    while(T--)
    {
        ll n,m,x;cin>>n>>m>>x;
        ll c[n],a[n+10][m+10];
        vs combn;
        for(int i=0;i<n;i++)
        {
            cin>>c[i];
            for(int j = 0 ; j<m;j++)
                cin>>a[i][j];
        }
        ll p = 1;
        for(int i=0;i<n;i++)
            p*=2;
        p--;
        for(int i=1;i<=p;i++)
        {
            ll key = i;
            string temp = "";
            while(key>0)
            {
                if(key%2)
                    temp+='1';
                else
                    temp+='0';
                key/=2;
            }
            reverse(temp.begin(), temp.end());
            ll z = n - temp.size();
            string t = "";
            while(z--)t+='0';
            temp = t + temp;
            combn.pb(temp);
        }
        ll ans = LLONG_MAX;
        for(int i=0;i<combn.size();i++)
        {
            string key = combn[i];
            ll cur = 0;
            vll v(m,0);
            for(int j = 0; j<n;j++)
            {
                if(key[j]=='1')
                {
                    cur+=c[j];
                    for(int k = 0 ; k<m ; k++)
                        v[k]+=a[j][k];
                }
            }
            ll count = 0;
            for(int j = 0 ; j<m;j++)
                if(v[j]>=x)
                    count++;
            if(count==m)
                ans = min(ans,cur);
        }
        if(ans==LLONG_MAX)
            ans = -1;
        cout<<ans;
    }
  
    return 0;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979
//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
//const int64_t MOD = 1000000007;
//const int64_t INF = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
typedef pair<int64_t, int64_t> P;

int main() {
    int H, N;
    cin >> H >> N;
    vector<int> A(N), B(N);
    rep(i, 0, N) cin >> A[i] >> B[i];
    
    vector<vector<int>> dp(N+1, vector<int>(H+1, INF));
    dp[0][0] = 0;
    rep(i, 0 ,N){
        rep(j, 0, H + 1){
            if(j <= A[i]){
                dp[i+1][j] = min(dp[i][j], B[i]);
            }
            else{
                dp[i+1][j] = min(dp[i+1][j - A[i]] + B[i], dp[i][j]);
            }
        }
    }
    cout << dp[N][H] << endl;
}

Measured memory_bytes: 39424
#include <iostream>

int main()
{
    int n, k, _h, re = 0;
    std::cin >> n >> k;
    for(int i = 0; i < n; i++)
    {
        std::cin >> _h;
        re += _h < k ? 0 : 1;
    }
    std::cout << re << std::endl;
	return 0;
}


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

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

ans=float("inf")
for i in range(2**N):
    ans_temp=0
    f=True
    check=[0]*M
    for j in range(N):
        if (i>>j)&1:
            ans_temp+=A[j][0]
            for k in range(M):
                check[k]+=A[j][k+1]
    for l in check:
        if l<X:
            f=False
            break
    if f:
        ans=min(ans,ans_temp)

if ans==float("inf"):
    print("-1")
else:
    print(ans)


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

int main()
{
    long long x,y;
    cin >> x >> y;
    if(x>=0){
        if(-x<y&&y<x) x= (y>0?-y+x+2:y+x+1);//
        else if(x<y) x = y-x;//
        else if(x>y) x= -y-x+1;//
      	else if(x==-y) x=1;//
    }else{
        if(x<y&&y<-x) x= (y>0?-y-x+1:y-x);//
        else if(x<y) x = y+x+1;//
        else if(x>y) x= -y+x+2;//
      	else if(x==-y) x=1;//
    }
    cout << x;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
l = [0,0,0]
for i in range(n-1):
  if h[i] >= h[i + 1]:
    l.insert(i, 1)
  else:
    l.insert(i,0)

con = 0
max = 0
for i in range(n + 1):
  if l[i] == 1:
    con = con + 1
  else:
    if con > max:
      max = con
    con = 0
print(max)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define tt this->
#define ll long long
using namespace std;
int main ()
{
ll r;
cin>>r;
cout<<2*(r)*3.14;

    return 0;
}

/*
▀█████████▄     ▄████████    ▄████████    ▄████████
  ███    ███   ███    ███   ███    ███   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
 ▄███▄▄▄██▀    ███    ███  ▄███▄▄▄▄██▀   ███    ███
▀▀███▀▀▀██▄  ▀███████████ ▀▀███▀▀▀▀▀   ▀███████████
  ███    ██▄   ███    ███ ▀███████████   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
▄█████████▀    ███    █▀    ███    ███   ███    █▀
                            ███    ███

*/


Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true; }return false; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
const ll INF = 1e18;
const ld eps = 1e-4;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int d; cin >> d;
    int c[26];
    REP(i,26) cin >> c[i];
    int v[d][26];
    REP(i,d)REP(j,26) cin >> v[i][j];
    V<> sol;
    V<> loss(26,0);
    REP(i,d){
        V<pair<ld,int>> score(26,{0.0,0});
        REP(j,26) score[j] = {v[i][j] + loss[j] + c[j] * eps, j};
        sort(rall(score));
        int r = score[0].second;
        sol.pb(r + 1);
        REP(j,26){
            if(j == r) loss[j] = 0;
            else loss[j] += c[j];
        }
    }
    REP(i,d) cout << sol[i] << endl;
}

Measured memory_bytes: 3704
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int> > Matrix;

int main(){
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> p(n, 0);
    rep(i, q){
        int a;
        cin >> a;
        p[a -1]++;
    }

    rep(i, n){
        if (k - (q - p[i]) > 0) cout << "Yes\n";
        else cout << "No\n";
    }
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
using namespace std;
int main(){
  int n;
  int minHeight;
  cin >> n >> minHeight;
  int counter = 0;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    if(a >= minHeight){
      counter++;
    }
  }
  cout << counter << endl;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    
    if (a<b){
        cout << "a < b" << endl;
    }else if (a>b){
        cout << "a > b" << endl;
    }else if (a == b){
        cout << "a == b" << endl;
    }
    
    return 0;
    
    
}


Measured memory_bytes: 3116
x,y,a,b,c = map(int,input().split())
alist = list(map(int,input().split()))
blist = list(map(int,input().split()))
clist = list(map(int,input().split()))

alist.sort(reverse = True)
blist.sort(reverse = True)
for i in range(x):
    clist.append(alist[i])
for i in range(y):
    clist.append(blist[i])
clist.sort(reverse = True)
sum = 0
for i in range(x+y):
    sum += clist[i]
print(sum,end='\n')


Measured memory_bytes: 111212
using System;
using System.Linq;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var n = int.Parse(_[0]);
            var k = int.Parse(_[1]);

            var s = new bool[n];
            for(var i = 0; i < k; i++){
                var d = int.Parse(Console.ReadLine());
                var a = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
                for(var j = 0; j < d; j++){
                    s[a[j]-1] = true;
                }
            }

            Console.WriteLine(s.Count(f => !f));
        }
    }
}


Measured memory_bytes: 28404
import java.util.Scanner;

public class Main {
	static int intN =0;
	static int sosuCnt =0;

	public static void main(String[] args) {
		//test
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String result = "a";
		if (Character.isUpperCase( s.charAt( 0 ) )) {
			result = "A";
		}

		System.out.println(result);
	}

}


Measured memory_bytes: 27044
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <map>
#include <cmath>
#include <bitset>
#include <string>
#include <queue>
#include <sstream>

using namespace std;

#define int long long

bool func(int i, string s) {
    ostringstream sout;
    sout << setfill('0') << setw(3) << i;
    string t = sout.str();

    int idx0 = s.find(t[0]);
    int idx1 = s.find(t[1], idx0 + 1);
    int idx2 = s.find(t[2], idx1 + 1);

    if(idx0 == string::npos || idx1 == string::npos || idx2 == string::npos) return false;
    else return true;
}

signed main() {
    int n;
    cin >> n;
    string s;
    cin >> s;

    int ans = 0;
    for(int i = 0; i < 1000; i++) {
        if(func(i, s)) ans++;
    }

    cout << ans << endl;
    return 0;
}

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

int main(){
  int N;
  vector<int> P;
  vector<int> Q;
  vector<int> X;
  cin >> N;
  for(int i=1; i<=N; i++){
    int p; cin >> p;
    P.push_back(p);
  }
  for(int i=1; i<=N; i++){
    int q; cin >> q;
    Q.push_back(q);
  }
  for(int i=1; i<=N; i++){
    X.push_back(i);
  }
  long c1=0, c2=0, x=0;
  do{
    bool f1=true, f2=true;
    for(int i=0; i<N; i++){
      if(P[i]==X[i]) continue;
      else{
        f1=false; break;
      }
    }
    for(int i=0; i<N; i++){
      if(Q[i]==X[i]) continue;
      else{
        f2=false; break;
      }
    }
    if(f1) c1=x;
    if(f2) c2=x;
    x++;
  }while(next_permutation(X.begin(),X.end()));
  cout << abs(c1-c2) << endl;
  return 0;
}

Measured memory_bytes: 256
S = list(str(input()))


def solve(strings):
    if strings[0] != "A":
        return 'WA'

    count = 0
    for i in range(2, len(strings)-1):
        if strings[i] == 'C':
            count += 1
    if count != 1:
        return 'WA'

    for s in strings:
        if s != 'A' and s != 'C':
            if s.isupper():
                return 'WA'

    return 'AC'


print(solve(S))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
bool enough(ll t, ll arr[], ll n, ll a, ll b)
{
	ll c=0;
	for(ll i=0;i<n;i++)
	{
		if(arr[i]-b*t>0)
			if((arr[i]-b*t+a-b-1)/(a-b)>0)
				 c += (arr[i]-b*t+a-b-1)/(a-b);

	}
	if(c<=t)
		return true;
	else 
		return false;
}
int main()
{
	ll n,a,b;
	cin>>n>>a>>b;
	ll arr[n];
	for(ll i=0;i<n;i++)
		cin>>arr[i];
	sort(arr,arr+n);
	ll lo = 0, hi =1000000000,m=0;
	while(lo<hi-1)
	{
		m = (lo+hi)/2;
		if(!enough(m,arr,n,a,b))
			lo=m;
		else
			hi=m;
	}
	cout<<lo+1<<"\n";
}

Measured memory_bytes: 4416
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int c = 0;
	for(int i = 0; i<(int)(s.length()/2); i++)
	{
		if(s[i] == s[s.length()-1-i])
		c++;
	}
	cout<<s.length()/2 - c<<endl;
}


Measured memory_bytes: 256