akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て

int		main(void)
{
	int N;
	cin >> N;
	vector<int> P(N);
	vector<int> Q(N);
	for (int i = 0; i < N; i++)
		cin >> P[i];
	for (int i = 0; i < N; i++)
		cin >> Q[i];
	vector<int> A(N);
	for (int i = 0; i < N; i++)
		A[i] = i + 1;
	int i = 1, a, b;
	do
	{
		if (P == A)
			a = i;
		if (Q == A)
			b = i;
		i++;
	}
	while (next_permutation(all(A)));
	cout << abs(a - b) << endl;
}



Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

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

	unsigned A, B, C;
	cin >> A >> B >> C;

	cout << min(B / A, C);

	return 0;
}

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

int main(){
  string s;
  cin >> s;
  int l;
  l = s.length();
  
  string ans = "";
  for(int i=0; i<l; i++){
    if(i%2 == 0) ans += s[i];
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cmath>
using namespace std;

int main(void){
    double a, b, c, s, l, h;
    scanf("%lf %lf %lf", &a, &b, &c);
    c = c * acos(-1) / 180;
    h = b * sin(c);
    s = a * h / 2;
    l = a + b + sqrt(pow(a - b * cos(c), 2) + pow(h, 2));
    printf("%lf\n", s);
    printf("%lf\n", l);
    printf("%lf\n", h);
    return 0;
}


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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

ans = INF
for x in range(1, 101):
    cur = 0
    for a in A:
        cur += abs(a - x)**2
    ans = min(ans, cur)
print(ans)


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

signed main(){
  int n,a[100000];
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  sort(a,a+n);
  int ans1=0,ans2=0;
  for(int i=0;i<n;i++){
    if(i<n/2)ans1-=2*a[i];
    else ans1+=2*a[i];
  }
  if(n%2)ans1-=a[n/2]+a[n/2+1];
  else ans1+=a[n/2-1]-a[n/2];

  if(n%2){
    for(int i=0;i<n;i++){
      if(i<(n+1)/2)ans2-=2*a[i];
      else ans2+=2*a[i];
    }
    ans2+=a[n/2-1]+a[n/2];
  }
  
  cout<<max(ans1,ans2)<<endl;
  
  return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  string A,B,C; cin>>A>>B>>C;
  char a=A[0]+'A'-'a';
  char b=B[0]+'A'-'a';
  char c=C[0]+'A'-'a';
  cout<<a<<b<<c<<endl;
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
const ll MOD = 998244353;

int main() {
	int N;
	cin >> N;
	int c = 0, d, e, f = 0;
	for (int i = 0;i < N;i++) {
		cin >> d >> e;
		if (d == e)c++;
		else c = 0;
		if (c == 3) f = 1;
	}
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL<<60;

typedef pair<ll,ll> Pair;

int main(){

ll A[5];
cin >> A[0] >> A[1] >> A[2] >> A[3] >> A[4];

for(ll i = 0;i < 5;++i){

if(A[i] == 0) cout << i+1 << endl;

}

return 0;

}   


Measured memory_bytes: 3520
N = int(input())
A = list(map(int, input().split()))

approved = True
for i in range(0, N):
    a = A[i]
    if a % 2 != 0:
        continue

    if a % 3 != 0 and a % 5 != 0:
        approved = False
        break

print("APPROVED") if approved else print("DENIED")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define MAX pow(10,18)
typedef long long ll;

int main(){
  
    int N,P,minv,ans=0;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> P;
        if(i == 0){ minv = P; ans++; }
        else { if(minv >= P) {minv = P; ans++;}}
    }
    cout << ans << endl;
}

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

long long dp[2][100005];

long long solution(int n , int* weight , int* values , int w){

    bool flag = 1;

    for(int i=1 ; i<=100000 ; i++){
        dp[0][i] = INT_MAX;
    }

    for(int i=1 ; i<=n ; i++){
        for(int j=1 ; j<=100000 ; j++){
            dp[flag][j] = dp[(flag^1)][j];
            if((j-values[i-1]) >= 0 && dp[(flag^1)][j-values[i-1]] != INT_MAX){
                dp[flag][j] = min(dp[flag][j] , dp[(flag^1)][j-values[i-1]] + weight[i-1]);
           }
        //    cout<<dp[flag][j]<<" ";
        }
        // cout<<endl;
        flag = flag^1;
    }
 

    int ans = 0;
    for(int i=0; i<=100000 ; i++){
        if(dp[flag^1][i]<=w){
            ans = i;
        }
    }

    return ans;

}



int main(){
    int n , w;
    cin>>n>>w;
    int* weight = new int[n];
    int* values = new int[n];
    
    for(int i=0 ; i<n ; i++){
        cin>>weight[i];
        cin>>values[i];
    }

    cout<<solution(n , weight , values , w)<<endl;


}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define sl set<ll>
#define vs vector<string>
#define vl vector<ll>
#define vi vector<int>
#define vpl vector<pair<ll,ll>>
#define pb push_back
#define PI 3.14159265358979323846
#define ll long long
#define ld long double
#define endl "\n"
#define rep(i,a,b) for (ll i = (a); i < (b); i++)
#define repp(i,a,b) for (ll i = (a); i >= (b); i--)
#define rop(i,a,b)  for(ll i=(a); i>(b); i--)
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define tt long long t; cin>>t; while(t--)
#define IOS ios::sync_with_stdio(0);cin.tie(0);
const int maxn=1e5+100;


int main()
{
ll n;
cin>>n;
ll b[3];
ll a[n];rep(i,0,n)cin>>a[i];sort(a,a+n);
ll ans=0;
rep(i,0,n)
{
    rep(j,i+1,n)
    {
            rep(k,j+1,n)
            {
                if(a[i]!=a[j] && a[j]!=a[k])
                {
                            b[0]=a[i];b[1]=a[j];b[2]=a[k];
                            sort(b,b+3);
                            if(b[0]+b[1]>b[2]){ans++;}
                }
            }
    }
}
cout<<ans;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

bool stringsmall(const string& a, const string& b){
	int al=a.length();
	int bl=b.length();
	for(int i=0;i<min(al,bl);i++){
		if(int(a[i])<int(b[i])){return true;}
		else if(int(a[i])>int(b[i])){return false;}
	}
	if(al<bl){return true;}
	else{return false;}
}

int main(){

string hoge[100];
int n,m;
cin>>n>>m;
for(int i=0;i<n;i++){cin>>hoge[i];}
sort(hoge,hoge+n,stringsmall);
for(int i=0;i<n;i++){cout<<hoge[i];}

return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    int n, m, x, y; cin >> n >> m >> x >> y;
    vector<int> xs(n);
    vector<int> ys(m);
    rep(i, n) {
        cin >> xs[i];
    }
    rep(i, m) {
        cin >> ys[i];
    }
    xs.push_back(x); ys.push_back(y);
    sort(xs.begin(), xs.end(), greater<int>());
    sort(ys.begin(), ys.end());

    if (ys[0] - xs[0] >= 1) {
        cout << "No War" << endl;
    } else {
        cout << "War" << endl;
    }
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;
int main(){

int i,N,count=0,step;

cin >> N;
vector<int> d(N);

step=N;

for(i=0;i<N;i++){
cin >> d[i];
}

sort(d.begin(),d.end());

for(i=N-1;i>0;i--){
  if(d[i]==d[i-1]){
    count++;
  }

}

cout << step-count << endl;
}


Measured memory_bytes: 3632
import java.util.*;

public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int val  =1;
        for (int i = 1; i <= n; i++) {
            int past = i * (i-1) / 2;
            int next = i * (i+1) / 2;
            if (past <= n && n <= next) {
                val = i;
                break;
            }
        }

        int diff = val * (val + 1) / 2 - n;

        for (int i = val; i > 0 ; i--) {
            if (diff >= i) {
                diff -= i;
            } else {
                System.out.println(i);
            }
        }

        System.out.println();
    }
}

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

int main() {
    string s;
    cin >> s;
    map<char, int> m;

    rep(i, s.size()) m[s[i]]++;
    for (auto e : m) {
        if (e.second % 2 != 0) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3632
N = int(input())
lis = [int(i) for i in input().split()]

cnt = 0
j = 0
flag = True

while(flag):
    if(j == N-1):
        cnt = cnt + 1
        j = 0
    elif(lis[j]%2 == 1):
        flag = False
    else:
        lis[j] = lis[j]/2
    
    j = j + 1

print(cnt)


Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main() {
    int n, m, l;
    cin >> n >> m >> l;
    int A[n][m], B[m][l];
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < m; ++j) {
            cin >> A[i][j];
        }
    }
    for(int i = 0; i < m; ++i) {
        for(int j = 0; j < l; ++j) {
            cin >> B[i][j];
        }
    }
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < l; ++j) {
            long long s = 0;
            for(int k = 0; k < m; ++k) {
                s += A[i][k]*B[k][j];
            }
            cout << s;
            if(j < l - 1) cout << " ";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3156
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)
 
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
#define repp(i, a, b) for(ll i = a; i <= b; i++)
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define rrep(i, b, a) for(ll i = b; i >= a; i--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define mem(a, b) memset(a, b, sizeof(a));
#define mem0(a) memset(a, 0, sizeof(a));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define in_edges(m) repp(i, 1, m){ll a, b; cin >> a >> b; v[a].pb(b), v[b].pb(a);}
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define endl "\n"
ll power(ll x, ll y); 

const ll MOD = 1000000007;
ll h[100005], f[100005];

int main() //PointBlank's code ¯\_(ツ)_/¯
{
    mem(f, MOD)
    quickio
    ll n, k;
    cin >> n >> k;
    repp(i, 1, n) cin >> h[i];
    f[1] = 0, f[2] = abs(h[1] - h[2]);
    repp(i, 3, n)
        rep(j, max(1ll, (i - k)), i) f[i] = min(f[i], f[j] + abs(h[i] - h[j]));
    cout << f[n];
}

ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

Measured memory_bytes: 1792
program main
  implicit none
  integer :: n, i, mi
  integer, allocatable :: a(:)
  read(*, *) n
  allocate(a(n))
  read(*, *) (a(i), i = 1, n)
  mi = 999999
  do i = 1, n
    mi = min(mi, fact_of_two(a(i)))
  end do
  ! print *, mi
  write(*, *), mi
  deallocate(a)

  contains

  function fact_of_two(i)
    implicit none
    integer :: i, j, fact_of_two
    do j = 0, 100
      if (mod(i, 2 ** j) /= 0) then
        exit
      end if
    end do
    if (j < 1) stop 1
    fact_of_two = j - 1
  end function fact_of_two
end


Measured memory_bytes: 512
#include<iostream>
using namespace std;
#define MAXSIZE 105
int h,w;
char map[MAXSIZE][MAXSIZE];
int sum;
void dfs(int x,int y) {
	int d[4][2]= {{-1,0},{0,-1},{1,0},{0,1}};
	char c = map[x][y];
	map[x][y]='.';
	for(int k=0; k<4; k++) {
		int dx=x+d[k][0];
		int dy=y+d[k][1];
		if(dx<0||dx>=h||dy<0||dy>=w||map[dx][dy]!=c) {
			continue;
		}

		dfs(dx,dy);
	}

}
int main() {
	while(true) {
		cin>>h>>w;
		if(h==0&&w==0) break;
		for(int i=0; i<h; i++)
			for(int j=0; j<w; j++) {
				cin>>map[i][j];
			}
		sum=0;


		for(int i=0; i<h; i++)
			for(int j=0; j<w; j++) {
				if(map[i][j]!='.') {
					dfs(i,j);
					sum++;
				}

			}

		cout<<sum<<endl;
	}

}

Measured memory_bytes: 3768
#include <iostream>

using namespace std;

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int out = 0;
    int point = 0;
    int r1 = 0, r2 = 0, r3 = 0;
    while (out <= 2) {
      string str;
      cin >> str;
      if (str == "HIT") {
        if (r3) point++;
        r3 = r2; r2 = r1; r1 = 1;
      } else if (str == "OUT") {
        out++;
      } else if (str == "HOMERUN") {
        point += r1 + r2 + r3 + 1;
        r1 = r2 = r3 = 0;
      }
    }
    cout << point << endl;
  }

  return 0;
}

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

int main(int argc, char*argv[])
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s, t;
	cin >> s>>t;
	
	// lets keep s as smaller string
	if(s.size()>t.size())
		swap(s,t);
	int n_s = s.size();
	int n_t = t.size();
	vector<vector<string>>  dp(2, vector<string>(n_s+1, ""));
	for (int i = 0 ; i < n_t ;i++)
	{
		for(int	j = 1; j < n_s+1; j++)
		{
			// Take the item 
			string taken;
			
			if(t[i] == s[j-1])
			{
				taken = dp[(i-1)&1][j-1];
				taken += t[i];
			}
			else
			{
				if(dp[(i-1)&1][j-1].size() > dp[i&1][j-1].size() )
					taken = (dp[(i-1)&1][j-1]);
				else 
					taken = (dp[i&1][j-1]);
			}
			
			// dont take
			string not_taken(dp[(i-1)&1][j]);
			dp[i&1][j] = taken.size()>not_taken.size()?taken:not_taken;
		}
	}
	//cout <<dp[!(n_t&1)][n_s].size();
	cout <<dp[!(n_t&1)][n_s];
}

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))

