akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 1000000;

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

typedef long long ll;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/


char grid[15][15];

char solve(int i,int j){
    if(grid[i][j]=='1'&&grid[i+1][j]=='1'&&grid[i][j+1]=='1'&&grid[i+1][j+1]=='1'){
        return 'A';
    }
    if(grid[i][j]=='1'&&grid[i+1][j]=='1'&&grid[i+2][j]=='1'&&grid[i+3][j]=='1'){
        return 'B';
    }
    if(grid[i][j]=='1'&&grid[i][j+1]=='1'&&grid[i][j+2]=='1'&&grid[i][j+3]=='1'){
        return 'C';
    }
    if(grid[i][j]=='1'&&grid[i][j+1]=='1'&&grid[i+1][j+1]=='1'&&grid[i+1][j+2]=='1'){
        return 'E';
    }
    if(grid[i][j]=='1'&&grid[i+1][j]=='1'&&grid[i+1][j+1]=='1'&&grid[i+2][j+1]=='1'){
        return 'F';
    }
    if(j>0){
        if(grid[i][j]=='1'&&grid[i+1][j]=='1'&&grid[i+1][j-1]=='1'&&grid[i+2][j-1]=='1'){
            return 'D';
        }
        if(grid[i][j]=='1'&&grid[i+1][j]=='1'&&grid[i+1][j-1]=='1'&&grid[i][j+1]=='1'){
            return 'G';
        }
    }
    return 0;
}
int main()
{
	while (!cin.eof())
	{
		rep(i, 15)
		{
			rep(j, 15)
			{
				grid[i][j] = '0';
			}
		}
		
		rep(i, 8)
		{
			cin >> grid[i];
		}
		
		char ans;
		bool solved = true;
		
		rep(i, 8)
		{
			rep(j, 8)
			{
				if (grid[i][j] == '1')
				{
					if (solved)
					{
						ans = solve(i, j);
						cout << ans << endl;
						solved = false;
					}
				} else {
					continue;
				}
			}
		}
	}
	
	return 0;
}

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

using namespace std;

/*
*   最大公約数と最小公倍数
*/
typedef long long int ll;

/// 最大公約数
ll GCD(ll a, ll b){
    if(a < b) swap(a, b);
    // a > b
    ll r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

/// 最小公倍数
ll LCM(ll a, ll b){
    return a*b/GCD(a, b);
}


int main(void){

    int a, b, k;
    vector<int> ans;

    cin >> a >> b >> k;

    for(int i = GCD(a, b);i >= 1;i--){
        if(a % i == 0 && b % i == 0){
            ans.push_back(i);
        }
    }

    cout << ans[k-1] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
#define DEBUG
#ifdef DEBUG
	#define debug printf
#else
	#define debug(...)
#endif
int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	if(n == 7 || n == 5 || n == 3)
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
	}
	return 0;
}


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

#define int long long

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

int n, s;

int f(int b, int n) {
    if (n < b) {
        return n;
    }
    if (b <= 1) {
        return -1;
    }
    int c = f(b, n / b);
    if (c == -1) {
        return -1;
    }
    return c + n % b;
}

signed main() {
    cin >> n >> s;
    if (n == s) {
        cout << n + 1 << endl;
        return 0;
    }
    for (int i = 2; i <= sqrt(n); i++) {
        if (f(i, n) == s) {
            cout << i << endl;
            return 0;
        }
    }
    for (int i = ceil(sqrt(n) - 1); i > 0; i--) {
        if ((s - n % i - i) % i == 0) {
            int x = (s - n % i - i) / i;
            if (f(n / i - x, n) == s) {
                cout << n / i - x << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
    return 0;
}


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

using namespace std;

int main()
{
    int n;
    int s=0;
    int b[51],c[51],a[21];

    cin>>n;
    a[0]=0;
    for(int i=1; i<=n; i++)
        cin>>a[i];
    b[0]=0;
    for(int i=1; i<=n; i++)
        cin>>b[i];
    c[0]=0;
    for(int i=1; i<=n-1; i++)
        cin>>c[i];


    s=b[a[1]];
    //cout<<s<<endl;
    for(int i=2; i<=n; i++)
    {
        s+=b[a[i]];
        //cout<<s<<endl;

        if(a[i]-1==a[i-1])
        {
            s+=c[a[i]-1];
            //cout<<s<<endl;

        }

    }

    cout<<s<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
clock_t t=clock();
namespace my_std{
	using namespace std;
	#define pii pair<int,int>
	#define fir first
	#define sec second
	#define MP make_pair
	#define rep(i,x,y) for (int i=(x);i<=(y);i++)
	#define drep(i,x,y) for (int i=(x);i>=(y);i--)
	#define go(x) for (int i=head[x];i;i=edge[i].nxt)
	#define templ template<typename T>
	#define sz 555
	typedef long long ll;
	typedef double db;
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	templ inline T rnd(T l,T r) {return uniform_int_distribution<T>(l,r)(rng);}
	templ inline bool chkmax(T &x,T y){return x<y?x=y,1:0;}
	templ inline bool chkmin(T &x,T y){return x>y?x=y,1:0;}
	templ inline void read(T& t)
	{
		t=0;char f=0,ch=getchar();double d=0.1;
		while(ch>'9'||ch<'0') f|=(ch=='-'),ch=getchar();
		while(ch<='9'&&ch>='0') t=t*10+ch-48,ch=getchar();
		if(ch=='.'){ch=getchar();while(ch<='9'&&ch>='0') t+=d*(ch^48),d*=0.1,ch=getchar();}
		t=(f?-t:t);
	}
	template<typename T,typename... Args>inline void read(T& t,Args&... args){read(t); read(args...);}
	char __sr[1<<21],__z[20];int __C=-1,__zz=0;
	inline void Ot(){fwrite(__sr,1,__C+1,stdout),__C=-1;}
	inline void print(register int x)
	{
		if(__C>1<<20)Ot();if(x<0)__sr[++__C]='-',x=-x;
		while(__z[++__zz]=x%10+48,x/=10);
		while(__sr[++__C]=__z[__zz],--__zz);__sr[++__C]='\n';
	}
	void file()
	{
		#ifdef NTFOrz
		freopen("a.in","r",stdin);
		#endif
	}
	inline void chktime()
	{
		#ifndef ONLINE_JUDGE
		cout<<(clock()-t)/1000.0<<'\n';
		#endif
	}
	#ifdef mod
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x%mod) if (y&1) ret=ret*x%mod;return ret;}
	ll inv(ll x){return ksm(x,mod-2);}
	#else
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x) if (y&1) ret=ret*x;return ret;}
	#endif
//	inline ll mul(ll a,ll b){ll d=(ll)(a*(double)b/mod+0.5);ll ret=a*b-d*mod;if (ret<0) ret+=mod;return ret;}
}
using namespace my_std;

