akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
typedef long long           ll;
typedef vector<int>         vi;
typedef vector<ll>          vll;

#define ff                  first
#define sf                  scanf
#define pf                  printf
#define ss                  second
#define ppb                 pop_back
#define pb                  push_back
#define MP                  make_pair
#define MAXN                10000
#define MOD                 100000007
#define inf                 0x3f3f3f3f
#define PI                  (2.0*acos(0.0))
#define INF                 0x3f3f3f3f3f3f3f3f
#define rev(v)              reverse(all(v))
#define all(v)              v.begin(), v.end()
#define __lcm(x, y)         (x * y) / __gcd(x, y)
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define si(n)               scanf("%d", &n)
#define sl(n)               scanf("%lld", &n)
#define sii(a, b)           scanf("%d %d", &a, &b)
#define sll(a, b)           scanf("%lld %lld", &a, &b)
#define siii(a, b, c)       scanf("%d %d %d", &a, &b, &c)
#define slll(a, b, c)       scanf("%lld %lld %lld", &a, &b, &c)
#define siiii(a, b, c, d)   scanf("%d %d %d %d", &a, &b, &c, &d)
#define sllll(a, b, c, d)   scanf("%lld %lld %lld %lld", &a, &b, &c, &d)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl;}

int main(){
        string A, B, C; cin >> A >> B >> C;
        int a = 1, b = 0, c = 0;
        while(1){
        	if(a == 1){
        		if(!A.size()) break;
        		if(A[0] == 'a'){
        			a = 1, b = 0, c = 0;
        		} else if(A[0] == 'b'){
        			a = 0, b = 1, c = 0;
        		} else {
        			a = 0, b = 0, c = 1;
        		}
        		A.erase(A.begin());
        	} else if(b == 1){
        		if(!B.size()) break;
        		if(B[0] == 'a'){
        			a = 1, b = 0, c = 0;
        		} else if(B[0] == 'b'){
        			a = 0, b = 1, c = 0;
        		} else {
        			a = 0, b = 0, c = 1;
        		}
        		B.erase(B.begin());
        	} else {
        		if(!C.size()) break;
        		if(C[0] == 'a'){
        			a = 1, b = 0, c = 0;
        		} else if(C[0] == 'b'){
        			a = 0, b = 1, c = 0;
        		} else {
        			a = 0, b = 0, c = 1;
        		}
        		C.erase(C.begin());
        	}
        }
        if(a == 1) puts("A");
        else if(b == 1) puts("B");
        else puts("C");


    return 0;
}

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

using namespace std;
int main(){
	int n;
	string s;
	int anS=INT_MAX;
	cin >> n >> s;
	vector<int> h(n+1,0),z(n+1,0);

	int i = 0;
	for ( i = 1; i < n+1; i++)
	{
		if (s[i-1] == '#')
		{
			h[i] = h[i - 1] + 1;
			z[i] = z[i - 1];
		}
		else {
			z[i] = z[i - 1] + 1;
			h[i] = h[i - 1];
		}

	}

	//cout << h[i-1] << "z " << z[i-1] << endl;

	for ( i = 0; i < n + 1; i++)
	{
		int L = h[i] ;
		int R = z[n] - z[i];
		//cout << "h " << L << " r " << R << endl;
		anS = min(anS, L + R);
	}
	cout << anS << endl;
	return 0;
}


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

using namespace std;

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

	int n = s.size();

	for(int i=0;i<n/2;i++)
	{
		if(s[i] != s[n-1-i])
		{
			cout << "No\n";
			return 0;
		}
	}

	for(int i=0;i<(n/2)/2;i++)
	{
		if(s[i] != s[n/2-1-i])
		{
			cout << "No\n";
			return 0;
		}
	}

	for(int i=0;i<(n/2)/2;i++)
	{
		if(s[n/2+1+i] != s[n-1-i])
		{
			cout << "No\n";
			return 0;
		}
	}

	cout << "Yes\n";
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let limit: u32 = read();
    let route: Vec<(u32, u32)> = (0..n).map(|_| (read(), read())).collect();

    let ans = route.into_iter().filter(|x| x.1 <= limit).fold(4294967295, |m, p| p.0.min(m));
    println!("{}", if ans == 4294967295 { "TLE".to_string() } else { ans.to_string() });
}


Measured memory_bytes: 2148
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    d = defaultdict(int)
    for a in A:
        if a == 0:
            continue
        digit = int(math.log2(a))
        for i in range(digit + 1):
            if 1 << i & a:
                d[i] += 1

    x = 0
    if K != 0:
        digit = int(math.log2(K))
        for i in range(digit + 1)[::-1]:
            if N / 2 <= d[i]:
                continue
            else:
                if K < x + 2 ** i:
                    continue
                else:
                    x += 2 ** i

    ans = 0
    for a in A:
        ans += x ^ a

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 14996
#include<queue>
#include<cstdio>
#include<algorithm>

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

using namespace std;

int hash(const vector<int> &a){
	int n=a.size();
	int res=0,fac=1;
	rep(i,n){
		int c=0;
		for(int j=i+1;j<n;j++) if(a[i]<a[j]) c++;
		res+=c*fac;
		fac*=n-i;
	}
	return res;
}

