akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;

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

int main(){
	string s;
	string t;
	cin >> s >> t;
	
	reverse(s.begin(), s.end());
	reverse(t.begin(), t.end());
	
	bool find = false;
	for(int i = 0; i < s.size(); ++i){
		if(i + t.size() <= s.size()){
			bool equal = true;
			for(int j = 0; j < t.size(); ++j){
				if(s[i+j] == t[j] || (s[i+j]) == '?') continue;
				equal = false;
			}
			if(equal){
				for(int j = 0; j < t.size(); ++j){
					s[i+j] = t[j];
				}
				find = true;
				break;
			}
		}
	}
	
	if(!find){
		cout << "UNRESTORABLE" << endl;
	}
	else{
		for(int i = 0; i < s.size(); ++i){
			if(s[i] == '?'){
				s[i] = 'a';
			}
		}
		
		reverse(s.begin(), s.end());
		cout << s << endl;
	}
	
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<numeric>
using namespace std;
#define ll  long long
#define mp make_pair
#define fi first
#define se second
#define pii pair<ll,ll>
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define what_is(x) cerr << #x << " is " << x << endl;
#define mod 1000000007
int main()
{
    ll int n,total,rem;
    cin >> n;
    total = 2*(n/11);
    rem = n%11;
    if(rem<=6&&rem)
    total +=1;
    else if(rem)
    total +=2;
    cout << total;
}

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

using namespace std;

string Input, Output;
const char ChangeTable[5][6] = { 'a','f','k','p','u','z',
								 'b','g','l','q','v','.',
								 'c','h','m','r','w','?', 
								 'd','i','n','s','x','!', 
								 'e','j','o','t','y',' ', };

bool solve(int len) {
	for (int i = 0; i < len; i += 2) {
		//cout << Input[i];
		if (Input[i]>'6' || Input[i]<'1' || Input[i + 1]>'5' || Input[i + 1] < '1') {
			return false;
		}
		//cout << ChangeTable[Input[i + 1] - '0' - 1][Input[i] - '0' - 1] << endl;
		Output += ChangeTable[Input[i+1] - '0'-1][Input[i] - '0'-1];
	}
	return true;
}

int main() {
	int len;

	while (cin >> Input) {
		len = Input.size();
		Output = "";
		if (len % 2 == 0 && solve(len)) {
			cout << Output << endl;
		}
		else {
			cout << "NA" << endl;
		}
		
	}

	return 0;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t T=0; T<v.size(); ++T){cout << " " << #v << "[" << T << "]=" << v[T];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n, m;
    cin >> n >> m;
    vector<lint> x(n), y(m);
    repeat(i, n) cin >> x[i];
    repeat(i, m) cin >> y[i];
    
    vector<lint> dx(n-1), dy(m-1);
    repeat(i, n-1) dx[i] = x[i+1] - x[i];
    repeat(i, m-1) dy[i] = y[i+1] - y[i];
    
    vector<lint> px(n+1), py(m+1);
    px[0] = py[0] = 0;
    repeat_from_to(i, 1, n) {
        px[i] = px[i-1] + (n-1) - (i-1)*2;
    }
    repeat_from_to(i, 1, m) {
        py[i] = py[i-1] + (m-1) - (i-1)*2;
    }
    assert(px[n] == 0 && py[m] == 0);
    px = vector<lint>(px.begin()+1, px.end()-1);
    py = vector<lint>(py.begin()+1, py.end()-1);
    
    auto productsum = [](const vector<lint> a, const vector<lint> b) -> lint {
        assert(a.size() == b.size());
        const lint MOD = 1e9 + 7;
        int n = a.size();
        lint res = 0;
        repeat(i, n) {
            res += a[i] * b[i];
            res %= MOD;
        }
        return res;
    };
    
    const lint MOD = 1e9 + 7;
    lint ans = productsum(dx, px) * productsum(dy, py);
    cout << ans % MOD << endl;
    return 0;
}

Measured memory_bytes: 8160
s = input()
k = int(input())

s1 = []
for i in range(len(s)):
    for j in range(i + 1, i + k + 1):
        s1.append(s[i:j])
s1.sort()
substring = []
i = 0
while len(substring) <= 4:
    try:
        if s1[i] not in substring:
            substring.append(s1[i])
        i = i + 1
    except:
        break
print(substring[k - 1])

Measured memory_bytes: 4340
#include <bits/stdc++.h>
#include <iterator>
#include <algorithm>
#include <queue>
#include <set>
#include <bitset>
#include <vector>
#include <map>



#define IOS                    ios::sync_with_stdio();cin.tie(0);
#define tc()                int tc;scanf("%d",&tc);while(tc--)
#define endl                "\n"
#define FLOAT_COM(a,b)      if(abs(a-b)==1e-9)
#define LOOP(a,b)           for(i=a;i<b;i++)
#define VI                  vector<int>
#define VLL                 vector<long long>
#define PB                  push_back
#define MP                  make_pair



using namespace std;

//int i,j,k,l,temp;

void shomoy(){
    #ifndef ONLINE_JUDGE
        cerr<<"\nTime  :"<<1.0*clock()/CLOCKS_PER_SEC<<"  s\n";
    #endif

}

bool isprime(int n){
    int f;
    for(f=2;f*f<=n;f++){
        if(n%f==0)
            return false;
    }
    return true;
}


                      /*Driver Code Startes Here*/
int main(){IOS
    int n,x,t,temp;
    cin>>n>>x>>t;
    if(n%x==0){
        temp = n/x;
    }
    else{
        temp = n/x + 1;
    }
			cout<<temp*t<<endl;
    


shomoy();
return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;


int main() {
    

    ll ans2 = 0, ans5 = 0;
    ll n;
    cin >> n;
    ll k = n/2;
    if(n%2 == 0){
        ll k5 = k;
        while(k5 > 0){
            ans5 += k5 / 5;
            k5 /= 5;
        }
        ll k2 = k;
        while(k2 > 0){
            ans2 += k2 / 2;
            k2 /= 2;
        }
        cout << min(ans2, ans5) << endl;
    }else{
        ll p5 = 2*k+1;
        while(p5 > 0){
            ans5 += p5 / 5;
            p5 /= 5;
        }
        ll p2 = 2*k+1;
        while(p2 > 0){
            ans2 += p2 / 2;
            p2 /= 2;
        }
        ll k5 = k;
        while(k5 > 0){
            ans5 -= k5 / 5;
            k5 /= 5;
        }
        ll k2 = k;
        while(k2 > 0){
            ans2 -= k2 / 2;
            k2 /= 2;
        }
        ans2 -= k;
        cout << min(ans2, ans5) << endl;
    }


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 2009
using namespace std;
int n,a[N],sum;
bitset<N*N> dp;
int main()
{
	cin>>n;
	for (int i=1;i<=n;i++) cin>>a[i],sum+=a[i];
	dp[0]=1;
	for (int i=1;i<=n;i++)
		dp|=(dp<<a[i]);
	for (int i=sum/2+sum%2;i<=sum;i++)
	{
		if (dp[i])
		{
			printf("%d\n",i);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 1792
x1,y1,x2,y2 = map(int, input().split())

x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)

x4 = x3 - (x2 - x1)
y4 = y3 - (y2 - y1)

print(x3, y3, x4, y4)

Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
	
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int str1 = sc.nextInt();
		int str2 = sc.nextInt();
		
		int kei = str1 + str2;
		if(kei < 24){
			System.out.println(kei); 
		}
		else{
			System.out.println(kei - 24); 
		}
		
	  }
	}

Measured memory_bytes: 23636
#include <cstdio>
#include <algorithm>

using namespace std;

double dp[100001];

int main()
{
	int n;
	
	dp[1] = 1.0; dp[2] = 1.5; dp[3] = 2.125;
	
	for (int i = 4; i <= 100000; i++){
		double mul = 1, p = 1, r = 0.5;
		for (int j = i - 2; j >= 0 && mul > 1e-15; j--){
			dp[i] += (dp[j] + i - 1 - j) * (1 - r) * mul;
			p *= 0.5;
			r *= 0.5;
			mul *= p;
		}
		dp[i] += mul * i;
	}
	
	while (scanf("%d", &n) && n){
		printf("%lf\n", dp[n]);
	}
	
	return (0);
}

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

int main(){
    char c;
    cin >> c;
    if(c=='a'
    ||c=='i'
    ||c=='u'
    ||c=='e'
    ||c=='o'
    ){
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }
}

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

int main(void)
{
    long long n, m, k, i, j, in, mx, cnt = 0;

    scanf("%lld %lld %lld", &n, &m, &k);
    long long a[n+1], b[m+1];

    a[0] = b[0] = 0;

    for(i = 1; i <= n; i++)
    {
        scanf("%lld", &in);
        a[i] = a[i-1] + in;
    }
    for(i = 1; i <= m; i++)
    {
        scanf("%lld", &in);
        b[i] = b[i-1] + in;
    }

    for(i = 1; i <= n; i++)
    {
        if(a[i] > k)
            break;
        cnt++;
    }

    i--;
    j = 1;
    mx = cnt;

    while(1)
    {
        if(i > 0 && a[i] + b[j] > k)
        {
            i--;
            cnt--;
            if(cnt < 0)
                cnt = 0;
        }
        else if(j <= m && a[i] + b[j] <= k)
        {
            j++;
            cnt++;

            if(cnt > mx)
                mx = cnt;
        }

        if(j > m)
            break;

        if(i == 0 && b[j] > k)
            break;
    }

    printf("%lld", mx);

    return 0;
}


Measured memory_bytes: 4812
package main

import (
	"fmt"
	"regexp"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)

	if isUpper(s) {
		fmt.Println("A")
	} else {
		fmt.Println("a")
	}
}

func isUpper(s string) bool {
	if regexp.MustCompile("[A-Z]").Match([]byte(s)) {
		return true
	}

	return false
}


Measured memory_bytes: 2064
#include<iostream>
#include <string>
#include <regex>

using namespace std;

int main()
{
	string buf,bufout;
	int i1,i2;

	cin >> i1 >> i2;

	for (int i = 0; i < i1; i++){
		cin >> buf;
		bufout += buf + "\n" + buf + "\n";
	}
	
	cout << bufout;

	// system("pause");

	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  ll n, x;
  cin >> n >> x;
  vector<ll> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<ll> b(n);
  for(int i = 0; i < n; i++) {
    b[i] = min(a[i], x);
  }
  for(int i = 0; i < n - 1; i++){
    if(b[i] + b[i + 1] > x){
      b[i + 1] -= (b[i] + b[i + 1]) - x;
    }
  }
  ll ans = 0;
  for(int i = 0; i < n; i++){
    ans += a[i] - b[i];
  }

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

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

int main(){
  int h, w;

  while(1){
    cin >> h >> w;
    if(h == 0 && w == 0) break;

    int area = h * h + w * w;
    int minh = 200, minw = 200, mina = 100000000;
    for(int i = 1 ; i <= 150 ; i++){
      for(int j = i+1 ; j <= 150 ; j++){
	int newarea = i * i + j * j;
	if(area > newarea || (area == newarea && i <= h)) continue;
	if(newarea < mina || (newarea == mina && i < minh)){
	  minh = i;
	  minw = j;
	  mina = newarea;
	}
      }
    }
    cout << minh << " " << minw << endl;
    
  }
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
int main () {
  string S;
  cin >> S;
  int N = S.size();
  int ans = 0;
  string A;
  for(int i = 0; i < N; i++) {
    A = S[i];
    ans += stoi(A);
  }
  if(ans % 9 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
    using namespace std;
    typedef long long lint;
    typedef pair<int,int> pint;
    typedef vector<int> vint;
    #define rep(i, n) for(int i = 0; i < n; i++)
    #define rep2(elem, vec) for(auto elem: vec)
    #define SORT(V) sort((V).begin(),(V).end())
    #define RSORT(V) sort((V).rbegin(), (V).rend())
    lint gcd(int a,int b){return b?gcd(b,a%b):a;}
    lint lcm(int a,int b){return a*b/gcd(a,b);}
    lint comb(int a,int b){return b?comb(a-1,b-1)*a/b:1;}
    int dx[4] ={1,0,-1,0},dy[4] = {0,1,0,-1};
    int MOD = 1e9+7;

int main(){
    string S;
    cin >> S;
    rep(i,S.size())cout << "x";

    return 0;
}


Measured memory_bytes: 256
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}



int main(){
  
  int a,b,c;cin>>a>>b>>c;
  if(a+b+c >= 22)cout << "bust" << endl;
  else cout << "win" << endl;

}

Measured memory_bytes: 256
#!/usr/bin/env python

n = int(input())
a = list(map(int, input().split()))
b = []

if n%2==1:
    i = n-1 
    while i>=0:
        b.append(a[i])
        i -= 2
    i = 1 
    while i<=n-2:
        b.append(a[i])
        i += 2
else:
    i = n-1 
    while i>=1:
        b.append(a[i])
        i -= 2
    i = 0 
    while i<=n-2:
        b.append(a[i])
        i += 2

b = list(map(str, b)) 
ans = ' '.join(b)
print(ans)


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

int main()
{
  int a, b;
  cin >> a >> b;
  if (b % a == 0)
    cout << a + b << endl;
  else
    cout << b - a << endl;

  return 0;
}


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

int main() {
	int A,B;
    cin >> A >> B;
    int count = 0;
    for(int i=A;i<=B;i++){
      int a = i/10000;
      int b = i/1000 - a*10;
      int c = i/100 - a*100 - b*10;
      int d = i/10 - a*1000 - b*100 - c*10;
      int e = i%10;
      if(a==e && b==d){
        count++;
      }
    }
    cout << count << endl;
}


Measured memory_bytes: 3644
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する


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

    int N, M;
    cin >> N >> M;

    vector<vector<int> > A(N, vector<int>(M));

    rep(i, 0, N)rep(j, 0, M) cin >> A[i][j], A[i][j]--;

    set<int> notuse;
    int ans = INF;


    while (notuse.size() < M) {
        //投票していく
        vector<int> vote(M);

        for (int i = 0; i < N; ++i) {
            for (auto e : A[i]) {
                if (!notuse.count(e)) {
                    vote[e]++;
                    break;
                }
            }
        }

        int max_v = -1;
        int max_k = -1;
        for (int i = 0; i < M; ++i) {
            if (vote[i] > max_v) {
                max_v = vote[i];
                max_k = i;
            }
        }

        chmin(ans, max_v);
        notuse.insert(max_k);
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 640
def main():
    n = int(input())
    h = list(map(int, input().split()))
    move = [ 0 for _ in range(len(h)-1)]

    for i in range(len(h)-1):
        move[i] = h[i+1] - h[i]

    ans = 0
    ans_max = 0
    for i in move:
        if i <= 0:
            ans += 1
        elif i > 0:
            ans_max = max(ans, ans_max)
            ans = 0
    ans_max = max(ans, ans_max)

    print(ans_max)

main()


Measured memory_bytes: 14224
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	char s[11];
	int i, flag,len;
	while (cin.getline(s, 11))
	{
		flag = 0;
		len = strlen(s);
		if (s[0] == 'A'&&s[1] != 'C'&&s[len-1] != 'C')
		{
			if (s[1] >'C' &&s[1] <= 'Z')
				flag = 666;
			for (i = 2; i<len; ++i)
			{
				if (s[i] == 'B'|| (s[i] > 'C'&&s[i] <= 'Z'))
					flag = 999;
				if (s[i] == 'C')
					flag ++;
			}
			if (flag != 1)
				cout << "WA" << endl;
			else
				cout << "AC" << endl;
		}
		else
			cout << "WA" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import os
import datetime

def main():

    str_dict = {}
    val_1 = int(input())
    for i in range(val_1):
        val_x = input()

        if not val_x in str_dict:
            str_dict[val_x] = 1
        else:
            num = str_dict.get(val_x)
            str_dict[val_x] = num + 1

    max_count = max(str_dict.values())
    max_list = []

    for k, v in sorted(str_dict.items(), key=lambda x: -x[1]):
        if max_count == v:
            max_list.append(k)

    new_list = sorted(max_list)

    for key in new_list:
        print(key)





if __name__ == '__main__':
    main()

Measured memory_bytes: 43476
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001
#define fcout cout << fixed << setprecision(12)

// vector<vector<int>> data(3, vector<int>(4));

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

  long long a;
  long double b;
  cin >> a >> b;

  long c = a * b;

  cout << c;

  return 0;
}

Measured memory_bytes: 3748
#from collections import deque
#from heapq import heapify, heappop, heappush
#from bisect import insort
#from math import gcd
#from decimal import Decimal
#mod = 1000000007
#mod = 998244353
N = int(input())
#N, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
#flag = True
ans = 0
b = -2
for k in range(N):
  if A[k] == b+1:
    ans += C[b-1]
  ans+=B[A[k]-1] 
  
  b = A[k]
print(ans)

Measured memory_bytes: 61852
#include<bits/stdc++.h>
using namespace std;
int cmp(int a, int b)
{
	return a > b;
}

int a[200000 + 7], b[200000 + 7];
int main()
{
	int n;
	
	while(~scanf("%d", &n))
	{
		for(int i = 0; i < n; i ++)
		{
			cin >> a[i];
			b[i] = a[i];
		}
		sort(a, a + n, cmp);
		for(int i = 0; i < n; i ++)
		{		
			if(b[i] == a[0]) cout << a[1] << endl;
			else cout << a[0] << endl;
//			cout << a[0] << endl;
		}
		
	}
	
	return 0;
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    ll n, m; cin >> n >> m;
    ll sum = 0;
    for (ll i = 0; i < m; ++i) {
        ll a; cin >> a;
        sum += a;
    }

    if (n >= sum) {
        cout << n - sum << endl;
    } else {
        cout << -1 << endl;
    }
}

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

string toUpper (string w) {
  string t = w;
  for (int i = 0; i < w.size(); i++) {
    t[i] = toupper(w[i]);
  }
  return t;
}

int main() {
  string w, t;
  cin >> w;
  w = toUpper(w);
  
  int count = 0;
  while (1) {
    cin >> t;
    if (t == "END_OF_TEXT") break;
    t = toUpper(t);
    if (t == w) count++;   
  }
  cout << count << endl;
}



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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N, M;
    cin >> N >> M;
    vector<pll> A(N);
    for (int i = 0; i < N; i++) {
        ll a, b;
        cin >> a >> b;
        A[i] = {a, b};
    }
    sort(all(A));
    ll ans = 0;
    int i = 0;
    while(M > 0) {
        ll d = min((ll)M, A[i].second);
        ans += A[i].first * d;
        i++;
        M -= d;
    }
    cout << ans << endl;


}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

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

int main(){
  int n, k, c;cin>>n>>c>>k;
  vector<int> t(n);
  for(auto &e: t)cin>>e;
  sort(t.begin(), t.end());
  int start=0, ans=0;
  while(start!=n){
    int i;
  	for(i=start;i<min(n, start+c);i++){
    	if(t[i]>t[start]+k)break;
    }
    start=i;
    ans++;
  }
  cout<<ans<<endl;
}


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

int main() {
    int N;
    cin >> N;
    bool isYellow = false;
    for (int i = 0; i < N; i++) {
        string S;
        cin >> S;
        if (S == "Y") {
            isYellow = true;
            break;
        }
    }
    if (isYellow == true) {
        cout << "Four" << endl;
    } else {
        cout << "Three" << endl;
    }
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	nextReader = newScanner()
	n := nextInt()
	s := nextString()

	var r, g, b int
	for _, c := range s {
		switch c {
		case 'R':
			r++
		case 'G':
			g++
		case 'B':
			b++
		}
	}
	ans := r * g * b
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			k := 2*j - i
			if k >= n {
				continue
			}
			if s[i] != s[j] && s[j] != s[k] && s[k] != s[i] {
				ans--
			}
		}
	}
	fmt.Println(ans)
}

// ---------------------------------------------------------------
// I/O
// ---------------------------------------------------------------
var nextReader func() string

func newScanner() func() string {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 1024), int(1e11))
	sc.Split(bufio.ScanWords)
	return func() string {
		sc.Scan()
		return sc.Text()
	}
}

func nextString() string { return nextReader() }

func nextInt() int { n, _ := strconv.Atoi(nextReader()); return n }

func nextInts(size int) []int {
	ns := make([]int, size)
	for i := 0; i < size; i++ {
		ns[i] = nextInt()
	}
	return ns
}


Measured memory_bytes: 1776
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
void solve() {
   string s,t;cin >> s >> t;
   vector<set<int>> vs(26);
   rep(i,s.size())vs[int(s[i]-'a')].insert(i+1);
   int k = 0;
   ll ans = 0;
   rep(i,t.size()){
      if (vs[int(t[i]-'a')].empty()){
         cout << -1 << endl;
         return;
      }
      set<int>::iterator itr = vs[int(t[i]-'a')].lower_bound(k+1);
      if (itr==vs[int(t[i]-'a')].end()){
         itr = vs[int(t[i]-'a')].lower_bound(1);
         ans += s.size()-k+*itr;
         k = *itr;
      }
      else {
         ans += *itr-k;
         k = *itr;
      }
   }
   cout << ans << endl;
}
int main() {
   cin.tie(nullptr); ios::sync_with_stdio(false);
   solve();
}

Measured memory_bytes: 5200
#include <stdio.h>
int main(void){
	int a,i=0;
	int x[10000];
	while(1){
		scanf("%d",&a);
		x[i]=a;
		if(a==0)break;
		i++;
	}
	int j,b=0;
	for(j=0;j<i;j++){
		b++;
		printf("Case %d: %d\n",b,x[j]);
	}
	
	return 0;
}


Measured memory_bytes: 2116
import Data.List
import Control.Arrow
import qualified Data.IntMap as IM

main = readLn >>= print.solve

solve n = sum $ [solve244,solve2_24,solve4_14,solve74] <*> [filter(>1) $ IM.elems(facPfac n)]

solve244 xs = let   f = over 4 xs
                    t = over 2 xs in div (f * (f-1) * (f-2)) 2 + div (f * (f-1)) 2 * (t-f)
solve4_14 xs = (over 14 xs)*((over 4 xs)-1)
solve2_24 xs = (over 24 xs)*((over 2 xs)-1)
solve74 xs = over 74 xs

over n xs = length(filter(>=n)xs)

facPfac n = foldr1 (IM.unionWith (+)) $ map f100 [1..n]

f100 = IM.fromList.map(head&&&length).group.factorize p100
p100 = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]