int n;
int pos[sz],cnt[sz];
int a[sz*sz];
pii s[sz];
#define STOP return puts("No"),0

int main()
{
//	file();
	queue<int>q1,q2;
	read(n);
	rep(i,1,n) read(pos[i]),a[pos[i]]=i,s[i]=MP(pos[i],i);
	sort(s+1,s+n+1);
	rep(i,1,n) rep(j,1,s[i].sec-1) q1.push(s[i].sec);
	rep(i,1,n*n)
	{
		if (a[i])
		{
			++cnt[a[i]];
			if (cnt[a[i]]!=a[i]) STOP;
			rep(j,a[i]+1,n) q2.push(a[i]);
			continue;
		}
		if (!q1.empty()) ++cnt[a[i]=q1.front()],q1.pop();
		else if (!q2.empty()) ++cnt[a[i]=q2.front()],q2.pop();
		else STOP;
	}
	puts("Yes");
	rep(i,1,n*n) printf("%d ",a[i]);
	return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>

using namespace std;
int main()
{/*二日目*/
	//abc167-b
	int a, b, c, k, sum;cin >> a >> b >> c >> k;
	if (k <= a)
		sum = k;
	else if (k <= a + b)
		sum = a;
	else
		sum = 2 * a + b - k;
	cout << sum;
}

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

#define MAX_N 1010
#define INF 10000000000000

using namespace std;

int n, m;
long d[MAX_N];
bool negative[MAX_N];
struct edge { long from, to, cost; };
vector<edge> edges; // 長さM
// ベルマンフォード法でstartから各点までの最短距離を計算する O(MN)
// checkLoop=trueかつ負のループがある場合は負のループにより最短距離が
// -INFになってしまう点を検出し、negativeに格納
void bellmanFord(int start, bool checkLoop=false) {
    fill(d, d+n, INF);
    fill(negative, negative + n, false);
    d[start] = 0;
    bool negloop = false;
    for (int i=1; i<n; i++) {
        for (auto e : edges) {
            if (d[e.to] > d[e.from] + e.cost) {
                d[e.to] = d[e.from] + e.cost;
                if (i == n-1) negloop = true;
            }
        }
    }
    if (!checkLoop || !negloop) return;
    for (int i = 0; i < n; i++) {
        for (auto e : edges) {
            if (d[e.to] > d[e.from] + e.cost) {
                d[e.to] = d[e.from] + e.cost;
                negative[e.to] = true;
            }
        }
    }
}

int main() {
    cin >> n >> m;
    for (int i=0; i<m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        edges.push_back({a, b, -c});
    }
    bellmanFord(0, true);
    if (negative[n-1]) cout << "inf" << '\n';
    else cout << -d[n-1] << '\n';
    return 0;
}

Measured memory_bytes: 384
let a, op, b = Scanf.scanf "%d %s %d\n" (fun a b c -> a, b, c)
let calc = function
  | "+" -> (+)
  | "-" -> (-)
  | _ -> failwith "hoge"
           
let () =
  let op = calc op in
  print_endline @@ string_of_int (op a b)

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

int main(){
    int n,k ; cin>>n>>k;
    ll s; cin>>s;
    if(k>1){
        for(int i=0; i<k-1; i++) cout << s << ' ';
        if(k>0) cout << s;
    }
    else if(k==1) cout << s << endl;
    if(s<pow(10,9)){
        for(int j=0; j<n-k; j++) cout << ' ' << s+1;
    }
    else{
        for(int j=0; j<n-k; j++) cout << ' ' << 1;
    }
    cout << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, K; cin >> N >> K;
    vector<vector<int>> A(N);
    for (int i = 0; i < N; i++) {
        int t, d; cin >> t >> d; t--;
        A[t].push_back(d);
    }
    vector<pair<int, bool>> B, C, D;
    for (int i = 0; i < N; i++) {
        sort(rbegin(A[i]), rend(A[i]));
        if (A[i].size() >= 1) B.emplace_back(A[i][0], true);
        for (int j = 1; j < A[i].size(); j++) {
            B.emplace_back(A[i][j], false);
        }
    }
    sort(rbegin(B), rend(B));
    long long neta = 0, taste = 0, maxscore = 0;
    for (int i = 0; i < K; i++) {
        taste += B[i].first;
        neta += B[i].second;
        maxscore = taste + neta * neta;
        if (!B[i].second) C.push_back(B[i]);
    }
    for (int i = K; i < N; i++) {
        if (B[i].second) D.push_back(B[i]);
    }
    sort(rbegin(C), rend(C));
    sort(begin(D), end(D));
    while (!C.empty() && !D.empty()) {
        int a = C.back().first, b = D.back().first;
        C.pop_back(); D.pop_back();
        taste += -a + b;
        neta++;
        maxscore = max(maxscore, taste + neta * neta);
    }
    cout << maxscore << endl;
    return 0;
}

Measured memory_bytes: 7412
n = int(input())
dat = []
for i in range(n-1):
    c, s, f = map(int, input().split())
    dat.append([c, s, f])
for i in range(n-1):
    #print("i={0}".format(i))
    t = 0
    for j in range(i, n-1):
        # 発車時刻前ならその時刻まで待たないといけない
        #print("reqch j={0}, t={1}".format(j, t))
        t = dat[j][1] if t <= dat[j][1] else t
        # w = (t - dat[j][1]) % dat[j][2]
        w = t % dat[j][2]
        #print("    t={0}, w={1}".format(t, w))
        if w != 0:
            t += (dat[j][2] - w)
        t += dat[j][0]
        #print("next t={0}".format(t, w))
    print(t)
print(0)



Measured memory_bytes: 3188
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
#include<map>
#include<vector>
using namespace std;
#define N 100005
int a[N];
struct node{
	int value;
	int cnt;
	bool operator<(const node& n) const{ //按出现次数排序 
		return cnt>n.cnt;
	}
};
vector<node> p1,p2;
int main() {
	int n,i;
	map<int,int> t1,t2;
	map<int,int> :: iterator it;
	cin>>n;
	for( i=0;i<n;i++ )
	{
		scanf("%d",&a[i]);
		if( i&1 )
			t1[ a[i] ]++;
		else
			t2[ a[i] ]++;
	}
	for( it=t1.begin();it!=t1.end();it++ ) //出现最多次的元素个数 
	{
		node tmp;
		tmp.value=it->first;
		tmp.cnt=it->second;
		p1.push_back(tmp);
	}
	for( it=t2.begin();it!=t2.end();it++ )
	{
		node tmp;
		tmp.value=it->first;
		tmp.cnt=it->second;
		p2.push_back(tmp);
	}	
	sort(p1.begin(),p1.end());
	sort(p2.begin(),p2.end());
	if( p1[0].value==p2[0].value )
	{
		if( p1.size()==1 && p2.size()==1 )
		{
			cout<<n-p1[0].cnt<<endl;
		}
		else if( p1.size()==1 )
			cout<<n-p1[0].cnt-p2[1].cnt<<endl;
		else if( p2.size()==1 )
			cout<<n-p1[1].cnt-p2[0].cnt<<endl;
		else
		{
			int m=max(p1[0].cnt+p2[1].cnt,p1[1].cnt+p2[0].cnt);
			cout<<n-m<<endl;
		}
	}
	else
		cout<<n-p1[0].cnt-p2[0].cnt<<endl;
	return 0;
	}



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

int main() {
	int w,h,x,y,r;
	cin >> w >> h >> x >> y >> r;
	if(((x - r) >= 0) && ((x + r) <= w) && ((y - r) >= 0) && ((y + r) <= h)) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
    double r;  cin >> r;
    cout << 2 * r * 3.14159265 << endl;
	return 0;
}


Measured memory_bytes: 3788
/*import java.util.*;
import java.io.*;
import java.lang.*;
// ArrayList<Integer>[] arr=new ArrayList[n];
public class Main_E{	
public static void main(String[] args) throws FileNotFoundException, IOException{
        Scanner s = new Scanner(System.in);
         StringBuilder sb=new StringBuilder();
         BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
         int n=s.nextInt(),w=s.nextInt();
        int[][] arr=new int[n+1][2];
        long[][] dp=new long[100001][101];
        
        for(int i=1;i<100001;i++){
            Arrays.fill(dp[i],(long)1e13); 
        }
        dp[0][0]=0;
        //dp[i][j] hold- minimum wt needed to get i values given j objects
        for(int i=1;i<=n;i++){
            arr[i][0]=s.nextInt(); arr[i][1]=s.nextInt();
        }

        for(int i=1;i<100001;i++){
            for(int j=1;j<=n;j++){
                if(arr[j][1]<=i){
                    dp[i][j]=Math.min(dp[i][j-1],arr[j][0]+dp[i-arr[j][1]][j-1]);
                }
                else{
                    dp[i][j]=dp[i][j-1];
                }
                //else{dp[j]=(long)1e13;}
            }
        }
        int res=0;
        for(int i=1;i<100001;i++){
            if(dp[i][n]<=w){res=i;}
        }       
        System.out.println(res);
    }
}

*/





import java.util.*;
import java.io.*;
import java.lang.*;
// ArrayList<Integer>[] arr=new ArrayList[n];
public class Main{  
public static void main(String[] args) throws FileNotFoundException, IOException{
        Scanner s = new Scanner(System.in);
         StringBuilder sb=new StringBuilder();
         BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
         int n=s.nextInt(),w=s.nextInt();
        int[][] arr=new int[n+1][2];
        long[][] dp=new long[101][100001];
        
        for(int i=0;i<101;i++){
            Arrays.fill(dp[i],(long)1e13); 
        }
        for(int i=0;i<101;i++){
            dp[i][0]=0; 
        }
       
        //dp[i][j] hold- minimum wt needed to get i values given j objects
        for(int i=1;i<=n;i++){
            arr[i][0]=s.nextInt(); arr[i][1]=s.nextInt();
        }

        for(int i=1;i<=n;i++){
            for(int j=1;j<100001;j++){
                if(arr[i][1]<=j){
                    dp[i][j]=Math.min(dp[i-1][j],arr[i][0]+dp[i-1][j-arr[i][1]]);
                }
                else{
                    dp[i][j]=dp[i-1][j];
                }
                //else{dp[j]=(long)1e13;}
            }
        }
        int res=0;
        for(int i=1;i<100001;i++){
            if(dp[n][i]<=w){res=i;}
        }       
        System.out.println(res);
    }
}


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

int main() {
  string a;
  string b;
  cin >> a >> b;
  int len = a.length();
  int count = 0;
  rep(i,len) {
    if ( a[i] != b[i] ) count++;
  }
  
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 3856
import math

N,M = map(int,input().split())


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

a = combinations_count(N, 2) if N > 1 else 0
b = combinations_count(M, 2) if M > 1 else 0

print(a + b)





Measured memory_bytes: 2940
N = gets.to_i
Ps = (0...N).map{ |i|
  x,y = gets.split.map &:to_f
  theta = Math.atan2(x,y)
  [theta,i,x,y]
}.sort

Ds = Ps + Ps

R2 = (0...N).map{ |k|
  t,i,x,y = Ds[k]
  v = [x,y]
  r = x**2 + y**2
  Ds[k+1..-1].each{ |t2,i2,x2,y2|
    break if i == i2
    v[0] += x2; v[1] += y2
    r = [r, v[0]**2 + v[1]**2].max
  }
  r
}.max

puts Math.sqrt(R2)


Measured memory_bytes: 1916
object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val v = new Array[Long](n)
    for (i <- 0 until n) {
      v(i) = sc.nextLong
    }
    var count = 0
    var max = 0
    for (i <- 0 until n - 1) {
      if (v(i) >= v(i + 1)) {
        count += 1
        max = math.max(max, count)
      } else {
        count = 0
      }
    }

    println(max)
  }
}