void bfs(vector<int> a,char *memo){
	int n=a.size();
	memo[hash(a)]=0;
	queue< pair<int,vector<int> > > Q; Q.push(make_pair(0,a));
	while(!Q.empty()){
		int t=Q.front().first;
		vector<int> a=Q.front().second; Q.pop();

		if(t==4) break;

		rep(l,n) for(int r=l+1;r<n;r++) {
			reverse(a.begin()+l,a.begin()+r+1);
			int h=hash(a);
			if(memo[h]>t+1){
				memo[h]=t+1;
				Q.push(make_pair(t+1,a));
			}
			reverse(a.begin()+l,a.begin()+r+1);
		}
	}
}

int main(){
	int n; scanf("%d",&n);
	int fact=1;
	vector<int> a(n);
	rep(i,n) scanf("%d",&a[i]), fact*=i+1;

	static char memo1[3628800],memo2[3628800];
	rep(i,fact) memo1[i]=memo2[i]=20;
	bfs(a,memo1);
	sort(a.begin(),a.end());
	bfs(a,memo2);

	int ans=9;
	rep(i,fact) ans=min(ans,memo1[i]+memo2[i]);
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 26448
#include <iostream>

using namespace std;

int main(){
	int n, x[100000];
	cin >> n;
	for(int i = 0;i < n; i++){
		cin >> x[i];
	}
	int counter = 0;
	int currentmax = 0;
	for(int i = 0; i < n - 1;i++){
		if(x[i] >= x[i + 1]){
			counter += 1;
		}else{
			counter = 0;
		}
		if(currentmax < counter){
			currentmax = counter;
		}
	}
	cout << currentmax;
}

Measured memory_bytes: 640
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a==5 && b==7 && c==5)
    {
        printf("YES\n");
    }
    else if(a==5 && b==5 && c==7)
    {
        printf("YES\n");
    }
    else if(a==7 && b==5 && c==5)
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 128
import sys

nums = list()

o = 'abcdefghijklmnopqrstuvwxyz'

for i in range(26):
    nums.append(0)

mylist1 = sys.stdin.read()


# while True:
#     try:
#         val = input()
#         for i in val:
#             mylist1.append(i) 
#     except:
#         break

for i in mylist1:
    for q in range(len(o)):
        if i.lower() == o[q]:
            nums[q] = nums[q] + 1

for q in range(len(o)):
    print('{} : {}'.format(o[q], nums[q]))


Measured memory_bytes: 5556
S = input()
Q = int(input())
re = False
front = []
back = []

for i in range(Q):
    t = input()
    
    if len(t) == 1:
        re = not re
        
    else:
        q, f, c = t.split()
        if (re == True and int(f) == 2) or (re == False and int(f) == 1):
            front.append(c)
        elif (re == True and int(f) == 1) or (re == False and int(f) == 2):
            back.append(c)

if re == False:
    front.reverse()
    F = "".join(front)
    B = "".join(back)
    print(F + S + B)
else:
    back.reverse()
    S = S[::-1]
    F = "".join(front)
    B = "".join(back)
    print(B + S + F)

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

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

signed main() {
	ll n, k;
  while(1) {
    cin >> n;
    if(n == 0) break;
    bool ch = false;
    ll cnt = 0;
    rep(i, n) {
      cin >> k;
      if(k >= 1) cnt++;
      if(k >= 2) ch = true;
    }
    if(ch) cout << cnt + 1 << endl;
    else cout << "NA" << endl;
  }
	return 0;
}


Measured memory_bytes: 3216
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	stack<int> S1;
	stack<pair<int, int> > S2;
	char ch;
	int sum = 0;
	for (int i = 0; cin >> ch; i++) {
		if (ch == '\\') S1.push(i);
		else if (ch == '/' && S1.size() > 0) {
			int j = S1.top();
			S1.pop();
			sum += i - j;
			int a = i - j;
			while (S2.size() > 0 && S2.top().first > j) {
				a += S2.top().second;
				S2.pop();
			}
			S2.push(make_pair(j, a));
		}
	}

	vector<int> ans;
	while (S2.size() > 0) {
		ans.push_back(S2.top().second);
		S2.pop();
	}
	reverse(ans.begin(), ans.end());
	cout << sum << endl;
	cout << ans.size();
	for (int i = 0; i < ans.size(); i++) {
		cout << " ";
		cout << ans[i];
	}
	cout << endl;

	return 0;
}

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

#define loop(lp) for(int lp2 = 0; lp2 < lp; lp2 ++)
#define ascent(i, a, b) for(int i = a; i < b; i ++)

#define pb push_back

using namespace std;

int dp[50];

int main() {
  ascent(i, 1, 30+1) {
    if(i == 1) {
      dp[i] = 1;
    }
    else if(i == 2) {
      dp[i] = 2;
    }
    else if(i == 3) {
      dp[i] = 4;
    }
    else {
      dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
    }
  }

  int n;
  while(cin >> n, n) {
    cout << int((dp[n]/10/365)+1) << endl;
  }
  return 0;
}

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

int main() {

  int K, N;
  cin >> K >> N;

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

  int answer = 0;
  int mx = 0;
  
  vector<int> D(N+1);
  for (int i = 0; i < N; i++) {
    D[i] = A[i + 1] - A[i];
    if (i == N - 1) {
      D[i] = K - A[i] + A[0];
    }
    answer += D[i];
    mx = max(D[i], mx);
  }

  cout << answer - mx << endl;

  return 0;

}

Measured memory_bytes: 1792
import java.io.*;

import java.util.*;



class Main{

