akhauriyash/Code-Regression huggingface dataset:
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
// }}}

int N;
int w[100];
int s[100];

void solve()
{
    int ans = INF;
    REP(i, N){
        s[i] = (i-1 >= 0 ? s[i-1] : 0) + w[i];
    }
    REP(i, N-1){
        ans = min(ans, abs(s[N-1]-s[i]-s[i]));
    }
    cout << ans << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    REP(i, N) cin >> w[i];
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 256
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    abcde = [int(input()) for _ in range(5)]
    k = ni()
    for i in range(5):
        for j in range(i, 5):
            if k < abs(abcde[i] - abcde[j]):
                print(':(')
                return
    print('Yay!')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9140
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;
    static CF_Reader in;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        in = new CF_Reader();

        out.println(in.intNext() * in.intNext());

        out.close();
    }


    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

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

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

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}




Measured memory_bytes: 32820
import itertools

def main():
    k,s=map(int,input().split())
    count = 0
    for x,y in itertools.product(range(k+1), repeat=2):
        if 0 <= s-(x+y) <= k:
            count += 1
    print(count)
        
if __name__ == "__main__":
    main()

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

using ll=long long;

int main() {
  int N; cin >>N;
  int ans=0;
  rep_eq(i,1,N) {
    int a; cin >>a;
    if (i%2==1 and a%2==1) {
      ans++;
    }
  }
  cout <<ans <<endl;
  return 0;
}


Measured memory_bytes: 3636
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  ll cur, ans = 0;
  vll as(n);
  rep(i, n){
    ll a;
    cin >> a;
    if(i == 0){
      ans += a - 1;
      cur = 1;
    } else {
      if(a == cur + 1){
        cur++;
      } else if (a > cur + 1) {
        ans += (a-1)/(cur+1);
      }
    }
    as[i] = cur;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4036
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] height = new int[N+1];
		int[] dp = new int[N+1];
		for(int i = 1; i <= N; i++) {
			height[i] = sc.nextInt();
		}
		dp[1] = 0;
		dp[2] = Math.abs(height[2]-height[1]);
		for(int i = 3; i <= N; i++) {
			int jump1 = Math.abs(height[i]-height[i-1]);
			int jump2 = Math.abs(height[i]-height[i-2]);
			dp[i] = Math.min(dp[i-1]+jump1,dp[i-2]+jump2);
		}
		System.out.println(dp[N]);
	}
}

Measured memory_bytes: 59312
#include <iostream>

using namespace std;

int n;
int a[100000];
long long result;
int lowest_abs_val;

void enter()
{

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

}

void process()
{

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

    if (a[n-1] >= 0)
    {
        for (int i = 0 ; i < n ; i++)
            result += a[i];
    }
    else
    {
        lowest_abs_val = abs(a[0]);
        for (int i = 0 ; i < n ; i++)
            {
                result += abs(a[i]);
                lowest_abs_val = min(lowest_abs_val,abs(a[i]));
            }
        result -= 2*lowest_abs_val;
    }
}

void print()
{

    cout << result;

}

int main()
{

    enter();
    process();
    print();
    return 0;

}


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