template<typename V,typename T>
T find_num(V v, T num) {
    if ( find(ALL(v), num) == v.end() ) {
        return false;
    } else {
        return true;
    }
}

// π M_PI
// deg = rad*180/M_PI

int main() {
    ll n;
    cin >> n;
    cout << 2*n*M_PI << endl;
    return 0;
}


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

using namespace std;

int INF = 1e9 + 7;

long long c[2000][2000];

void setPascal(int N){
    for(int i = 0; i < N; i++){
        c[i][0] = 1;
        for(int j = 1; j <= i; j++){
            c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
            c[i][j] %= INF;
        }
    }
}

void solve(){
    setPascal(2000);
    int n, k;
    cin >> n >> k;
    for(int i = 1; i <= k; i++){
        if(i == 1 && n == k){
            cout << 1 << "\n";
            continue;
        }
        if(i == n){
            cout << 0 << "\n";
            continue;
        }
        long long ans = c[n - k + 1][i] * c[k - 1][i - 1];
        ans %= INF;
        cout << ans << "\n";
    }
}

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

Measured memory_bytes: 30080
#include <stdio.h>
#include <stdlib.h>
#define max(a,b) ((a)>(b)?(a):(b))
int main()
{   int n,i,j,k,cx,cy,flag=0;
    scanf("%d",&n);
    long x[101],y[101],h[101],a,b,c,height,hans;
    for(i=0;i<n;i++){
        scanf("%ld%ld%ld",&x[i],&y[i],&h[i]);
        if(h[i]>=1&&flag==0){
            a=x[i];
            b=y[i];
            c=h[i];
            flag=1;
        }
    }
    for(i=0;i<101;i++){
        for(j=0;j<101;j++){
            height=c+abs(a-i)+abs(b-j);
            for(k=0;k<n;k++){
                if(h[k]!=max((height-abs(i-x[k])-abs(j-y[k])),0)){
                break;
            }else if(k==n-1){
                    cx=i;
                    cy=j;
                    hans=height;
                }
            }
        }
    }
    printf("%d %d %ld",cx,cy,hans);
    return 0;
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			long x = in.nextLong();
			long y = in.nextLong();
			out.println(MathUtils.gcd(x, y));
		}

	}

	static class ArrayUtils {
		public static Map<Integer, Integer> getCountMap(int[] array) {
			Map<Integer, Integer> map = new TreeMap<>();
			for (int x : array)
				map.merge(x, 1, Integer::sum);
			return map;
		}
	}
	static class MathUtils {
		/**
		 * 最大公約数
		 * */
		public static long gcd(long a, long b) {
			return (b == 0) ? a : gcd(b, a % b);
		}
		/**
		 * 最小公倍数
		 * */
		public static long lcm(long a, long b) {
			return a * b / gcd(a, b);
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}



Measured memory_bytes: 24276
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define all(x) (x).begin(),(x).end()
#define SORT(c) sort(all(c))
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define SUM(c) accumulate(all(c),0)
#define COUNT(c,a) count(all(c), a)
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")
#define VSTIN(c,n) int (n); cin >> (n); vector<string> (c)(n); REP(i,n) cin >> (c)[i]
#define VINTIN(c,n) int (n); cin >> (n); vector<int> (c)(n); REP(i,n) cin >> (c)[i]
 
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  Yn(a+b>=c);
}