	public static void check_ball(ArrayList<Integer> ball_list){

		ArrayList <Integer> cb = new ArrayList<Integer>();
		ArrayList <Integer> cc = new ArrayList<Integer>();
		int pri = 0;
		boolean ch = true;

		cb.add(0);
		cc.add(0);

		for(int i=0;i<ball_list.size();i++){
			if(cb.get(cb.size()-1) == 0){
				cb.add(ball_list.get(i));
				continue;		
			}
			if(cb.get(cb.size()-1) > ball_list.get(i)){
				if(cc.get(cc.size()-1) > ball_list.get(i)){
					System.out.println("NO");
					ch = false;
					break;
				}
			}

			if(cb.get(cb.size()-1) > cc.get(cc.size()-1)){
				if(cb.get(cb.size()-1) < ball_list.get(i))
					cb.add(ball_list.get(i));
				else cc.add(ball_list.get(i));
			}
			else{
				if(cc.get(cc.size()-1) < ball_list.get(i))
					cc.add(ball_list.get(i));
				else cb.add(ball_list.get(i));
			}
			
		}
		if(ch == true)System.out.println("YES");
	}


	public static void ball(ArrayList<Integer> list){
		ArrayList <Integer> inp = new ArrayList<Integer>();
		for(int i=0;i<list.size()/10;i++){
				for(int j=0;j<10;j++){
					inp.add(list.get(i*10+j));
				}
				check_ball(inp);
				inp.clear();
		}
	}

		

	public static void main(String args[]) throws IOException{

		String str;

		ArrayList <Integer> inp = new ArrayList<Integer>();



		Scanner scan = new Scanner(System.in);

		str = scan.next();
		int n = Integer.valueOf(str).intValue();

		for(int i=n;i>0;i--){
			for(int j=0;j<10;j++){
				str = scan.next();			

				int x = Integer.valueOf(str).intValue();			
				inp.add(x);
			}
		}

		ball(inp);

	}

}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>

using namespace std;

static const int N = 100000;
static const int NIL = -1;

int n, m, c;
vector<int> G[N];
int color[N];

void bfs(int u)
{
	queue<int> q;
	q.push(u);
	color[u] = c;

	while (!q.empty())
	{
		u = q.front(); q.pop();
		for (int i = 0; i < G[u].size(); ++i)
		{
			int v = G[u][i];
			if (color[v] == -1)
			{
				q.push(v);
				color[v] = c;
			}
		}
	}
}

void DrawColor()
{
	c = 0;
	for (int i = 0; i < n; ++i) color[i] = -1;
	for (int i = 0; i < n; ++i)
	{
		if (color[i] == -1) bfs(i);
		c++;
	}
}

int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; ++i)
	{
		int u, v; cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}

	DrawColor();

	int n2, p1, p2;
	cin >> n2;
	for (int i = 0; i < n2; ++i)
	{
		cin >> p1 >> p2;
		if (color[p1] == color[p2])
			cout << "yes" << endl;
		else
			cout << "no" << endl;
	}

	return 0;
}

Measured memory_bytes: 9008
// #pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vii = vector<int>;
using pii = pair<int, int>;
template <typename T = vii>
using vec = vector<T>;

const ll INF = 1e18, MOD = 1e9 + 7;

const int MAX = 1e6;

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    // freopen("in.in", "r", stdin);

    int n, m;
    cin >> n >> m;
    priority_queue<double> q;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        q.push(x);
    }
    while (m--) {
        const double x = q.top();
        q.pop();
        q.push(x / 2);
    }
    ll res = 0;
    while (not q.empty()) {
        res += q.top();
        q.pop();
    }
    cout << res << '\n';
}

Measured memory_bytes: 1400
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7


def comb_mod(n, k, mod):
    numerator = 1
    denominator = 1
    for i in range(k):
        numerator = numerator * (n - i) % mod
        denominator = denominator * (i + 1) % mod

    return ((numerator % mod) * (pow(denominator, mod - 2, mod) % mod)) % mod


n_c_a = comb_mod(n, a, mod)
n_c_b = comb_mod(n, b, mod)

result = (pow(2, n, mod) - 1 - n_c_a - n_c_b) % mod
print(result)



Measured memory_bytes: 3064
<?php
$count1=0;
$count2=0;
while(fscanf(STDIN,"%d,%d,%d",$a,$b,$c)){
    if($a*$a+$b*$b==$c*$c){
        $count1++;
    }
    if($a==$b){
        $count2++;
    }
}
echo $count1."\n".$count2."\n";
?>

Measured memory_bytes: 6568
import math
def P(n,r):
    return math.factorial(n) // math.factorial(n-r)
def C(n,r):
    return P(n,r) // math.factorial(r)
n,m = map(int,input().split())
if n < 2:
    n_len = 0
else:
    n_len = C(n,2)
if m < 2:
    m_len = 0
else:
    m_len = C(m,2)
ans = n_len + m_len
print(ans)

