akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


void dfs(vector<vector<int>>& G, vector<int>& count, vector<int>& ans,
         int sum, int pos, int par)
{
    ans[pos] = sum + count[pos];
    for(auto v: G[pos]){
        if(v != par) dfs(G, count, ans, ans[pos], v, pos);
    }
}

int main()
{
    int N, Q;
    cin >> N >> Q;
    vector<vector<int>> G(N, vector<int>());
    for(int i = 0; i < N-1; ++i){
        int a, b;
        cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<int> count(N, 0);
    for(int i = 0; i < Q; ++i){
        int p, x;
        cin >> p >> x;
        --p;
        count[p] += x;
    }

    vector<int> ans(N, 0);
    dfs(G, count, ans, 0, 0, 0);

    for(int i = 0; i < N; ++i) cout << ans[i] << " ";
    cout << endl;

    return 0;
}

Measured memory_bytes: 30464
X, Y = map(int, input().split())

tsuru = ((Y - 2 * X) / 2)
kame = ((4 * X - Y) / 2)

if tsuru >= 0 and tsuru.is_integer() and kame >= 0 and kame.is_integer():
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9172
#include<stdio.h>
    int main()
    {
    	int N;
    	long a[1000];
    	while(scanf("%d",&N)!=EOF)
    	{
    		int i=0,j=0;
    		for(i=0;i<N;i++)
    			scanf("%ld",&a[i]);
    		
    		int max=0;
    		int min=0;
    		int c[10]={0};
    		for(i=0;i<N;i++)
    		{
    			if(a[i]>=1&&a[i]<=399) 	c[0]=1;
    			else if(a[i]>=400&&a[i]<=799) c[1]=1;
    			else if(a[i]>=800&&a[i]<=1199) c[2]=1;
    			else if(a[i]>=1200&&a[i]<=1599) c[3]=1;
    			else if(a[i]>=1600&&a[i]<=1999) c[4]=1;
    			else if(a[i]>=2000&&a[i]<=2399) c[5]=1;
    			else if(a[i]>=2400&&a[i]<=2799) c[6]=1;
    			else if(a[i]>=2800&&a[i]<=3199)	c[7]=1;
    			else max++;
    			
    		}
    		for(i=0;i<10;i++)
    		{
    			if(c[i]!=0)
    				min+=c[i];
    		}
   			max+=min;
   			if(min==0)
    			min=1;
    		printf("%d %d\n",min,max);
    	}
    	return 0;	
    }

Measured memory_bytes: 128
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a:number[]=[];for(let i=0;i<arg;i++) {a.push(t.n());}return a;}else{const a = t.input[0];t.input.shift();return Number(a);}},s:(arg:number=0):any=>{if(arg){const a:string[]=[];for(let i=0;i<arg;i++){a.push(t.s());}return a;}else{const a=t.input[0];t.input.shift();return String(a);}},c:(arg:number=0):any=>{if(arg) {const a:string[]=[];for(let i=0;i<arg;i++) {a.push(t.c());}return a;}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('');}else{t.input.shift();}return String(b);}},o: (...arg)=>{console.log(...arg);},abs:(a)=>{return Math.abs(a);},min:(...a)=>{return Math.min(...a);},max:(...a)=>{return Math.max(...a);},floor:(a)=>{return Math.floor(a);},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b});},desc:(ar:number[])=>{ return ar.sort((a,b)=>{return b-a});},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1]}return arr[arr.length-1];}}
const main = ()=>{
  let [a,b,c] = t.n(3)
  t.o(t.min(a+b,b+c,a+c))
}
main()

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int P = 1e9 + 7;
inline int add(int a, int b) {if((a += b) >= P) a -= P; return a;}
inline int sub(int a, int b) {if((a -= b) < 0) a += P; return a;}
inline int mul(int a, int b) {return 1ll * a * b % P;}
inline int kpow(int a, int b) {int r=1;for(;b;b>>=1,a=mul(a,a)) {if(b&1)r=mul(r,a);}return r;}
//----
int n, m;
int main(){
	scanf("%d%d", &n, &m);
	ll ans = 0;
	ans += 1ll * (n / m) * (n / m) * (n / m);
	if(m % 2 == 0) {
		int t = n / m + (n % m >= m / 2);
		ans += 1ll * t * t * t;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main() {
    cin>>N>>A>>B;
    vec v(N);
    rep(i,N) cin>>v[i];
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    long double ans = 0;
    rep(i,A) ans += v[i];
    long double div = A;
    cout<<fixed<<setprecision(10)<<ans / div<<endl;
    //まずA個選ぶ時の重複
    ll sameV = 0;
    rep(i,N) sameV += v[i] == v[A-1];
    ll num_dif = 0;
    rep(i,A) num_dif += v[i] != v[A-1];
    vec nCm(sameV + 1,1); //sameV C iの値
    reps(i, 1, sameV + 1){
        nCm[i] = ((nCm[i-1] * (sameV - i + 1)) / i);
    }
    ll out = nCm.at(A - num_dif);
    //A個より多く選べる場合
    if(v[0] == v[A-1]){
        reps(i, A, B){
            if(v[i] != v[A-1]) break;
            out += nCm.at(i + 1);
            //cout<<i+1<<' '<<nCm.at(i+1)<<endl;
        }
    }
    cout<<out<<endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var r, g, b, n int
	fmt.Scan(&r, &g, &b, &n)

	ans := 0
	for x := 0; x <= n; x++ {
		for y := 0; y <= n; y++ {
			cal := n - (r*x + g*y)
			if cal >= 0 && cal%b == 0 {
				ans++
			}
		}
	}

	fmt.Print(ans)
}


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

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

    vector<long long> Lucas(N + 1);
    Lucas.at(0) = 2;
    Lucas.at(1) = 1;
    for (int i = 2; i <= N; i++) {
        Lucas.at(i) = Lucas.at(i - 1) + Lucas.at(i - 2);
    }

    cout << Lucas.at(N) << endl;
}

Measured memory_bytes: 256
n = int(input())
adj = [[] for _ in range(n)]
adj_dict = dict()

for i in range(n - 1):
    a, b = [int(x) - 1 for x in input().split()]
    adj[a].append(b)
    adj[b].append(a)
    if a > b:
        adj_dict[(b, a)] = i
    else:
        adj_dict[(a, b)] = i

m = int(input())
uv = []
for _ in range(m):
    uv.append([int(x) - 1 for x in input().split()])

def dfs(p, v, dest):
    if v == dest:
        return [v]
    if p != -1 and len(adj[v]) == 1:
        return False
    for nv in adj[v]:
        if nv == p:
            continue
        ret = dfs(v, nv, dest)
        if ret:
            return ret + [v]
    return False

edgest = [0] * (2 ** m)
for i, (u, v) in enumerate(uv):
    ret = dfs(-1, u, v)
    for uu, vv in zip(ret, ret[1:]):
        if uu > vv:
            uu, vv = vv, uu
        if (uu, vv) in adj_dict:
            edgest[1 << i] |= (1 << adj_dict[(uu, vv)])

for i in range(1, 2 ** m):
    lsb = i & (-i)
    edgest[i] = edgest[i ^ lsb] | edgest[lsb]

dp = [0] * (2 ** m)
dp[0] = 1 << (n - 1)
ans = dp[0]
for i in range(1, 2 ** m):
    lsb = i & (-i)
    lim = bin(edgest[i] ^ edgest[i ^ lsb]).count('1')
    dp[i] = dp[i ^ lsb] >> lim
    if bin(i).count('1') % 2 == 0:
        ans += dp[i]
    else:
        ans -= dp[i]
print(ans)

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

using namespace std;

int main(){

	double n;
	while(cin>>n){
		double nums[11];
		double sum=n;
		nums[0]=n;
		for(int i = 1; i < 10; i++){
			if(i%2)
				nums[i]=nums[i-1]*2;
			else
				nums[i]=nums[i-1]/3;
			sum+=nums[i];
		}
		printf("%.6f\n",sum);
	}

	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;


int main(){
  char c; cin >> c;
  if(c-'a'<=25 && c-'a'>=0) cout << 'a' << endl;
  else cout << 'A' << endl;
}


Measured memory_bytes: 3592
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

bool check(string s){
    rep(i,0,s.size())if(s[i]!=s[0])return false;
    return true;
}

int main (){
    vector<bool> al(26);
    string ss;cin>>ss;
    if(check(ss)){
        cout<<0<<endl;
        return 0;
    }
    rep(i,0,ss.size())al[ss[i]-'a']=true;
    int ans=1000000;
    rep(lp,0,26){
        if(!al[lp])continue;
        string s=ss;
        int ct=0;
        while(1){
            ct++;
            string temp;
            rep(i,0,s.size()-1){
                if(s[i]=='a'+lp || s[i+1]=='a'+lp)temp.push_back('a'+lp);
                else temp.push_back(s[i]);
            }
            if(check(temp)){
                ans=min(ans,ct);
                break;
            }
            else s=temp;
        }
    }
    cout<<ans<<endl;
}

/*

*/


Measured memory_bytes: 256
#include <iostream>

#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

#include <cmath>
#include <algorithm>

#include <fstream>

using namespace std;

#define M_PI 3.14159265358979323846264338327950288


int main()
{
  srand(179179);

  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  cout.setf(ios_base::fixed);
  cout.precision(28);

  string S;
  cin >> S;
  map<char, int> m;
  for (auto& x : S) {
    ++m[x];
  }
  if (m.size() == 4 || (m.size() == 2 && (m['S'] > 0 && m['N'] > 0 || m['E'] > 0 && m['W'] > 0))) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  return 0;
}

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

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> P;
    for(int i = 0; i < n; i++){
        int p;
        cin >> p;
        P.push_back(p);
    }
    int ans = 0;
    sort(P.begin(), P.end());
    for(int i = 0; i < k; i++){
        ans += P[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3156
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
int n,a[200005];
inline bool check(int k){
	if(a[n-1]<=k&&a[n]<=k)return 1;
	if(a[n]<=k&&a[n+1]<=k)return 1;
	if(a[n-1]>k&&a[n]>k)return 0;
	if(a[n]>k&&a[n+1]>k)return 0;
	for(int i=1;i<n-1;i++){
		if(a[n+i]<=k&&a[n+i+1]<=k)return 1;
		if(a[n-i]<=k&&a[n-i-1]<=k)return 1;
		if(a[n+i]>k&&a[n+i+1]>k)return 0;
		if(a[n-i]>k&&a[n-i-1]>k)return 0;
	}
	return (a[1]<=k);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<n<<1;i++)scanf("%d",a+i);
	int l=1,r=(n<<1)-1;
	for(int mid=n;l<r;mid=l+r>>1)
		if(check(mid))r=mid;
		else l=mid+1;
	printf("%d",l);
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
 
using namespace std;
 
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
 
#define equal equalll
#define less lesss
#define matr vector<vector<int>>

int main() {
	// freopen("input.txt", "r", stdin);
	int n;
	scanf("%d", &n);
	vector<int>a(n);
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		--a[i];
	}
	for (int i = 0; i < n; i++) if (a[a[i]] == i) ++cnt;
	cout << cnt / 2 << endl;
}

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

#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define Rep0(i, n) for (int i = 0; i <= n; i ++)
#define RepG(i, x) for (int i = head[x]; i; i = edge[i].next)

using namespace std;

typedef long long LL;
const int N = 100010;

LL r[N], a[N], b[N], z[N];
int main()
{
	LL x, k;
	scanf("%lld%lld", &x, &k);
	a[0] = 0, b[0] = x;
	Rep(i, k) {
		scanf("%lld", &r[i]);
		LL tmp = r[i] - r[i - 1];
		a[i] = a[i - 1], b[i] = b[i - 1], z[i] = z[i - 1];
		if (i & 1) {
			if (z[i] >= tmp) z[i] -= tmp;
			else if (tmp <= b[i] - a[i] + z[i])
				a[i] += tmp - z[i], z[i] = 0; 
			else z[i] = 0, a[i] = 0, b[i] = 0;
		}
		else {
			if (z[i] + b[i] - a[i] + tmp <= x) z[i] += tmp;
			else if (z[i] + tmp <= x)
				z[i] += tmp, b[i] -= z[i] + b[i] - a[i] - x;
			else z[i] = x, a[i] = 0, b[i] = 0;
		}
		//printf("%lld %lld %lld\n", a[i], b[i], z[i]);
	}
	int q;
	scanf("%d", &q);
	Rep(i, q) {
		LL a0, t0;
		scanf("%lld%lld", &t0, &a0);
		LL tmp = (upper_bound(r + 1, r + 1 + k, t0) - r) - 1;
		LL ans;
		if (a0 <= a[tmp]) ans = z[tmp];
		else if (a0 <= b[tmp]) ans = z[tmp] + a0 - a[tmp];
		else ans = z[tmp] + b[tmp] - a[tmp];
		LL tx = t0 - r[tmp];
		if ((tmp + 1) & 1) ans = max(0ll, ans - tx);
		else ans = min(x, ans + tx);
		
		printf("%lld\n", ans);
	}
	
	return 0;
}
/*
50 3
9 35 67
1
92 28
38

*/

Measured memory_bytes: 4224
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxn 100010
using namespace std;
typedef long long ll;
ll read()
{
    ll x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,m;
ll K;
int a[maxn],d[maxn],vis[maxn],id[maxn];
int p[maxn],top;
ll ans[maxn];
int main()
{
    n=read();
    for(int i=1;i<=n;i++)  a[i]=read();
    for(int i=1;i<=n;i++)  d[i]=a[i]-a[i-1];
    for(int i=1;i<=n;i++)  id[i]=i;
    m=read();K=read();
    for(int i=1;i<=m;i++)
    {
        int x=read();
        swap(id[x],id[x+1]);
    }
    for(int i=1;i<=n;i++)
    {
        if(!vis[i])
        {
            top=0;
            for(int j=i;!vis[j];j=id[j])  vis[j]=1,p[++top]=j;
            for(int j=1;j<=top;j++)  ans[p[j]]=d[p[(K+j-1)%top+1]];
        }
    }
    for(int i=1;i<=n;i++)  ans[i]+=ans[i-1];
    for(int i=1;i<=n;i++)  printf("%lld\n",ans[i]);
    puts("");
    return 0;
}

Measured memory_bytes: 3968
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
int n, x, d, a[200], ans = 0;

int main()
{
	scanf("%d %d %d", &n, &d, &x);
	for(int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
		int cnt = 1;
		while(a[i] * cnt + 1 <= d)
		{
			ans++;
			cnt++;
		}
		ans += 1;
	}
	printf("%d\n", ans + x);
	return 0;
}

Measured memory_bytes: 256
'''
研究室PCでの解答
'''
import math
#import numpy as np
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7 #998244353
dir = [(-1,0),(1,0),(0,-1),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"


def main():
    n,m = map(int,ipt().split())

    way = [[] for i in range(n+1)]
    gway = [[] for i in range(n+1)]
    rway = [[] for i in range(n+1)]
    for i in range(m):
        a,b,c = map(int,ipt().split())
        way[a].append((b,-c))
        rway[b].append(a)
        gway[a].append(b)

    ar = [True]*(n+1)
    ar[n] = False
    q = [n]
    while q:
        qi = q.pop()
        for j in rway[qi]:
            if ar[j]:
                ar[j] = False
                q.append(j)
    q = [1]
    ar2 = [True]*(n+1)
    ar2[1] = False
    while q:
        qi = q.pop()
        for j in gway[qi]:
            if ar2[j]:
                ar2[j] = False
                q.append(j)

    for i in range(1,n+1):
        if ar[i] or ar2[i]:
            way[i] = []

    def bellmanford(s,g,way):
        n = len(way)
        d = [10**18]*(n)
        d[s] = 0
        sl = 0
        re = True
        while re:
            re = False
            for i in range(1,n):
                for j,cj in way[i]:
                    if d[j] > d[i]+cj:
                         d[j] = d[i]+cj
                         re = True
            sl += 1
            if sl == n:
                d[g] = -10**18
                break
        return d[g]

    ans = bellmanford(1,n,way)
    if ans == -10**18:
        print("inf")
    else:
        print(-ans)

    return None

if __name__ == '__main__':
    main()


Measured memory_bytes: 76792
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){

	int w,n,left,right;
	scanf("%d",&w);
	int array[w+1];
	for(int i=0;i<w+1;i++)array[i]=i;
	scanf("%d",&n);

	for(int i=0;i<n;i++){
		scanf("%d,%d",&left,&right);
		swap(array[left],array[right]);
	}

	for(int i=1;i<=w;i++){
		printf("%d\n",array[i]);
	}

    return 0;
}

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

int lcs(string X, string Y) {
    int m = X.length();
    int n = Y.length();
    X = ' ' + X;
    Y = ' ' + Y;
    vector<vector<int>> dp(2000 + 1, vector<int>(2000 + 1, 0));

    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= n; j++) {
            if (X[i] == Y[j]) {
                dp[i][j] = dp[i - 1][j - 1] + 1;
            } else {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }

    return dp[m][n];
}

int main() {
    int q;
    cin >> q;
    for (int t = 0; t < q; t++) {
        string X, Y;
        cin >> X >> Y;
        cout << lcs(X, Y) << endl;
    }

    return 0;
}


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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

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

int main(){
	int a, b, k;
	bool cnt = true;
	
	cin >> a >> b >> k;

	rep(i, k){
		if(cnt){
			if(a % 2)	a--;
			b += (a / 2);
			a -= (a / 2);
			cnt = false;
		}else{
			if(b % 2)	b--;
			a += (b / 2);
			b -= (b / 2);
			cnt = true;
		}	
	}

	cout << a << " " << b << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int_fast64_t read(){int_fast64_t x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
inline string read_s(){string s="";char c=getchar();while(c<'!'||c>'~'){c=getchar();}while(c>='!'&&c<='~'){s+=c;c=getchar();}return s;}
void Main(){
    int A = read(), B = read();
    if (A%2 && B%2) printf("Yes\n");
    else printf("No\n");
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

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

int main(){
  ll k,a,b,c;
  cin >>  a >> b >> c>>k;
  if(k%2==0)cout<<a-b<<endl;
  else cout<<b-a<<endl;
}

Measured memory_bytes: 256
/*
 * test.cpp
 *
 *
 *      Author: Fireworks
 */

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<cmath>
#include<bitset>
#include<set>
#include<iomanip>
#include<fstream>
#include<bitset>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<list>
#include<sstream>

using namespace std;

typedef pair<int,int> ii;
typedef pair<int,long long> il;
typedef pair<long long,long long> ll;
typedef pair<ll,int> lli;
typedef pair<long long,int> li;
typedef pair<double,double> dd;
typedef pair<ii,int> iii;
typedef pair<int,ii> iii2;
typedef pair<double,int> di;
typedef pair<ii,ii> iiii;
long long mod = 1000000007LL;
long long base = 37;
long long large = 1000000000000000000LL;


vector<int> addv,maxi;

int ul,ur,uv;

void build(int o,int l,int r){
	if(l==r){
		addv[o] = -1000000000;
		maxi[o]=addv[o];
	}else{
		int m = (l+r)/2;
		build(o*2,l,m);
		build(o*2+1,m+1,r);
		maxi[o]=max(maxi[o*2],maxi[o*2+1]);
	}
}
void update(int o,int l,int r){
	if(ul<=l&&ur>=r){
		addv[o]+=uv;
		if(l==r) maxi[o]=addv[o];
		else maxi[o]=max(maxi[o*2],maxi[o*2+1])+addv[o];
	}else{
		int m = (l+r)/2;
		if(ul<=m) update(o*2,l,m);
		if(ur>m) update(o*2+1,m+1,r);
		maxi[o]=max(maxi[o*2],maxi[o*2+1]);
		maxi[o]+=addv[o];
	}
}

int ql,qr,re;

void query(int o,int l,int r,int add){
	if(qr<ql) return ;
	if(ql<=l&&qr>=r){
		re=max(re,maxi[o]+add);
	}else{
		int m = (l+r)/2;
		if(ql<=m) query(o*2,l,m,add+addv[o]);
		if(qr>m) query(o*2+1,m+1,r,add+addv[o]);
	}
}

int main(){
	int n,m;
	cin>>n>>m;
	vector<ii> e;
	for(int i=0;i<n;i++){
		int x,y;
		cin>>x>>y;
		e.push_back(ii(x,y));
	}
	sort(e.begin(),e.end());
	addv.assign(4*m+20,0);
	maxi.assign(4*m+20,-1000000000);
	build(1,0,m+1);
	int ans = 0;
	for(int i=0;i<n;i++){
		int s = e[i].first;
		int t = e[i].second;
		ql=qr=t;
		re=-1000000000;
		query(1,0,m+1,0);
		if(re<-100000000){
			ul=ur=t;
			uv=1000000000-(m+1-t);
			update(1,0,m+1);
		}
		ul=0;
		ur=t;
		uv=1;
		update(1,0,m+1);

		ql=s+1;
		qr=t;
		re=-1000000000;
		query(1,0,m+1,0);
		ans=max(ans,re-s);
	}
	//cout<<ans<<endl;
	int maxs = 0;
	int mint = m+1;
	for(int i=0;i<n;i++){
		maxs=max(maxs,e[i].first);
		mint=min(mint,e[i].second);
	}
	if(maxs+1>=mint){
		ans=max(ans,n-m);
	}else{
		ans=max(ans,n-(maxs+m+1-mint));
	}
	cout<<ans<<endl;




	/*int totalcase;
	int testcase=0;
	cin>>totalcase;
	ofstream out;
	out.open("result.txt");

	while(totalcase--){
		testcase++;
		out<<"Case #"<<testcase<<": ";
		cout<<testcase<<": "<<endl;

		//GOGOGO


		//END
	}
	out.close();*/

	return 0;
}


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

int main() {
  double A, B, H, M;
  cin >> A >> B >> H >> M;
  static const double pi = 3.141592653589793;
  
  double rad = 2 * pi * (H / 12.0 + M / 60.0 / 12.0 - M / 60.0);
  
  double C = sqrt(A * A + B * B - 2 * A * B * cos(rad));
  cout << fixed << setprecision(10);
  cout << C << endl;
}



Measured memory_bytes: 4160
h,w=map(int,input().split())
C=[list(map(int,input().split())) for i in range(10)]
A=[list(map(int,input().split())) for j in range(h)]
for k in range(10):
    for i in range(10):
        for j in range(10):
            C[i][j]=min(C[i][j],C[i][k]+C[k][j])
cost=[C[i][1] for i in range(10)]
cnt=0
for i in range(h):
    for j in range(w):
        add=A[i][j]
        if add!=-1:
            cnt +=cost[add]
print(cnt)

Measured memory_bytes: 3444
#include <cstdio>
#include <cstdlib>

int main(){
    int x,a,b;
    scanf("%d %d %d",&x,&a,&b);
    int da = abs(x - a);
    int db = abs(x - b);
    if(da < db){
        printf("A\n");
    }else if(da > db){
        printf("B\n");
    }

    return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
field = [list(input()) for _ in range(h)]

d = [[-1]*w for _ in range(h)]

directions = [[1, 0], [-1, 0], [0, 1], [0, -1]]

from collections import deque
que = deque([])
# スタート地点を追加する
que.append((0, 0))
d[0][0] = 0

while que:
    x, y = que.popleft()
    if x == h-1 and y == w-1:
        break
    for i in range(4):
        dx, dy = directions[i]
        nx = x + dx
        ny = y + dy
        if 0 <= nx < h and 0 <= ny < w and field[nx][ny] =='.' and d[nx][ny] == -1:
            que.append((nx, ny))
            d[nx][ny] = d[x][y] + 1   
            

if d[h-1][w-1] == -1:
    print(-1)
else:
    white = sum(field, []).count('.')
    print(white - (d[h-1][w-1] + 1))

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

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

  int ans = 0;
  char c = s[0];
  for (int i = 1; i < s.size(); ++i) {
    if (c != s[i]) ans++;
    c = s[i];
  }

  cout << ans << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int main(){
    int n; cin >> n;
    string s; cin >> s;
    int ans = 0;
    rep(pin, 1000){
        int p[3];
        p[0] = pin / 100;
        p[1] = (pin - p[0]*100) / 10;
        p[2] = pin % 10;
        int keta = 0;
        rep(i, n){
            if(p[keta] == s[i] - '0'){
                if(keta == 2){
                    ans++;
                    i = n;
                }else{
                    keta++;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
  int a, b, k;
  std::cin >> a >> b >> k;
  int count = 0;
  for (int i = std::min(a, b); i >= 1; i--) {
    if (a % i == 0 && b % i == 0) {
      count++;
      if (count == k)
        std::cout << i << std::endl;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n, k; cin >> n >> k;
    int now = 1;
    rep(i,n){
        if(now * 2 < now + k) now *= 2;
        else now += k;
    }
    cout << now << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
auto const INF = (ll)1e19;

int main(){
    double a,b,x;
    cin >> a >> b >> x;
    double h = x/(a*a);
    double x1 = 2*a*h/b;
    double x2 = 2*(b-h);
    double deg1 = asin(2*a*h/x1/sqrt(x1*x1+b*b))*180.0/(atan(1.0)*4.0);
    double deg2 = 90.0 - asin(2*a*(b-h)/x2/sqrt(x2*x2+a*a))*180.0/(atan(1.0)*4.0);
    cout << setprecision(10)<<fixed;
  	if (a*a*b == x){
    	cout << 0;
    }
  	else if(a*b/2.0>a*h){
    	cout << deg1;
    }else{
    	cout << deg2;
    }
    return 0;
}

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

double cross_prod(double x0, double y0, double x1, double y1) {
	return x0 * y1 - x1 * y0;
}

int main() {
	double x[4], y[4];
	while(cin >> x[0] >> y[0]) {
		for(int i = 1; i < 4; i++)
			cin >> x[i] >> y[i];
		double a, b;
		a = b = 0;
		for(int i = 0; i < 3; i++) {
			double tmp;
			tmp = cross_prod(x[i]-x[3], y[i]-y[3], x[(i+1)%3]-x[3], y[(i+1)%3]-y[3]);
			a += tmp;
			b += abs(tmp);
		}
		a = abs(a);
		if(abs(a-b) < 1e-7)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

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

int main(){
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> a(m);
    for(int i = 0;i < m;i++)cin >> a.at(i);
    int ans1 = 0, ans2 = 0;
    for(int i = 0;i < m;i++){
        if(a.at(i) <= x)ans1++;
        else ans2++;
    }
    cout << min(ans1, ans2) << endl;
}

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

// author: Seong Yong-ju ( @sei40kr )

#define DEBUG(x) cout << #x << ": " << x << endl

#define MIN(a, b) (a > b ? b : a)
#define MAX(a, b) (a > b ? a : b)

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); --i)

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i =  (n) - 1; i >= 0; --i)

#define ALL(a) (a).begin(), (a).end()

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  set<int> found;
  list<int> pairs;
  REP(i, n) {
    int a;
    scanf("%d", &a);
    const auto &ptr = found.find(a);
    if (ptr != found.end()) {
      found.erase(ptr);
      pairs.push_back(-a);
    } else {
      found.insert(a);
    }
  }

  pairs.sort();
  if (2 <= pairs.size()) {
    int a = pairs.front();
    pairs.pop_front();
    int b = pairs.front();
    cout << (long) a * b;
  } else {
    cout << 0;
  }

  cout << endl;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(int a) { 
	if(a==0){
		return "pairwise coprime";
	}
	if(a==1){
		return "setwise coprime";
	}else{
		return "not coprime";
	}
	 }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	int ans=0;
	cin >>n;
	V a(n);
	cin >> a;
	int some = 0;
	int total = n;
	//some > 2 at any n 1
	// some == n : INF
	vector<bool> tri(1000010, true),dis(1000010,false);
	rep(i,n){
		if(dis[a[i]] and a[i]!=1){
			ans = 1;
		}
		if(dis[a[i]]){
			total--;
		}
		dis[a[i]]=true;
	}
	tri[0] = false;
	tri[1] = false;
	for (int i = 2; i <= 1000000;i++){
		if(tri[i]==false){
			continue;
		}
		some = 0;
		for (int j = i; j<= 1000000;j+=i){
			tri[j] == false;
			if (dis[j]) {
				some++;
			}
		} 
		if(some==total){
			cout << solve(INF) << endl;
			return 0;
		}
		if(some >=2){
			ans = 1;
		}
	}
	 cout << solve(ans) << endl;
}
/*
篩
素因数分解(素数のみ)
n+ nloglog n
*/

Measured memory_bytes: 11344
#include<bits/stdc++.h>
using namespace std;
int main(){
string s,t;cin>>s>>t;
for(int i=0;i<t.size();i++){
cout<<s.at(i)<<t.at(i); 
}
if(s.size()>t.size()) cout<<s.at(s.size()-1)<<endl;
}


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

long long ans = 1e18;

void upd(const pair<int, int> &a, const pair<int, int> &b)
{
    int x = a.first - b.first, y = a.second - b.second;
    long long d = 1LL * x * x + 1LL * y * y;
    ans = min(ans, d);
}

void hoge(const vector<pair<int, int>> &as)
{
    int n = as.size();
    if (as.size() <= 1)
        return;
    vector<pair<int, int>> bs(as.begin(), as.begin() + n / 2), cs(as.begin() + n / 2, as.end());
    for (const auto &p : cs)
    {
        upd(bs.back(), p);
    }
    for (const auto &p : bs)
    {
        upd(p, cs.front());
    }
    hoge(bs);
    hoge(cs);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<pair<int, int>> as;
    for (int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        as.emplace_back(a, b);
    }
    sort(as.begin(), as.end());
    hoge(as);

    cout << ans << endl;
}


Measured memory_bytes: 14636
#include<iostream>
#include<climits>
using namespace std;
int main(){
  int n,data[101]; cin>>n;
  for(int i=0;i<n;++i) cin>>data[i]>>data[i+1];
  int dp[100][100]={};
  for(int num=2;num<=n;++num){
    for(int first=0;first<=n-num;++first){
      int end=first+num-1;
      dp[first][end]=INT_MAX/2;
      for(int i=first;i<=end;++i){
	if(dp[first][end]>dp[first][i]+dp[i+1][end]+data[first]*data[i+1]*data[end+1])
	  dp[first][end]=dp[first][i]+dp[i+1][end]+data[first]*data[i+1]*data[end+1];
      }
    }
  }
  cout<<dp[0][n-1]<<endl;
  return 0;
}



Measured memory_bytes: 3152
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#include <list> 
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll getDigit(ll n) {
	ll cnt = 0;
	while (n != 0) {
		n /= 10;
		cnt++;
	}
	return cnt;
}
typedef pair<double, long long> pair_t;
bool comp(const pair_t& a, const pair_t& b) {
	if (a.first == b.first)return  a.second > b.second;
	else {
		return a.first > b.first;
	}
}

int main() {
	ll n;
	cin >> n;
	vector<ll>a(n);
	rep(i, n)cin >> a[i];
	sort(all(a));
	a.push_back(-100);
	for (ll i = 0; i < n; i++) {
		if (a[i] == a[i + 1])return cout << "NO" << endl, 0;
	}
	cout << "YES" << endl;
} 


Measured memory_bytes: 4480
#include <iostream>

using namespace std;
typedef long long LL;

int n, k;
LL w[100000 + 10];


//模拟装货过程
bool check(LL P) {
	int cnt = k;
	for (int i = 0; i < n; ) {
		LL t = P;
		cnt--;
		// 卡车已经用完，证明卡车当前最大装载量不能装完货物
		if (cnt < 0)
			return false;
		while (i < n && t >= 0) {
			// 剩余重量可以装上当前货物
			if (t >= w[i])
				t -= w[i], i++;
			//装不下则用下一辆卡车去装
			if (t < w[i])
				break;
		}
	}
	return true;
}
// 二分找出P的最小值
LL BinarySearch(LL sum) {
	LL left = 0, right = sum;
	LL mid;
	while (left + 1 < right) {
		mid = (left + right) / 2;
		//可以装好货物
		if (check(mid))
			right = mid;
		else
			left = mid;
	}

	return right;
}

int main()
{
	LL sum = 0;

	cin >> n >> k;
	for (int i = 0; i < n; ++i)
	{
		cin >> w[i];
		sum += w[i];
	}
	
	LL P = BinarySearch(sum);
	cout << P << endl;

	return 0;
}


Measured memory_bytes: 3868
#pragma GCC optimize("O3")
/* #pragma GCC target ("avx2") */
/* #pragma GCC optimize("Ofast") */
/* #pragma GCC optimize("unroll-loops") */
/* #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T, typename cmp=less<T>>
using ordered_set=tree<T,null_type,cmp,rb_tree_tag,tree_order_statistics_node_update>;
template<typename K, typename V, typename cmp=less<K>>
using ordered_map=tree<K, V, cmp, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k) returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
using ll = long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax = 1000*1007;
#define ar array
#define len(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define tT template<typename T
#define tV typename V
#define ins inline string
#ifdef LOCAL
tT>ins to_string(T& t);
ins to_string(string s) {return '"' + s + '"';}
ins to_string(char c){string res="'";res.push_back(c);return res+"'";}
ins to_string(const char* s) {return to_string((string)s);}
ins to_string(char* s) {return to_string((string)s);}
template <size_t N>ins to_string(bitset<N> v) {string res="";for(size_t i = 0; i < N; i++){
res += static_cast<char>('0' + v[i]);}return res;}
ins to_string(bool b) {return (b ? "true" : "false");}
tT,tV>ins to_string(pair<T, V>& p){return "("+ to_string(p.first)+", "+to_string(p.second)+")";}
tT>ins to_string(T& v){string res="{";for(auto& i:v){res+=to_string(i)+',';} return res+'}';}
#define log(...) cerr<< "[" << #__VA_ARGS__ << " : "<< to_string(__VA_ARGS__) << "]"<<endl
#else
#define log(...) 0x30
#endif

int dp[1001][1001];
const int mod = 1e9+7;

int solve(const vector<vector<char>>& grid, int n, int w){
    if(n < 1 || w < 1 ) return 0;
    if(n==1 && w == 1) return 1;
    if(dp[n][w] != -1) return dp[n][w];
    int a = 0;
    int b = 0;
    if(grid[n-1][w] != '#') a = solve(grid, n-1, w);
    if(grid[n][w-1] != '#') b = solve(grid, n, w-1);
    return dp[n][w] = (a%mod+b%mod)%mod;
}

inline void test_case(){
    memset(dp, -1, sizeof dp);
    int h, w;
    cin>>h>>w;
    vector<vector<char>> grid(h+1, vector<char>(w+1));
    for(int i=1; i<=h; i++){
        for(int j=1; j<=w; j++){
            cin>>grid[i][j];
        }
    }
    cout<<solve(grid, h, w)<<"\n";
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    test_case();
}   



Measured memory_bytes: 5376
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define M (L+R)/2
#define N 500009
#define inf 99999999999
#define ll long long
#define mod 1000000007
#define sz size();
using namespace std;
ll a,b,c;
int main(){

	ios::sync_with_stdio(0);
	
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b<<endl;

	return 0;
}



Measured memory_bytes: 256
import java.util.*;

class Main{
  static int[] dy={1,0,-1,0};
  static int[] dx={0,1,0,-1};
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int h=sc.nextInt();
    int w=sc.nextInt();
    String[] a=new String[h];
    for(int i=0;i<h;i++){
      a[i]=sc.next();
    }
    Deque<C> dq=new ArrayDeque<>();
    int[][] d=new int[h][w];
    boolean[][] v=new boolean[h][w];
    int max=0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(a[i].charAt(j)=='.'){
//          System.err.println("["+i+":"+j+"]");
          dq.add(new C(j,i));
          d[i][j]=0;
          v[i][j]=true;
          while(!dq.isEmpty()){
            C here=dq.pollFirst();
            int hy=here.y;
            int hx=here.x;
//            System.err.println(hy+":"+hx);
            for(int k=0;k<4;k++){
              int nx=hx+dx[k];
              int ny=hy+dy[k];
              if(0<=nx&&nx<w&&0<=ny&&ny<h&&a[ny].charAt(nx)=='.'&&!v[ny][nx]){
                v[ny][nx]=true;
                d[ny][nx]=d[hy][hx]+1;
                max=Math.max(d[ny][nx],max);
                dq.add(new C(nx,ny));
              }
            }
          }
//          System.err.println(Arrays.deepToString(d));
          for(int k=0;k<h;k++){
            Arrays.fill(v[k],false);
          }
        }
      }
    }
    System.out.println(max);
  }
  static class C{
    int y;
    int x;
    C(int x,int y){
      this.x=x;
      this.y=y;
    }
  }
}

Measured memory_bytes: 25332
void main() {
  problem();
}

void problem() {
  const A = scan!ulong;
  const B = scan.split(".").to!(ulong[]);

  ulong solve() {
    const b100 = B[0] * 100 + (B.length == 1 ? 0 : B[1]);

    deb(A, b100);

    return A * b100 / 100;
  }

  solve().writeln;
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

// -----------------------------------------------


Measured memory_bytes: 2760
#include<stdio.h>
#include<string.h>
#define N 1000000

typedef struct pp
{
  int time;
  char name[100];
}P;

P Q[N];
  
int head,tail,n;


int min(int, int);


int main()
{
  int n,q,i,goukei=0;
  int sa;
  P nq;

  scanf("%d%d",&n,&q);

  for(i=0; i<n; i++)
    {
      scanf("%s",Q[i].name);
      scanf("%d",&Q[i].time);
    }

  
  head=0;
  tail=n;
  
  while(head!=tail)
    {
      sa = min(q,Q[head].time);

      if(q<Q[head].time)
	{
	  goukei += q;
	  Q[tail].time = Q[head].time-q;
	  strcpy(Q[tail].name,Q[head].name);
	  tail++;
	}
      else
	{
	  goukei += Q[head].time;
	  printf("%s %d\n",Q[head].name,goukei);
	}
      head++;
      
    }

  return 0;
}
      

  
int min(int a, int b)
{
  if(a<b) return a;
  else return b;
}




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

int main(void)
{
  int n,l;
  int i;
  vector<string> s;
  string v;
  
  cin >> n >> l;
  for(i=0; i<n; i++)
  {
    cin >> v;
    s.push_back(v);
  }
  sort(s.begin(), s.end());
  
  for(i=0; i<n; i++)
    cout << s[i];
  
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>

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

using namespace std;
typedef long long ll;

int main() {

    ll N;
    cin >> N;
    cout << N*N*N << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
typedef long long ll;
int main(){
    int N,K;
    cin>>N>>K;
    vector<int>A(N);
    map<int,int>ma;
    rep(i,N){
        cin>>A[i];
        ma[A[i]]++;
    }
    vector<pair<int,int>>pa(ma.size());
    int i=0;
    int size=ma.size();
    for(auto x:ma){
        //cout<<x.second<<" "<<x.first<<endl;
        pa[i]=make_pair(x.second,x.first);
        //cout<<i<<" "<<pa[i].first<<" "<<pa[i].second<<endl;
        //cout<<x.first<<" "<<x.second<<endl;
        i++;
    }
    sort(pa.begin(),pa.end());
    int kazu=0;
    rep(i,ma.size()){
        //cout<<i<<" "<<pa[i].first<<" "<<pa[i].second<<endl;
        if(size<=K){
            break;
        }
        kazu+=pa[i].first;
        size--;
    }
    cout<<kazu<<endl;
    
    return 0;
}

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

#define rep3(i, s, n ,a) for (int i = (s); i < (int)(n); i+=a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

int main(){
    string s, t;
    cin >> s >> t;
    t.pop_back();
    // if(s+t[t.size()-1]==t){
    //     cout << "Yes";
    // }else{
    //     cout << "No";
    // }
    if(s==t) cout << "Yes";
    else cout << "No";
    cout << endl;
    return 0;
}

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

int main(void){
    int a,b,c,d;
    scanf("%d %d",&a,&b);
    if(b/100!=0){
        c = 1000*a + b;
    }else if(b/10!=0){
        c = 100*a + b;
    }else if(b!=0){
        c = 10*a + b;
    }else{
        printf("Error");
    }
    d = (int)sqrt(c);
    if(d*d==c){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define P 1000000007
#define N 310
int n;
int f[N][N][N*2];
int d[N];
int F[N];
int IF[N];

void gcd(int a,int b,int &x,int &y) {
  if(b==0){x=1,y=0;return;}
  gcd(b,a%b,y,x),y-=a/b*x;
}
int inv(int n) {
  int x,y;gcd(n,P,x,y);
  if(x<0)x+=P;return x;
}

const int INV2 = inv(2);

int main() {
	F[0]=1;for(int i=1;i<N;i++)F[i]=(ll)F[i-1]*i%P;
	IF[N-1]=inv(F[N-1]);for(int i=N-1;i;i--)IF[i-1]=(ll)IF[i]*i%P;
	cin >> n;
	for (int i = 0; i < n; i ++) cin >> d[i];
	f[0][0][0] = 1;
	for (int i = 0; i < n; i ++)
		for (int j = 0; j <= i; j ++)
			for (int k = 0; k <= 2*n; k ++) if (f[i][j][k]) {
				f[i+1][j][k] = (f[i+1][j][k] + (ll)f[i][j][k]*IF[d[i]-1])%P;
				if (d[i] >= 2) f[i+1][j+1][k+d[i]-2] = (f[i+1][j+1][k+d[i]-2] + (ll)f[i][j][k]*IF[d[i]-2])%P;
			}
	int S = 0;
	for (int i = 3; i <= n; i ++)
		for (int j = 0; j <= 2*n; j ++) if (f[n][i][j]) {
			if (i < n && j == 0) continue;
			if (i == n && j == 0) {
				S = (S + (ll)f[n][i][j]*F[i-1]%P*INV2%P)%P;
				continue;
			}
			//printf ("%d %d %lld\n", i, j, (ll)f[n][i][j]);
			//printf ("%d %d %lld\n", i, j, (ll)f[n][i][j]*F[i-1]%P*INV2%P*F[j]%P*IF[j-1]%P*F[n-1-i]%P);
			S = (S + (ll)f[n][i][j]*F[i-1]%P*INV2%P*F[j]%P*IF[j-1]%P*F[n-1-i]%P)%P;
		}
	cout << S << endl;
	return 0;
}

Measured memory_bytes: 225536
#include<cstdio>
#include<algorithm>
using namespace std;
int n;
long long A, B, C, Mod = 1000003, F[1010000], InvF[1010000];
long long PA, PB;
long long Pow(long long a, long long b) {
	long long r = 1;
	while (b) {
		if (b & 1)r = r * a%Mod;
		a = a * a%Mod; b >>= 1;
	}
	return r;
}
long long Inv(long long a) {
	return Pow(a, Mod - 2);
}
long long Comb(int a, int b) {
	if (b < 0 || a < b)return 0;
	return F[a] * InvF[b] % Mod*InvF[a - b] % Mod;
}
long long Prob(int a, int b) {
	return Pow(PA, a)*Pow(PB, b) % Mod*Comb(a + b, a) % Mod;
}
void Solve(int x, int d, int n) {
	if (d == 0) {
		printf("%lld\n", Pow(x, n));
		return;
	}
	long long t = x * Inv(d)%Mod;
	if (t == 0 || t + n - 1 >= Mod) {
		puts("0");
		return;
	}
	printf("%lld\n", F[t + n - 1] * InvF[t - 1] % Mod * Pow(d, n) % Mod);
}
int main() {
	int i, Q;
	scanf("%d", &Q);
	int n, x, d;
	F[0] = 1;
	for (i = 1; i < Mod; i++)F[i] = F[i - 1] * i%Mod;
	InvF[Mod-1] = Inv(F[Mod-1]);
	for (i = Mod-1; i >= 1; i--)InvF[i - 1] = InvF[i] * i%Mod;

	while (Q--) {
		scanf("%d%d%d", &x, &d, &n);
		Solve(x, d, n);
	}
}

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

int main(){
    int i,j,k,N,b;
    int flg=0;
    vector<vector<int>>A(3,vector<int>(3)),ch(3,vector<int>(3));
    for(i=0;i<3;i++)for(j=0;j<3;j++)cin>>A[i][j];
    cin>>N;
    for(i=0;i<N;i++){
        cin>>b;
        for(j=0;j<3;j++)for(k=0;k<3;k++)if(A[j][k]==b)ch[j][k]=1;
    }

    for(i=0;i<3;i++){
        if(ch[i][0]+ch[i][1]+ch[i][2]==3)flg=1;
        if(ch[0][i]+ch[1][i]+ch[2][i]==3)flg=1;
    }
    if(ch[0][0]+ch[1][1]+ch[2][2]==3)flg=1;
    if(ch[0][2]+ch[1][1]+ch[2][0]==3)flg=1;

    if(flg==0)cout<<"No"<<endl;
    if(flg==1)cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))


for Z in range(X + 1, Y + 1):
  if (max(x) < Z and Z <= min(y)):
    print('No War')
    exit()
else:
  print('War')


Measured memory_bytes: 3060