Measured memory_bytes: 256
h, w, k = gets.chomp.split(' ').map(&:to_i)
hw = h.times.map do
  gets.chomp.split('')
end

def dfs(hw, h, i, k, used)
  return {} if k < 0
  return {} if i >= h + hw.first.size

  ans = dfs(hw, h, i + 1, k, used)

  u = used + [i]
  idx = i >= h ? i - h : i
  diff = if i >= h
    # w
    d = 0
    h.times do |hi|
      next if used.include?(hi)
      d += 1 if hw[hi][idx] == '#'
    end
    d
  else
    # h
    hw[idx].count { |e| e == '#' }
  end

  nk = k - diff

  if nk == 0
    key = u.join('$')
    ans[u.join('$')] = 1
  end
  ans.merge!(dfs(hw, h, i + 1, nk, u))

  ans
end

cnt = hw.sum { |arr| arr.count { |e| e == '#' } }

h = dfs(hw, h, 0, cnt - k, [])
# p h
ans = h.size
if cnt == k
  ans += 1
end
puts ans


Measured memory_bytes: 14328
function Main(input: string) {

    let target = input.split('\n')[0].split('');
    let center = Math.floor(target.length / 2);
    let count = 0;

    target.some((v, i, arr) => {
        if (i >= center) {
            return true;
        }
        if (v !== arr[(target.length - 1) - i]) {
            count++;
        }
    })

    console.log(count)

}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