factorize pr@(p:ps) 1 = []
factorize pr@(p:ps) n = if n`rem`p==0 then p:(factorize pr (n`quot`p)) else factorize ps n


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

int main()
{
  int N, K;
  cin >> N >> K;
  vector<int> p;
  rep(i, K) {
    int d;
    cin >> d;
    rep(j, d) {
      int val;
      cin >> val;
      p.push_back(val);
    }
  }
  sort(p.begin(), p.end());
  p.erase(std::unique(p.begin(), p.end()), p.end());
  cout << N - p.size() << endl;
}


Measured memory_bytes: 3604
#define _CRT_SECURE_NO_WARNINGS
#define MOD 1000000007 
#define MOD2 998244353
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <bitset>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <functional>
#include <algorithm>
#include <iterator>
#include <cstdio>
#include <utility>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <chrono>
#include <random>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,n-1,-1)
#define ALL(obj) (obj).begin(), (obj).end()

int main() {
	ll power[2501];
	power[0] = 1;
	REP(i, 2500) power[i + 1] = (power[i] * 29) % MOD;

	ll power2[2501];
	power2[0] = 1;
	REP(i, 2500) power2[i + 1] = (power2[i] * 29) % MOD2;

	int n;
	cin >> n;
	char s[5001];
	scanf("%s", s);

	vll hash_list;
	ll ha=0;
	hash_list.push_back(0);
	REP(i, n) {
		ha *= 29;
		ha += s[i] - 'a' + 2;
		ha %= MOD;
		hash_list.push_back(ha);
	}

	vll hash_list2;
	ll ha2 = 0;
	hash_list2.push_back(0);
	REP(i, n) {
		ha2 *= 29;
		ha2 += s[i] - 'a' + 2;
		ha2 %= MOD2;
		hash_list2.push_back(ha2);
	}

	RFOR(j, n/2, 0) {
		unordered_map<ll, int> ma;
		REP(i, n - j + 1) {
			ll x = (hash_list[i]*power[j])%MOD;
			x = (hash_list[i + j]+MOD-x)%MOD;
			if (ma.find(x) == ma.end()) ma[x] = i;
			else if (i >= ma[x] + j) {
				ll xx = (hash_list2[i]*power2[j])%MOD2;
				xx = (hash_list2[i + j]+MOD2-xx)%MOD2;
				ll xxx = (hash_list2[ma[x]]*power2[j])%MOD2;
				xxx = (hash_list2[ma[x] + j]+MOD2-xxx)%MOD2;
				if(xx==xxx){
					cout << j;
					return 0;
				}
			}
		}
	}

	cout << "0";
	return 0;
}