Measured memory_bytes: 53512
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	#endif

	int n;
	cin >> n;
	vector<ll> frq(n);
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		ll inp;
		cin >> inp;
		ll cr = i - inp;
		if(cr > 0) ans += frq[cr];
		ll ot = i + inp;
		if(ot < n) frq[ot]++;
	}
	cout << ans << '\n';
}



Measured memory_bytes: 4820
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;

int main() {
  int64_t N, H, W, ans;
  cin >> N >> H >> W;
  ans=0;
  vector<int64_t> A(N);
  vector<int64_t> B(N);
  for (int64_t i=0; i<N; i++) {
    cin >> A[i] >> B[i];
  }
  for (int64_t j=0; j<N; j++) {
    if (A[j]>=H && B[j]>=W) {
      ans=ans+1;
    }
  }
  cout << ans << endl;
}


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

const int MAX = 5100000;
const int MOD = 1000000007;
vector<ll>fac(MAX);
vector<ll>finv(MAX);
vector<ll>inv(MAX);
// テーブルを作る前処理
void COMinit() {
	fac.at(0) = 1;
	fac.at(1) = 1;
	finv.at(0) = 1;
	finv.at(1) = 1;
	inv.at(1) = 1;
	for (int i = 2; i < MAX; i++) {
		fac.at(i) = fac.at(i - 1) * i % MOD;
		inv.at(i) = MOD - inv.at(MOD % i) * (MOD / i) % MOD;
		finv.at(i) = finv.at(i - 1) * inv.at(i) % MOD;
	}
}
// 二項係数計算
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac.at(n) * (finv.at(k) * finv.at(n - k) % MOD) % MOD;
}

