akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

ll ans[MAXn];
int main(){
    IOS();
    string s;
    cin >> s;
    ll n = SZ(s);
    vector<ll> dt;
    ll cnt = 1;
    REP (i,n-1) {
        if (s[i] != s[i+1]) {
            dt.eb(cnt);
            cnt = 0;
        }
        cnt++;
    }
    dt.eb(cnt);
    debug(dt);
    ll idx = 0;
    for (ll i=0;i<SZ(dt);i+=2) {
        ii R = (dt[i]&1 ?ii(dt[i]/2,dt[i]/2+1):ii(dt[i]/2,dt[i]/2));
        ii L = (dt[i+1]&1 ?ii(dt[i+1]/2+1,dt[i+1]/2):ii(dt[i+1]/2,dt[i+1]/2));
        if (dt[i]&1) swap(R.X,R.Y);
        if (dt[i+1]&1) swap(L.X,L.Y);
        REP (j,dt[i]-1) ans[idx++] = 0;
        ans[idx++] = R.X + L.X;
        ans[idx++] = R.Y + L.Y;
        REP (j,dt[i+1]-1) ans[idx++] = 0;
    }
    REP (i,n) cout << ans[i] << " \n"[i==n-1];
}


Measured memory_bytes: 2244
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }



void solve() {
     char ch;
     cin>>ch;
     int yo=ch-'a';
     if(yo>=0) cout<<'a';
     else cout<<'A';
        
    
    
 }

    
int32_t main() {
	cool;
	int t=1;

	//cin>>t;
	while(t--)
	solve();


return 0;	   
}