Measured memory_bytes: 736
import math
a,b,c,d=map(int,input().split())
X=math.fabs(c-a)
Y=math.fabs(a-b)
Z=math.fabs(b-c)
if X<=d:
    print('Yes')
elif (Y<=d) and (Z<=d):
    print('Yes')
else:
    print('No')

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

typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;

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

  int ans;
  if (x <= 599) {
    ans = 8;
  } else if (x <= 799) {
    ans = 7;
  } else if (x <= 999) {
    ans = 6;
  } else if (x <= 1199) {
    ans = 5;
  } else if (x <= 1399) {
    ans = 4;
  } else if (x <= 1599) {
    ans = 3;
  } else if (x <= 1799) {
    ans = 2;
  } else {
    ans = 1;
  }

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

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;
using ld = long double;
using P = complex<ld>;
using VP = vector<P>;
const ld eps = 1e-8, pi = acos(-1.0);

ld dot (P a, P b) { return real(conj(a) * b); }
ld cross (P a, P b) { return imag(conj(a) * b); }

int ccw (P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > eps) return 1;   // counter clockwise
  if (cross(b, c) < -eps) return -1; // clockwise
  if (dot(b, c) < 0) return 2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;  // a--b--c on line
  return 0;                          // a--c--b on line
}

int main()
{
  int n;
  cin>>n;
  vector<pair<ld, ld>> vp;
  REP(i,n) {
    ld x, y;
    cin>>x>>y;
    vp.emplace_back(x, y);
  }
  REP(i,n) {
    ld minarg = pi;
    ld maxarg = -pi;
    ld minarg2 = 2*pi;
    ld maxarg2 = 0;
    ld x, y;
    tie(x, y) = vp[i];
    REP(j,n) {
      if (i==j) continue;
      ld nx, ny;
      tie(nx, ny) = vp[j];
      ld arg = atan2(ny-y, nx-x);
      minarg = min(minarg, arg);
      maxarg = max(maxarg, arg);
      if (arg < 0) arg += 2*pi;
      minarg2 = min(minarg2, arg);
      maxarg2 = max(maxarg2, arg);
    }
    //cerr << maxarg << ' ' << minarg << ' ' << maxarg2 << ' ' << minarg2 << endl;
    ld deg1 = pi - (maxarg - minarg);
    ld deg2 = pi - (maxarg2 - minarg2);
    ld deg = max(deg1, deg2);
    if (deg > 0) {
      cout << setprecision(10) << fixed << deg / (2*pi) << endl;
    } else {
      cout << setprecision(10) << fixed << 0.0 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main (){
    long long int n;
    scanf("%lld", &n);
    int count = 0;
    char name[255] = {0};
    n--;
    while (n >= 0){
        name[count] = (n % 26) + 'a';
        n /= 26;
        count++;
        n--;
    }
    int len=strlen(name);
    for(int i = len-1; i >= 0; i--){
        printf("%c", name[i]);
    }
    puts("");

    return 0;
}

Measured memory_bytes: 1648
#include<stdio.h>
#include<string.h>
int solve(int i,int n,int *A,int m)  {

  int res;
  if(m==0) return 1;
  if(i >=n)return 0;
  res = solve(i+1,n,A,m) +solve(i+1,n,A,m-A[i]);
  return res;


}




int main(){
  int n,q,i,s,j,m[2000],A[2000];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %d",&A[i]);
  }
  scanf("%d",&q);
  for(j=0;j<q;j++){
    scanf(" %d",&m[j]);
  }
  for(i=0;i<q;i++){
    s=solve(0,n,A,m[i]);
  
    if(s==0) printf("no\n");
    else  printf("yes\n");
  }
  return 0;
}



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

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(v) (v).begin(),(v).end()

const int MOD = 1000000007;
const int N = 3005;
const double PI =4*atan(1);

long double dp[2][N],ans;
long double p[N];
ll n;


int main(){
    ios::sync_with_stdio(0);
    //freopen("baklava.in","r",stdin);
    cin.tie(0);
    cout.tie(0);
    //start
    cin >> n;
	for(int i=0;i<n;i++){
		cin >> p[i];
	}
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		ll pos=(i&1);
		for(int j=0;j<=i;j++){
			dp[pos][j]=(1.0-p[i-1])*dp[pos^1][j];
			if(j>=1)dp[pos][j]+=dp[pos^1][j-1]*p[i-1];
			//cout << dp[pos][j]<< " ";
		}
		//cout << endl;
	}
	ans=0;
	for(int i=n/2 +1;i<=n;i++){
		ans+=dp[n&1][i];
	}
	printf("%.9Lf",ans);
	
    return 0;
}


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

int main() {
    string S;
    cin >> S;
    int a = S.at(0)-'0';
    int b = S.at(1)-'0';
    int c = S.at(2)-'0';
    int d = S.at(3)-'0';
    if (a+b+c+d==7) printf("%d%c%d%c%d%c%d=7", a,'+',b,'+',c,'+',d);
    else if (a+b+c-d==7) printf("%d%c%d%c%d%c%d=7", a,'+',b,'+',c,'-',d);
    else if (a+b-c+d==7) printf("%d%c%d%c%d%c%d=7", a,'+',b,'-',c,'+',d);
    else if (a+b-c-d==7) printf("%d%c%d%c%d%c%d=7", a,'+',b,'-',c,'-',d);
    else if (a-b+c+d==7) printf("%d%c%d%c%d%c%d=7", a,'-',b,'+',c,'+',d);
    else if (a-b+c-d==7) printf("%d%c%d%c%d%c%d=7", a,'-',b,'+',c,'-',d);
    else if (a-b-c+d==7) printf("%d%c%d%c%d%c%d=7", a,'-',b,'-',c,'+',d);
    else if (a-b-c-d==7) printf("%d%c%d%c%d%c%d=7", a,'-',b,'-',c,'-',d);
}

Measured memory_bytes: 3736
#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;

int main(){

	double x1, y1, x2, y2;

	cin >> x1 >> y1 >> x2 >> y2;

	double d = sqrt( (x1 - x2) * ( x1 - x2) + ( y1 - y2) * ( y1 - y2) );

	printf( "%1f\n", d);

	return 0;

}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define per(i, a, b) for(int i = (a); i >= (b); --i)
using namespace std;

typedef long long ll;
const int mod = 1e9+7;
const int MAXN = 2e5 + 7;

int a[MAXN];
int main(int argc, char const *argv[])
{
	int n;
	cin >> n;
	int ans = 0, cur = 0;
	rep(i, 1, n){
		cin >> a[i];
		if(a[i] <= a[i-1]){
			cur++;
			ans = max(ans, cur);
		} else {
			cur = 0;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int A,B,work = 0,reverse = 0,R = 0;
	cin >> A >> B;
	
	for (int i = A; i <= B; i++){
		work = i;
		while ( work > 0) {
		reverse *= 10;
		reverse += work%10;
		work /= 10;
		}
			
		if ( i == reverse ) {
			R += 1;
		}
		reverse = 0;
	
	}
		
	cout << R << endl;
}
	

Measured memory_bytes: 256
use std::io;
fn main(){
    let stdin = io::stdin();
    const MAX: i64 = 1000000000000000000;

    let _first_line = {
	let mut buf = String::new();
	stdin.read_line(&mut buf).unwrap();
	buf.retain(|c| c!='\n');
	buf.parse::<usize>().unwrap()
    };

    let second_line = {
	let mut buf = String::new();
	stdin.read_line(&mut buf).unwrap();
	buf.retain(|c| c!='\n');
	buf.split_whitespace().map(|n| n.parse::<i64>().unwrap()).collect::<Vec::<i64>>()
    };
    
    let mut res : i64 = 1;
    
    for n in second_line.iter(){
	let n = *n;
	res = if n == 0{
	    0
	}else if let Some(a) = res.checked_mul(n){
	    if a <= MAX && a > 0{
		a
	    }else{
		-1
	    }
	}else{
	    -1
	};
	if res == 0{
	    break;
	}
    }
    
    println!("{}",res);
}


Measured memory_bytes: 4812
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
//#include <iomanip.h>
#include <limits.h>
//#include <strstrea.h>
//#include <fstream.h>
#define pb push_back
#define ll long long
#define ull unsigned long long
//#define int64 long long
#define INF  0x3f3f3f3f

using namespace std;

const int maxn = 1e5 + 5;
int n;
int odd, even;

int main() {
    cin >> n;
    odd = even = 0;
    int tmp;
    for (int i = 0; i < n; i++) {
        cin >> tmp;
        if (tmp % 2 == 0) even++;
        else odd++;
    }
    int res = 0;
    if (odd % 2 == 0) even += (odd / 2);
    else {
        even += (odd / 2);
        res = 1;
    }
    while (even >= 2) {
        even = even % 2 + even / 2;
    }
    res += even;
    if (res == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

ll binpow(ll a, ll b) {
    if (b == 0)
    {
        return 1;
    }
    ll res = binpow(a, b / 2);
    res*=res;
    if (b % 2)
    {
        return res * a;
    }
    return res;
}

ll gcd(ll a,ll b)
{
    if (b==0) return a;
    return gcd(b,a%b);
}

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    set<string> s;
    string t;
    while (n--)
    {
        cin>>t;
        s.insert(t);
    }
    cout<<sz(s);
    return 0;
}

Measured memory_bytes: 19180
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	int a[n];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		a[i]--;
	}

	int res = 0;
	for (int i = 0; i < n; i++)
	{
		if(a[a[i]] == i) res++;
	}
	cout << res / 2 << endl;
	return 0;
}


Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define M 1101
#define MOD 1000000007
#define fi first
#define se second
#define vi vector<int>
#define vl vector<ll>
#define all(v) v.begin(),v.end()
#define repl(i,l,r) for(long long i=l;i<=r;++i)
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define ins insert
#define inf INT_MAX
#define vp vector< pair<int,int> >
const int maxn=123456;
int n,m;
vector<int> adj[maxn];
int dp[maxn];
int longestpath(int x)
{
    if(dp[x]!=-1)
    {
        return dp[x];
    }
    if(adj[x].empty())
    {
        dp[x]=0;
        //longestpath(x+1);
    }
    else
    {
        for(auto y:adj[x])
        {
            dp[x]=max(1+longestpath(y),dp[x]);
        }
    }

    return dp[x];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>m;
    rep(i,1,m)
    {
        int x,y;
        cin>>x>>y;
        adj[x].pb(y);
    }
    memset(dp,-1,sizeof dp);
    int ans=-1;
    rep(j,1,n)
    {
        ans=max(longestpath(j),ans);
    }
    cout<<ans<<"\n";

    return 0;
}







Measured memory_bytes: 8192
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

R = inputI()

print(R*3.1415926535*2)

Measured memory_bytes: 72808
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a[] = new int[3];
    for(int i = 0; i < 3; i++){
      a[i] = Integer.parseInt(sc.next());
    }
    while(true){
      if(a[0] <= a[1] && a[1] <= a[2]){
        break;
      }
      if(a[0] > a[1]){
        int c = a[1];
        a[1] = a[0];
        a[0] = c;
      }
      if(a[1] > a[2]){
        int c = a[2];
        a[2] = a[1];
        a[1] = c;
      }
    }
    System.out.printf("%d %d %d\n", a[0], a[1], a[2]);
  }
}