int main() {
	COMinit();
	ll x, y;
	cin >> x >> y;
	if ((2 * y - x) % 3 != 0 || (2 * x - y) % 3 != 0 ||x==0||y==0){
		cout << 0 << endl;
		return 0;
	}
	ll u = (2 * y - x) / 3;
	ll r = (2 * x - y) / 3;
	ll t = u + r;
	cout << COM(t,r) << endl;
}

Measured memory_bytes: 119808
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn bfs(g: &Vec<Vec<usize>>, start: usize, n: usize) -> Vec<usize> {
    let mut dist = vec![std::usize::MAX; n];
    dist[start] = 0;
    let mut que = VecDeque::new();
    que.push_back(start);

    while let Some(v) = que.pop_front() {
        for node in &g[v] {
            if dist[*node] <= dist[v] {
                continue;
            }
            dist[*node] = dist[v] + 1;
            que.push_back(*node);
        }
    }
    dist
}

fn main() {
    input! {
        n: usize,
        ab: [(usize1, usize1); n-1],
    }
    let mut g = vec![vec![]; n];
    for &(a, b) in &ab {
        g[a].push(b);
        g[b].push(a);
    }

    let mut f_dist = bfs(&g, 0, n);
    let mut s_dist = bfs(&g, n - 1, n);

    let mut f_cnt = 0;
    let mut s_cnt = 0;

    for i in 0..n {
        if f_dist[i] <= s_dist[i] {
            f_cnt += 1;
        } else {
            s_cnt += 1;
        }
    }
    println!("{}", if f_cnt > s_cnt { "Fennec" } else { "Snuke" });
}


Measured memory_bytes: 14588
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int n;
string s;

int main() {
    fastio();

    cin >> n >> s;

    int rc = count(all(s), 'R');
    int ans = rc;
    int wc = 0;
    forn(i, n) {
        if (s[i] == 'W')
            wc++;
        else
            rc--;
        chmin(ans, max(wc, rc));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,k;
    cin>>n>>k;
    vector<pair<int,int>> num;
    for(int i=0;i<n;i++){
        int tmp1,tmp2;
        cin>>tmp1>>tmp2;
        num.emplace_back(tmp1,tmp2);
    }
    sort(num.begin(),num.end());
    for(auto i:num){
        k-=i.second;
        if(k<=0){
            cout<<i.first<<endl;
            break;
        }
    }
}


Measured memory_bytes: 1528
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
def time(x):
    return (x+9)//10*10
def last(x):
    return time(x)-x
sum_time=time(a)+time(b)+time(c)+time(d)+time(e)
ans=sum_time-max(last(a),last(b),last(c),last(d),last(e))
print(ans)

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

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

	int N;
	string s;
	cin >> N >> s;

	int h = 0, minH = 0;
	for(int i = 0; i < N; i++) {
		if(s[i] == '(') h++;
		else h--;
		minH = min(minH, h);
	}

	int l = -minH, r = h + l;
	s = string(l, '(') + s + string(r, ')');

	cout << s << endl;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

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

		int a = sc.nextInt();
		int b = a*a;
		int ans = a+b;
		b=a*a*a;
		ans=ans+b;


		System.out.println(ans);

	}

}