using namespace std;

typedef long long ll;
const double eps=1e-6,pi=acos(-1);
const int N=1e5+5,M=1e9+7,SEGM=4*N,OO=0x3f3f3f3f;
int t,n,m,k;
int arr[N];

int main(){
    //freopen("myfile.txt","w",stdout);
    ll a,b,c,d;
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
    ll ans=max(a*c,max(a*d,max(b*c,b*d)));
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 3824
import fractions
n=int(input())
A=[int(i) for i in input().split()]
mod=10**9+7

lcm=A[0]
for i in range(1,n):
  if lcm%A[i]!=0:
    lcm=lcm*A[i]//fractions.gcd(lcm,A[i])
lcm%=mod
ans=0
for i in range(n):
  ans=(ans+lcm*pow(A[i],mod-2,mod))%mod
print(ans)


Measured memory_bytes: 67432
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	cin >> N;
	int ans = 1;
	while (ans * 2 <= N)ans *= 2;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ld long double
#define lli long long int
#define vi vector<int>
#define vlli vector<lli>
#define vvi vector<vi >
#define str string
#define vs vector<str>
#define vb vector<bool>
#define slli set<lli>
#define mii map<int, int>
#define mlli map<int, lli>
#define msi map<str, int>
#define mp make_pair
#define pii pair<int, int>
#define pll pair<lli, lli>
#define vpii vector<pii >
#define vpll vector<pll >
#define pb push_back
#define loop(i, s, l, j) for(int i = s; i < l; i += j)
#define rloop(i, s, l, j) for(int i = s; i >= l; i -= j)
#define rep(i, n) loop(i,0,n,1)
#define rrep(i, n) rloop(i,n-1,0,1) 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ft first
#define sd second
#define all(a) a.begin(),a.end()
#define rev(a) reverse(all(a))
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define mod 1000000007
#define inf 100000000
#define limit 200005
#define minval -100000000000000000
#define maxval 1000000000000000
/**********************************************************************************************************************************************/
int dx4[4] = {0, -1, 0, 1};
int dy4[4] = {1, 0, -1, 0};
int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int Power(int base,int exp){int ans=1;  while(exp > 0){if(exp&1)ans=(1LL*ans*base)%mod; exp=exp>>1; base=(1LL*base*base)%mod;}  return ans;}
/**********************************************************************************************************************************************/ 
void input()
{
    str s;
    cin >> s;
    lli ans = 0;
    int n = s.length();
    rep(i,n)
        ans += (s[i]-'0');
    ans = ans%9;
    if(ans == 0)
        cout << "Yes\n";
    else
        cout << "No\n";
}
int main()
{
   /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   */
    fastio();
    int q = 1;
    //cin >> q;
    while(q--)
        input();
}


Measured memory_bytes: 3740
//第8回シンデレラガール総選挙は是非本田未央ちゃんに投票をお願いします！
//ファンのことも他のアイドルの子たちのことも本当に大事にしてて、今まで周りに色んなものを与えてくれました。
//今度は私たちが未央ちゃんにお返しをする番です。みんなでガラスの靴を履かせてあげましょう！
// #本田未央を一番星に #本田未央を令和のシンデレラガールに #第8回シンデレラガール総選挙
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
lint num[30];
int main()
{
	lint out=1,mo=1000000007;
	memset(num,0,sizeof(num));
	int n;string s;cin>>n;cin>>s;
	rep(i,n) num[(s[i]-'a')]++;
	rep(i,26){
		out*=num[i]+1;out%=mo;
	}
	cout<<(out+mo-1)%mo<<endl;
}


Measured memory_bytes: 512
#include <vector>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>
#include <set>
#include <numeric>

using namespace std;

template <typename T>
using TABLE = vector<vector<T>>;

long long PRIME = 1e9 + 7;
long long PRIME2 = 998244353;


int main(){
    long long K;
    cin >> K;

    long long A, B;
    cin >> A >> B;

    int div_A = A / K;
    int div_B = B / K;

    if(A % K == 0 || B % K == 0){
        cout << "OK";
    }
    else if(div_A != div_B){
        cout << "OK";
    }
    else{
        cout << "NG";
    }

}



Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int zero;
	int a,b;
	int save;
	cin>>a>>b;
	save=b;
	while(b/10>=1)
	{
		zero++;
		b/=10;
	}
	b=save;
	a=a*(pow(10,zero+1));
	int total=a+b;
	save=sqrt(total);
	if(save*save!=total)
	{
		cout<<"No"<<endl;
	
	}
	else
	{
		cout<<"Yes"<<endl;
		return 0;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,x,n) for (int i = x; i < n; i++)
using ll = long long int;
int main() {
    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i,n) cin >> p.at(i);
    sort(p.begin(),p.end());
    int ans=0;
    rep(i,k) ans += p.at(i);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int n;//桁数
string str;
int kouho[11];
int sum =0;
int dp[100001][10];//dp[i][j]インデックスj以降を使ってmod10の値jがいくつあるか
int calc(int x,int a){
  if(x%2==1) a *=2;
  return a/10+a%10;
}

int main()
{
  int m;
  cin>>n;
  cin>>str;
  cin>>m;
  int ans = 0;
  for(int i = 0;i <m;i++){
    cin>>kouho[i];
  }
  fill(dp[0],dp[100001],0);
  reverse(str.begin(), str.end());
  if(str[0]!='*')
    dp[0][str[0]-'0'] = 1;
  else
    for(int i = 0;i <m;i++){
      dp[0][kouho[i]] = 1;
    }
  for(int i = 1;i <n;i++){
    for(int j = 0;j <10;j++){
      if(str[i]=='*'){
	for(int k = 0;k < m;k++){
	  dp[i][(calc(i,kouho[k])+j)%10] +=dp[i-1][j];
	}
      }else
	dp[i][(calc(i,str[i]-'0')+j)%10] +=dp[i-1][j];
	}
  }
  cout <<dp[n-1][0]<<endl;
  return 0;
}

Measured memory_bytes: 5236
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  long long n;
  cin >>n;
  long long n1,n2;
  n1=n%1000;
  n2=1000-n1;
  if(n1==0)
  {
      cout << 0 << "\n";
  }
  else
  cout << n2 << "\n";
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=105;
//i_am_noob
char c;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> c;
	if(c=='A') print1("T");
	else if(c=='T') print1("A");
	else if(c=='G') print1("C");
	else print1("G");
	return 0;
}


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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
 