Measured memory_bytes: 26280
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <list>
#include <set>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1010101010
#define MOD 1000000007
#define LL long long
using Coord = pair<int, int>;

int cnt[30][51];

int main() {
    int n;
    cin >> n;
    int cnt[51][30];
 
    for (int i = 0; i < 51; i++)
        for (int j = 0; j < 30; j++)
            cnt[i][j] = 0;
    
    for (int i = 0; i < n; i++) {
        string tmp;
        cin >> tmp;
        for (char &c: tmp) cnt[i][c - 'a']++; 
    }
 
    for (int i = 0; i <= 'z' - 'a'; i++) {
        int c = INF;
        for (int j = 0; j < n; j++) {
            c = min(c, cnt[j][i]);
        }
        for (int j = 0; j < c; j++) {
            cout << (char)('a' + i);
        }
    }
    cout << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String strT = br.readLine();
		
		int n = Integer.parseInt(br.readLine());
		
		String[] strQ = new String[n];
		
		constructSA(strT);

		for(int i = 0; i < n; i++){
			strQ[i] = br.readLine();
			
			if(strT.length() >= strQ[i].length() &&  contain(strT, strQ[i])){
				System.out.println(1);
			}
			else {
				System.out.println(0);
			}
		}
				

	}
	
	static final int MAX_N = 1000000 + 1;
	static int rank[] = new int[MAX_N];
	static int tmp[] = new int[MAX_N];
	static Integer sa[];// = new Integer[MAX_N];
	static int n;
	static int k;
	
	static boolean compareSA(int i, int j, int n, int k){
		if(rank[i] != rank[j]){
			return rank[i] < rank[j];
		}
		else {
			int ri = i + k <= n ? rank[i + k] : -1;
			int rj = j + k <= n ? rank[j + k] : -1;
			return ri < rj;
		}
	}
	
	static void constructSA(String s){
		n = s.length();
		
		sa = new Integer[n + 1];
		
		for(int i = 0; i < sa.length; i++){
			sa[i] = 0;
		}
		
		for(int i = 0; i <= n; i++){
			sa[i] = i;
			rank[i] = i < n ? s.charAt(i) : -1;
		}
		
//		System.out.println(sa[0]);
		
		for(k = 1; k <= n; k *= 2){
//			System.out.println("k = "+k);
			Arrays.sort(sa, new Comparator<Integer>() {
				public int compare(Integer i, Integer j){
//					System.out.println(i+" "+j);
					if(rank[i] != rank[j]){
						return rank[i] - rank[j];
					}
					else {
						int ri = i + k <= n ? rank[i + k] : -1;
						int rj = j + k <= n ? rank[j + k] : -1;
						return ri - rj;
					}
				}
			});
			
			tmp[sa[0]] = 0;
			for(int i = 1; i <= n; i++){
				tmp[sa[i]] = tmp[sa[i- 1]] + (compareSA(sa[i - 1], sa[i], n, k) ? 1 : 0);
			}
			
			for(int i = 0; i <= n; i++){
				rank[i] = tmp[i];
			}
		}
//		
//		for(int i = 0; i <= 11; i++){
//			System.out.println("i = "+i+" sa[i] = "+ sa[i] + " s.sub = "+s.substring(sa[i]));
//		}
		
	}
	
	static boolean contain(String s, String t){
		int a = 0;
		int b = s.length();
		while(b - a > 1){
			int c = (a + b)/2;
			
//			System.out.println("sa[c] = "+sa[c] + " t.length " + t.length());
			if((s.substring(sa[c], Math.min(sa[c] + t.length(), s.length()))).compareTo(t) < 0){
				a = c;
			}
			else {
				b = c;
			}
		}
		
		return (s.substring(sa[b], Math.min(sa[b]+t.length(), s.length()) )).compareTo(t) == 0;
	}
}