Measured memory_bytes: 35684
fn main() {
    let (x, y, z): (usize, usize, usize) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };

    println!("{} {} {}", z, x, y);
}

Measured memory_bytes: 2168
#include <stdio.h>
int main(void)
{
int H, W, i, j;

while(1){

scanf("%d %d", &H, &W);

if(H == 0 && W == 0)break;

for(i = 0; i < H; i++){

for(j = 0; j < W; j++){
printf("#");}

printf("\n");}

printf("\n");}

return 0;
}


Measured memory_bytes: 2000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector< vector<int> > Graph;
int n[2],m[2];
map<string,int> mp;
vector<int> vp;
int cnt=1;

vector<Graph> Forest_to_Trees(Graph &G){
	vector<int> num(n[0],-1);
	vector<Graph> tree;
	for(int i=0;i<n[0];i++){
		if(num[i]==-1){
			Graph gra(1);
			queue<int> q;
			q.push(i);
			int cur=0;
			num[i]=0;
			while(q.size()){
				int v=q.front();
				q.pop();
				for(int j=0;j<G[v].size();j++){
					int nv=G[v][j];
					if(num[nv]==-1){
						num[nv]=++cur;
						gra.push_back(vector<int>());
						gra[num[v]].push_back(num[nv]);
						gra[num[nv]].push_back(num[v]);
						q.push(nv);
					}
				}
			}
			tree.push_back(gra);
		}
	}
	return tree;
}


int calc2(Graph &G2,int v,int parent){
	if(G2[v].size()==0)return 1;
	if(G2[v].size()==1 && parent!=-1)return 1;
	vector<string> s;
	for(int i=0;i<(int)G2[v].size();i++){
		int nv=G2[v][i];
		if(parent==nv)continue;
		int val=calc2(G2,nv,v);
		s.push_back(to_string(val));
	}
	sort(s.begin(),s.end());
	string str="";
	for(int i=0;i<s.size();i++){
		if(i!=0)str+=',';
		str+=s[i];
	}
	if(!mp.count(str))mp.insert(map<string,int>::value_type(str,++cnt));
	return mp[str];
}

void dfs2(Graph &G2,int v,vector<int> &dist){
	if(dist[v]==-1)dist[v]=0;
	for(int i=0;i<G2[v].size();i++){
		if(dist[G2[v][i]]==-1){
			dist[G2[v][i]]=dist[v]+1;
			dfs2(G2,G2[v][i],dist);
		}
	}
}

vector<int> getCenter(Graph &G){
	int nn=G.size();
	vector<int> dist(nn,-1);
	vector<int> dist2(nn,-1);
	vector<int> dist3(nn,-1);
	dfs2(G,0,dist);
	int maxi=-1;
	int tgt=0;
	for(int i=0;i<nn;i++){
		if(dist[i]>maxi){
			maxi=dist[i];
			tgt=i;
		}
	}
	dfs2(G,tgt,dist2);
	maxi=-1;
	for(int i=0;i<nn;i++){
		if(dist2[i]>maxi){
			maxi=dist2[i];
			tgt=i;
		}
	}
	dfs2(G,tgt,dist3);
	vector<int> res;
	for(int i=0;i<nn;i++){
		if(maxi%2==0){
			if(dist2[i]==maxi/2 && dist3[i]==maxi/2)res.push_back(i);
		}else{
			if(dist2[i]==(maxi+1)/2 && dist3[i]==maxi/2)res.push_back(i);
			if(dist2[i]==maxi/2 && dist3[i]==(maxi+1)/2)res.push_back(i);
		}
	}
	return res;
}

int main(void){
	Graph g2;
	scanf("%d%d",&n[0],&m[0]);
	Graph G(n[0]);
	for(int i=0;i<m[0];i++){
		int f,t;
		scanf("%d%d",&f,&t);
		f--;
		t--;
		G[f].push_back(t);
		G[t].push_back(f);
	}
	vector<Graph> tree=Forest_to_Trees(G);
	scanf("%d",&n[1]);
	m[1]=n[1]-1;
	for(int i=0;i<n[1];i++){
		g2.push_back(vector<int>());
	}
	for(int i=0;i<m[1];i++){
		int f,t;
		scanf("%d%d",&f,&t);
		f--;
		t--;
		g2[f].push_back(t);
		g2[t].push_back(f);
	}
	vector<int> root[2];
	root[1]=getCenter(g2);
	mp["0"]=1;
	for(int i=0;i<root[1].size();i++){
		vp.push_back(calc2(g2,root[1][i],-1));
	}
	int res=0;
	for(int i=0;i<tree.size();i++){
		if(tree[i].size()!=n[1])continue;
		root[0].clear();
		root[0]=getCenter(tree[i]);
		bool flag=false;
		for(int j=0;j<root[0].size();j++){
			if(flag)break;
			int s1=calc2(tree[i],root[0][j],-1);
			for(int k=0;k<vp.size();k++){
				if(s1==vp[k])flag=true;
			}
		}
		if(flag)res++;
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 55672
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author toshibablack
 */

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) for(int i=0;i<n;++i)
#define FOREACH(x, a) for(auto& (x) : (a))
#define ALL(a) (a).begin(),(a).end()
#define COUT(x) out << (x) << endl;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;


class ATransfer {
public:
    int a, b, c;

    void solve(std::istream& in, std::ostream& out) {
        in >> a >> b >> c;
        COUT(max(c - (a - b), 0));
    }
};


int main() {
    ATransfer solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
main = do
  [x, y] <- map read . words <$> getLine :: IO [Float]
  let kame = - x + y/2
  let tsuru = x - kame
  putStrLn $ if (round y) `mod` 2 == 0
     then if  kame >= 0 && tsuru >= 0
             then "Yes"
             else "No"
     else "No"


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

struct Card {
    string s;

    char mark;
    int number;

    Card() {}
    Card(string _s) {
        s = _s;

        mark = s[0];
        number = s[1] - '0';
    }

    bool operator>(const Card& a) const {
        return number > a.number;
    }
};

int bubbleSort(Card a[], int n) {
    int total_swap = 0;
    int swap_;
    int i = 0;

    do {
        swap_ = 0;

        for (int j = n - 1; j > i; j--) {
            if (a[j -1] > a[j]) {
                swap(a[j -1], a[j]);
                swap_++;
            }
        }

        total_swap += swap_;
        i++;
    } while (swap_ > 0);

    return total_swap;
}

int selectionSort(Card a[], int n) {
    int total_swap = 0;

    for (int i = 0; i < n - 1; i++) {
        int min = i;
        for (int j = i + 1; j < n; j++) { if (a[min] > a[j]) min = j;
        }

        if (i != min) {
            swap(a[i], a[min]);
            total_swap++;
        }
    }

    return total_swap;
}

bool isStable(Card in[], Card out[], int n) {
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            for (int a = 0; a < n; a++) {
                for (int b = a + 1; b < n; b++) {
                    if (in[i].number == in[j].number && in[i].s == out[b].s && in[j].s == out[a].s) return false;
                }
            }
        }
    }
    return true;
}