typedef long long ll;
using namespace std;
 
int main() {
  ll n,ans;
  cin >> n;

  rep(i,1,n+1){
    if(i*i <= n) ans = i*i;
    else break;
  }
  printf("%lld\n",ans);

	return 0;
}

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

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

void solve(void) {
  int N; cin >> N;
  vector<int> a(N), b(N), c(N-1);
  rep(N, i) cin >> a[i];
  rep(N, i) cin >> b[i];
  rep(N-1, i) cin >> c[i];

  int res = b[a[0]-1];
  for(int i = 1; i < N; ++i) {
    res += b[a[i]-1];
    if(a[i] - a[i-1] == 1) res += c[a[i-1]-1];
  }

  cout << res << endl;
}

int main(void) {
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	string s;
	cin >> s;
	if (s.size() % 2)cout << "No" << endl;
	else {
		for (int i = 0; i < s.size() / 2; i++) {
			if ((s[i] == 'p'&&s[s.size() - 1 - i] == 'q') || (s[i] == 'q'&&s[s.size() - 1 - i] == 'p') || (s[i] == 'd'&&s[s.size() - 1 - i] == 'b') || (s[i] == 'b'&&s[s.size() - 1 - i] == 'd'));
			else {
				cout << "No" << endl;
				return 0;
			}
		}
		cout << "Yes" << endl;
	}
	return 0;
}


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