Measured memory_bytes: 38492
import sys
import math
def area(d,sum1,i):
    while i<=((600//d)-1):
        sum1=sum1+d*i*i*d*d
        i=i+1
    return sum1
        

try:
    while True:
        d=int(input())
        sum0=0 # 初期設定
        i=1 # 初期設定
        area_new=area(d,sum0,i)
        print(round(area_new))
except EOFError:
    pass


Measured memory_bytes: 5656
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 98765431219876543
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, string> PS;

int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  ll h = a + b;
  if (h + 1 < c) {
    cout << h + 1 + b << endl;
  } else {
    cout << c + b << endl;
  }
}

Measured memory_bytes: 256
s=list(input())
t=list(input())

a=len(s)
b=len(t)
f=0
for i in range(-1,-a+b-2,-1):
    f=0
    for j in range(-1,-b-1,-1):
        if (s[i+j+1]!="?"and t[j]!=s[i+j+1]):
            f=1
            break
    if f==1: continue
    for k in range(-1,-b-1,-1):
        s[i+k+1]=t[k]
    for p in range(a):
        if s[p]=="?":
            s[p]="a"
    print("".join(s))
    exit()
print("UNRESTORABLE")

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

int main() {

  ios::sync_with_stdio(false);
  cout.tie(nullptr);
  cin.tie(nullptr);

  string s;
  cin >> s;

  bool good = 0;
  if (s[2] == s[3] && s[4] == s[5]) good = 1;
  if (good) cout << "Yes\n";
  else cout << "No\n";
}


Measured memory_bytes: 256
n, m = map(int, input().split())
sc = [map(int, input().split()) for _ in range(m)]

number = [-1] * n
for s, c in sc:
    if number[s - 1] < 0:
        number[s - 1] = c
    elif number[s - 1] != c:
        print(-1)
        exit()

res = 0
for i in range(n):
    if number[i] > 0:
        res += number[i] * 10 ** (n - i - 1)
    elif i == 0 and number[i] < 0 and n > 1:
        res += 10 ** (n - i - 1)

if len(str(res)) == n:
    print(res)
else:
    print(-1)


Measured memory_bytes: 3064
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
	int n,k;
	string s;
	cin>>n>>k>>s;
	s[k-1]-=('A'-'a');
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
def getval():
    n,w = map(int,input().split())
    p = [list(map(int,input().split())) for i in range(n)]
    return n,w,p 

def main(n,w,p):
    #DP[n][w] 
    dp = [[0 for i in range(w+1)]]
    for i in range(n):
        item = p[i]
        temp = []
        for j in range(w+1):
            cur = dp[i][j]
            if j>=item[0]:
                cur = max(cur,dp[i][j-item[0]]+item[1])
            temp.append(cur)
        dp.append(temp)
    print(dp[n][w])
                
if __name__=="__main__":
    n,w,p = getval()
    main(n,w,p)


Measured memory_bytes: 172708
n = gets.to_i
playlist = []
playlist_time = []
n.times do
 song, playtime = gets.chomp.split()
 playlist.push(song)
 playlist_time.push(playtime.to_i)
end
x = gets.chomp!

if playlist[-1] == x
 puts(0)
else
 slep = playlist.index(x)
 puts(playlist_time[slep+1..-1].inject(:+))
end

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

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

int main() {
    int n;
    cin>>n;
    vector<int> a(n+1), b(n);
   

    rep(i,n+1)  cin>>a[i];

    rep(i, n)  cin>>b[i];

    long long int cnt=0;
    rep(i,n){
        
        if(a[i]>=b[i]){
            cnt+=b[i];
        }else{
            cnt+=a[i];
            b[i]-=a[i];

            if(a[i+1]>=b[i]){
                cnt+=b[i];
                a[i+1]-=b[i];
            }else{
                cnt+=a[i+1];
                a[i+1]=0;
            }
        }
    }

    cout<<cnt<<endl;
    
}

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

int main() {
	int n;
	int t[100001];
	int m;
	int p, x;
	cin >> n;
	int sum = 0;
	for (int i = 0; i < n; ++i) {
		cin >> t[i];
		sum = sum + t[i];
	}
	cin >> m;
	int a[m];

	for (int i = 0; i < m; ++i) {
		cin >> p >> x;
		a[i]= sum - t[p - 1] + x ;
	}
	for (int i = 0; i < m; ++i) {
		cout<<a[i]<<endl;
	}
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
int x,h=0,i;
cin>>x;
while(x>0){
    if(x>=500){
        for(i=0;i<x && x>=500; x=x-500)
        h=h+1000;}
    else if(x<500){
        int r=x%5;
         x=x-r;
        for(i=0;i<x;x=x-5)
             h=h+5;}}
cout<<h;
return 0;}

Measured memory_bytes: 256
using System;
using System.Text;

namespace CGL_1_A_Projection
{
	class Program
	{
		static void Main ( string[] args )
		{
			int[] inputNum = Array.ConvertAll (Console.ReadLine ().Split (' '), int.Parse);
			int inputCount = int.Parse (Console.ReadLine ());

			StringBuilder output = new StringBuilder (inputCount * 10 * 2);

			Vector2 beginPoint = new Vector2 (inputNum[0], inputNum[1]);
			Vector2 endPoint = new Vector2 (inputNum[2], inputNum[3]);

			for (int lp = 0; lp < inputCount; lp++)
			{
				inputNum = Array.ConvertAll (Console.ReadLine ().Split (' '), int.Parse);

				Vector2 result = Vector2.Projection (beginPoint, endPoint, new Vector2 (inputNum[0], inputNum[1]));

				output.Append (result.X);
				output.Append (" ");
				output.Append (result.Y);
				output.AppendLine ();
			}

			Console.Write (output);
		}
	}

	class Vector2
	{
		public Vector2 ( decimal x, decimal y )
		{
			this.X = x;
			this.Y = y;
		}

		public decimal X { private set; get; }
		public decimal Y { private set; get; }

		public static Vector2 operator + ( Vector2 ob1, Vector2 ob2 )
		{
			return new Vector2 (ob1.X + ob2.X, ob1.Y + ob2.Y);
		}
		public static Vector2 operator - ( Vector2 ob1, Vector2 ob2 )
		{
			return new Vector2 (ob1.X - ob2.X, ob1.Y - ob2.Y);
		}
		public static Vector2 operator * ( Vector2 ob, decimal scalar )
		{
			return new Vector2 (ob.X * scalar, ob.Y * scalar);
		}

		public decimal Length ()
		{
			return X * X + Y * Y;
		}
		public static decimal DotProduct ( Vector2 ob1, Vector2 ob2 )
		{
			return ob1.X * ob2.X + ob1.Y * ob2.Y;
		}

		public static Vector2 Projection ( Vector2 beginPoint, Vector2 endPoint, Vector2 point )
		{
			Vector2 segment = endPoint - beginPoint;
			decimal ratio = Vector2.DotProduct (point - beginPoint, segment) / segment.Length ();
			return beginPoint + segment * ratio;
		}
	}
}

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



int main (){
    int N;
    cin>>N;
    vector<int> A(N+1), B(N);
    for(int i=0; i<N+1; i++){
        cin>>A.at(i);
    }
    for(int i=0; i<N; i++){
        cin>>B.at(i);
    }
    long long Sum=0;
    if(A.at(0)>B.at(0)){
        Sum += B.at(0);
        B.at(0)=0;
    }
    else{
        Sum += A.at(0);
        B.at(0) -= A.at(0);
    }
    for(int i=1; i<N+1 ;i++){
        if(A.at(i)>B.at(i-1)){
            Sum += B.at(i-1);
            A.at(i) -= B.at(i-1);
        }
        else{
            Sum += A.at(i);
            A.at(i) =0;

        }
      	if(i<N){
        if(A.at(i)>B.at(i)){
            Sum += B.at(i);
            B.at(i)=0;
        }
        else{
            Sum += A.at(i);
            B.at(i) -= A.at(i);
            
        }
        }
    }
    cout<<Sum<<endl;
}

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

int main(){
    int h,n;cin >>h>>n;
    vector<int64_t> a(h);

    for (int i = 0; i <h; i++)
    {
        /* code */
        cin >> a.at(i);

     }
    // sort(a.begin(),a.end());
    stable_sort(a.begin(),a.end(),greater<int>());
    if(h<=n){cout<<0<<endl;}
    else{
        for(int i=0;i<n;i++){
            a.at(i)=0;
        }
       int64_t cnt =0;
 
        for (int i = 0; i <h; i++) {cnt +=a.at(i);}
        cout<<cnt<<endl;
    }
  

    
}



Measured memory_bytes: 2560
//
// Created by Myabu on 2020/01/28.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <numeric>
#include <iomanip>

using namespace std;


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

    int D,X;
    cin>>D>>X;

    vector<int> A(N);

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

    int used = 0;
    for (int i = 0; i < N; ++i) {
        used += (D-1) / A[i] + 1;
    }

    cout<<used+X<<endl;


    return 0;
}

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