int main() {
 int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  int z=max(x,y);
  int ans=1e9;
  for(int i=0;i<=2*z;i++){
    int A=max(0,x-i),B=max(0,y-i),sum;
    sum=2*i*c+A*a+B*b;
    ans=min(ans,sum);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
// A.

#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	string a, b, c, d;
	cin >> a >> b >> c >> d;
	string e = a + b + c + d;
	sort(e.begin(), e.end());
	string ans = e == "1479" ? "YES" : "NO";
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
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;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
ll n;
vector<ll> a;
bool check(vector<ll> &bit, ll &r){
    if(r >= n) return false;
    for(int i = 0; i < 22; i++){
        if(a[r] & (1 << i)){
            if(bit[i] + 1 > 1){
                return false;
            }
        }
    }
    return true;
}
int main(void){
    cin >> n;
    a.resize(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    vector<ll> bit(22, 0);
    ll r = 0;
    ll ans = 0;
    for(ll l = 0; l < n; l++){
        while(check(bit, r)){
            for(int i = 0; i < 22; i++){
                if(a[r] & (1 << i)){
                    bit[i]++;
                }
            }
            //cout << l << " " << r << endl;
            r++;
        }

        ans += (r - l);
        //if(r == l) r++;

        for(int i = 0; i < 22; i++){
            if(a[l] & (1 << i)){
                bit[i]--;
            }
        }
    }
    cout << ans << endl;
}   

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;

using ll = long long;
#define pb push_back
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(v) v.begin(), v.end()
#define file freopen("in.txt", "r", stdin);
#define pii pair<int, int>
#define pll pair<ll, ll>

const int maxn = 1e5 + 5;
int arr[maxn];
ll dp[maxn];
int n;
ll call(int i){
	if(i >= n-1){
		return 0;
	}
	if(dp[i] != -1)return dp[i];
	ll ret = 1e11;
	if(i+1 <= n-1)ret = min(ret, abs(arr[i] - arr[i+1])+call(i+1));
	if(i+2 <= n-1)ret = min(ret, abs(arr[i] - arr[i+2]) + call(i+2));
	return dp[i] = ret;
}

int main(){
	//file
	scanf("%d", &n);
	for(int i=0; i<n; i++)scanf("%d", &arr[i]);
	memset(dp, -1, sizeof dp);
	cout<<call(0)<<endl;
}

Measured memory_bytes: 6144
from cmath import phase

r,c,n = map(int,input().split())
l = list()
for i in range(n):
  w,x,y,z = map(int,input().split()) 
  if (w in (0,r) or x in (0,c)) and (y in (0,r) or z in (0,c)):
    l.append((i,w-r/2+(x-c/2)*1j))
    l.append((i,y-r/2+(z-c/2)*1j))
l.sort(key=lambda t: phase(t[1]))
p = list()
for x,c in l:
  if p == [] or p[-1] != x:
    p.append(x)
  else:
    p.pop()
ans = ["NO", "YES"]
print(ans[p==[]])
  

Measured memory_bytes: 35104
#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int N,A,B,C;
  cin>>N>>A>>B>>C;
  vector<int>D(N,0);
  for(int i=0;i<N;i++)cin>>D[i];
  vector< vector<int> >dp(N+1,vector<int>(A+N*B+1,0));
  dp[0][A]=C;
  for(int i=0;i<N;i++){
    for(int j=A;j<=A+N*B;j++){
      dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
      if(j+B<=A+N*B)dp[i+1][j+B]=max(dp[i][j+B],dp[i][j]+D[i]);
    }
  }
  int ans=0;
  for(int j=A;j<=A+N*B;j++){
    ans=max(ans,dp[N][j]/j);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 0
#include <stdio.h>


int main()
{
	double w,h,x,y;
	int flag=0;
	
	scanf("%lf %lf %lf %lf",&w,&h,&x,&y);
	if(x==w/2&&y==h/2)flag=1;
	
	printf("%f %d",(w*h/2),flag);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i,n)   for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(long long i=(a);((a)<(b)?i<=(b):i>=(b));((a)<(b)?++i:--i))
#define ALL(v)     (v).begin(),(v).end()
#define debug(x)   cerr<<#x<<": "<<(x)<<endl
using namespace std;
using llong = long long;
using vi    = vector<int>;
using vvi   = vector<vi >;
using vvvi  = vector<vvi >;
using pii   = pair<int,int>;
constexpr int    INF=1e9;
constexpr double EPS=1e-9;
constexpr int    MOD=1e9+7;
template<class Type>
void line(const Type &a){int cnt=0;for(const auto &elem:a){cerr<<(cnt++?' ':'>');cerr<<elem;}cerr<<endl;}

int main(){//Refering other editorials.
	int n;
	llong k;
	cin>>n>>k;
	
	vector<llong> a(n),f(n);
	REP(i,n) cin>>a[i];
	REP(i,n) cin>>f[i];
	sort(ALL(a));
	sort(ALL(f),greater<llong>());
	
	llong l=-1LL,r=1e18;
	while(r-l>1){
		llong mid=(l+r)/2;
		llong need=0LL;
		REP(i,n){
			llong hoge=mid/f[i];
			if(a[i]-hoge>0) need+=a[i]-hoge;
		}
		
		if(need>k) l=mid;
		else r=mid;
	}
	
	cout<<r<<endl;
}

Measured memory_bytes: 6428
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MaxN 100003
#define Max(A,B) (A>B?A:B)
#define Min(A,B) (A<B?A:B)

int A,B;
int Q,Pa,Pb;
ll Ldisa,Rdisa,Ldisb,Rdisb;
ll Ans;
ll s[MaxN],t[MaxN],x;

inline ll Rd() {
	
	ll x=0; int f=1; char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-') f=-1;ch=getchar(); }
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*f;
}
inline void CkMin(ll &aa,ll bb) {
	if(aa>bb) aa=bb; return;
}
inline void CkMax(ll &aa,ll bb) {
	if(aa<bb) aa=bb; return;
}

int main() {

	register int i,L,R,Mid;
	A=Rd(),B=Rd(),Q=Rd();
	for(i=1;i<=A;++i) s[i]=Rd();
	for(i=1;i<=B;++i) t[i]=Rd();
	
	t[0]=s[0]=-100000000000000;
	t[B+1]=s[A+1]=100000000000000;
	
	while(Q--) {
		
		x=Rd(),Ans=1000000000000;
		L=1,R=A,Pa=0;
		while(L<=R) {
			Mid=(L+R)>>1;
			if(s[Mid]<=x) {
				Pa=Max(Pa,Mid),L=Mid+1;
			} else R=Mid-1;
		} Ldisa=x-s[Pa],Rdisa=s[Pa+1]-x;
		L=1,R=B,Pb=0;
		while(L<=R) {
			Mid=(L+R)>>1;
			if(t[Mid]<=x) {
				Pb=Max(Pb,Mid),L=Mid+1;
			} else R=Mid-1;
		} Ldisb=x-t[Pb],Rdisb=t[Pb+1]-x;
		CkMin(Ans,Max(Ldisa,Ldisb)),CkMin(Ans,Max(Rdisa,Rdisb));
		CkMin(Ans,Rdisb+Ldisa+Min(Rdisb,Ldisa)),CkMin(Ans,Rdisa+Ldisb+Min(Rdisa,Ldisb));
		printf("%lld\n",Ans);
	}
	
	return 0;
}

Measured memory_bytes: 2816
#include <iostream>
#include<bits/stdc++.h>
#define ll long long 
using namespace std;

int main() {
	// your code goes here
	int n;
	cin >> n;
	int a[n];
	double ans = 0;
	for(int i = 0; i < n; i++){
	    cin >> a[i];
	    ans += (1.0) / a[i];
	}
	ans = (1.0) / ans;
	printf("%.12lf\n", ans);

	return 0;
}


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

int main() {
  int N,A,D;
  cin >> N >> A;
  
  D=A-(N%500);

  if (D >= 0) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define INF 114514810

int n, k;
// vector<vector<edge> > G{120];
int dist[120];
int cost[120][120];

void dikstr(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(dist, dist + n, INF);
    dist[s] = 0;
    que.push(P(0, s));

    while(!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second; // ????????????
        if(dist[v] < p.first) continue;

        rep(i,n) {
            if(dist[i] > p.first + cost[p.second][i]) {
                dist[i] = p.first + cost[p.second][i];
                que.push(P(dist[i], i));
            }
        }
    }
}


int main(void) {
    while(1) {
        scanf("%d %d", &n, &k);
        if(n == 0 and k == 0) break;
        rep(i,n) rep(j,n) cost[i][j] = INF;

        rep(i,k) {
            int f,a,b,c,d,e;
            scanf("%d", &f);
            if(f == 0) {
                scanf("%d%d", &a, &b);
                a--; b--;
                dikstr(a);
                if(dist[b] >= INF) puts("-1");
                else
                    cout << dist[b] << "\n";
            } else if(f == 1) {
                scanf("%d%d%d", &c, &d, &e);
                c--; d--;
                cost[c][d] = cost[d][c] = min(cost[c][d], e);
            }
        }

        /* debug
        rep(i,n) rep(j,n) {
            printf("dist[%d][%d] = %d\n", i, j, dist[i][j]);
        }
        */
    }

    return 0;
}

Measured memory_bytes: 1268
#include<stdio.h>
#include<math.h>
int main(void)
{
	int a, b;
	while ((scanf("%d%d", &a, &b) != EOF)) {
		double n = 0,pro,bb=b;
		while (b) b /= 10, n++;
		pro = sqrt(a*pow(10.0, n) + bb);
		if ((pro - (int)pro) == 0)
			printf("Yes\n");
		else printf("No\n");
		
	}
	return 0;
}

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

int N, a[200005], b[200005], A[31][200005], B[31][200005];

void init(){
  
  int k = 2;
  
  for(int idx=1;idx<=30;idx++){
    
    for(int i=0;i<N;i++){
      A[idx][i] = a[i] % k;
      B[idx][i] = b[i] % k;
    }
    
    sort( B[idx], B[idx] + N );
    
    k *= 2;
            
  }
  
}

int get(int l, int r, int idx){ // [ l, r )
  auto L = lower_bound( B[idx], B[idx] + N, l );
  auto R = lower_bound( B[idx], B[idx] + N, r );

  return max( 0LL, (int)( R - L + 1 ) );
}

void solve(){
  
  int ans = 0;
  
  for(int i=1;i<30;i++){
    
    int cnt = 0;
    
    for(int j=0;j<N;j++){
      
      int num = A[i][j], T = 1<<(i-1);
      
      cnt += get( T - num, 2 * T - num, i );
      
      cnt += get( 3 * T - num, 4 * T - num, i );
      
    }
    
    if( cnt % 2 ) ans |= 1<<(i-1);
    
  }
  
  cout<<ans<<endl;
  
}

signed main(){
  
  cin>>N;
  
  for(int i=0;i<N;i++) cin>>a[i];
  
  for(int i=0;i<N;i++) cin>>b[i];
  
  init();
  
  solve();
  
  return 0;
}


Measured memory_bytes: 98688
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t;cin>>s>>t;
    int a,b;cin>>a>>b;
    string u;cin>>u;
    if(u==s){
        cout<<a-1<<" "<<b<<endl;
    }
    else if(u==t){
        cout<<a<<" "<<b-1<<endl;
    }
}

Measured memory_bytes: 256
#include <utility> // pair make_pair
using std::swap; // c++11
using std::pair;
using std::make_pair;
#include <tuple> // tuple(c++11) make_tuple(c++11)
using std::tuple; // get<address>(variable)
using std::make_tuple;
#include <string> // string stoi(c++11) stoll(c++11) to_string(c++11)
using std::string;
using std::stoi;
using std::stoll;
using std::to_string;
#include <queue> // queue priority_queue
using std::queue;
using std::priority_queue;
#include <stack> // stack
using std::stack;
#include <vector> // vector
using std::vector;
#include <map> // map
using std::map;
#include <set> // set
using std::set; // insert erase find count
#include <algorithm> // min max
using std::sort;
using std::lower_bound; // iterator,  >=
using std::upper_bound; // iterator,  >
using std::min;
using std::max;
using std::min_element; // iterator
using std::max_element; // iterator
#include <complex> // complex
using std::complex; // real imag
#include <iostream> // cin cout
using std::cin;
using std::cout;
using std::endl;
#include <iomanip> // setprecision fixed(manipulator)
using std::setprecision;
using std::fixed;
#include <cmath>
#include <cstdio>

#define lli long long int
#define INF (int)1e09
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define EFOR(i, m, n) for (int i = m; i <= n; i++)
#define RFOR(i, m, n) for (int i = m; i > n; i--)
#define REFOR(i, m, n) for (int i = m; i >= n; i--)
#define VSORT(v) sort((v).begin(), (v).end()) // sort vector
typedef pair<int, int> PI;
typedef tuple<int, int, int> TI;
template <typename T> using Vec = vector<T>; // c++11

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


Measured memory_bytes: 256
from math import ceil
from collections import deque
n,d,a = map(int,input().split())
m = [list(map(int,input().split())) for _ in range(n)]
m.sort()
l = [(x, ceil(h/a)) for x,h in m]

ans = 0
damage = 0
que = deque([])

for x,h in l:
    while que and que[0][0] < x:
            s,t = que.popleft()
            damage -= t
    need = max(0, h - damage)
    ans += need
    damage += need
    if need:
        que.append((x+2*d, need))
print(ans)

Measured memory_bytes: 118620
#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long int
#define MOD 1000000007
#define P pair<ll,ll>
#define INF 1000000000000000000

//using namespace atcoder;
using namespace std;

int main(void){
  ll n;
  cin >> n;
  
  vector<ll> a(n);
  for (ll i = 0; i < n; i++){
    ll b, c;
    cin >> b >> c;
    
    if (b == c){
      a[i] = 1;
    }
    else
      a[i] = 0;
  }

  ll ok = 0;
  for (ll i = 0; i < n-2; i++){
    if (a[i]*a[i+1]*a[i+2] == 1)
      ok = 1;
  }

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

  return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		char s[] = sc.next().toCharArray();
		int ss[] = new int[s.length];
		int sa[] = new int[26];
		char t[] = sc.next().toCharArray();
		int tt[] = new int[t.length];
		int ta[] = new int[26];

		int si=1;
		int ti=1;
		for(int i=0; i<s.length; i++) {

			if(sa[s[i]-'a'] ==0) {
				sa[s[i]-'a']=si++;
			}
			ss[i]=sa[s[i]-'a'];


			if(ta[t[i]-'a'] ==0) {
				ta[t[i]-'a']=ti++;
			}
			tt[i]=ta[t[i]-'a'];
		}
		int j=0;
		for(; j<s.length; j++) {
			if(ss[j] != tt[j]) break;
		}
		if(j == s.length) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	}
}


Measured memory_bytes: 28876
n = gets.chomp.split('').map(&:to_i)
max = n.max
if max == n[0]
  puts max * 100 + max * 10 + max
elsif max == n [1]
  puts (n[0] + 1) * 100 + (n[0] + 1) * 10 + n[0] + 1
elsif max == n[2]
  if n[0] > n[1]
    puts n[0] * 100 + n[0] * 10 + n[0]
    #puts max * 100 + max * 10 + max
  elsif n[0] <= n[1]
    puts (n[0] + 1) * 100 + (n[0] + 1) * 10 + n[0] + 1
  end
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

vector<int> a = {1, 4, 7, 9};

int main() {
  vector<int> n(4);
  rep(i, 4) cin >> n[i];

  sort(n.begin(), n.end());
  
  cout << (n == a ? "YES" : "NO") << endl;
  


  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
template <class T>
inline void chmin(T &a, const T &b) { a = min(a, b); }
template <class T>
inline void chmax(T &a, const T &b) { a = max(a, b); }
template <class T>
inline bool kbit(const T &x, const int &k) { return ((x >> k) & 1LL); }
inline int popcount(const int &n) { return __builtin_popcount(n); }
inline ll popcountll(const ll &n) { return __builtin_popcountll(n); }
inline ll mask(const ll &k) { return (1LL << k) - 1LL; }
template <class T>
void zip(V<T> &v) {
    sort(all(v));
    v.erase(unique(all(v)), v.end());
}
template <class T>
int lwb(V<T> &v, const T &x) { return lower_bound(all(v), x) - v.begin(); }
template <class T>
int upb(V<T> &v, const T &x) { return upper_bound(all(v), x) - v.begin(); }
void dump() {
    cerr << '\n';
}
template <class Head, class... Tail>
void dump(Head &&head, Tail &&... tail) {
    cerr << head << (sizeof...(Tail) == 0 ? " " : ", ");
    dump(std::move(tail)...);
}
template <class T>
void print(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void read(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
constexpr char sp = ' ', newl = '\n';
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
constexpr ll INF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
//////////////////////////////////////////////INSERT ABOVE HERE
//@docs Docs/BinaryIndexedTree.md
template <class T>
struct BinaryIndexedTree {
    int n;
    vector<T> dat;
    BinaryIndexedTree(const int &n) : n(n + 1), dat(n + 1) {}
    void add(int k, const T &x) {
        for (++k; k < n; k += k & -k) dat[k] += x;
    }
    T get(int k) {
        T res = 0;
        for (++k; k > 0; k -= k & -k) res += dat[k];
        return res;
    }
    inline T get(const int &l, const int &r) { //0-indexed [l,r)
        return get(r - 1) - get(l - 1);
    }
};
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    V<int> c(n), idx(n + 1);
    V<V<int>> cs(n + 1);
    read(c);
    for (int i = 0; i < n; i++) {
        cs[c[i]].eb(i);
    }
    V<int> l(q), r(q);
    V<V<int>> qs(n);
    for (int i = 0; i < q; i++) {
        cin >> l[i] >> r[i];
        --l[i];
        --r[i];
        qs[l[i]].eb(i);
    }
    BinaryIndexedTree<ll> bit(n + 1);
    V<int> pos(n + 1), res(q);
    for (int i = 0; i <= n; i++) {
        if (cs[i].empty()) continue;
        bit.add(cs[i][0], 1);
    }
    for (int i = 0; i < n; i++) {
        for (auto id : qs[i]) {
            res[id] = bit.get(r[id]);
        }
        bit.add(i, -1);
        if (cs[c[i]].back() == i) {
            continue;
        }
        idx[c[i]]++;
        bit.add(cs[c[i]][idx[c[i]]], 1);
    }
    for (int i = 0; i < q; i++) {
        cout << res[i] << newl;
    }
}

Measured memory_bytes: 67448
#include "bits/stdc++.h"
using namespace std;

int a,b,s,l;
vector<int> v;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	for(int i=1;i<=9;i++){
		for(int j=0;j<=9;j++){
			for(int k=0;k<=9;k++){
				int n = i*10000 + j*1000 + k*100 + j*10 + i;
				v.push_back(n);
			}
		}
	}
	sort(v.begin(),v.end());
	cin>>a>>b;
	s=0; l=v.size()-1;
	for(int i=0;i<v.size();i++){
		if(v[i] == a){
			s = i;
			break;
		}
		if(v[i] > a){
			s = i;
			break;
		}
	}
	for(int i=v.size()-1;i>=0;i--){
		if(v[i] == b){
			l = i;
			break;
		}
		if(v[i] < b){
			l = i;
			break;
		}
	}
	cout<<l-s+1;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC target("avx")
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define DB double
#define ST string
#define BS bitset
#define PA pair<LL,LL>
#define VE vector
#define VL vector<LL>
#define VP vector<pair<LL,LL>>
#define VVL vector<vector<LL>>
#define PQ priority_queue
#define PQS priority_queue<LL,vector<LL>,greater<LL>>
#define PB push_back
#define POB pop_back
#define PF push_front
#define POF pop_front
#define EB emplace_back
#define TS to_string
#define TU to_ullong
#define BPL __builtin_popcountll
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORR(i,a,n) for(i=n-1;i>=a;i--)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) FOR(i,0,n)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define UB(a,n) *upper_bound(ALL(a),n)
#define LB(a,n) *lower_bound(ALL(a),n)
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000001
//#define ERR 0.00000000000001
#define NUM 200010
#define FAST cin.tie(0);ios::sync_with_stdio(false)

void Yn(LL a){if(a)printf("Yes\n");else printf("No\n");}
void YN(LL a){if(a)printf("YES\n");else printf("NO\n");}
LL pwmn(LL a,LL n){LL ans=1;while(ans<a)ans*=n;return ans;}
LL LBn(VL &v,LL a){LL mx=v.size(),mn=-1,md;while(mx-mn>1){md=(mx+mn)/2;if(v[md]<a)mn=md;else mx=md;}return mx;}
LL GCD(LL a,LL b){LL c=1,tmp=max(a,b);b=min(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int lcmpr(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return -1;if(*(LL*)a<*(LL*)b)return 1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int ccmpr(const void* a,const void* b){return *(char*)b-*(char*)a;}
int scmp(const void* a,const void* b){return strcmp((char*)a,(char*)b);}
int scmpr(const void* a,const void* b){return strcmp((char*)b,(char*)a);}
LL mod(LL a,LL m){if(a%m<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(m,d);x-=k*y;swap(x,y);}return mod(a*mod(x,MOD),MOD);}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}
bool cmps(pair<LL,LL> a,pair<LL,LL> b){if(a.second!=b.second)return a.second<b.second;return a.first<b.first;}
template<typename T>bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  FAST;
  LL i,N,M,a,b,q=0,f=0;
  cin>>N>>M;
  a=1,b=N;
  if(N%2==0)q=N/2;
  rep(i,M){
    cout<<a<<" "<<b<<endl;
    a++,b--;
    if(b-a<=q&&f==0)b--,f++;
  }
}


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

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

  int cnt = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'o') cnt += 100;
  }
  cout << 700 + cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

ssize_t bisect(long t, std::vector<long> &b) {
  ssize_t lb = -1, rb = b.size();
  while (lb + 1 < rb) {
    ssize_t m = lb + (rb - lb) / 2;
    (b[m] < t ? lb : rb) = m;
  }
  return lb + 1;
}

void solve(long N, std::vector<long> a, std::vector<long> b) {
  long ans = 0;
  for (int k = 29; k >= 0; k--) {
    long m = 1 << (k + 1);
    for (auto &ai : a) {
      ai %= m;
    }
    for (auto &bi : b) {
      bi %= m;
    }
    std::sort(b.begin(), b.end());
    long v = 1 << k;
    ssize_t cnt = 0;
    for (auto &ai : a) {
      cnt += bisect(2 * v - ai, b) - bisect(v - ai, b) +
        bisect(4 * v - ai, b) - bisect(3 * v - ai, b);
    }
    if (cnt % 2 == 1) {
      ans |= v;
    }
  }
  std::cout << ans << std::endl;
}

int main() {
  long N;
  std::cin >> N;
  std::vector<long> a(N), b(N);
  for (long i = 0; i < N; i++) {
    std::cin >> a[i];
  }
  for (long i = 0; i < N; i++) {
    std::cin >> b[i];
  }
  solve(N, std::move(a), std::move(b));
  return 0;
}


Measured memory_bytes: 3328
{-
切り捨てで10%がb円になるのは、b*10からb*10+9
この中で8%がa円になるものを前から探せば十分。
-}

main = do
  li <- getLine
  let [a,b] = map read $ words li
  let ans = compute a b
  print ans

compute :: Int -> Int -> Int
compute a b
  | null xs = -1
  | True = head xs
  where
    xs = [ x | x <- [b*10..b*10+9], x * 8 `div` 100 == a ]


Measured memory_bytes: 508
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;


using ll = long long;



const int N = 2e5+33, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11 , T = 2000;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
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; }


typedef pair <int, int> pii;        // #include <ext/pb_ds/assoc_container.hpp>
typedef pair <ll, ll> pll;         // #include <ext/pb_ds/tree_policy.hpp>
typedef vector <int> vi;          // #include <ext/rope>
                // #include <ext/rope>
                                 // #include <ext/rope>
bool prime(int n) {             // template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0){return 0;}
    }return 1;}

int h[N];
int u[N];


void solve() {
    int n , m;
    cin >> n >> m;
    for(int i = 1; i <= n; i ++) {
        cin >> h[i];
    }
    for(int i = 1; i <= m; i ++) {
        int a , b;
        cin >> a >> b;
        if(h[a] <= h[b]) {
            u[a] = 1;
        }
        if(h[a] >= h[b]) {
            u[b] = 1;
        }
    }
    int cnt = 0;
    for(int i = 1; i <= n; i ++) {
        cnt += u[i];
    }
    cout << n-cnt;
}
/*

*/

main() {
    ios;
    int tt = 1;
//    cin >> tt;
    while(tt --) {
        solve();
//        brute();
    }
    return 0;
}
/*

*/


Measured memory_bytes: 4480
import java.io.*;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));       
		try {
			String line;
			/* input */
			line = br.readLine();

			int c = Integer.parseInt(line);

			for(int n=0;n<c;n++){
				int p = Integer.parseInt(br.readLine());
				int year = Integer.parseInt(br.readLine());
				int m = Integer.parseInt(br.readLine());

				int amount = 0; 

				for(int i=0;i<m;i++){
					line = br.readLine();
					int sc = Integer.parseInt(line.split(" ")[0]);
					double rate = Double.parseDouble(line.split(" ")[1]);
					int charge = Integer.parseInt(line.split(" ")[2]);

					int balance = p;

					switch(sc){
					case 0:
						double after = balance;
						int ci = 0;
						for(int j=0;j<year;j++){
							after = balance * (rate);
							ci += (int)Math.floor(after);
							balance -= charge;
						}

						if(ci+balance>amount) amount = ci+balance;
						break;
					case 1:
						double afterc = balance;
						for(int j=0;j<year;j++){
							afterc = balance * (1.0+rate);
							balance = (int)Math.floor(afterc) - charge;
						}
						if(balance>amount) amount = balance;
						break;
					}
				}
				/* output */

				System.out.println(amount);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

Measured memory_bytes: 38912
def main():
    n = int(input())
    a = list(map(int,input().split()))
    b = [0 for i in range(n + 1)]
    a.sort()
    ans = n
    for i in range(n):
        b[i + 1] = b[i] + a[i]
    for i in range(1,n):
        if b[i + 1] - b[i] >  2 * b[i]:
            ans = n - i
    print(ans)

main()

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

int main()
{
  long long n, a, b;
  cin >> n >> a >> b;
  if (a % 2 == b % 2) cout << (b - a) / 2 << endl;
  else cout << min(a + b - 1, n * 2 - a - b + 1) / 2 << endl;
}


Measured memory_bytes: 256
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 = sc.nextInt();

        if (a < b) {
            StringBuilder sb = new StringBuilder("");

            for (int i = 0; i < b; i++) {
                sb.append(a);
            }

            System.out.println(sb);
        } else {
            StringBuilder sb = new StringBuilder("");

            for (int i = 0; i < a; i++) {
                sb.append(b);
            }

            System.out.println(sb);
        }
    }

}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <math.h>
#define REP0(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REP1(i,n) for((i)=1;(i)<=(int)(n);(i)++)
#define ll long long
using namespace std;