int main() {
  int N, K, a = 1;
  cin >> N >> K;
  for(; N > 0; N--) {
    if(a > K) {
      a += K;
    }
    else {
      a *= 2;
    }
  }
  
  cout << a << endl;
}

Measured memory_bytes: 3552
N = int(input())
A = list(map(int, input().split()))
cnt = 0
while True:
  f = True
  for i in range(N):
    if A[i] % 2 == 1:
      f = False
    else:
      A[i] /= 2
  if not f:
    break
  else:
    cnt += 1
print(cnt)


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

int main(){
    string S,T;
    cin>>S>>T;
    bool b=false;
    int place=S.size()-T.size();
    for(int i=S.size()-T.size();0<=i;i--){
        bool make=true;
        for(int j=i;j<i+T.size();j++){
            if(S[j]!=T[j-i]&&S[j]!='?'){
                make=false;
                break;
            }
        }
        if(make){
            b=true;
            break;
        }
        place--;
    }
    if(b){
        for(int i=0;i<S.size();i++){
            if(place<=i&&i<place+T.size()){
                S[i]=T[i-place];
            }else if(S[i]=='?'){
                S[i]='a';
            }
        }
        cout<<S<<endl;
    }else cout<<"UNRESTORABLE"<<endl;


}

Measured memory_bytes: 256
using System;

namespace ELP
{
    class Program
    {
        static void Main(string[] args)
        {
            string InputChar;
            int A, B, C, K;
            int num_card;
            int totalD;

            InputChar=Console.ReadLine();
            string[] arr = InputChar.Split(' ');

            A = int.Parse(arr[0]);
            B = int.Parse(arr[1]);
            C = int.Parse(arr[2]);
            K = int.Parse(arr[3]);

            num_card = 0;
            totalD = 0;

            if (A <= K)
            {
                num_card += A;
                totalD += A;

                if (num_card + B <= K)
                {
                    num_card += B;

                    if (num_card + C <= K)
                    {
                        totalD -= C;
                    }
                    else
                    {
                        totalD -= ( K- num_card);
                    }
                }
            }else
            {
                totalD += K;
            }

            Console.WriteLine(totalD);
        }
    }
}


Measured memory_bytes: 27468
x = int(input())
y = x
a = []
while y:
    a.append(y%10)
    y = y//10