int main() {
  int n, w;
  cin >> n >> w;
  
  ll weight[110];
  ll value[110];
  
  for (int i = 0; i < n; i++) {
    cin >> weight[i] >> value[i];
  }
  
  ll dp[110][100010] = {0};
  
  for (int i = 0; i < n; i++) {
    for (int sum_w = 0; sum_w <= w; sum_w++) {
      if (sum_w >= weight[i]) {
        dp[i + 1][sum_w] = max(dp[i][sum_w - weight[i]] + value[i], dp[i][sum_w]);
      }
      else {
        dp[i + 1][sum_w] = dp[i][sum_w];
      }
    }
  }
  
  cout << dp[n][w] << endl;
}

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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

#define PQ(T) priority_queue<T>
#define RPQ(T) priority_queue<T,vector<T>,greater<T>>

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }

template <typename T1, typename T2>
vector<T2> accum(vector<T1>& a, T2 init) {
    int L = a.size();
    vector<T2> acc(L + 1);
    acc[0] = init;
    for (int i=0; i<L; ++i) acc[i+1] = acc[i] + a[i];
    return move(acc);
}

int solve(int N, int K, string& s){
    vi starts;
    int last=' ';
    vi a(N,0);
    rep(i,N){
        if (s[i] != last){
            starts.pb(i);
            last = s[i];
            if (s[i] == '0') a[i]=1;
        }
    }
    vi ac = accum(a, 0);
    int best = 0;
    for (int lo: starts) {
        auto it = upper_bound(ac.begin()+lo, ac.end(), ac[lo] + K);
        int hi = (it - ac.begin()) - 1;
        amax(best, hi - lo);
    }

    return best;
}

int main() {
    int N, K; cin >> N >> K;
    string s; cin >> s;
    cout << solve(N,K,s) << endl;
    return 0;
}


Measured memory_bytes: 1656
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cassert>
#include <bitset>

//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//std::cout << std::fixed << std::setprecision(10)
//std::ios::sync_with_stdio(false);
constexpr long long MOD = 1000000007;

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

int main()
{
  long long k, q;
  std::cin >> k >> q;
  std::vector<long long> d1(k);
  for(auto& val: d1)
    std::cin >> val;
  while(q--)
  {
    int n, x, m;
    std::cin >> n >> x >> m;
    auto d = d1;
    for(auto& val: d)
      val %= m;
    long long ans = n - 1;
    ans -= std::count(d.begin(), d.end(), 0LL) * ((n - 1) / k);
    for(int i = 0; i < n-1-((n-1)/k)*k; ++i)
      if(d[i] % m == 0) ans--;
    long long sum = std::accumulate(d.begin(), d.end(), 0LL) * ((n - 1) / k) + x;
    for(int i = 0; i < n-1-((n-1)/k)*k; ++i)
      sum += d[i];
    ans -= sum/m - x/m;
    std::cout << ans << std::endl;
  }
  return 0;
}