ll i,j,k;
const ll MOD = 1000000000 + 7;

int main(){
    ll n,ans;
    cin>>n;
    ans=n+pow(n,2)+pow(n,3);
    
    
    
    cout<<ans<<'\n';
    
    
    return 0;
}

Measured memory_bytes: 4004
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


bool check[26];

int main(){

	for(int i = 0; i < 26; i++){

		check[i] = false;
	}

	int N;
	scanf("%d",&N);

	char buf[2];

	for(int loop = 0; loop < N; loop++){

		scanf("%s",buf);
		check[buf[0]-'A'] = true;
	}

	int count = 0;

	for(int i = 0; i < 26; i++){

		if(check[i])count++;
	}

	if(count == 3){

		printf("Three\n");

	}else{

		printf("Four\n");
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, P=0, W=0, G=0, Y=0;
  cin >> N;
  for(int i=0;i<N;i++){
    string S;
    cin >> S;
    if(S=="P") P++;
    if(S=="W") W++;
    if(S=="G") G++;
    if(S=="Y") Y++;
  }
  int j=0;
  if(P>0) j++;
  if(W>0) j++;
  if(G>0) j++;
  if(Y>0) j++;
  if(j<4) cout << "Three" << endl; else cout << "Four" << endl;  
}

Measured memory_bytes: 3624
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<pii,int> ppiii ;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
int main(){
	string str;
	cin>>str;
	for(int i=0;i<12;i++){
		if(i==4)cout<<" ";
		cout<<str[i];
	}
	cout<<endl;
	
}

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

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

    int count = 0;
    for (int i = 0; i < 1000; i++){
        if(N >= 3){
            N -= 3;
            count++;
        }
        else{
            break;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		long x = fs.nextLong();
		
		long yokin = 100;
		long year = 0;
		while(yokin < x) {
			yokin = (long)(yokin * 1.01);
			year++;
		}
		
		System.out.println(year);
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 32760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    for(int i=0;i<10000;i++) cout<<-1<<endl;
}



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

typedef long long ll;

namespace comb {
    ll fact[500001];
    ll fact_inv[500001];
    const ll MOD = 1000000007;

    ll modpow(ll a, ll b){
        ll base = 1, kakeru = a;
        while (b > 0)
        {
            if(b & 1) base *= kakeru, base %= MOD;
            kakeru *= kakeru, kakeru %= MOD;
            b >>= 1;
        }
        return base;
    }

    void setup(){
        fact[0] = fact[1] = 1;
        for (int i = 2; i <= 500000; i++)
        {
            fact[i] = (fact[i-1] * i) % MOD;
        }

        fact_inv[500000] = modpow(fact[500000], MOD - 2);
        for (int i = 499999; i >= 0; i--)
        {
            fact_inv[i] = fact_inv[i + 1] * (i + 1);
            fact_inv[i] %= MOD;
        }
    }

    ll combination(int a, int b){
        if(a - b < 0) return 0;
        ll ret = fact[a];
        ret *= fact_inv[b], ret %= MOD;
        ret *= fact_inv[a - b], ret %= MOD;
        return ret;
    }

    ll homogeneous(int a, int b){
        return combination(a + b - 1, b);
    }
}

int main() {
    ll n, k; cin >> n >> k;
    comb::setup();

    ll ans = 0;
    for (int i = 0; i <= min(k, n - 1); i++)
    {
        ll tmp = comb::combination(n, i);
        tmp *= comb::homogeneous(n - i, i);
        tmp %= comb::MOD;
        ans += tmp;
        ans %= comb::MOD;
    }
    cout << ans % comb::MOD << endl;
    return 0;
}

Measured memory_bytes: 8064
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <limits>

using namespace std;

int u_find(vector<int>& roots, int id) {
	if (roots[id] == id) {
		return id;
	} else {
		return roots[id] = u_find(roots, roots[id]);
	}
}

void process_connections(vector<int>& roots, int n) {
	for (int i = 0; i < n; i++) {
		int from, to;
		cin >> from >> to;
		from--; to--;
		int from_id = u_find(roots, from);
		int to_id = u_find(roots, to);
		if (from_id == to_id) {
			continue;
		}
		roots[to_id] = from_id;
	}
}

int main (int argc, char* argv[]) {
	int n, k, l;
	cin >> n >> k >> l;
	vector<int> road_roots(n);
	vector<int> rail_roots(n);
	for (int i = 0; i < n; i++) {
		road_roots[i] = rail_roots[i] = i;
	}

	process_connections(road_roots, k);
	process_connections(rail_roots, l);

	unordered_map<long long, int> count;
	for (int i = 0; i < n; i++) {
		count[(long long)u_find(road_roots, i) * (long long)n + (long long)u_find(rail_roots, i)]++;
	}
	for (int i = 0; i < n; i++) {
		cout << count[(long long)u_find(road_roots, i) * (long long)n + (long long)u_find(rail_roots, i)] << " ";
	}
	cout << endl;
}


Measured memory_bytes: 9928
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
#include<algorithm>
#include<string>
#include<set>
#include<deque>

using namespace std;

#define pb push_back
#define int long long
#define ld long double

const int N = 1e3 + 10;
bool used[N][N];

int n, m;

bool check(int i, int j){
    return (i >= 0 && i < n && j >= 0 && j < m && !used[i][j]);
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    int d[n][m];
    int x, y, x1, y1;
    cin >> x >> y >> x1 >> y1;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            d[i][j] = 1e18;
            char c;
            cin >> c;
            if (c == '#') used[i][j] = 1;
            else used[i][j] = 0;
        }
    }
    x--, y--, x1--, y1--;
    deque<pair<pair<int,int>, int>> q;
    q.push_back({{x, y}, 0});
    while(!q.empty()){
        auto to = q.front();
        q.pop_front();
        int i = to.first.first, j = to.first.second;
        if (d[i][j] != 1e18) continue;
        d[i][j] = to.second;
        //cout << i << " " << j << " " << d[i][j] << endl;
        if (check(i + 1, j) && d[i + 1][j] == 1e18){
            q.push_front({{i + 1, j}, d[i][j]});
        }
        if (check(i, j + 1) && d[i][j + 1] == 1e18){
            q.push_front({{i, j + 1}, d[i][j]});
        }
        if (check(i - 1, j) && d[i - 1][j] == 1e18){
            q.push_front({{i - 1, j}, d[i][j]});
        }
        if (check(i, j - 1) && d[i][j - 1] == 1e18){
            q.push_front({{i, j - 1}, d[i][j]});
        }
        for (int k = -2; k <= 2; k++){
            for (int jj = -2; jj <= 2; jj++){
                if (check(i + k, j + jj) && d[i + k][jj + j] == 1e18){
                    q.pb({{i + k, j + jj}, d[i][j] + 1});
                }
            }
        }
    }
    if (d[x1][y1] == 1e18){
        cout << -1 << endl;
    }
    else{
        cout << d[x1][y1] << endl;
    }
    return 0;
}


Measured memory_bytes: 13704
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main() {
	int n, m = 0;
	cin >> n;
	for (int i = 0;; i++)
	{
		m += i;
		if (m >= n) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <set>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int n, k;
    cin >> n >> k;
    ll s[n], p[n];
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        p[i] = max(s[i], 0LL);
        if (i > 0) {
            s[i] += s[i-1];
            p[i] += p[i-1];
        }
    }

    ll score = 0;
    for (int i = 0; i <= n-k; i++) {
        ll tmp = s[i+k-1];
        if (i > 0) {
            tmp -= s[i-1];
        }
        tmp = max(tmp, 0LL);

        if (i > 0) {
            tmp += p[i-1];
        }
        tmp += p[n-1];
        tmp -= p[i+k-1];

        score = max(score, tmp);
    }

    cout << score << "\n";
    return 0;
}

Measured memory_bytes: 1792