void printCard(Card a[], int n) {
    for (int i = 0; i < n; i++) {
        if (i) cout << " ";
        cout << a[i].s;
    }
    cout << endl;
}

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

    Card a[n], b[n];

    string s;
    for (int i = 0; i < n; i++) {
        cin >> s;
        a[i] = Card(s);
    }

    for (int i = 0; i < n; i++) b[i] = a[i];
    bubbleSort(b, n);
    printCard(b, n);
    cout << "Stable" << endl;

    for (int i = 0; i < n; i++) b[i] = a[i];
    selectionSort(b, n);
    printCard(b, n);
    cout << (isStable(a, b, n) ? "Stable" : "Not stable") << endl;

    return 0;
}



Measured memory_bytes: 3180
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BC
import           Data.Maybe            (fromJust)
import qualified Data.Vector.Unboxed   as VU

main :: IO ()
main = do
  n <- readLn
  as <- getInts
  putStr . unlines . map show $ solve n as

solve :: Int -> [Int] -> [Int]
solve n as =  map skip [1 .. n] where
  va = VU.fromList  $ 0 : as ++ [0]
  d = sum $ zipWith cost [0 .. n + 1] [1 .. n + 1]
  skip i = d - cost (i - 1) i - cost i (i + 1) + cost (i - 1) (i + 1)
  cost i j = abs $ va `VU.unsafeIndex` i - va `VU.unsafeIndex` j