Measured memory_bytes: 3624
S=list(input())
top_S = S[:len(S)//2]
S.reverse()
down_S = S[:len(S)//2]
if(top_S==down_S):
    top_top_S=top_S[:len(top_S)//2]
    top_S.reverse()
    top_down_S =top_S[:len(top_S)//2]
    down_top_S = down_S[:len(down_S)//2]
    down_S.reverse()
    down_down_S = down_S[:len(down_S)//2]
    if (top_top_S == top_down_S and down_top_S == down_down_S):
        print('Yes')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 9024
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e16;
const double PI = 2 * asin(1);
typedef long long ll;

int main(){

  int A, B, Q; cin >> A >> B >> Q;

  vector <ll> S(A + 2), T(B + 2);
  for (int i = 1; i < A + 1; i++) cin >> S[i];
  S[A + 1] = 1e10 + 1;
  for (int i = 1; i < B + 1; i++) cin >> T[i];
  T[B + 1] = 1e10 + 1;
  
  vector <ll> ans(Q);
  for (int i = 0; i < Q; i++){
    ll X; cin >> X;

    ll SL = 0, SR = A + 2, Snow = (A + 1) / 2;
    bool flag = true;
    while (flag == true){
      if (S[Snow - 1] <= X && X <= S[Snow]){
        break;
      }else{
        if (S[Snow] < X){
          SL = Snow;
          Snow = (SL + SR) / 2;
        }else{
          SR = Snow;
          Snow = (SL + SR) / 2;
        }
      }
    }

    ll TL = 0, TR = B + 2, Tnow = (B + 1) / 2;
    while (flag == true){
      if (T[Tnow - 1] <= X && X <= T[Tnow]){
        break;
      }else{
        if (T[Tnow] < X){
          TL = Tnow;
          Tnow = (TL + TR) / 2;
        }else{
          TR = Tnow;
          Tnow = (TL + TR) / 2;
        }
      }
    }
    
    ll Sleft = X - S[Snow - 1], Sright = S[Snow] - X;
    ll Tleft = X - T[Tnow - 1], Tright = T[Tnow] - X;

    if (S[Snow - 1] == 0){
      if (T[Tnow - 1] == 0){
        ans[i] = max(Sright, Tright);
      }else if(T[Tnow] == 1e10 + 1){
        ans[i] = min(2 * Sright + Tleft, Sright + 2 * Tleft);
      }else{
        ans[i] = min(max(Sright, Tright), min(2 * Sright + Tleft, Sright + 2 * Tleft));
      }
    }else if (S[Snow] == 1e10 + 1){
      if (T[Tnow] == 1e10 + 1){
        ans[i] = max(Sleft, Tleft);
      }else if(T[Tnow - 1] == 0){
        ans[i] = min(2 * Sleft + Tright, Sleft + 2 * Tright);
      }else{
        ans[i] = min(max(Sleft, Tleft), min(2 * Sleft + Tright, Sleft + 2 * Tright));
      }
    }else{
      if (T[Tnow - 1] == 0){
        ans[i] = min(min(2 * Sleft + Tright, Sleft + 2 * Tright), max(Sright, Tright));
      }else if(T[Tnow] == 1e10 + 1){
        ans[i] = min(max(Sleft, Tleft), min(Sright * 2 + Tleft, Sright + 2 * Tleft));
      }else{
        ans[i] = min(min(max(Sleft, Tleft), max(Sright, Tright)), min(min(2 * Sright + Tleft, Sright + 2 * Tleft), min(2 * Sleft + Tright, Sleft + 2 * Tright)));
      }
    }    
  }

  for (int i = 0; i < Q; i++){
    cout << ans[i] << endl;
  }
  
  
  
  
  return 0;
}


Measured memory_bytes: 3712
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

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

int main()
{
	int X, Y, Z;
	cin >> X >> Y >> Z;

	int P = max(X, max(Y, Z));
	int Q = min(X, min(Y, Z));

	cout << P - Q << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<climits>
#define ll long long
using namespace std;
int main() {
	ll n;
	cin >> n;
	for (ll i = 1; i <= 9; i++) {
		for (ll j = 1; j <= 9; j++) {
			if (i*j == n) {
				cout << "Yes" << endl;
				exit(0);
			}
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main
{
  public static void main(String [] args)
  {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    if(n%10 == 2 || n%10 == 4 || n%10 == 5 || n%10 == 7 || n%10 == 9)
      System.out.println("hon");
    if(n%10 == 0 || n%10 == 1 || n%10 == 6 || n%10 == 8)
      System.out.println("pon");
    if(n%10 == 3)
      System.out.println("bon");
  }
}

Measured memory_bytes: 35648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
const ll C = 1e9+7;

int main() {
    int N;
    cin >> N;
    vector<int> C(N-1), S(N-1), F(N-1);
    for(int i=0; i<N-1; i++) cin >> C[i] >> S[i] >> F[i];

    //i:スタート地点
    for(int i=0; i<N; i++) {
        ll t = 0;
        for(int j=i; j<N-1; j++) {
            if(t < S[j]) t = S[j];
            else if(t % F[j] == 0) t = t;
            else t = t + F[j] - (t % F[j]);
            t += C[j];
        }
        cout << t << endl;
    }
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007
ll fact[110000];
ll invfact[110000];
ll inv(ll a) {

	ll res = 1;
	int p = MOD - 2;
	while (p>0) {
		if (p & 1 == 1) { res *= a; res %= MOD; }
		a = a*a%MOD;
		p >>= 1;
	}
	return res;
}

ll combo(int n,int k) {
	ll res = fact[n];
	res *= invfact[k];
	res %= MOD;
	res *= invfact[n - k];
	return res%MOD;
}


int main()
{
	int N;
	vec(A)
		map<int, int> K;
	int first, second;
	cin >> N;
	fx(N+1) {
		vecp(A);
		if (K[A.at(x)]>0) {
			first = K[A.at(x)] - 1;
			second = N - x;
		}
		else {
			K[A.at(x)] = x + 1;
		}
	}

	fact[0] = 1;
	fx(N+1) {
		fact[x + 1] = fact[x] * (x + 1);
		fact[x + 1] %= MOD;
	}
	invfact[N+1] = inv(fact[N+1]);
	for (int x = N; x >= 0; x--) {
		invfact[x] = invfact[x + 1] * (x + 1);
		invfact[x] %= MOD;
	}

	ce(N)
		for (int x = 2; x <= N ; x++) {
			ll ans = combo(N + 1, x);

			if (x - 1 <= first + second) {
				ll sum = combo(first+second,x-1);
				sum %= MOD;
				ans -= sum;
				if (ans<0) {
					ans += MOD;
				}
			}

			ce(ans)
		}
	ce(1)


    return 0;
}



Measured memory_bytes: 7800
import java.io.*;
import java.util.*;

public class Main{
	
	static int mod=(int)1e9+7;
	
	public static void main(String[] args) throws IOException {
//		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		Writer out=new Writer(System.out);
		Reader in=new Reader(System.in);
		int t=1;
		
		outer: while(t-->0) {	
			int n=in.nextInt();
			int k=in.nextInt();
			Set<Integer> set=new HashSet<>();
			for(int i=0; i<k; i++) set.add(in.nextInt());
			for(int i=0; ; i++) {
				
				int temp=n+i;
				while(temp>0) {
					int curr=temp%10;
					if(set.contains(curr)) break;
					temp/=10;
				}
				
				if(temp==0) {
					out.println(n+i);
					continue outer;
				}
				
			}
			
			
		}
		out.close();		
		
	}

	
	
/*********************************** UTILITY CODE BELOW **************************************/	
	
	static int ans=Integer.MAX_VALUE;
	
	
	
	static int abs(int a) {
		return a>0 ? a : -a;
	}
	static int pow(int n, int m) {
		if(m==0) return 1;
		int temp=pow(n,m/2);
		long res=(((long)temp*temp)%mod);
		if(m%2==0) return (int)res;
		return (int)((res*n)%mod);
	}
	
	static class Pair{
		int u, v;
		
		Pair(int u, int v){this.u=u; this.v=v;}
		
		static void sort(Pair [] coll) {		
			List<Pair> al=new ArrayList<>(Arrays.asList(coll));
			Collections.sort(al,new Comparator<Pair>() {
				public int compare(Pair p1, Pair p2) {
					return p1.u-p2.u;
				}	
			});
			for(int i=0; i<al.size(); i++) {
				coll[i]=al.get(i);
			}
		}
		
	}
	
	static void sort(int[] a) {
		ArrayList<Integer> list=new ArrayList<>();
		for (int i:a) list.add(i);
		Collections.sort(list);
		for (int i=0; i<a.length; i++) a[i]=list.get(i);
	}
	
	static int [] array(int n, int value) {	
		int a[]=new int[n];
		for(int i=0; i<n; i++) a[i]=value;
		return a;
	}
	
	static class Reader{
		
		BufferedReader br;
		StringTokenizer to;
		
		Reader(InputStream stream){
			br=new BufferedReader(new InputStreamReader(stream));
			to=new StringTokenizer("");
		}
		
		String next() {
			while(!to.hasMoreTokens()) {
				try {
					to=new StringTokenizer(br.readLine());	
				}catch(IOException e) {}
				
			}
			return to.nextToken();
			
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		int [] readArray(int n) {
			int a[]=new int[n];
			for(int i=0; i<n ;i++) a[i]=nextInt();
			return a;
		}
		long [] readLongArray(int n) {
			long a[]=new long[n];
			for(int i=0; i<n ;i++) a[i]=nextLong();
			return a;
		}
		
	}
	
	static class Writer extends PrintWriter{
		Writer(OutputStream stream){
			super(stream);
		}
		void println(int [] array) {
			for(int i=0; i<array.length; i++) {
				print(array[i]+" ");
			}
			println();
		}
		void println(long [] array) {
			for(int i=0; i<array.length; i++) {
				print(array[i]+" ");
			}
			println();
		}
	}
	
}

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

using namespace std;

int main() {
  int A, B, AB, X, Y;
  cin >> A >> B >> AB >> X >> Y;
  int answer = A * X + B * Y;
  int temp = AB * max(X, Y) * 2;
  answer = min(answer, temp);
  temp = AB * min(X, Y) * 2;
  if (max(X, Y) == X) {
    temp += A * (X - Y);
  } else {
    temp += B * (Y - X);
  }
  answer = min(answer, temp);

  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int A,B,C,D;
    int x;
    int y;
    scanf("%d %d %d %d",&A,&B,&C,&D);
    if(A%D==0){
        x=A/D;
    }else if(A%D!=0){
        x=A/D+1;
    }
    if(C%B==0){
        y=C/B;
    }else if(C%B!=0){
        y=C/B+1;
    }
    if(y<=x){
        printf("Yes\n");
    }else if(x<y){
        printf("No\n");
    }
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long   ll;
typedef unsigned long long   ull;
typedef long double ld;
typedef pair<ll, ll>    pll;
typedef pair<ull, ull>    pull;
typedef pair<ll, ll>  pii;
typedef pair<ld, ld>  pld;
ll dp[3009][3009];
string s, t;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin >> s >> t;
    for(int i = 0; i <= s.size(); ++i)
        for(int j = 0; j <= t.size(); ++j){
            if(i == 0 || j == 0)
                dp[i][j] = 0;
            else if(s[i-1] == t[j-1])
                dp[i][j] = dp[i-1][j-1] + 1;
            else{
                if(dp[i-1][j] > dp[i][j-1])
                    dp[i][j] = dp[i-1][j];
                else
                    dp[i][j] = dp[i][j-1];
            }
        }
    vector<char> v;
    int i = s.size();
    int j = t.size();
    while(i > 0 && j > 0){
        if(s[i-1] == t[j-1]){
            v.pb(s[i-1]);
            --i;
            --j;
        }
        else if(dp[i-1][j] > dp[i][j-1])
            --i;
        else
            --j;
    }
    reverse(v.begin(), v.end());
    if(v.size() == 0)
        cout << " ";
    for(auto u : v)
        cout << u;
    cout << "\n";
}

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

int main() {
	int A, B, K;
	cin >> A >> B >> K;
	
	if (B - A + 1 > 2 * K) {
		for (int i = A; i <= A + K - 1; ++i) {
			cout << i << endl;
		}
		for (int j = B - K + 1; j <= B; ++j) {
			cout << j << endl;
		}
	}
	else for (int k = A; k <= B; ++k) {
		cout << k << endl;
	}
}

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

int main()
{
	char c11, c12, c13, c21, c22, c23, c31, c32, c33;

	cin >> c11 >> c12 >> c13 >> c21 >> c22 >> c23 >> c31 >> c32 >> c33;

	cout << c11 << c22 << c33 << endl;

    return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc054/tasks/abc054_c
import itertools


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

C = [list(map(int, input().split())) for _ in range(M)]

seq = [i + 1 for i in range(1, N)]
# print(list(itertools.permutations(seq)))

count = 0
for l in itertools.permutations(seq):
    # print(l)
    connected = True
    for i in range(len(l) - 1):
        a = min(l[i], l[i+1])
        b = max(l[i], l[i+1])
        if i == 0 and [1, l[i]] not in C:
            connected = False
            break
        if [a, b] not in C:
            connected = False
            break
    if connected:
        # print(l)
        count += 1

print(count)


Measured memory_bytes: 3064
#include <stdio.h>

int n,k;

int main()
{
    scanf("%d%d",&n,&k);
    int i=1;
    for(int ans=0;;ans++)
    {
        if(n<i) {
            printf("%d\n",ans);
            return 0;
        }
        i*=k;
    }
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	long long int a;
	long double b;
	long long int ans;

	cin >> a >> b;
	b = b * 1000;
	ans = a * b/1000;
	cout << ans << endl;
}

Measured memory_bytes: 3732
#include<stdio.h>
int main(){
	char a[110],b[110],c[110],t='a';
	int ap=0,bp=0,cp=0;
	scanf("%s",a);
	scanf("%s",b);
	scanf("%s",c);
	while(1){
		if(t=='a'){
			if(a[ap]!='\0'){
			t=a[ap];
			ap++;
		}else{
			printf("A");
			return 0;
		}
	}	if(t=='b'){
			if(b[bp]!='\0'){
			t=b[bp];
			bp++;
		}else{
			printf("B");
			return 0;
		}
	}	if(t=='c'){
			if(c[cp]!='\0'){
			t=c[cp];
			cp++;
		}else{
			printf("C");
			return 0;
		}
	}
}
}

Measured memory_bytes: 128
<?php

fscanf(STDIN, '%d', $n);
$line = trim(fgets(STDIN));
$A = array();
foreach (explode(' ', $line) as $m) {
    $A[] = (int)$m;
}

$A = partition($A, 0, $n - 1);
echo implode(' ', $A), PHP_EOL;

function partition($A, $p, $r)
{
    $x = $A[$r];
    $i = $p - 1;
    for ($j = $p; $j < $r; $j++) {
        if ($A[$j] <= $x) {
            $i++;
            $tmp = $A[$i];
            $A[$i] = $A[$j];
            $A[$j] = $tmp;
        }
    }

    $i++;
    $A[$r] = $A[$i];
    $A[$i] = "[$x]";

    return $A;
}

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

int dp[101][4][4][4];
int mod = 1e9 + 7;

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

  dp[0][3][3][3] = 1;
  for (int s = 0; s < n; s ++) {
    for (int c1 = 0; c1 < 4; c1 ++) {
      for (int c2 = 0; c2 < 4; c2 ++) {
        for (int c3 = 0; c3 < 4; c3 ++) {
          if (dp[s][c1][c2][c3] == 0) continue;

          for (int c0 = 0; c0 < 4; c0 ++) {
            if (c0 == 2 && c1 == 1 && c2 == 0) continue;
            if (c0 == 2 && c1 == 0 && c2 == 1) continue;
            if (c0 == 1 && c1 == 2 && c2 == 0) continue;
            if (c0 == 2 && c1 == 1 && c3 == 0) continue;
            if (c0 == 2 && c2 == 1 && c3 == 0) continue;
            
            dp[s + 1][c0][c1][c2] += dp[s][c1][c2][c3];
            dp[s + 1][c0][c1][c2] %= mod;
          }
        }
      }
    }
  }

  int ans = 0;
  for (int i = 0; i < 4; i ++) {
    for (int j = 0; j < 4; j ++) {
      for (int k = 0; k < 4; k ++) {
        ans += dp[n][i][j][k];
        ans %= mod;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

const int maxn = 1e5 + 10;

ll fact[maxn], fact_inv[maxn];

ll power(ll a, ll b) {
	ll result = 1;
	while(b) {
		if(b % 2) result = (result * a) % P;
		a = (a * a) % P;
		b /= 2;
	}
	
	return result;
}

ll divide(ll a, ll b) {
	return a * power(b, P - 2) % P;
}

ll C(int n, int k) {
	return fact[n] * fact_inv[n - k] % P * fact_inv[k] % P; 
}

void init() {
	fact[0] = 1;
	for(int i = 1; i < maxn; i++) fact[i] = fact[i - 1] * i % P;
	
	fact_inv[maxn - 1] = divide(1, fact[maxn - 1]);
	for(int i = maxn - 2; i >= 0; i--) fact_inv[i] = (fact_inv[i + 1] * (i + 1)) % P;
}

void solve() {
	int n, k;
	cin >> n >> k;
	
	vi a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	
	sort(all(a));
	
	ll mxs = 0, mns = 0;
	for(int i = k - 1; i < n; i++) {
		mxs = ((C(i, k - 1) * a[i] % P) + mxs) % P;
	}
	
	reverse(all(a));
	for(int i = k - 1; i < n; i++) {
		mns = ((C(i, k - 1) * a[i] % P) + mns) % P;
	}
	
	cout << (mxs - mns + P) % P << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	init();
	solve();
    return 0;
}

Measured memory_bytes: 5300
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();
		int H = sc.nextInt();
		int M = sc.nextInt();
		double HDo = H*60+M;
		HDo = HDo/(double)2;
		double MDo = M*6;
		double Sa = HDo-MDo;
		HDo = Math.PI*Sa/180;
		double C2= A*A+B*B-2*A*B*Math.cos(HDo);
		System.out.println(Math.sqrt(C2));
	}
}

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

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}

int main() {
	int n, m; cin >> n >> m;
	int a[101];
	int sum = 0;
	int r = 4*m;
	for(int i=0;i<n;i++){
		cin >> a[i];
		sum += a[i];
	}
	int cnt = 0;
	for(int i=0;i<n;i++){
		if(a[i] > sum/r){
			cnt++;
		}else if(a[i] == sum/r && sum%r == 0){
			cnt++;
		}
	}
	if(cnt>=m){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define il inline
#define rg register
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define rep(i,st,ed) for(rg int i=(st);i<=(ed);++i)
#define per(i,ed,st) for(rg int i=(ed);i>=(st);--i)
#define rep0(i,n) for(rg int i=0;i<(n);++i)
#define per0(i,n) for(rg int i=(n)-1;i>=0;--i)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> il T qmin(const T &x,const T &y){return x<y?x:y;}
template<typename T> il T qmax(const T &x,const T &y){return x>y?x:y;}
template<typename T> il void getmin(T &x,const T &y){if(y<x) x=y;}
template<typename T> il void getmax(T &x,const T &y){if(y>x) x=y;}
il void fileio(const string &s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int inf=(int)1e9+7;
const ll linf=(ll)1e18+7;

int id1[1<<18],id2[1<<18];
int a[(1<<18)+5],n;
vector<int> id;

il bool cmp(const int &x,const int &y){
	return a[x]>a[y];
}

int main(){
//	fileio("test");
	scanf("%d",&n);
	rep0(i,1<<n) scanf("%d",a+i);
	id1[0]=0,id2[0]=1<<n;
	rep(comb,1,(1<<n)-1){
		id.clear();
		id.pb(comb);
		for(int x=comb;x;x^=x&-x){
			id.pb(id1[comb^(x&-x)]);
			id.pb(id2[comb^(x&-x)]);
		}
		sort(id.begin(),id.end(),cmp);
		id.erase(unique(id.begin(),id.end()),id.end());
		assert(id.size()>=2);
		id1[comb]=id[0],id2[comb]=id[1];
	}
	int ans=0;
	rep(comb,1,(1<<n)-1){
	//	cerr<<comb<<" "<<id1[comb]<<" "<<id2[comb]<<endl;
		getmax(ans,a[id1[comb]]+a[id2[comb]]);
		printf("%d\n",ans);
	}
	return 0;
}


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

int main() {
  int N, K, temp, res = 0;
  cin >> N >> K;
  vector<int> vec(N);
  for(int i = 0; i < N; i++) {
    cin >> temp;
    res += min(temp * 2,(K - temp) * 2);
  }
  cout << res << endl;
}

Measured memory_bytes: 3588
#include <iostream>

using namespace std;

int multi10 (int x) {
    return ((x / 10) + 1) * 10;
}

int main() {
    ios::sync_with_stdio(false);

    int v[5], soma = 0;
    int resto[5];
    int mult;
    for (int i = 0; i < 5; i++) {
        cin >> v[i];
        if (v[i] % 10 != 0) {
            resto[i] = (multi10 (v[i]) - v[i]);
        }
        else {
            resto[i] = 0;
        }
        soma+= v[i];
    }

    for (int i = 0; i < 5; i++) {
        for (int j = i+1; j < 5; j++) {
            if (resto[i] > resto[j]) {
                int aux = resto[i];
                resto[i] = resto[j];
                resto[j] = aux; 
            }
        }
    }

    for (int i = 0; i < 4; i++) {
        soma += resto[i];
    }


    cout << soma << endl;

    return 0;
}

Measured memory_bytes: 256
from collections import deque
que = deque([])
Q = int(input())

for _ in range(Q):
    query = list(map(int, input().split()))
    if query[0] == 0:
        _, d, x = query
        if d:
            que.append(x)
        else:
            que.appendleft(x)
    elif query[0] == 1:
        print(que[query[1]])
    else:
        _, d = query
        if d:
            que.pop()
        else:
            que.popleft()


Measured memory_bytes: 21940
#include <string>
#include <map>
#include <vector>
#include <iostream>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int x = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'x')
            x++;
    }
    if (x >= 8) {
        cout << "NO";
    } else {
        cout << "YES";
    }
}


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

int main() {
	int N; cin >> N;
	vector<int>p(N); for (int i = 0; i < N; i++)cin >> p[i];
	sort(p.begin(), p.end());
	int ans = p[p.size()-1] /2;
	for (int i = 0; i < p.size() - 1; i++)ans += p[i];
	cout << ans << endl;
	
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
#define int long long
//for set
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   
// for multiset
// typedef tree<
// int,
// null_type,
// less<int>,
// rb_tree_tag,
// tree_order_statistics_node_update> ordered_multiset;

#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
#define PI 3.1415926535897932384626433832795
int MOD=1e9+7;
// int MOD=998244353;
int powmod(int a,int l, int md){int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
typedef long long ll; typedef vector<int> vi; typedef pair<int,int> ii; typedef vector<ii> vii;
#define pb push_back
int __set(int b, int i) {return b|(1<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return ((a%md)*(b%md))%md;}
int addmod(int a, int b, int md) {return (a+b)%md;}
int submod(int a, int b, int md) {return (((a-b)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

int cmp(const ii& p1, const ii& p2) {
	return (p1.ss>p2.ss);
}
const int MX = 3000010;

int f[MX];
int rf[MX];

int C(int l,int k, int md) 
{
    if (k<0||k>l){
        return 0;
    }
    return f[l]*rf[k]%md*rf[l-k]%md;
}

void precfac() {
    f[0]=1;
    for (int i=1;i<MX;i++){
        f[i]=f[i-1]*i%MOD;
    }
    rf[MX-1]=powmod(f[MX-1],MOD-2, MOD);
    for (int i=MX-2;i>=0;i--){
        rf[i]=rf[i+1]*(i+1)%MOD;
    }
}
signed main(void)
{
	IOS;
	precfac();
	int r1,r2,c1,c2;
	cin>>r1>>c1>>r2>>c2;
	int ans=0;
	for(int c=c1; c<=c2; c++) {
		int s1=C(r1+c+1,c+1,MOD);
		int s2=C(r2+c+1,c+1,MOD);
		ans += (s2-s1+MOD)%MOD+C(r1+c,c,MOD);
		ans %=MOD;
	}
	cout<<ans<<endl;
	time();
	return 0;
}

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

int main() {
	int i, j, k;
	int	n, m, h, g, b, c, d, l, r;
	int f = 0;
	int w;
	int a[100100];

	scanf("%d", &n);

	for (i = 0;i < n;i++) {
		scanf("%d", &a[i]);
	}
	/*
	for (i = 1;i < n - 1 ;i++) {
		w = a[i - 1] ^ a[i + 1];
		if (w == a[i]) {
	
		}
		else {
			f = 0;
		}
	}
	w = a[n - 1] ^ a[1];
	if (w == a[0]) {

	}
	else{
		f = 0;
	}
	w = a[n - 2] ^ a[0];
	if (w == a[n - 1]) {

	}
	else {
		f = 0;
	}
	*/
	w = 0;
	for (i = 0;i < n;i++) {
		w = w ^ a[i];
	}
	if (w == 0) {
		f = 1;
	}


	if (f == 1) {
		printf("Yes");
	}
	else if (f == 0) {
		printf("No");
	}
	else {
		return 1;
	}


	return 0;
}

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

using namespace std;
using ll = long long;

//cout << std::fixed << std::setprecision(15) << y << endl;

int main() {
    ll n = 0;
    cin >> n;
    vector<ll> v(n);
    for(int i = 0;i < n;i++){
        ll tmp = 0;
        cin >> tmp;
        v[tmp - 1] = i + 1;
    }
    for(int i = 0;i < n - 1;i++){
        cout << v[i] << " ";
    }
    cout << v[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 1664
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a = inp()
if a == 25:
    print('Christmas')
elif a == 24:
    print('Christmas Eve')
elif a == 23:
    print('Christmas Eve Eve')
else:
    print('Christmas Eve Eve Eve')

Measured memory_bytes: 5176
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <unordered_map>
#include <random>
using namespace std;

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

#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()

int N,K;
ll cnt[200500];
int main(){
	ll ans = 0;
	scanf("%d%d",&N,&K);
	for(int i=1;i<=N;i++){
		int x;
		scanf("%d",&x); cnt[x]++;
	}
	priority_queue<ll, vector<ll>, greater<ll>> pq;
	for(int i=1;i<=N;i++) if( cnt[i] ) pq.push(cnt[i]);
	while( sz(pq) > K ){
		ans += pq.top(); pq.pop();
	}
	printf("%lld\n",ans);
}













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

int main(void)
{
	int n;
	int g = 100000;
	int i;
	
	scanf("%d", &n);
	
	for(i = 1; i <= n; i++){
		g = g * 1.05;
		if(g % 1000 != 0){
		g = (g / 1000 + 1) * 1000;
		}
	}
	printf("%d\n", g);
	return 0;
}

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

int main() {
  int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  
  if (a[0] % 10 == 0 && a[1] % 10 == 0 && a[2] % 10 == 0 && a[3] % 10 == 0 && a[4] % 10 == 0) {
    cout << a[0] + a[1] + a[2] + a[3] + a[4] << endl;
  } else {
    int m = 10;
    for (int i = 0; i < 5; i++) {
      if (a[i] % 10 != 0) {
        m = min(a[i] % 10, m);
      }
    }
    int ans = 0;
    for (int i = 0; i < 5; i++) {
      ans += ((a[i] + 9) / 10) * 10;
    }
    ans = ans - 10 + m;
    cout << ans << endl;
  }
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VLL a(n);
  VLL b(n);

  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  priority_queue<PLL> que;
  rep(i,n){
    if(a[i] > b[i]){
      cout << -1 << "\n";
      return 0;
    }
    que.push({b[i],i});
  }

  ll ans = 0;
  while(!que.empty()){
    PLL p = que.top();
    que.pop();
    int idx = p.second;
    if(b[idx] == a[idx]) continue;

    ll sum = b[(idx+1)%n] + b[(idx-1+n)%n];
    ll cnt = (b[idx] - a[idx]) / sum;
    if(cnt == 0){
      cout << -1 << endl;
      return 0;
    }
    b[idx] -= sum * cnt;
    ans += cnt;
    que.push({b[idx],idx});
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9328
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
int inf = 1000000000;
// int inf = (1<<30);

vector<int> r;
vector< vector<int> > cost;

void wf(int n){
  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      for(int k=0; k<n; k++){
        cost[j][k] = min( cost[j][k], cost[j][i] + cost[i][k] );
      }
    }
  }
}
int calc(){
  int c = 0;
  for(int i=0; i<r.size()-1; i++){
    c += cost[ r[i] ][ r[i+1] ];
  }
  return c;
}

int main(void) {
  int n, m, rn;
  cin >> n >> m >> rn;
  r.resize(rn);
  for(int i=0; i<rn; i++) cin >> r[i];
  for(int i=0; i<rn; i++) r[i]--;

  cost = vector< vector<int> > (n, vector<int>(n, inf));
  for(int i=0; i<n; i++) cost[i][i] = 0;
  int a, b, c;
  for(int i=0; i<m; i++){
    cin >> a >> b >> c;
    a--; b--;
    cost[a][b] = c;
    cost[b][a] = c;
  }

  wf(n);
  sort(r.begin(), r.end());
  // for(int i=0; i<n; i++){
  //   for(int j=0; j<n; j++) cerr << cost[i][j] << " ";
  //   cerr << endl;
  // }

  int ans = inf;
  while( true ){
    ans = min(ans, calc());

    if( !next_permutation(r.begin(), r.end()) ) break;
  }
  cout << ans << endl;
  return 0;
}

// EOF


Measured memory_bytes: 384
A,B = map(int,input().split())
if A % 2 == 1:
    a1,a2 = int(A*12.5)+1, A*12.5+12.5
else:
    a1,a2 = int(A*12.5),int(A*12.5+12.5)
b1,b2 = B*10,B*10+10

if (b2 <= a1) or (a2 <= b1):
    print(-1)
else:
    print(max(a1,b1))


Measured memory_bytes: 3060
from sys import stdin, stdout


def solve():
    n = int(input())
    A = [int(i) for i in stdin.readline().split()]
    dp = [[i,0] for i in A]
    t = [[0,0] for _ in range(len(A))]
    for i in range(1, len(A)):
        for j in range(i, len(A)):
            l = A[j-i] + dp[j][1]
            r = A[j] + dp[j-1][1]
            if l > r:
                t[j][0] = l
                t[j][1] = dp[j][0]
            else:
                t[j][0] = r
                t[j][1] = dp[j-1][0]
        dp = t
        t = [[0,0] for _ in range(len(A))]
    return dp[-1][0] - dp[-1][1]


print(solve())

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

using namespace std;

using i64 = long long int;
const i64 MOD = 1000000007;

int main() {
    int n, k;
    cin >> n >> k;
    vector<vector<i64> > dp(n, vector<i64>(k+1, 0));
    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    for(int i=0; i<=a[0]; i++) dp[0][i] = 1;
    for(int t=1; t<n; t++) {
        i64 sum = 0;
        queue<i64> q;
        int qsize = a[t]+1;
        for(int i=0; i<=k; i++) {
            if(q.size()==qsize) {
                sum += (MOD - q.front());
                q.pop();
            }
            sum = (sum + dp[t-1][i]) % MOD;
            q.push(dp[t-1][i]);
            dp[t][i] = sum;
        }
    }
    cout << dp[n-1][k] << endl;
}

Measured memory_bytes: 79488
def readinput():
    s=input()
    return s

def main(s):
    if 'A' <= s and s <='Z':
        return 'A'
    elif 'a' <= s and s <= 'z':
        return 'a' 
    return ''

if __name__=='__main__':
    s=readinput()
    ans=main(s)
    print(ans)


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

int main()
{
    int N;
    cin >> N;
    vector<vector<int>> D(N, vector<int>(2));
    rep (i, N) {
        cin >> D.at(i).at(0) >> D.at(i).at(1);
    }
    bool check[N];
    rep (i, N) {
        check[i] = false;
    }
    rep (i, N) {
        if (D.at(i).at(0) == D.at(i).at(1)) check[i] = true;
    }
    bool out = false;
    rep (i, N - 2) {
        if (check[i] == true && check[i + 1] == true && check[i + 2] == true) {
            out = true;
        }
    }
    if (out) cout << "Yes"; else cout << "No";
    return 0;
}

Measured memory_bytes: 3632
'use strict';
(function(stdin) {
  //declare function
  var calculation = function(array) {
    var result = [];
    for (var i = 0, len = array.length; i < len; i++) {
      var formula = array[i];
      // console.log(formula);
      if (formula[1] === '+') {
        result[i] = Number(formula[0]) + Number(formula[2]);
      } else
      if (formula[1] === '-') {
        result[i] = formula[0] - formula[2];
      } else
      if (formula[1] === '*') {
        result[i] = formula[0] * formula[2];
      } else
      if (formula[1] === '/') {
        result[i] = parseInt(formula[0] / formula[2]);
      } else
      if (formula[1] === '%') {
        result[i] = formula[0] % formula[2];
      } else
      if (formula[1] === '\?') {
        break;
      }
    }
    return result.join('\n');
  };
  //declare variable
  var inputs = stdin.toString().trim().split('\n');
  var cols = inputs.map(function(v) {
    return v.split(' ');
  });
  //main
  //display
  console.log(calculation(cols));
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 15760
import sys

sys.setrecursionlimit(10 ** 5 * 2 + 10)

MOD = 10 ** 9 + 7
inv = [None, 1]
for i in range(2, 10 ** 5 * 2 + 1):
    inv.append(MOD - MOD // i * inv[MOD % i] % MOD)

fact = [1]
ifact = [1]
for i in range(1, 10 ** 5 * 2 + 1):
    fact.append((i * fact[-1]) % MOD)
    ifact.append((inv[i] * ifact[-1]) % MOD)


class Node:
    def __init__(self, ind):
        self.ind = ind
        self.val = 1
        self.ndesc = 1
        self.neighs = []

    def calc(self, fro):
        for neigh in self.neighs:
            if neigh.ind == fro:
                continue
            neigh.calc(self.ind)
            self.val = self.val * neigh.val * ifact[neigh.ndesc] % MOD
            self.ndesc += neigh.ndesc
        self.val = self.val * fact[self.ndesc - 1] % MOD

    def comp(self, fro, carry):
        self.val = carry * self.ndesc * inv[max(1, N - self.ndesc)] % MOD
        for neigh in self.neighs:
            if neigh.ind == fro:
                continue
            neigh.comp(self.ind, self.val)


N = int(input())
nodes = [Node(i) for i in range(N)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    nodes[a - 1].neighs.append(nodes[b - 1])
    nodes[b - 1].neighs.append(nodes[a - 1])
nodes[0].calc(0)
nodes[0].comp(0, (nodes[0].val * inv[N]) % MOD)
for i in range(N):
    print(nodes[i].val)


Measured memory_bytes: 150980
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<string>
#include <fstream>
using namespace std;

using ll = long long;

int main() {

	int n;
	cin >> n;

	cout << 0 << endl;
	fflush(stdout);

	string s;
	cin >> s;
	if (s == "Vacant")
		return 0;
	string botStr = s;
	int bot = 0;
	int top = n - 1;

	int counti = 1;
	while (counti < 20) {
		
		int nexti = (bot + top) / 2;
		if (nexti == bot)
			nexti++;
		cout << nexti << endl;
		fflush(stdout);

		cin >> s;
		if (s == "Vacant")
			return 0;
		if ((bot % 2 == nexti % 2 && botStr == s) || (bot % 2 != nexti % 2 && botStr != s)) {
			bot = nexti;
			botStr = s;
		}
		else {
			top = nexti - 1;
		}

		counti++;
	}

	return 0;
}

Measured memory_bytes: 852
num = int(input())
len = list(map(int,input().split()))
count = 0
max = 0
m1 = 0
m2 = 0

#print(num)
#print(len[0],len[1])

for i in range(num):
    for j in range(num):
        for k in range (num):
            if (len[i] != len[j]) and (len[i] != len[k]) and (len[j] != len[k]):
                if len[i] > len[j]:
                    max = len[i]
                    m1  = len[j]
                else:
                    max = len[j]
                    m1  = len[i]
                if len[k] > max:
                    m2  = max
                    max = len[k]
                else:
                    m2 = len[k]

                if (m1 + m2) > max:
                    if (i>j) and (j>k):
                        count += 1

print(count)


Measured memory_bytes: 74512
n, m = map(int, input().split())
a = [0]*m
for _ in range(n):
    k = list(map(int, input().split()))
    for i in range(m):
        if i+1 in k[1:]:
            a[i] += 1
ans = 0
for i in range(m):
    if a[i] == n:
        ans += 1
print(ans)


Measured memory_bytes: 9076
import sys
input = sys.stdin.readline

n = int(input())
L, R = [], []
LR = []
INF = 10**9+1
m, M = INF, 0
for i in range(n):
  x, y = map(int, input().split())
  if x > y:
    x, y = y, x
  L.append(x)
  R.append(y)
  LR.append((x, y))
  if m > x:
    m = x
    idx_m = i
  if M < y:
    M = y
    idx_M = i
ans1 = (M-min(R))*(max(L)-m)
if idx_m == idx_M:
  print(ans1)
  exit()
a, b = L[idx_M], R[idx_m]
if a > b:
  a, b = b, a
LR = sorted([lr for i, lr in enumerate(LR) if i != idx_m and i != idx_M])
if not LR:
  print(ans1)
  exit()
L, R = zip(*LR)
max_R = [-1]*(n-2)
min_R = [-1]*(n-2)
max_R[0] = R[0]
min_R[0] = R[0]
for i in range(n-3):
  max_R[i+1] = max(max_R[i], R[i+1])
  min_R[i+1] = min(min_R[i], R[i+1])
l_min, l_max = L[0], L[-1]
ans2 = max(b, l_max) - min(a, l_min)
for i in range(n-2):
  if i < n-3:
    l_min = min(min_R[i], L[i+1])
  else:
    l_min = min_R[i]
  l_max = max(l_max, max_R[i])
  ans2 = min(ans2, max(b, l_max) - min(a, l_min))
ans2 *= M-m
ans = min(ans1, ans2)
print(ans)

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

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int size = scan.nextInt();
        int arr[] = new int[size];
        for(int i = 0; i < size; i++) arr[i] = scan.nextInt();
        for(int i = 0; i < size; i++){
            int tmp = arr[i], j = i;
            for(; 0 < j && tmp <= arr[j - 1]; j--) arr[j] = arr[j - 1];
            arr[j] = tmp;
            for(j = 0; j < size; j++)
                System.out.print((j == 0 ? "" : " ") + arr[j]);
            System.out.println();
        }
    }
}

Measured memory_bytes: 33136
def main():
    N, K = list(map(int, input().split(' ')))
    A = list(map(int, input().split(' ')))
    dp = [0 for _ in range(K + 1)]  # whether Taro wins
    for n in range(1, K + 1):
        win = 0
        for a in A:
            if n - a >= 0 and dp[n - a] == 0:
                win = 1
                break
        dp[n] = win
    print('First' if dp[K] == 1 else 'Second')


if __name__ == '__main__':
    main()

Measured memory_bytes: 3864
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define maxn 10004
#define mod 1000000007
#include <bits/stdc++.h>
using namespace std;




int main() {
    int tc = 1;
    while(tc--){
        ll n, k;
        cin >> n >> k;
        if(n>=k){
            ll d = n / k;
            n -= d * k;
        }
        cout << min(n, k-n) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_variables)]
use proconio::input;
use proconio::marker::*;
use std::cmp::{min, max};
use std::collections::{HashSet, HashMap, BinaryHeap};

fn main() {
    input! {
        r: f64,
    }
    let pi = 3.14159265;
    let ans = 2.0 * r * pi;
    println!("{}", ans);
}


Measured memory_bytes: 2208