a.reverse()
if len(a)<=3:
    print(abs(x-753))
else:
    ans = 1000000
    ll = len(a)
    for i in  range(0,ll-2):
        ans=min(ans,abs(a[i]*100+a[i+1]*10+a[i+2]-753))
        #print(a[i]*100+a[i+1]*10+a[i+2])
    print(ans)

Measured memory_bytes: 3064
import copy
K = int(input())
ans, nex = [i for i in range(1, 10)], [i for i in range(1, 10)]
for i in range(10):
    pre, nex = copy.deepcopy(nex), []
    for p in pre:
        if p % 10 != 0:
            ans.append(p * 10 + p % 10 - 1)
            nex.append(p * 10 + p % 10 - 1)
        ans.append(p * 10 + p % 10)
        nex.append(p * 10 + p % 10)
        if p % 10 != 9:
            ans.append(p * 10 + p % 10 + 1)
            nex.append(p * 10 + p % 10 + 1)

ans.sort()
print(ans[K - 1])


Measured memory_bytes: 121196
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    ll n, k, s;
    cin >> n >> k >> s;

    vector<ll> ans(n);
    rep(i, k) ans[i] = s;

    ll emp = 1e9;
    if (s == 1e9) {
        emp = 1;
    }

    for (int i = k; i < n; i++) ans[i] = emp;


    for (ll l : ans) cout << l << ' ';
    cout << endl;

}


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

int n;
int d[1000];
bool exist[1000000] = {false};