readInts :: BC.ByteString -> [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words

getInts :: IO [Int]
getInts = readInts <$> BC.getLine


Measured memory_bytes: 7420
#include <set>
#include <vector>
#include <iostream>

using namespace std;

#define int long long

const int N = 3e5 + 10;

int c[N];
vector<int> r[N];
set<pair<int, int>> sc;

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);    
  int h, w, m;
  cin >> h >> w >> m;
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    r[x].push_back(y);
    ++c[y];    
  }
  for (int i = 1; i < N; ++i) {
    sc.insert({c[i], i});
  }
  int ans = 0;
  for (int i = 1; i < N; ++i) {
    for (int &y : r[i]) {
      sc.erase(sc.find({c[y], y}));
      sc.insert({c[y] - 1, y});
    }
    auto it = sc.end();
    --it;
    ans = max(ans, it->first + (int)r[i].size());
    for (int &y : r[i]) {
      sc.erase(sc.find({c[y] - 1, y}));
      sc.insert({c[y], y});
    }
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 40672
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = input()
ans = 0
L = []
for i in range(N):
    if i <= K - 1:
        if T[i] == "r":
            ans += P
            L.append("p")
        elif T[i] == "s":
            ans += R
            L.append("r")
        else:
            ans += S
            L.append("s")
    else:
        if T[i] == "r":
            if L[i-K] != "p":
              ans += P
              L.append("p")
            else:
                if i + K <= (N - 1):
                    if T[i + K] == "s":
                        L.append("s")
                    else:
                        L.append("r")
                else:
                    L.append("r")
        elif T[i] == "s":
            if L[i-K] != "r":
              ans += R
              L.append("r")
            else:
                if i+K<=(N - 1):
                    if T[i + K] == "p":
                        L.append("p")
                    else:
                        L.append("s")
                else:
                    L.append("s")

        else:
            if L[i-K] != "s":
                ans += S
                L.append("s")
            else:
                if i+K<=(N - 1):
                    if T[i + K] == "r":
                        L.append("r")
                    else:
                        L.append("p")
                else:
                    L.append("p")
print(ans)


Measured memory_bytes: 4212
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <utility>
using namespace std;

int main() {
  bool isSame(int a, int b, int c);
  cin.tie(0);
  ios::sync_with_stdio(false);
  int c[3][3];
  for (int i = 0; i < 3; i++) {
    cin >> c[i][0] >> c[i][1] >> c[i][2];
  }
  if (isSame(c[0][0]-c[0][1], c[1][0]-c[1][1], c[2][0]-c[2][1]) &&
      isSame(c[0][1]-c[0][2], c[1][1]-c[1][2], c[2][1]-c[2][2]) &&
      isSame(c[0][0]-c[1][0], c[0][1]-c[1][1], c[0][2]-c[1][2]) &&
      isSame(c[1][0]-c[2][0], c[1][1]-c[2][1], c[1][2]-c[2][2])) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

bool isSame(int a, int b, int c) {
  return a == b && b == c && c == a;
}


Measured memory_bytes: 256
# 人を頂点と見なしたグラフを作る。有向で、逆向きの場合は正負を反転させて辺を張る
# 頂点からの距離を記録し、一致しない箇所があればNG。
# 全ての辺を通るまで続ける。
# 辺の情報を[{0から行ける頂点},{1から行ける頂点},...]で管理する
# 親には進まないようにしてDFSする

N,M = map(int,input().split())
E = [[] for i in range(N)]
for i in range(M):
  L,R,D = map(int,input().split())
  E[L-1].append([R-1,D])
  E[R-1].append([L-1,-D])
from collections import deque
# 頂点、親、距離
INF = 10 ** 10
dist = [INF] * N
for i in range(N):
  if dist[i] != INF:
    continue
  dist[i] = 0
  q = deque()
  # 頂点、親
  q.append([i,-1])
  while q:
    v,parent = q.popleft()
    for child in E[v]:
      if child[0] == parent:
        continue
      if dist[child[0]] == INF:
        dist[child[0]] = dist[v] + child[1]
        q.append([child[0],v])
      else:
        if dist[child[0]] != dist[v] + child[1]:
          print("No")
          exit(0)
else:
  print("Yes")


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

int main() {
  int n,x;
  cin>>n;
  x=0;
  vector<int> v(n);
  for(int i=0; i<n; i++){
    cin>>v[i];
  }
  sort(v.begin(),v.end());
  for(int i=0; i<n-1; i++){
    if(v[i]==v[i+1]){
      x++;
    }
  }
  cout<<v.size()-x<<endl;
}

Measured memory_bytes: 3612
#include "bits/stdc++.h"
using namespace std;
 
#define nl '\n'
#define ll long long 
#define ull unsigned long long
#define debug(x)       { cerr << #x << " = " << x << endl; } 
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
 
const int Max = (int)2e5+5;
 
//functions
ll lcm(ll a,ll b) {if(a==0 || b==0){return 0;}else{return (a*b)/__gcd(a,b);}}
 
//direction arry
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
 
//____________________________________________________________________________________________________
void solve()
{
    int n;
    scanf("%d",&n);
    ll sum = 0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            for(int k=1;k<=n;k++)
            {
                sum+=__gcd(__gcd(i,j),k);
            }
        }
    }
    cout<<sum<<endl;
}
int main()
{
    fastread;
    int tc=1;
    // cin>>tc;
    while(tc--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
using namespace std;
ll n;
int32_t main(){
CODE_START;
cin>>n;
cout<<3*n*n;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define vsort(v) sort(v.begin(), v.end())
typedef long long ll;
using namespace std;
int main()
{
	ll N, K, sum = 0;
  	cin >> N >> K;
  	vector<ll> H(N);
  	for (ll i = 0; i < N; i++) {
    	cin >> H[i];
    }
  	vsort(H);
  	for (ll i = 0; i < N - K; i++) {
    	sum += H[i];
    }
  	cout << sum << endl;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> A(n+1), B(n);
  rep(i, n+1) cin >> A[i];
  rep(i, n) cin >> B[i];
  ll ans = 0;
  rep(i, n) {
    if(B[i] > A[i]) {
      ans += A[i];
      ans += min(A[i+1], B[i]-A[i]);
      A[i+1] = max(0LL, A[i+1]-B[i]+A[i]);
    } else {
      ans += B[i];
      A[i] -= B[i];
    }
  }
  cout << ans << "\n";
  return 0;
}


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

int main() {
  
  string S; getline(cin, S);
  
  for (int i = 0; i < S.size(); i++) {
    
    char alp = S.at(i);
    
    if ('a' <= alp && alp <= 'z') alp -= 32;
    
    else if ('A' <= alp && alp <= 'Z') alp += 32;
    
    S.at(i) = alp;
    
  }
  
  cout << S << endl;
  
}


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

F = []
for i in range(N):
    tmp = list(map(int,input().split()))
    F.append(tmp)

P = []
for i in range(N):
    tmp = list(map(int,input().split()))
    P.append(tmp)

ans = -1e10
for bits in range(1<<10):
    if bits == 0: continue

    cnt = [0 for i in range(N)]
    for i in range(10):
        if not (bits>>i & 1): continue 

        for shop in range(N):
            if F[shop][i]: cnt[shop] += 1
    
    benefit = 0
    for shop in range(N):
        benefit += P[shop][cnt[shop]]
    
    ans = max(ans, benefit)

print(ans)

Measured memory_bytes: 3188
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define INF 1LL<<60
#define PI acos(-1)
typedef long long ll;
typedef pair<int, int> p_ii;


int main() {
	
	int n, i;
	cin >> n >> i;
	cout << n - i + 1 << endl;

	return 0;
}

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


ll K, X, Y;

ll dist( ll x0, ll y0, ll x1, ll y1 ){
	return abs(x0-x1)+abs(y0-y1);
}

void output( ll x, ll y ){
	cout << x << " " << y << endl;
}

void last2step( ll x0, ll y0 ){
	for ( ll x1 = -K; x1 <= K; x1++ ){
		for ( ll sgn = -1; sgn <= 1; sgn += 2 ){
			ll y1 = sgn * (K-abs(x1));
			if ( dist( x0+x1, y0+y1, X, Y ) == K ){
				output( x0+x1, y0+y1 );
				output( X, Y );
				return;
			}
		}
	}
}

void move_to_k( ll &x0, ll &y0, int step )
{
	for ( int i = 0; i < step; i++ ){
		if ( abs(X)-abs(x0) > abs(Y)-abs(y0) )
			x0 += (X<0 ? -K : K);
		else
			y0 += (Y<0 ? -K : K);
		output( x0, y0 );
	}
}

int main(){
	cin >> K;
	cin >> X >> Y;
	
	ll x0 = 0, y0 = 0;
	ll dist = abs(X)+abs(Y);
	ll step = dist / K;
	ll remain = dist % K;
	
	if ( K % 2 == 0 ){
		if ( dist % 2 == 0 ){
			if ( step == 0 ){
				cout << 2 << endl;
				last2step( x0, y0 );
			}
			else {
				if ( remain == 0 ){
					cout << step << endl;
					move_to_k( x0, y0, step-1 );
					output( X, Y );
				}
				else {
					cout << step+1 << endl;
					move_to_k( x0, y0, step-1 );
					last2step( x0, y0 );
				}
			}
		}
		else {
			cout << "-1" << endl;
		}
	}
	else {
		if ( step == 0 ){
			if ( remain % 2 == 0 ){
				cout << 2 << endl;
				last2step( x0, y0 );
			}
			else {
				cout << 3 << endl;
				move_to_k( x0, y0, 1 );
				last2step( x0, y0 );
			}
		}
		else {
			if ( remain == 0 ){
				cout << step << endl;
				move_to_k( x0, y0, step-1 );
				output( X, Y );
			}
			else {
				if ( remain % 2 == 0 )
					step++;
				cout << step+1 << endl;
				move_to_k( x0, y0, step-1 );
				last2step( x0, y0 );
			}
		}
	}
	
	
	return 0;
}



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

int main() {
  int N, ret = 1;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < N-1; i++) {
    if (vec.at(i) < vec.at(i+1))
      ret ++;
  }
  cout << ret << endl;
}


Measured memory_bytes: 256
#include <time.h>

#include <stdlib.h>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
#include <numeric>

using namespace std;

struct near{
	int32_t left_index;
	int32_t right_index;
};
near bsearch_area(vector<int64_t>& array,int64_t value,int32_t left,int32_t right){
	if(right-left==1){
		return near{left,right};
	}
	int32_t center=(left+right)/2;
	if(array.at(center)>value){
		return bsearch_area(array,value,left,center);
	}else{
		return bsearch_area(array,value,center,right);
	}
}

int main() {
	int32_t A,B,Q;
	cin>>A>>B>>Q;
	vector<int64_t> shrine;
	shrine.reserve(A);
	vector<int64_t> temple;
	temple.reserve(B);
	for(int32_t i=0;i<A;i++){
		int64_t temp;
		cin>>temp;
		shrine.push_back(temp);
	}
	for(int32_t i=0;i<B;i++){
		int64_t temp;
		cin>>temp;
		temple.push_back(temp);
	}
	vector<int64_t> x;
	x.reserve(Q);
	for(int i=0;i<Q;i++){
		int64_t temp;
		cin>>temp;
		x.push_back(temp);
	}
	for(int i=0;i<Q;i++){
		int64_t pos=x.at(i);
		int64_t shrine_left;
		int64_t shrine_right;
		int64_t temple_left;
		int64_t temple_right;
		if(pos<shrine.at(0)){
			shrine_left=100000000000000;
			shrine_right=shrine.at(0)-pos;
		}else if(pos>shrine.at(A-1)){
			shrine_right=100000000000000;
			shrine_left=pos-shrine.at(A-1);
		}else{
			near a=bsearch_area(shrine,pos,0,A-1);
			shrine_right=shrine.at(a.right_index)-pos;
			shrine_left=pos-shrine.at(a.left_index);
		}

		if(pos<temple.at(0)){
			temple_left=100000000000000;
			temple_right=temple.at(0)-pos;
		}else if(pos>temple.at(B-1)){
			temple_right=100000000000000;
			temple_left=pos-temple.at(B-1);
		}else{
			near a=bsearch_area(temple,pos,0,B-1);
			temple_right=temple.at(a.right_index)-pos;
			temple_left=pos-temple.at(a.left_index);
		}

		int64_t c_ans=100000000000000;
		if(max(shrine_right,temple_right)<c_ans){
			c_ans=max(shrine_right,temple_right);
		}
		if(max(shrine_left,temple_left)<c_ans){
			c_ans=max(shrine_left,temple_left);
		}
		if(shrine_left*2+temple_right<c_ans){
			c_ans=shrine_left*2+temple_right;
		}
		if(shrine_right*2+temple_left<c_ans){
			c_ans=shrine_right*2+temple_left;
		}
		if(shrine_left+temple_right*2<c_ans){
			c_ans=shrine_left+temple_right*2;
		}
		if(shrine_right+temple_left*2<c_ans){
			c_ans=shrine_right+temple_left*2;
		}
		cout<<c_ans<<endl;



	}




}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main() {
  int a; cin >> a;
  int ans = 0;
  for (int i = 0; i < a; i ++, ans ++)
    for (int j = 0; j < a; j ++, ans ++)
      for (int k = 0; k < a; k ++, ans ++)
        {}
  cout << ans << endl;
}

Measured memory_bytes: 3540
n=int(input())
s=input()
w=[0]*(n+2)
e=[0]*(n+2)
for i in range(n):
  if s[i]=='W':w[i+1]=1
  else:e[i+1]=1
for i in range(1,n+2):
  w[i]+=w[i-1]
  e[-i-1]+=e[-i]
ans=10**9
for i in range(1,n+1):
  ans=min(ans,w[i-1]+e[i+1])
print(ans)

Measured memory_bytes: 33008
use proconio::{input, fastout};

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        d: usize,
    }

    match d {
        22 => println!("Christmas Eve Eve Eve"),
        23 => println!("Christmas Eve Eve"),
        24 => println!("Christmas Eve"),
        25 => println!("Christmas"),
        _ => return,
    }

}


Measured memory_bytes: 2124