Measured memory_bytes: 384
#include <cstdio>
#include <cmath>
struct point{
	double x, y;
	point(double _x = 0, double _y = 0){
		x = _x, y = _y;
	}
	point operator + (const point &rhs) const { return point(x + rhs.x, y + rhs.y); }
	point operator - (const point &rhs) const { return point(x - rhs.x, y - rhs.y); }
}A, B, C, D;
int q;
double dot_product(point a, point b){
	return a.x * b.x + a.y * b.y;
}
point projection(point p, point a, point b){
	double l1 = dot_product(p - a, b - a);
	double l2 = dot_product(b - a, b - a);
	double d = l1 / l2;
	return point(a.x + (b.x - a.x) * d, a.y + (b.y - a.y) * d);
}
int main(){
	scanf("%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y);
	scanf("%d", &q);
	for (register int i = 1; i <= q; ++i){
		scanf("%lf%lf", &C.x, &C.y);
		D = projection(C, A, B);
		printf("%.10lf %.10lf\n", D.x, D.y);
	}
}


Measured memory_bytes: 2764
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();

		String check = S.toUpperCase();
		if(S.charAt(0) == 'A') {
			int count = 0;
			for(int i = 1; i < S.length(); i++) {
				if(i != 1 && i != S.length() - 1 && S.charAt(i) == 'C') {
					count++;
					continue;
				}
				if(S.charAt(i) == check.charAt(i)) {
					System.out.println("WA");
					return;
				}
			}
			if(count == 1) {
				System.out.println("AC");
			}else {
				System.out.println("WA");
			}
		}else {
			System.out.println("WA");
			return;
		}
	}

}

Measured memory_bytes: 21844
def resolve():
    ss = input()
    t = input()
    ans = 'UNRESTORABLE'

    # マッチ点が複数ある場合は、辞書順最小にしなければならないため、なるべく後ろのマッチ点でマッチさせたい。
    # そのため、ループは逆順で回す必要がある。
    for i in reversed(range(len(ss) - len(t) + 1)):
        flg = True
        for j in range(len(t)):
            if ss[i + j] != t[j] and ss[i + j] != '?':
                flg = False
                break

        if flg:
            ans = ss[:i] + t + ss[i + len(t):]
            ans = ans.replace('?', 'a')
            break

    print(ans)
    
resolve()

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

int main()
{
	int A,B;
	cin >> A >> B;
	if (A%3==0||B%3==0||(A+B)%3==0)
	{
		cout << "Possible" << endl;
	}
	else
	{
		cout << "Impossible" << endl;
	}
	return 0;
}

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

using namespace std;