Measured memory_bytes: 213876
#include <bits/stdc++.h>
using namespace std;
int N,M;
vector<int> arr[100001];
int catat[100001];
queue<int> q;
int main(){
	cin>>N>>M;
	for(int i=0; i<M; i++){
		int a,b;
		cin>>a>>b;
		arr[a].push_back(b);
		arr[b].push_back(a);
	}
	q.push(1);
	while(!q.empty()){
		for(int i=0; i<arr[q.front()].size(); i++){
			if(catat[arr[q.front()][i]]==0){
				catat[arr[q.front()][i]]=q.front();
				q.push(arr[q.front()][i]);
			}
		}
		q.pop();
	}
	for(int i=2; i<=N; i++){
		if(catat[i]==0){
			cout<<"No"<<'\n';
			return 0;
		}
	}
	cout<<"Yes"<<'\n';
	for(int i=2; i<=N; i++){
		cout<<catat[i]<<'\n';
	}
}

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

int main(void) {
  int N;
  cin >> N;
  vector<int> h(N);
  for (int i = 0; i < N; i++) {
    cin >> h[i];
  }
  int ans = 0;
  for (int i = 0; i < 100; i++) {
    bool flag = false;
    for (int j = 0; j < N; j++) {
      if (h[j] > 0) {
        if (!flag) {
          ans++;
        }
        h[j]--;
        flag = true;
      } else {
        flag = false;
      }
    }
  }

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

Measured memory_bytes: 256
#define _DEBUG 1
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                         \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z     \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

void solve(ll K) {
  vector<int> s = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                   1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << s.at(K - 1) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  ll K;
  scanf("%lld", &K);
  solve(K);
  return 0;
}


Measured memory_bytes: 256