akhauriyash/Code-Regression huggingface dataset:
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

string a,b;
int c;
inline void solve(){
  IN2(a,b);
  c=stoi(a+b);
  OUT((int)sqrt(c)*(int)sqrt(c)==c?"Yes":"No");
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().strip().split(' ')))
R = [0 for i in range(N+1)]
ans = []

for _ in range(N):
    i = N - _
    a = A[i-1]
    if sum(R[i::i]) % 2 != a:
        R[i] = 1
        ans.append(i)

ans.sort()
print(len(ans))
if ans:
    print(' '.join(map(str, ans)))

Measured memory_bytes: 19936
n = int(input())

if n != 0:
    ans = ''
    while n != 0:
        while n%2 == 0:
            n = n//(-2)
            ans = '0'+ans
        n = n-1
        ans ='1'+ans
        n = n/(-2)
else:
    ans = '0'
    
print(ans)

Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>

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

using namespace std;

int main(){
    int X,Y;
    while(cin >> X >> Y,X+Y){
        int fld[20][20] = {0};
        rep(y,Y){
            rep(x,X){
                cin >> fld[y][x];
            }
        }

        int dp[20][20] = {0};
        rep(x,X){
            if(fld[0][x] == 0)
                dp[0][x] = 1;
        }

        rep(y,Y-1){
            rep(x,X){
                int val = dp[y][x];
                if(fld[y][x] == 0){
                    if(x>0 && fld[y+1][x-1] == 0){
                        dp[y+1][x-1] += val;
                    }
                    if(fld[y+1][x+1] == 0){
                        dp[y+1][x+1] += val;
                    }
                    dp[y+1][x] += val;
                }else if(fld[y][x] == 2){
                    dp[y+2][x] += val;
                }
            }
        }

        int ans = 0;
        rep(i,2){
            rep(x,X){
                if(fld[Y+i-1][x] != 1)
                    ans += dp[Y+i-1][x];
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;
#define int long long
const int MOD = 1000000007;

int L[10];
int R[10];
signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    string S;
    cin >> S;
    for (int i = 0; i < N; i++) {
        R[S[i] - '0']++;
    }
    set<int> st;
    for (int i = 0; i < N; i++) {
        R[S[i] - '0']--;

        for (int j = 0; j < 10; j++) {
            for (int k = 0; k < 10; k++) {
                if (L[j] > 0 && R[k] > 0) {
                    st.insert(j * 100 + (S[i] - '0') * 10 + k);
                }
            }
        }
        L[S[i] - '0']++;
    }

    cout << st.size() << endl;
}

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

#define PI 3.141592653589793238

int main() {
    
    int A,B,H,M;
    double deg_H,deg_M,deg,ans;
    
    scanf("%d %d %d %d",&A,&B,&H,&M);
    
    deg_H = PI * H / 6 + PI * M / 360;
    deg_M = PI * M / 30;
    deg = fabs(deg_H - deg_M);
    
    ans = sqrt(A * A + B * B - 2 * A * B * cos(deg));
    
    printf("%.9lf\n",ans);
    
    return 0;
}


Measured memory_bytes: 2604
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long  ll;
#define EPS 1e-9
#define PI acos(-1.0)

int main() {

   ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
   string s , t;
   cin >> s >> t;
   int c1, c2;
   cin >> c1 >> c2;
   string u;
   cin >> u;
   if(u == s)c1--;
   if(u == t)c2--;
   cout << c1 << ' ' << c2 << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, sum = 0;
  cin >> N >> K;
  
  for (int i = 0; i < N; i++) {
    int x_i;
    cin >> x_i;
    if (x_i < K && K <= 2 * x_i) {
      sum += 2 * (K - x_i);
    }
    else {
      sum += 2 * x_i;
    }
  }
  cout << sum << endl;
    
}

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

int main(){
    int N,M,AC=0,WA=0;
    cin>>N>>M;
    vector<int> p(M),wa(105000,0);
    vector<string> S(M);
    vector<bool> flag(105000,false);
    for(int i=0;i<M;++i){
        cin>>p.at(i)>>S.at(i);
        if(!flag.at(p.at(i))){
            if(S.at(i)=="WA"){
                wa.at(p.at(i))++;
            }else if(S.at(i)=="AC"){
                ++AC;
                WA += wa.at(p.at(i));
                flag.at(p.at(i))=true;
            }
        }
    }
    
    cout<<AC<<" "<<WA<<endl;
    
}

Measured memory_bytes: 6528
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
int n;
cin>>n;
if(n/10==9||n-10==9||n-20==9||n-30==9||n-40==9||n-50==9||n-60==9||
n-70==9||n-80==9){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){

    int a,b;
    scanf("%d %d",&a,&b);

    int sum = a+b;
    int dif = a-b;
    int by = a*b;

    if(sum>=dif && sum>=by){
        printf("%d\n",sum);
    }else if(dif>=sum && dif>=by){
        printf("%d\n",dif);
    }else{
        printf("%d\n",by);
    }
    return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1566>
問題文============================================================
 太郎君は夏休みの間、毎日１つの映画を近所の映画館で見ることにしました。
 （太郎君の夏休みは8月1日から8月31日までの31日間あります。）
 
 その映画館では、夏休みの間にn つの映画が上映されることになっています。
 それぞれの映画には 1 から n までの番号が割り当てられており、
 i 番目の映画は8月 ai 日から8月 bi 日の間だけ上映されます。
 
 太郎君は映画を見た時、それが初めて見る映画だった場合は 100 の幸福度を得ることができます。
 しかし、過去に 1 度でも見たことのある映画だった場合は 50 の幸福度を得ます。
 
 太郎君は上映される映画の予定表をもとに、夏休みの計画を立てることにしました。
 太郎君が得られる幸福度の合計値が最大になるように映画を見たときの合計値を求めてください。
 
 どの日も必ず1つ以上の映画が上映されていることが保証されます。
=================================================================

解説=============================================================

できるだけ多く初視聴となる映画をみるには
 1日から31日まで順番に見て行き、i日目のとき、その区間を覆う期間のうち
 最も早く期間が終了するもの（bが最も近いもの）を優先して視聴していけば最適となる。
 
 また、その選び方として、sortの他にpriority_queue、フローなどで実装できる
 
================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n),b(n);
    for(int i = 0; i < n;i++) {
        cin >> a[i] >> b[i]; a[i]--; b[i]--;
    }
    vector<vector<pii>> G(31);
    vector<int> flag(n,0);
    for(int i = 0; i < n;i++){
        for(int j = a[i]; j <= b[i];j++){
            G[j].push_back(pii(b[i],i));
        }
    }
    for(int i = 0; i < 31;i++) sort(G[i].begin(),G[i].end());
    for(int i = 0; i < 31;i++){
        for(auto e:G[i]){
            if(flag[e.second] == 0){
                flag[e.second] = 1;
                break;
            }
        }
    }
    ll ans = 50*31;
    for(int i = 0; i < n;i++){
        if(flag[i]){
            ans += 50;
        }
    }
    cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3172
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
	int n,i,x;
	string s;
	x=0;
	getline(cin,s);
	for(i=0;i<s.size()-1;i++)
	{
		if(s[i]!=s[i+1])
			x++;
	}
	cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 512
n = int(input())
s = []
for _ in range(n):
    s.append(input())
s.sort(key=len)
moji = set(s[0])
ans=[]
for cha in moji:
    mn=10**9
    for st in s:
        cnt = st.count(cha)
        if cnt < mn:
            mn = cnt
    for i in range(mn):
        ans.append(cha)
ans.sort()
print(*ans,sep="")

Measured memory_bytes: 38640
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
const ll Mod=1000000007;
const ll INF=999999999999999999;
const ll NN=(ll)(1e6+5);
int mod(string s,int a) 
{ 
    int ans=0; 
    for (int i=0;i<s.length();i++) 
         ans=(ans*10+(int)s[i]-'0')%a; 
    return ans; 
}
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {
       ll n,m,k,c,i,j,ii,jj,ans=0;
       cin>>n>>m>>k;
       char a[n][m];
       for(i=0;i<n;i++)
        for(j=0;j<m;j++)
         cin>>a[i][j];
       for(i=0;i<(1<<n);i++)
       {
           for(j=0;j<(1<<m);j++)
           {
               c=0;
               for(ii=0;ii<n;ii++)
               {
                   for(jj=0;jj<m;jj++)
                   {
                       if(i>>ii&1&&j>>jj&1&&a[ii][jj]=='#')
                        c++;
                   }
               }
               ans+=(c==k);
           }
       }  
       cout<<ans;          
   }
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define T top()
#define E end()
#define PS push
#define Q queue
#define PP pop()
#define L0 (LL)0
#define V vector
#define ST stack
#define FI first
#define MAX 4e18
#define MIN -MAX
#define DQ deque
#define RE rend()
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define SE second
#define DL double
#define G getline
#define IN insert
#define endl "\n"
#define EM empty()
#define EE emplace
#define RB rbegin()
#define MD 1000000007
#define PSB push_back
#define PI acos(-1.00)
#define PPB pop_back()
#define PSF push_front
#define ub upper_bound
#define lb lower_bound
#define PPF pop_front()
#define EB emplace_back
#define LL long long int
#define PQ priority_queue
#define N cout<<"No"<<endl
#define Y cout<<"Yes"<<endl
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define UOSMOY v.C;w.C;ww.C;u.C;uu.C;uo.C;vo.C;vu.C;ab.C;bc.C;cc.C;uuu.C;a.C;b.C;c.C
V<LL>v;
V<LL>w,ab,bc;
set<LL>uo;
map<LL,LL>u;
map<LL,LL>ww,cc;
V<pair<LL,LL> >uu;
map<LL,V<LL> >uuu;
map<pair<LL,LL>,LL> vo;
map<pair<LL,LL>,LL> vu;
LL ar[100];
LL dxx[]= {-1,0,1,0};
LL dyy[]= {0,1,0,-1};
LL dx[]= {2,1,-1,-2,-2,-1,1,2};
LL dy[]= {1,2,2,1,-1,-2,-2,-1};
int main()
{
//  BRR;
//  file;
    FAST;
    char ch;
    string a,b,c;
    DL x,y,d,e,f,g,h;
    LL n,m,i,j,k,p,q,o,l,s,tt=1,t,z,aa,r=0;
//    cin>>tt;
    while(tt--)
    {
        UOSMOY;
       cin>>n>>m>>o>>s;
       while(n>=m)
       {
           m*=2;
           s--;
       }
       while(m>=o)
       {
           o*=2;
           s--;
       }
       if(s<0)
       {
           N;
       }
       else
       {
           Y;
       }
    }
    return 0;
    //IN
    //AL
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main(){
  int X;
  cin >> X;
  bool flag = false;
  for(int i=1; i<2000; i++){
    int Y = X - 100*i;
    if(Y <= 5*i && Y >= 0){
      flag = true;
    }
  }
  
  if(flag){
    cout << 1 << endl;
  }
  else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
stack = []
store_num = []
store_result = []

for i,c in enumerate(input().split()): 
        
        def pop_and_stack(list_,num):
                     
            list_.pop()
            list_.pop()
            list_.append(num)
            
            return list_
            
    
        if c == '+' :
            a = stack[-2]
            b = stack[-1]
            num = a+b
            pop_and_stack(stack,num)

        elif c== "-":
            a = stack[-2]
            b = stack[-1]
            num = a-b
            pop_and_stack(stack,num)
        elif c =='*':
            a = stack[-2]
            b = stack[-1]
            num = a*b
            pop_and_stack(stack,num)  
        elif c == '/':
            a = stack[-2]
            b = stack[-1]
            num = a/b
            pop_and_stack(stack,num)
        else:
            stack.append(int(c))
            
print(stack[-1]) 


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define FOR(i, b, n) for (ll i = b; i < n; ++i)

using namespace std;
using ll = long long;
using P = pair<int, int>;

void solve(ll x) {
  if (x == 0)
    cout << 1 << endl;
  else
    cout << 0 << endl;
}

int main(){
  // int 3E4  long 2E9  ll 9E18
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll x;
  cin >> x;

  solve(x);

  return 0;
}


Measured memory_bytes: 3584
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
 
/*Atcoder用
 * 		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		int a = Integer.parseInt(tmp[0]);
		int b = Integer.parseInt(tmp[1]);
		int c = Integer.parseInt(tmp[2]);
 
 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String get = br.readLine();
		char[] s = get.toCharArray();
		for(char c:s)System.out.println(c);
 
		List<Integer> ls = new ArrayList<Integer>();
		String[] tmp = br.readLine().split(" ");
		for (int n = 0; n < N; n++) {
			ls.add(Integer.parseInt(tmp[n]));
		}
 */
 
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		int N = Integer.parseInt(tmp[0]);
		int K = Integer.parseInt(tmp[1]);
 
		List<Integer> ls = new ArrayList<Integer>();
		String[] foo = br.readLine().split(" ");
		//for (int n = 0; n < N; n++) {
			//ls.add(Integer.parseInt(foo[n]));
		//}
 
		int ans = 0;
		if((N-1)%(K-1) != 0){
			ans = (int)Math.floor((N-1)/(K-1));
			ans++;
		}else{
			ans = (int)((N-1)/(K-1));
		}
 
		System.out.println(ans);
	}
}

Measured memory_bytes: 37468
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
        int[] wac = new int[100001];
        int[] pass = new int[100001];

		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();

		String[] substr = str.split(" ", 0);

        int n = Integer.parseInt(substr[0]);
        int a = Integer.parseInt(substr[1]);

        if (a == 0) {
    		System.out.println("0 0");
    		return;
        }
		for (int i=0; i<a; i++) {
	        str = scan.nextLine();
	        substr = str.split(" ", 0);

	        int no = Integer.parseInt(substr[0]);
	        String result = substr[1];
	        if (result.equals("WA")) {
	        	if (pass[no] == 0) {
	        		wac[no] += 1;
	        	}
	        } else {
	        	pass[no] = 1;
	        }
		}

		int good = 0;
		int ng = 0;
		for (int i=1; i<n+1; i++) {
			good += pass[i];
			if (pass[i] == 1) {
				ng += wac[i];
			}
		}

		System.out.println(good + " " + ng);

	}
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  ll n, k;
  cin >> n >> k;
  n %= k;
  n = min(n, abs(n - k));
  cout << n << endl;
}


Measured memory_bytes: 256
a, b, c = map(int, input().split())
x = abs(b-a) + abs(c-b)
y = abs(c-a) + abs(b-c)
z = abs(a-b) + abs(c-a)
l = abs(c-b) + abs(a-c)
m = abs(a-c) + abs(b-a)
n = abs(b-c) + abs(a-b)
print(min(x, y, z, l, m, n))


Measured memory_bytes: 9188
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<map>
#include<utility>
#define mod 1000000007
#define pb push_back
using namespace std;
int main(){
	int n,k,ans=mod;
	cin>>n>>k;
	vector<int> pl,mi;
	for(int i=0;i<n;i++){
		int t;
		cin>>t;
		if(t>0){ pl.pb(t);}
		else if(t<0){ mi.pb(-t); }
		else{ k--;}
	}
	sort(pl.begin(),pl.end());
	sort(mi.begin(),mi.end());
	for(int i=0;i<=pl.size();i++){
		
		int ptime;
		if(i==0)ptime=0;
		else ptime=pl[i-1];
		
		int mtime = mod;
		if( 0 <= k-i && k-i <= mi.size() ){
			if(k-i==0)mtime=0;
			else mtime = mi[k-i-1];
			int res = ptime + mtime + min(ptime,mtime);
			if(res<ans)ans=res;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1020
n, m = map(int, input().split())
l_ = list(map(int, input().split()))
l = [(-1)*l_[i] for i in range(n)]

import heapq
heapq.heapify(l)

for i in range(m):
  x = (-1)*heapq.heappop(l)
  heapq.heappush(l, (x//2)*(-1))

print(sum(l)*(-1))

Measured memory_bytes: 73068
import sys
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


S = LS2()
if S[0] == S[1] == S[2] == S[3]:
    print('No')
elif S[0] == S[1] and S[2] == S[3]:
    print('Yes')
elif S[0] == S[2] and S[1] == S[3]:
    print('Yes')
elif S[0] == S[3] and S[1] == S[2]:
    print('Yes')
else:
    print('No')


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

int main() {
    int n; cin >> n;
    vector<double> p(n);
    vector< vector<double> > dp(n+1, vector<double>(n+1, 0));
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        for (int j = n; j >= 0; j--) {
            if (j == 0) dp[i+1][0] = dp[i][0] * (1-p[i]);
            else {
                dp[i+1][j] = dp[i][j] * (1-p[i]) + dp[i][j-1] * p[i];
            }
        }
    }
    double ans = 0;
    for (int i = 0; i <= n; i++) {
        if (i > n-i) {
            ans += dp[n][i];
        }
    }
    printf("%.12f\n", ans);
    return 0;
}

Measured memory_bytes: 70656
a,b=gets.chomp.split.map(&:to_i)
cnt = 1
x = 0
y = 0
a.times do
  x = cnt - b
  y = cnt + b
  break if x > 0
  cnt +=1
end
z = y - x + 1
k = a/z.to_f
puts k.ceil

Measured memory_bytes: 1788
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let s = get!(String).chars().collect::<Vec<_>>();
    let n = s.len();

    for i in 0..n {
        if s[i] != s[n-i-1] {
            println!("No");
            return;
        }
    }

    for i in 0..(n-1)/2 {
        if s[i] != s[(n-1)/2-i-1] {
            println!("No");
            return;
        }
    }

    for i in (n+1)/2..n {
        if s[i] != s[n-i+(n+1)/2-1] {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 8572
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
from collections import Counter
def main():
    c = Counter(list(input()))
    if len(c) != 2:
        print('No')
        exit()
    if c.most_common()[0][1] != 2:
        print('No')
        exit()
    print('Yes')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)

int main()
{
    string s, t;
    cin >> s >> t;
    int ans = 0;
    rep(i, s.size()){
        if(s[i] == t[i])    ans++;
    }
    cout << ans << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i=0; i<N; i++) cin >> A[i];

  for (int i=1; i<N; i++) {
    for (int t=0; t<N-1; t++) cout << A[t] << " ";
    cout << A[N-1] << endl;
    int v = A[i];
    int j = i - 1;
    while (j >= 0 && A[j] > v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
  }

  for (int t=0; t<N-1; t++) cout << A[t] << " ";
  cout << A[N-1] << endl;

  return 0;
}



Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

set<long long int> S;

long long int A[100005];
int N;

long long int INF = 999999999999;

map<long long int, int> C;

int main(void) {

	cin >> N;

		for (int i = 1; i <= N; i++) {
			cin >> A[i];
			
		}

		S.insert(-INF);
		S.insert(INF);

		int ans = 0;

		for (int i = 1; i <= N; i++) {
			auto y = S.upper_bound(A[i] - 1);
			y--;
			if ((*y) == -INF) { ans++; S.insert(A[i]); C[A[i]]++; }
			else {
				C[*y]--;
				if (C[*y] == 0) { S.erase(*y); }

				S.insert(A[i]); C[A[i]]++;
			}
		}

		cout << ans << endl;

	return 0;
}

Measured memory_bytes: 11776
using System;
using System.Linq;
using System.Collections.Generic;

class Myclass
{
    static void Main()
    {
        var S = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int A = S[0];
        int B = S[1];
        int left = A - B;
        int C = S[2];
        int ans = C-left;
        if (ans < 0)
            ans = 0;
        Console.WriteLine(ans);



    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (m); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl


int main() {
    int H, W;
    vector<string> S;
    cin >> H >> W;
    rep(i, H) {
        string _S;
        cin >> _S;
        S.push_back(_S);
    }

    vector<vector<int>> toR(H, vector<int>(W, 0)); // →
    vector<vector<int>> toL(H, vector<int>(W, 0));  // ←
    vector<vector<int>> D(H, vector<int>(W, 0));  // ↓
    vector<vector<int>> U(H, vector<int>(W, 0));  // ↑

    rep(i, H) {
        int k = 1;
        rep(j, W) {
            if (S[i][j] == '.') {
                toR[i][j] = k;
                ++k;
            } else {
                k = 1;
            }
        }
    }
    rep(i, H) {
        int k = 1;
        rep(j, W) {
            if (S[i][W-1-j] == '.') {
                toL[i][W-1-j] = k;
                ++k;
            } else {
                k = 1;
            }
        }
    }
    rep(j, W) {
        int k = 1;
        rep(i, H) {
            if (S[i][j] == '.') {
                D[i][j] = k;
                ++k;
            } else {
                k = 1;
            }
        }
    }
    rep(j, W) {
        int k = 1;
        rep(i, H) {
            if (S[H-1-i][j] == '.') {
                U[H-1-i][j] = k;
                ++k;
            } else {
                k = 1;
            }
        }
    }

    int ans = 0;
    rep(i, H) {
        rep(j, W) {
            if (S[i][j] != '#') {
                int sum = toR[i][j] + toL[i][j] \
                + D[i][j] + U[i][j] - 3; // 縦横の各被りとすぬけ君の位置の3つを引く
                ans = max(ans, sum);
            }
        }
    }

    print(ans);

    return 0;   

}


Measured memory_bytes: 67200
#include <iostream>
#include <algorithm>
//#include <cstdio>
//#include <map>
//#include <cmath>
#include <vector>
using  namespace std;
int main() {
    int  m,n;
    cin>>m>>n;
    if(m<n){
        for (int i = 0; i < n; ++i) {
            cout<<m;
        }
    }
    else{
        for (int i = 0; i < m; ++i) {
            cout<<n;
        }
    }
    return 0;
}

Measured memory_bytes: 256
A, B, C = map(int, input().split())
min_k = 1000000 // 7 + 1
min_r = 0
for r in range(7):
    u = C - r * A
    d = 7 * A + B

    k = 1
    if u < 0:
        k = 0
    elif u % d == 0:
        k = u // d
    else:
        k = u // d + 1

    if min_k > k:
        min_k = k
        min_r = r

print(7 * min_k + min_r)


Measured memory_bytes: 5596
N,A,B=map(int,input().split())
S=input()

X=A+B
Y=B

T=[]
for s in S:
    if s=="a":
        if X>0:
            T.append(True)
            X-=1
        else:
            T.append(False)
    elif s=="b":
        if X>0 and Y>0:
            T.append(True)
            X-=1
            Y-=1
        else:
            T.append(False)
    else:
        T.append(False)

for t in T:
    if t:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 79804
import java.util.*;class Main{public static void main(String[]z){double[]b=new double[8];for(Scanner s=new Scanner(System.in);s.hasNext();System.out.println((f(b[0],b[1],b[4],b[5],b[6],b[7])>0&&f(b[4],b[5],b[0],b[1],b[2],b[3])>0&&f(b[2],b[3],b[6],b[7],b[0],b[1])>0&&f(b[6],b[7],b[2],b[3],b[4],b[5])>0)||(f(b[0],b[1],b[4],b[5],b[6],b[7])<0&&f(b[4],b[5],b[0],b[1],b[2],b[3])<0&&f(b[2],b[3],b[6],b[7],b[0],b[1])<0&&f(b[6],b[7],b[2],b[3],b[4],b[5])<0)?"YES":"NO")){z=s.next().split(",");for(int i=0;i<8;++i)b[i]=new Double(z[i]);}}static double f(double a,double b,double c,double d,double e,double f){return ((d-b)*e+(a-c)*f+c*b-a*d);}}

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

#define rep(i, n) for (ll i = 0; i < n; i++)
#define repm(i, m, n) for (ll i = m; i < n; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define YesNo(a) (a) ? cout << "Yes" << endl : cout << "No" << endl
#define YESNO(a) (a) ? cout << "YES" << endl : cout << "NO" << endl
#define INF (2e9)
#define PI (acos(-1))
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007

typedef long long ll;

int main(){
  double l; cin >> l;

  cout << fixed << setprecision(7) << pow(l/3, 3) << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-11
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<double,double> P;
typedef complex<double> CP;
typedef long long ll;

int main(){
	P a,b,c,d;
	while(cin>>a.F>>a.S>>b.F>>b.S>>c.F>>c.S>>d.F>>d.S){
		P x,y;
		x.F=b.F-a.F;
		x.S=b.S-a.S;
		y.F=d.F-c.F;
		y.S=d.S-c.S;
		if(fabs(x.F*y.F+x.S*y.S)<=EPS) cout<<"YES\n";
		else cout<<"NO\n";
	}
	return 0;
}

Measured memory_bytes: 1188
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as MV

main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine
  q <- V.replicateM m $ do
    [x, y] <- map read . words <$> getLine
    return (x-1, y-1)
  let
    ans = V.create $ do
      vn <- MV.replicate n (1 :: Int)
      vb <- MV.replicate n False
      MV.write vb 0 True
      V.forM_ q $ \(x, y) -> do
        red <- MV.read vb x
        MV.modify vn (+1) y
        MV.modify vb (\b -> red || b) y
        MV.modify vn (subtract 1) x
        l <- MV.read vn x
        MV.modify vb (\b -> (l /= 0) && b) x
      return vb
  print $ V.length $ V.filter id ans


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

int main() {
    int n, k;
    string s;

    cin >> n >> k >> s;

    vector<int> nums;
    int now = 1;
    int cnt = 0;

    for (int i = 0; i < s.length(); i++) {
        if (s[i] - '0' != now) {
            nums.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        } else {
            cnt++;
        }
    }

    if (cnt > 0) {
        nums.push_back(cnt);
    }

    // 1の数 - 0の数 - 1の数 - 0の数 - 1の数 という配列を作りたい
    // 0で終わってたら最後に1のやつを加える

    if (nums.size() % 2 == 0) {
        nums.push_back(0);
    }

    // for (auto a : nums) {
    //     cout << a << " ";
    // }
    // cout << endl;

    vector<int> sums;
    sums.push_back(0);

    for (int i = 0; i < nums.size(); i++) {
        sums.push_back(sums[i] + nums[i]);
    }

    int ans;
    for (int i = 0; i < nums.size(); i += 2) {
        int left = i;
        int right = min(left + k * 2 + 1, (int)nums.size());

        ans = max(ans, sums[right] - sums[left]);
    }

    cout << ans << endl;

    return 0;
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = 1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";

void solve() {
    int n, k;
    cin >> n >> k;
    int g = 0, mx = 0;
    FOR(i, 0, n) {
        int x; cin >> x;
        g = gcd(g, x);
        chkmax(mx, x);
    }
    if (k % g || k > mx) {
        cout << "IMPOSSIBLE\n";
    }
    else {
        cout << "POSSIBLE\n";
    }
}

int main() {
    int JUDGE_ONLINE = 1;
    if (fopen("in.txt", "r")) {
        JUDGE_ONLINE = 0;
        assert(freopen("in.txt", "r", stdin));
        //assert(freopen("out.txt", "w", stdout));
    }
    else {
        ios_base::sync_with_stdio(0), cin.tie(0);
    }
    solve();
    if (!JUDGE_ONLINE) {
        //cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    }
    return 0;
}

Measured memory_bytes: 256
# TLE (and may be wrong)
# 解説を読んでからDP

S = input()
lS = len(S)

# dp[i][j]
# - 最初にマスjに居た子供が，i回目の移動後に居るマス
# - dp[1][j]
#   - S[j] == 'L'ならj - 1，S[j] == 'R'ならj + 1
# - dp[i1 + i2][j] = dp[i2][dp[i1][j]]
#
# 実際は10^5計算すれば良い (端から端までいくので)

dp = [[None for _ in range(lS)] for _ in range(33)]

for j in range(lS):
    if S[j] == 'R':
        dp[0][j] = j + 1
    else:
        dp[0][j] = j - 1

for p in range(32):
    for i in range(len(S)):
        dp[p + 1][i] = dp[p][dp[p][i]]

# for row in dp: print(row)

ans = [0] * len(S)
for i in range(lS):
    ans[dp[32][i]] += 1

print(*ans)

Measured memory_bytes: 120820
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <sstream>

#define DEBUG 0
#define fi first
#define se second
#define pb push_back
#define fore(i, a, b) for (int i = (a), _b = (b); i < (_b); ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= (_b); ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= (_b); --i)

using namespace std;

typedef long long LL;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const int INF = 1e9 + 3;
const int MOD = 1e9 + 7;

int main() {
    if (DEBUG) {
        freopen("CP.inp", "r", stdin);
        //freopen("CP.out", "w", stdout);
    }
    ios_base::sync_with_stdio(false); cin.tie(0);
	int a, b; cin >> a >> b;
  	if ((a + b) & 1) cout << "IMPOSSIBLE\n";
  	else cout << (a + b) / 2 << '\n';
    return 0;
}


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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100
typedef long long ll;

int n;
int count_HIT=0, count_OUT=0;
int Point=0;
string S;


void solve()
{
	while (count_OUT <3)
	{
		cin >> S;
		if (S == "HIT")
		{
			count_HIT++;
			if (count_HIT == 4)
			{
				Point++;
				
				count_HIT -- ;
			}
		}
		else if (S == "HOMERUN")
		{
			Point += count_HIT + 1;
			
			count_HIT = 0;
		}
		else count_OUT++;
	}
	cout << Point << endl;
	count_OUT = 0; count_HIT = 0;
	Point = 0;
	
	return;
}

int main()
{
	cin >> n;
	REP(j, n)
	{
		solve();
	}

	

	return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
#define ll long long

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#ifdef DEBUG
#define line(i) cout << "[" << __LINE__ << "] ";
#define dump(i) cout << #i ":" << i << " ";
#define dumpl(i) cout << #i ":" << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
int g[2000][2000], sum[2000][2000];
int main(int argc, char const *argv[])
{

    int n, k;
    cin >> n >> k;
    rep(i, n)
    {
        int x, y;
        char c;
        cin >> x >> y >> c;
        if (c == 'W')
            x += k;
        g[y % (2 * k)][x % (2 * k)]++;
    }
    rep(i, 2 * k) rep(j, 2 * k)
    {
        sum[i][j] = g[i][j];
        if (j != 0)
            sum[i][j] += sum[i][j - 1];
    }
    rep(i, 2 * k) rep(j, 2 * k)
    {
        if (i != 0)
            sum[i][j] += sum[i - 1][j];
    }
    int ans = -1, all = sum[2 * k - 1][2 * k - 1];
    rep(j, k) rep(i, k)
    {

        int now = sum[i][j];
        now += sum[2 * k - 1][j] - sum[i + k][j];
        now += sum[i][2 * k - 1] - sum[i][j + k];
        now += sum[i + k][j + k] - sum[i][j + k] - sum[i + k][j] + sum[i][j];
        now += sum[2 * k - 1][2 * k - 1] - sum[2 * k - 1][j + k] - sum[i + k][2 * k - 1] + sum[i + k][j + k];
        ans = max({ans, now, all - now});
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 31488
import math
A, B = map(int,input().split())
if A == 0:
    if B % 4 ==0:
        print(B)
    elif B % 4 == 1:
        print(1)
    elif B % 4 == 2:
        print(B+1)
    else:
        print(0)
elif A == B:
    print(A)
else:
    LA = []
    LB = []
    for i in range(int(math.log2(A))+1):
        P = A % (2**(i+1))
        Q = P % (2**i)
        R = (P-Q)//(2**i)
        LA.append(R)
    for i in range(int(math.log2(B))+1):
        P = B % (2**(i+1))
        Q = P % (2**i)
        R = (P-Q)//(2**i)
        LB.append(R)
    LS = []
    def Q(a,b):
        return (a%2,b%2)
    if A == B-1:
        if Q(A,B) == (0,1):
            print(1)
        else:
            LS.append(1)
            if len(LA) == len(LB):
                for i in range(1,len(LA)):
                    LS.append((LA[i]+LB[i])%2)
            else:
                for i in range(len(LA)):
                    LS.append(1)
            ANS = 0
            for i in range(len(LS)):
                ANS += (2**i)*LS[i]
            print(ANS)
    else:
        if Q(A,B) == (0,0):
            if (B-A+1)%4 ==1:
                print(B)
            else:
                print(B+1)
        elif Q(A,B) == (0,1):
            if (B-A+1)%4 == 0:
                print(0)
            else:
                print(1)
        elif Q(A,B) == (1,0):
            if (B-A+1)%4 == 0:
                LS.append(0)
            else:
                LS.append(1)
            if len(LA) > 1:
                for i in range(1,len(LA)):
                    LS.append((LA[i]+LB[i])%2)
            if len(LB) > len(LA):
                for i in range(len(LA),len(LB)):
                    LS.append(LB[i])
            ANS = 0
            for i in range(len(LS)):
                ANS += (2**i)*LS[i]
            print(ANS)
        else:
            if (B-A+1)%4 == 1:
                print(A)
            else:
                print(A-1)

Measured memory_bytes: 3444
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

int n, a[10];

int solve(int k, bool f) {
	if (k == n) return f ? 1 : 0;
	if (a[k] % 2 == 0) return solve(k + 1, true) + 2 * solve(k + 1, f);
	else return solve(k + 1, f) + 2 * solve(k + 1, true);
}
 
int main(int argc, char **argv) {
	cin >> n;
	REP(i, n) cin >> a[i];
	cout << solve(0, false) << endl;
	return 0;
}
 

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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	string t;
  cin >> t;
  if(t[0] == '?'){
    t[0] = 'D';
  }
  for(int i = 1;i < t.length() - 1;i++){
    if(t[i] == '?'){
     if(t[i - 1] == 'P'){
       t[i] = 'D';
     }else if(t[i] == '?' && t[i + 1] == '?'){
      t[i] = 'P';
      t[i + 1] = 'D';
    }else{
       t[i] = 'D';
     }
    }
  }
    if(t[t.length() - 1] == '?'){
      t[t.length() - 1] = 'D';
    }
  cout << t << endl;
return 0;
}

Measured memory_bytes: 3756
A = [list(map(int,input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
for i in range(3):
    bng = 1
    for j in range(3):
        if A[i][j] in B:
            continue
        else:
            bng = 0
            break
    if bng ==1:break
if bng==1:
    print("Yes")
else:
    for j in range(3):
        bng = 1
        for i in range(3):
            if A[i][j] in B:
                continue
            else:
                bng = 0
                break
        if bng==1:break
    if bng==1:
        print("Yes")
    else:
        if A[0][0] in B and A[1][1] in B and A[2][2] in B:
            print("Yes")
        elif A[0][2] in B and A[1][1] in B and A[2][0] in B:
            print("Yes")
        else:
            print("No")

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

int main(){
  long long L;
  long long R;
  cin >> L >> R;
  long long l = L;
  long long m = 2018;
  if (4000 <= R-L){
    cout << "0" << endl;
    return 0;
  }
  for (long long i=L; i<R; i++){
    for (long long j=i+1; j<=R; j++){
        long long tmp = (i*j)%2019;
		m=min(tmp,m);
  }
  }
  cout << m << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
string s="CODEFESTIVAL2016",a;
ll ans;
int main()
{
	getline(cin,a);
	for(register ll i=0;i<=15;i++)
	if(a[i]!=s[i])ans++;
    cout<<ans<<endl;
    return 0;
}

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

int main() {

	//A

	char st[200000];
	int i;
	for (i = 0; i < 200000; i++) {
		st[i] = ' ';
	}
	cin >> st;
	int stcount,delcount;
	stcount = 0;
	delcount = 0;
	for (i = 0; i < 200000; i++) {
		if (st[i] == 'T') {
			if (delcount == 0) {
				stcount++;
			}
			else {
				delcount--;
			}
		}else if(st[i] =='S'){
			delcount++;
		}
	}
	cout << stcount * 2;

	return 0;
}

Measured memory_bytes: 384
def get_input():
    N = int(input())
    S = input().strip()
    return N,S

w="."
b="#"


def solve(N,S):
    cur = 0
    whites = []
    for i in range(N):
        if S[i] == w:
            cur+=1
            whites.append(cur)
        else:
            whites.append(cur)
    cand = []
    for i in range(N):
        if i == 0:
            cand.append(whites[N-1])
        else:
            cand.append(i -whites[i] + (whites[N-1] - whites[i-1])) #all black i to N
    cand.append(N-whites[-1]) # all white 
    return min(cand)

if __name__ =="__main__":
    N,S = get_input()
    ans = solve(N,S)
    print(ans)

Measured memory_bytes: 19304
// 2015/06/23 Tazoe

#include <iostream>
using namespace std;

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

	for(int i=0; i<N; i++){
		int K, P;
		cin >> K >> P;

		int W = K%P;

		if(W==0){			// 割り切れた場合
			cout << P << endl;
		}
		else{
			cout << W << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

const int MAX = 670000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


ld N;
ld X[10],Y[10],W=0;

int main(){
    COMinit();
    ll X,Y;
    cin >> X >> Y;
    ll N=X+Y;
    if((X+Y)%3!=0){
        cout << 0 << endl;
        return 0;
    }
    ll K=abs(X-Y);
    ll M=N/3;
    if(K>M){
        cout << 0 << endl;
        return 0;
    }
    cout << COM(M,(M+K)/2)%MOD << endl;

}

Measured memory_bytes: 16000
#include<stdio.h>
#include<string.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
#define ll long long
const int N = 1e3+99;
int n,T;
int ans = 1;
int c[N],t[N];
int main()
{
    //freopen("in.txt","r",stdin);
    cin>>n>>T;
    int minn = 999999999;
   for(int i = 1; i <= n; i++)
   {
       cin>>c[i]>>t[i];
       if(t[i]<=T){
           minn=min(minn,c[i]);
       }
   }
   if(minn==999999999)
   {
       cout<<"TLE"<<endl;
   }
   else{
       cout<<minn<<endl;
   }
    return 0;
}

Measured memory_bytes: 256
/*
 * ITP1_1_D.c
 *
 *  Created on: 2017/05/11
 *      Author: sl2-user
 */
#include<stdio.h>

int main(void){

	int x,y,i=1;
	while(1){
	scanf("%d %d" , &x,&y);
	if((x==0 && y==0 ) || i>3000 ){break;}
	if(x>y){printf("%d %d\n",y,x);}
	else {printf("%d %d\n",x,y);}

	i++;
	}
return 0;
}

Measured memory_bytes: 600