int main(){

	int n, k, c, aa, bb;
	string s;
	vector<int> a, b;

	cin>> n >> k >> c;
	cin>> s;

	for (int i = 0;i < n;i++) {
		if (s[i] == 'o') {
			a.push_back(i + 1);
			i += c;
		}
		if (a.size() == k) break;
	}

	for (int i = n - 1;i >= 0;i--) {
		if (s[i] == 'o') {
			b.push_back(i + 1);
			i -= c;
		}
		if (b.size() == k) break;
	}

	/*for (int i = 0;i < a.size();i++) cout << a[i] << " ";
	cout << endl;
	for (int i = 0;i < b.size();i++) cout << b[i] << " ";
	cout << endl;
	cout << a.size() << endl;
	cout << b.size() << endl;*/

	//sort(a.begin(), a.end());
	/*reverse(b.begin(), b.end());
	
	aa = 0;
	bb = 0;
	while (1) {
		//if((aa+bb)>132090) cout << aa << " " << bb << endl;;
		if (a[aa] == b[bb]) {
			cout << a[aa] << endl;
			aa++;
			bb++;
		}
		else if (a[aa] < b[bb]) {
			aa++;
		}
		else if (a[aa] > b[bb]) {
			bb++;
		}

		if (aa == k || bb == k) break;
	}*/

	for (int i = 0;i < k;i++) {
		if (a[i] == b[k - i - 1]) cout << a[i] << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3448
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
    int n,k;
    cin>>n>>k;
    int h[n];
    for(int i=0;i<n;i++)cin>>h[i];
    long long ans=0;
    sort(h,h+n);
    if(n>k){
        for(int i=0;i<n-k;i++){
            ans+=h[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;
mt19937_64 rng(58);

typedef long long ll;

ll choose(int n, int k) {
  k = min(k, n - k);
  __int128 ans = 1LL;
  for (int i = n - k + 1; i <= n; i++) ans *= i;
  for (int i = 1; i <= k; i++) ans /= i;
  return (ll)ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n, m;
    ll ans = 0;
    cin >> n >> m;
    ans = n * (n - 1) / 2 + m * (m - 1) / 2;
    cout << ans << "\n";
}

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

struct Card{
    char suit, value;
};

void bubblesort(struct Card a[], int n){
    for(int i = 0; i < n; i++){
        for(int j = n - 1; j >= i + 1; j--){
            if(a[j - 1].value > a[j].value){
                swap(a[j - 1], a[j]);
            }
        }
    }
/*    for(int i = 0; i < n; i++){
        if(i != 0) cout << ' ';
        cout << a[i].suit << a[i].value;
    }
    cout << endl;*/
}
void selectionsort(struct Card a[], int n){
    for(int i = 0; i < n; i++){
        int minj = i;
        for(int j = i; j < n; j++){
            if(a[j].value < a[minj].value){
                minj = j;
            }
        }
        if(minj != i){
            swap(a[minj], a[i]);
        }
    }
}
string check(struct Card a[], struct Card b[], int n){
    for(int i = 0; i < n; i++){
        if(a[i].suit != b[i].suit){
            return "Not stable";
        }
    }
    return "Stable";
}
void print(struct Card a[], int n){
    for(int i = 0; i < n; i++){
        if(i != 0) cout << ' ';
        cout << a[i].suit << a[i].value;
    }
    cout << endl;
}

int main(){
    int n;
    cin >> n;
    Card C1[n], C2[n];
    for(int i = 0; i < n; i++){
        cin >> C1[i].suit >> C1[i].value;
        C2[i] = C1[i];
    }
    bubblesort(C1, n);
    selectionsort(C2, n);
    print(C1, n);
    cout << "Stable" << endl;
    print(C2, n);
    cout << check(C1, C2, n) << endl;
    return 0;
}



Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

vector<ll> V;

int N,K;
ll X[51],Y[51];
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	FOR(i,N) cin>>X[i]>>Y[i], V.push_back(X[i]);
	sort(ALL(V));
	ll mi=1LL<<62;
	FOR(j,V.size()) FOR(i,j+1) {
		ll W=V[j]-V[i];
		
		vector<ll> YS;
		FOR(x,N) if(V[i]<=X[x] && X[x]<=V[j]) YS.push_back(Y[x]);
		sort(ALL(YS));
		
		FOR(x,YS.size()) {
			if(x+K<=YS.size()) mi=min(mi,W*(YS[x+K-1]-YS[x]));
		}
		
		
	}
	cout<<mi<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num,init) vector<ll> name((num),(init));
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define mat(name,fnum,snum,init); vector<vector<ll>> name((fnum),vector<ll>((snum),(init)));
#define debugP int debug_point; cin>>debug_point;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(ll n){
	vector<T> Vector_temp;
	rep(i,n){
		T input;
		cin >> input;
		Vector_temp.emplace_back(input);
	}
	return Vector_temp;
}
ll gcd(ll c,ll b){
    while(1){
        if(c%b!=0){
        ll tmp=b;
        b=c%b;
        c=tmp;
        }else{
            return b;
        }
    }
}
/* <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3*/

void dfs(ll d){

}


int main(){
    ll n,m;
    cin>>n>>m;
    vec(a,m,0);
    vec(b,m,0);
    vec(c,200001,0);
    rep(i,m){
        cin>>a[i]>>b[i];
        if(a[i]==1){
            if(c[b[i]]){
                op("POSSIBLE");
                return 0;
            }else{
                c[b[i]]++;
            }
        }else if(b[i]==n){
            if(c[a[i]]){
                op("POSSIBLE");
                return 0;
            }else{
                c[a[i]]++;
            }
        }
    }
    op("IMPOSSIBLE");
    return 0;
}

Measured memory_bytes: 4992
#!/usr/bin/env python3
#EDPC P

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
graph = [[] for _ in range(n)]
for _ in range(n-1):
    x,y = LI()
    graph[x-1].append(y-1)
    graph[y-1].append(x-1)

dp = [[1,1] for _ in range(n)]
flg = [0]*n
def f(v):
    flg[v] = 1
    for u in graph[v]:
        if flg[u]:
            continue
        f(u)
        dp[v][0] *= (dp[u][0]+dp[u][1])
        dp[v][0] %= mod
        dp[v][1] *= dp[u][0]
        dp[v][1] %= mod

f(0)
ans = (dp[0][0] + dp[0][1]) % mod
print(ans)


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

int main() {
  int X, N;
  cin >> X >> N;
  vector<int> p(N);
  rep(i, N) cin >> p[i];

  vector<bool> isValid(102, true);
  rep(i, N) {
    isValid[p[i]] = false;
  }

  int ans;
  int tmp = 1000;
  rep(i, 102) {
    if (isValid[i] && abs(X - i) < tmp) {
      ans = i;
      tmp = abs(X - i);
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;

typedef long long ll;

vector<pair<ll, ll> > v;
ll dp[2222][2222], n;

int main(void)
{
	ll a, i, j;

	scanf("%lld", &n);
	for (i = 1; i <= n; i++)
	{
		scanf("%lld", &a);
		v.push_back(make_pair(a, i));
	}

	sort(v.begin(), v.end(), greater<>());

	for (i = 1; i <= n; i++)
		for (j = i; j >= 1; j--)
		{
			ll cnt = j - 1 + n - i;
			dp[j][i] = max(dp[j + 1][i] + v[cnt].first * abs(v[cnt].second - j), dp[j][i - 1] + v[cnt].first * abs(v[cnt].second - i));
		}

	printf("%lld", dp[1][n]);
	return 0;
}


Measured memory_bytes: 26592
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define cs const 
#define fr first 
#define se second
#define ls (now<<1)
#define rs (now<<1|1)
#define mid ((l+r)>>1)
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define low(i) (i&(-i))
#define par pair<int,int>
#define cn(x) memset(x, 0, sizeof(x))
#define rep(i, x, y) for(int i=x; i<=y; ++i)
#define sep(i, x, y) for(int i=x; i>=y; --i)
#define fore(i, x) for(int i=fir[x]; i; i=nex[i])

cs int G = 3;
cs int ff = 2e6 + 1;
cs int inf = 1e9 + 1;
cs int base = 2333;
cs int mod = 1e9 + 7;

int n, fa[ff], m, x, y, mx, va[ff];
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
void merge(int x, int y)
{
	x = find(x); y = find(y);
	if(x != y) fa[x] = y, va[y] += va[x];
}
signed main()
{
	cin >> n >> m;
	rep(i, 1, n) fa[i] = i, va[i] = 1;
	rep(i, 1, m) cin >> x >> y, merge(x, y);
	rep(i, 1, n) mx = max(mx, va[i]);
	cout << mx;
}

Measured memory_bytes: 6764
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数 __builtin_popcount bitの個数

int main() {
  ld T, X;
  ci(T, X);
  sp(10);
  co(T / X);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A,*B;

  int C[VMAX+1];
  int n,i,j;
  scanf("%d",&n);

  A = malloc(sizeof(short)*n + 1);
  B = malloc(sizeof(short)*n + 1);
  
  for(i=0;i<=VMAX;i++) C[i] = 0;
  
  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  
  for(i=1;i<=VMAX;i++) C[i] = C[i]+C[i-1];
  
  for(j=1;j<=n;j++){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  
  for(i=1;i<=n;i++){
    if(i>1) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");

  free(A);  
  free(B);

  return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int cal(string x, string y)
{
  int n1 = x.size(), n2 = y.size();
  vector<vector<int> > dp(n1 + 5, vector<int>(n2 + 5, 0));
  for (int i = 0; i < n1; ++i) {
    for (int j = 0; j < n2; ++j) {
      if (x[i] == y[j]) {
        dp[i + 1][j + 1] = dp[i][j] + 1;
      }
      else {
        dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
      }
    }
  }
  return dp[n1][n2];
}

int main()
{
  int n = 0;
  fscanf(stdin, "%d", &n);
  for (int i = 0; i < n; ++i) {
    string x, y;
    cin >> x >> y;
    int len = cal(x, y);
    fprintf(stdout, "%d\n", len);
  }
  return 0;
}

Measured memory_bytes: 5068
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

std::string N;
LL ans;

int main()
{
	in >> N;
	rep(i, N.length() - 1)
	{
		if (N[i + 1] != '9')
		{
			--N[i];
			for (int j = i + 1; j < N.length(); ++j)N[j] = '9';
			break;
		}
	}
	for (auto c : N) ans += c - '0';
	out << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
/*
...........__________                                                                           ___  __
.............|       |                                                                           |   /
.............|       |                                                                           |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
...........__|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
const int inf=1e18;const int mod=1e9+7;const int N=2e5+9;
void read_And_write(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}

void raushan_kumar(){
    int d=0,e=0,f=0,g=0,p=0,w=0,flag=0,ans=0,res=0,cnt=0,sum=0;double f1=0.0,f2=0.0,f3=0.0;
    int n;cin>>n;cout<<2*3.14*n;
}

int32_t main()
{
    read_And_write();fast;int t=1;
    // cin>>t;
    while(t--){raushan_kumar();}
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define vi vector <int>
#define vp vector <pair<int,int>>
#define f(x,y,z) for(x=y;x<z;x++)
#define pb push_back
#define mp make_pair
#define ld long double
#define fb(x,y,z) for(x=y;x>z;x--)
#define pqf priority_queue <int,vector <int>> 
#define pqb priority_queue <int,vector <int>,greater<int>> 
#define ps(x,y) fixed << setprecision(y) << x
#define PI 3.1415926535
#define mod 1000000007 
#define mods 998244353 
#define setbits(x) __builtin_popcountll(x)
#define all(x) (x).begin(), (x).end()
#define fill(a) memset(a,0,sizeof(a))


// AUTHOR ALOK KUMAR
int lcm(int a,int b)
{
    return (a*b)/(__gcd(a,b));
}
int power(int a,int b)
{
    int c=1;
    while(b)
    {
        if(b&1)
        c*=a;
        a*=a;
        b/=2;
    }
    return c;
}
void solve()
{
  int n;
  cin>>n;
  string s[n];
   int i,j,k1,k2,k;
  f(i,0,n)
    cin>>s[i];
 
  int count[4]={0};
  f(i,0,n)
  {
    if(s[i]=="AC")
      count[0]++;
    else if(s[i]=="WA")
      count[1]++;
    else if(s[i]=="TLE")
      count[2]++;
    else
      count[3]++;
    
  }
  cout<<"AC x "<<count[0]<<"\n"<<"WA x "<<count[1]<<"\n"<<"TLE x "<<count[2]<<"\n"<<"RE x "<<count[3]<<"\n";
    
}



int32_t main()
{
    IOS
    int t=1;
    //cin>>t;
    while(t--)
    solve();
    return 0;
}
































Measured memory_bytes: 6792
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define ld long double
typedef pair<ll,ll> pll;
typedef pair<pll,pll> ppll;
typedef vector <pll> vi;
#define out(x) return cout<<x,0;
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define lc(n) 2*n+1
#define rc(n) 2*n+2
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

int main() {
    FAST;
    ll i, n, k, m, x = 0, y = 0, t, z = 0, ans = 0, j, c = 0;
    cin >> n >> m ;
    if ( n > m ) swap(n , m);
    for ( i = 0 ; i < m ; i ++ )
    	cout << n;
}

Measured memory_bytes: 256