int main() {
	int i, j;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> d[i];
	
	for (i = 0; i < n; i++) {
		int value = 0;
		for (j = i; j < n && j - i < 6; j++) {
			value *= 10;
			value += d[j];
			exist[value] = true;
		}
	}
	
	for (i = 0; i < 1000000; i++) {
		if (!exist[i]) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 2096
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define ll long long
bool BinarySearch(int a[],int right,int key)
{
	int left=0;
	while(left<right)
	{
		int middle=(left+right)/2;
		if(a[middle]==key)return 1;
		else if(a[middle]<key)left=middle+1;//****+1记得是middle +1 !! 
		else right=middle;//是middle!!//******因为left是最左边的那个元素,而right是最右边的那个元素的下一个! 
	}
	return 0;
}
int main()
{
	int n,S[100000],q,t,s=0,i;
	cin>>n;
	for(i=0;i<n;i++)cin>>S[i];
	cin>>q;
	while(q--)
	{
		cin>>t;
		s+=BinarySearch(S,n,t);
	}
	cout<<s<<endl;
	return 0;
}


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

class Amondai
{
    static void Main()
    {
        var line = Console.ReadLine().Split(' ').Select(x=>Int32.Parse(x)).ToArray();
        var A = line[0];
        var B = line[1];
        var T = line[2];
        var count = (T / A)*B;
        Console.WriteLine(count);
    }
}



Measured memory_bytes: 13268
package main

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

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024
var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	h, w := nextInt(), nextInt()

	if h == 1 || w == 1 {
		fmt.Println(1)
	} else {
		fmt.Println((h*w+1)/2)
	}
}

Measured memory_bytes: 640
A, B, C = map(int, raw_input().split())

X = A/2 * B * C - (A- A/2) * B * C
Y = B/2 * A * C - (B- B/2) * A * C
Z = C/2 * B * A - (C- C/2) * B * A

X, Y, Z = map(abs, (X, Y, Z))

print min(X, Y, Z)


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

int main()
{
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	cout << (x >= r && x + r <= W && y >= r && y + r <= H ? "Yes" : "No") << endl;
	return 0;
}

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

int main() {

    int N,R;
    cin >> N >> R;
    
    if (N <= 10) {
        cout << R + (100 * (10 - N)) << endl;
    }
    
    else { cout << R << endl;
         }
    
    
    
}


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

const int RLEN=1<<18|1;
inline char nc() {
	static char ibuf[RLEN],*ib,*ob;
	(ib==ob) && (ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
	return (ib==ob) ? -1 : *ib++;
}
inline int rd() {
	char ch=nc(); int i=0,f=1;
	while(!isdigit(ch)) {if(ch=='-')f=-1; ch=nc();}
	while(isdigit(ch)) {i=(i<<1)+(i<<3)+ch-'0'; ch=nc();}
	return i*f;
}

const int N=2e5+50;
vector <pLL> edge[N];
vector <pLL> f[N];
vector <pLL> tl, tr;
LL lim;
inline void inc(int x,const pLL &t) {
	if(f[x].size() && f[x].back()<=t) return;
	while(f[x].size() && f[x].back().second>=t.second) f[x].pop_back();
	f[x].push_back(t);
}
inline bool dfs(int x,int fa) {
	f[x].clear();
	if(edge[x].size()==1) {f[x].push_back(pLL(0,0)); return true;} 
	LL lc,rc,disl,disr; int fir=0;
	for(int e=edge[x].size()-1;e>=0;e--) {
		int v=edge[x][e].first; if(v==fa) continue;
		if(!dfs(v,x)) return false;
		if(!fir) fir=1, lc=v, disl=edge[x][e].second;
		else rc=v, disr=edge[x][e].second;
	}
	tl.clear(), tr.clear(); LL lim2=lim-disl-disr;
	if(lim2<0) return false; 
	for(int p1=0,p2=0;p2<f[rc].size();p2++) {
		while(p1<f[lc].size() && f[lc][p1].first+f[rc][p2].second>lim2) ++p1;
		if(p1==f[lc].size()) break;
		tl.push_back(pLL(f[rc][p2].first+disr,f[lc][p1].second+disl));
	}
	for(int p1=0,p2=0;p1<f[lc].size();p1++) {
		while(p2<f[rc].size() && f[lc][p1].second+f[rc][p2].first>lim2) ++p2;
		if(p2==f[rc].size()) break;
		tr.push_back(pLL(f[lc][p1].first+disl,f[rc][p2].second+disr));
	}
	int pl=0, pr=0;
	while(pl<tl.size() && pr<tr.size()) {
		if(tl[pl].first>tr[pr].first) inc(x,tl[pl++]);
		else inc(x,tr[pr++]);
	}
	while(pl<tl.size()) inc(x,tl[pl++]);
	while(pr<tr.size()) inc(x,tr[pr++]);
	return f[x].size()>0;
}
inline bool check(LL v) { lim=v; return dfs(1,0);}
int main() {
	int n=rd();
	for(int i=2;i<=n;i++) {
		int x=rd(), w=rd();
		edge[x].push_back(pLL(i,w));
		edge[i].push_back(pLL(x,w));
	}
	LL l=0, r=1e12, ans=0;
	while(l<=r) {
		LL mid=(l+r)>>1;
		if(check(mid)) ans=mid, r=mid-1;
		else l=mid+1;
	} cout<<ans;
}

Measured memory_bytes: 40036
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
#include <stack>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef map<int, int> Mii;
typedef vector<int> Vi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

ll a[2010];
ll c[2010][2010];

int main()
{
	ll n, x;
	cin >> n >> x;
	rep(i,0,n) cin >> a[i];

	rep(i,0,n) {
		c[i][i] = a[i];
		rep(j,1,n) {
			c[i][(n+i-j)%n] = min(a[(n+i-j)%n], c[i][(n+i-j+1)%n]);
		}
	}

	ll ans = ll_inf;
	rep(i,0,n) {
		ll cur = x * i;
		rep(j,0,n) {
			cur += c[j][(n+j-i)%n];
		}
		ans = min(ans, cur);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 31616
(let ((a (read))
      (b (read))
      (k (read))
      (cnt 0)
      (ans 0))
  (loop for i from 100 downto 1
        while (not (= cnt k)) do (if (and (= 0 (rem a i)) (= 0 (rem b i))) (progn (incf cnt)
                                                                                  (if (= cnt k) (setf ans i)))))
  (princ ans))


Measured memory_bytes: 11496
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let a: i64 = input();
    let b: i64 = input();

    let mut g = vec![vec!['.'; 100]; 100];
    for i in 50..100 {
        for j in 0..100 {
            g[i][j] = '#';
        }
    }

    let mut cnt = 1;
    for i in (50..100).rev() {
        if i % 2 == 0 {
            continue;
        }
        for j in 0..100 {
            if cnt == a {
                break;
            }
            if j % 2 == i % 2 {
                continue;
            }
            g[i][j] = '.';
            cnt += 1;
        }
        if cnt == a {
            break;
        }
    }

    let mut cnt = 1;
    for i in 0..50 {
        if i % 2 == 0 {
            continue;
        }
        for j in 0..100 {
            if cnt == b {
                break;
            }
            if j % 2 == i % 2 {
                continue;
            }
            g[i][j] = '#';
            cnt += 1;
        }
        if cnt == b {
            break;
        }
    }

    let out = std::io::stdout();
    let mut buf = std::io::BufWriter::new(out.lock());
    writeln!(buf, "{} {}", 100, 100).unwrap();
    for i in 0..100 {
        for j in 0..100 {
            write!(buf, "{}", g[i][j]).unwrap();
        }
        writeln!(buf, "").unwrap();
    }
}


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

int main() {
    string s, t;
    cin >> s >> t;
    int s1, t1;
    cin >> s1 >> t1;
    string u;
    cin >> u;
    if(u == s) s1--;
    else t1--;
    cout << s1 << " " << t1 << endl;
}

Measured memory_bytes: 256