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

int main(){
    int x;
    vector<int> xs;
    for(int i=0; i<3; i++){
        cin >> x;
        xs.push_back(x);
    }

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

    cout << xs[2] * 10 + xs[1] + xs [0] << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double r = sc.nextDouble();
		double a,b;

		a = r * r * 3.141592653589;
		b = 2 * r * 3.141592653589;
		System.out.println( String.format("%.6f",a) + " " +  String.format("%.6f",b));
	}

}


Measured memory_bytes: 28100
#include<iostream> 
using namespace std;
#define h 100100
 int t[h];
  	int main(){
        int n;
        cin>>n;
        int i=1;
    while(n --){
        cin>>t[i];
        i++; 	}
        int m; 
        cin>>m;
    while(m--){ 
        int p,x;
        cin>>p>>x;
        int c; 		
        c=t[p]; 		
        t[p]=x; 		
        int sum=0; 		
        for(int j=1;j<i;j++){
        sum+=t[j]; 		} 		
        cout<<sum<<endl; 		
        t[p]=c; 	}
        return 0; }


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;

vector<int> d{-2,-1,0,1,2};

vector<int> dx{1,0,-1,0};
vector<int> dy{0,1,0,-1};

vector<int> dx2{1,1,-1,-1};
vector<int> dy2{1,-1,-1,1};

int main() {
    int H,W; cin >> H >> W;
    pair<int,int> start, goal;
    cin >> start.first >> start.second;
    start.first++;
    start.second++;
    cin >> goal.first >> goal.second;
    goal.first++;
    goal.second++;

    vector<vector<char>> G(H+4, vector<char>(W+4,'#'));
    vector<vector<int>> dp(H+4, vector<int>(W+4,INF));
    REP(i,H){
        string s; cin >> s;
        REP(j,W){
            G[i+2][j+2] = s[j];
        }
    }

    deque<pair<int, pair<int,int>>> q;
    q.push_front({0, start});
    dp[start.first][start.second] = 0;

    while(!q.empty()){
    
        auto pos = q.front(); q.pop_front();
        int x = pos.second.first;
        int y = pos.second.second;
        int t = pos.first;
        //cout << x-1 << " " << y-1 << endl;


        if(t > dp[x][y]) continue;

        REP(i,4){//隣接
            if(G[x+dx[i]][y+dy[i]] == '.'){
                if(dp[x+dx[i]][y+dy[i]] > dp[x][y]){
                    dp[x+dx[i]][y+dy[i]] = dp[x][y];
                    q.push_front({dp[x+dx[i]][y+dy[i]], {x+dx[i],y+dy[i]}});
                }
            }
        }

        REP(i,4){//斜め
            if(G[x+dx2[i]][y+dy2[i]] == '.'){
                if(dp[x+dx2[i]][y+dy2[i]] > 1+dp[x][y]){
                    dp[x+dx2[i]][y+dy2[i]] = 1+dp[x][y];
                    q.push_back({dp[x+dx2[i]][y+dy2[i]], {x+dx2[i],y+dy2[i]}});
                }
            }
        }

        REP(i,5){
            REP(j,5){
                if(abs(d[i])!=2 && abs(d[j])!=2) continue;

                if(G[x+d[i]][y+d[j]] == '.'){
                    if(dp[x+d[i]][y+d[j]] > 1+dp[x][y]){
                        dp[x+d[i]][y+d[j]] = 1+dp[x][y];
                        q.push_back({dp[x+d[i]][y+d[j]], {x+d[i],y+d[j]}});
                    }
                }    
            }
        }
    }
    int ans = dp[goal.first][goal.second];
    cout << (ans==INF?-1:ans) << endl;

    return 0;
}

Measured memory_bytes: 8680
#include <stdio.h>

int main() {

  int i,k,n;
  int sum = 0;

  while(1) {
    sum = 0;
    scanf("%d",&k);
    if(k == 0) break;

    for(i=0;i<k*(k-1)/2;i++) {

      scanf("%d",&n);
      sum = sum + n;

    }

    printf("%d\n",sum/(k-1));

  }
  return 0;

}

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

using namespace std;

void solve()
{
	int N, M;
	cin >> N;
	multiset<int> ms;
	while(N--)
	{
		int d;
		cin >> d;
		ms.insert(d);
	}
	cin >> M;
	while(M--)
	{
		int t;
		cin >> t;
		if (ms.find(t) == ms.end())
		{
			cout << "NO" << endl;
			return;
		}
		ms.erase(ms.find(t));
	}
	cout << "YES" << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 9600
#!/usr/bin/env python3
from queue import Queue

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

while True:
    w, h = map(int, input().split())
    if w == 0:
        exit()
    wall = [list(map(int, input().split())) for _ in range(2 * h - 1)]

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

    q = Queue()
    q.put((0, 0))
    while not q.empty():
        sy, sx = q.get()
        for i in range(4):
            ty = sy + dy[i]
            tx = sx + dx[i]
            if tx < 0 or w - 1 < tx or ty < 0 or h - 1 < ty:
                continue
            if d[ty][tx] > 0:
                continue
            if wall[sy + ty][(sx + tx) // 2] == 1:
                continue

            d[ty][tx] = d[sy][sx] + 1
            q.put((ty, tx))

    print(d[-1][-1])



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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	int n;cin>>n;
	vi a(n);
	rep(i,n){
		cin>>a[i];
		a[i]--;
	}
	int ans=0;
	rep(i,n){
		if(a[a[i]]==i)ans++;
	}
	cout<<ans/2<<endl;
}

Measured memory_bytes: 640
using System;

namespace Volume0_0007
{
    class Program
    {
        static void Main(string[] args)
        {
            int week = Convert.ToInt32(Console.ReadLine());
            double debt = 100000;

            for(int i = 0; i < week;i++)
            {
                debt = debt + (debt * 0.05);
                debt = (Math.Ceiling(debt / 1000)) * 1000;
            }
            Console.WriteLine(debt);
        }
    }
}

Measured memory_bytes: 5672
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N, x = map(int, input().split())
A = list(map(int, input().split()))

A.sort()
ans = 0
for a in A:
    x -= a
    if x >= 0:
        ans += 1
    else:
        break
if x > 0 and ans:
    ans -= 1
print(ans)

Measured memory_bytes: 3060
sx,sy,tx,ty = map(int,input().split())
ans = ""
ans += "U" * (ty-sy)
ans += "R" * (tx-sx)
ans += "D" * (ty-sy)
ans += "L" * (tx-sx)
ans += "L"
ans += "U" * (ty-sy+1)
ans += "R" * (tx-sx+1)
ans += "D"
ans += "R"
ans += "D" * (ty-sy+1)
ans += "L" * (tx-sx+1)
ans += "U"
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

int main()
{
	char str[21];
	int len=0;
	
	scanf("%s",str);
	while(*(str+len))
	{
		len++;
	}
	while(len--)
	{
		putchar(*(str+len));
	}
	putchar('\n');
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
double const pi=acos(double(-1));
const int maxn = 2e5+100;
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    double a,b,h,m;
    cin>>a>>b>>h>>m;
	h=h*30+m*1.0/2;
    m=m*6;
    double ans=a*a+b*b-2*a*b*cos(fabs(h-m)*pi/180);
    printf("%.20lf",sqrt(ans));
	return 0;
}

Measured memory_bytes: 4152
#!/usr/bin/env python
n, k = map(int, input().split())
mod = 10**9+7

d = [-1 for _ in range(k+1)]
d[k] = 1 

for i in range(k-1, 0, -1):
    d[i] = pow(k//i, n, mod)
    j = 2*i 
    while j <= k:
        d[i] -= d[j]
        j += i

#print('d =', d)
ans = 0 
for i in range(1, k+1):
    ans += (i*d[i])%mod
print(ans%mod)


Measured memory_bytes: 11352
#include <bits/stdc++.h>
using namespace std;
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
int main() {
    int N;
    cin >> N;
    vector<i64> a(N);
    for(int i = 0; i < N; i++) {
        cin >> a[i];
    }
    i64 ans = 1e18;
    for(int b = 0; b < 2; b++) {
        i64 tmp = 0;
        i64 S = 0;
        for(int i = 0; i < N; i++) {
            S += a[i];
            if((b + i) & 1) {
                if(S >= 0) {
                    tmp += S + 1;
                    S = -1;
                }
            } else {
                if(S <= 0) {
                    tmp += 1 - S;
                    S = 1;
                }
            }
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
def Ii():return int(input())
def Mi():return map(int,input().split())
def Li():return list(map(int,input().split()))
n = Ii()
a = sorted(Li())

mx = 10**18
ans = 1
for i in a:
  
  ans *= i
  if ans > mx:
    ans = -1
    break
  elif ans == 0:
    break
    
print(ans)

Measured memory_bytes: 21528
#include<iostream>
#include<algorithm>
using namespace std;
string s;int n,dp[1<<19],l;
main()
{
	cin>>n>>s;s="0"+s;
	for(int i=3;i<s.size();i++)
	{
		dp[i]=dp[i-1];
		if(s.substr(i-2,3)=="101")
		{
			l=i;
			for(int j=i-2;j>0&&s[j]!='0';j--)
			{
				dp[i]=max(dp[i],dp[j-1]+i-j-1);
			}
		}
		else if(s[i]=='0')l=0;
		if(l)dp[i]=max(dp[i],dp[l-3]+i-l+1);
	}
	cout<<dp[n]<<endl;
}

Measured memory_bytes: 2840
from collections import deque

k=int(input())

a=[1,2,3,4,5,6,7,8,9]

b=deque(a)

while b:
  v=b.popleft()
  if v%10==0:
    f=v*10+1
    if f<=3234566667:
      
      b.append(f)
      a.append(f)
    g=v*10
    if g<=3234566667:
      b.append(g)
      a.append(g)
    
  elif v%10==9:
    f=v*10+8
    g=v*10+9
    if f<=3234566667:
      
      b.append(f)
      a.append(f)
    if g<=3234566667:
      b.append(g)
      a.append(g)
    
  else:
    f=v*10+(v%10)-1
    g=v*10+(v%10)
    h=v*10+(v%10)+1
    if f<=3234566667:
      b.append(f)
      a.append(f)
    if g<=3234566667:
      b.append(g)
      a.append(g)
    if h<=3234566667:
      b.append(h)
      a.append(h)
      
a.sort()

print(a[k-1])

Measured memory_bytes: 13964
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int a,b,c,d;
int main(){
	ios::sync_with_stdio(0);
	cin>>a>>b>>c>>d;
	int aa=(c+b-1)/b,bb=(a+d-1)/d;
	if(aa<=bb)
	cout<<"Yes";
	else
	cout<<"No";
	re 0;
}

Measured memory_bytes: 3640
#include <iostream>  
#include <vector>  
#include <map>  
#include <set>  
#include <string.h>  

using namespace std;
struct xy {  
    int first;  
    int second;  
};  
  
xy presets1[1000];  
xy input[1000];  

void solve()
{
	int n;  
    while (1) {  
        cin >> n;  
        if (n == 0) {  
            break;  
        }  
          
        memset(presets1 , 0 , sizeof(presets1));  
        memset(input , 0 , sizeof(input));  
        int m;  
        cin >> m;  
        for (int i = 0 ; i < m ; i++) {  
            cin >> presets1[i].first >> presets1[i].second;  
        }  
  
        for (int i = 0 ; i < n ; i++) {  
            int check;  
            cin >> check;  
            for (int j = 0 ; j < check ; j++) {  
                cin >> input[j].first >> input[j].second;  
            }  
            if (m != check) {  
                continue;  
            }  
            for (int k = 0 ; k < 4 ; k++) {  
                int ix0 = input[0].first;  
                int iy0 = input[0].second;  
                int px0 = presets1[0].first;  
                int py0 = presets1[0].second;  
                for (int j = 0 ; j < check ; j++) {  
                    if (presets1[j].first - px0 != input[j].first - ix0 || presets1[j].second - py0 != input[j].second - iy0) {  
                        goto NEXT;  
                    }  
                }  
                cout << i + 1 << endl;  
                goto END;  
    NEXT:;  
                px0 = presets1[check - 1].first;  
                py0 = presets1[check - 1].second;  
                for (int j = 0 ; j < check ; j++) {  
                    if (presets1[check - j - 1].first - px0 != input[j].first - ix0 || presets1[check - j - 1].second - py0 != input[j].second - iy0) {  
                        goto NEXT2;  
                    }  
                }  
                cout << i + 1 << endl;  
                goto END;  
NEXT2:;  
                //ñ]ìÆ  
                for (int j = 0 ; j < check ; j++) {  
                    int temp = input[j].first;  
                    input[j].first = input[j].second;  
                    input[j].second = -temp;  
                }  
            }  
END:;  
        }  
        cout << "+++++" << endl;  
    }  
}

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

Measured memory_bytes: 0
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        a: f64,
        b: f64,
        x: f64,
    }
    println!(
        "{}",
        if 2f64 * x <= a * a * b {
            (a * b * b / (2f64 * x)).atan().to_degrees()
        } else {
            (2f64 * b / a - 2f64 * x / (a * a * a)).atan().to_degrees()
        }
    );
}


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

int main(){
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	int ans = 0;
	for(int i = 0; i <= 100; i++){
		if(A <= i &&  B >= i && C <= i && D >= i) ans++;
	}
	if(ans > 0 ) cout << ans - 1 << endl;
	else cout << 0 << endl;
	
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] l = new int[n];
        for (int i = 0; i < n; i++) {
            l[i] = sc.nextInt();
        }
        Arrays.sort(l);
        for (int i = 1; i <= l[0]; i++) {
            for (int j = 0; j < n && l[j] % i == 0; j++) {
                if (j == n - 1) {
                    System.out.println(i);
                }
            }
        }
    }
}


Measured memory_bytes: 26356
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> A(H, vector<char>(W));
  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) cin >> A[i][j];
  }
  int num = 0;
  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      if (A[i][j]=='#') num++;
    }
  }
  if (num==H+W-1) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
}

Measured memory_bytes: 256
//Keep Working Hard
  // I__Like__Food  
  #include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 998244353
  #define N 200005
  #define INF 1000000000000
  #define eps 1e-6
  #define int long long
  #define pie 3.1415926535897932384626433832795028
int32_t main()
{



   int n,m;
   cin >> n >> m;

   int sum = 0;

   vector<int> v(m);

   for(int i = 0; i <m; i++)
   {
    cin >> v[i];
    sum += v[i];
   }

   n-=sum;

   if(n < 0)n = -1;

   cout << n;
    return 0;
}

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

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

  if (s[2]==s[3] && s[4]==s[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = 0;
    while(1) {
        if ( x <= 0 && y <= 0 ) break;
        if ( x > 0 && y > 0 ) {
            if ( a + b > c * 2 ) {
                ans += c * 2;
                --x;
                --y;
            }
            else if ( a > c * 2 ) {
                ans += c + 2;
                --x;
                --y;
                if ( y > 0 ) {
                    ans += b;
                    --y;
                }
            }
            else if ( b > c * 2 ) {
                ans += c * 2;
                --x;
                --y;
                if ( x > 0 ) {
                    ans += a;
                    --x;
                }
            }
            else {
                ans += a + b;
                --x;
                --y;
            }
        }
        else if ( x <= 0 ) {
            if ( b > c * 2 ) {
                ans += c * 2;
                --x;
                --y;
            }
            else {
                ans += b;
                --y;
            }
        }
        else {
            if ( a > c * 2 ) {
                ans += c * 2;
                --x;
                --y;
            }
            else {
                ans += a;
                --x;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    int x;
    cin>>x;
    if(x>=1200) {
        cout<<"ARC"<<endl;
    }
    else cout<<"ABC"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        String[] array = new String[n];

        for (int i = 0; i < n; i++) {
            array[i] = sc.next();
        }

        HashMap <String, Integer> map = new HashMap<>();

        for (int i = 0; i < n; i++) {
            if (map.containsKey(array[i])){
                int value = map.get(array[i]);
                map.put(array[i], value + 1);
            } else {
                map.put(array[i], 1);
            }
        }

        int max = Collections.max(map.values());

        List<String> list = new ArrayList<String>();

        for (String key : map.keySet()) {
            if (map.get(key) == max){
                list.add(key);
            }
        }

        Collections.sort(list);

        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }
}


Measured memory_bytes: 78224
#include<bits/stdc++.h>
using namespace std;
const int N =2e5+100;
typedef long long ll;

int main()
{
    int x[N]={0},n;
    ll ans =0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&x[i]);
    for(int l=1,r=1,now=0;r<=n;){
        for(;!(now&x[r])&&r<=n;){
            now |=x[r++];
            ans +=r-l;
        }
        now ^=x[l++];
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 1024
n, q = map(int, input().split())
s = input()
b = [0]
for t in range(1, n):
	if s[t-1] == "A" and s[t] == "C":
		b.append(b[t-1] + 1)
	else:
		b.append(b[t-1])
for u in range(q):
	l, r = map(int, input().split())
	print(b[r-1] - b[l-1])

Measured memory_bytes: 6176
import sys

input = sys.stdin.readline


def main():
    x = input()
    two = int(x[-3:])
    max_count = int(x[:-3] or 0)
    count = 0
    for i in range(5, 0, -1):
        q, two = divmod(two, i)
        count += q
    print(int(count <= max_count))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
/*input
async layered coding
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int main()
{
	IOS;
	int a,b;
	cin>>a>>b;
	a+=b;
	if(a>=10) cout<<"error\n";
	else cout<<a;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n,x;
		String str;
		String strs[];
		try {
			while (true) {
			str = br.readLine();
			strs=str.split(" ");
			n=Integer.parseInt(strs[0]);
			x=Integer.parseInt(strs[1]);
			if(n==0&&x==0){
				break;
			}
			int cnt = 0;
			for(int i=1;i<=n-2;i++){
				for(int j=i+1;j<=n-1;j++){
					for(int k=j+1;k<=n;k++){
						if(i+j+k==x){
							cnt++;
						}
					}
				}
			}
			System.out.println(cnt);
		}
		} catch (Exception e) {
			System.err.println( e );
		}
		

	}

}

Measured memory_bytes: 24948
#include <iostream>
#include <vector>
#define MAX_R 100000
using namespace std;
int main(void) {
  int q;
  cin >> q;
  vector<int> l(q), r(q);
  for (int i = 0; i < q; i++) {
    cin >> l[i] >> r[i];
  }
  vector<bool> prime(MAX_R + 1, 1);
  vector<int> count(MAX_R + 1, 0);
  prime[0] = prime[1] = 0;
  for (int i = 2; i <= MAX_R; i++) {
    if (prime[i]) {
      for (int j = i * 2; j <= MAX_R; j += i) {
        prime[j] = 0;
      }
    }
  }
  for (int i = 3; i <= MAX_R; i++) {
    if (prime[i] && prime[(i + 1) / 2]) {
      count[i] = count[i - 1] + 1;
    } else {
      count[i] = count[i - 1];
    }
  }
  for (int i = 0; i < q; i++) {
    cout << count[r[i]] - count[l[i] - 1] << endl;
  }
  return 0;
}

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

int main(){
    ll x;
    cin >> x;
    ll e = 100, y = 0;
    while(e < x){
        ll n = e + (ll)(e / 100);
        y++;
        e = n;
    }
    cout << y << endl;
    return 0;
}

Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine().Split().Select(long.Parse).ToArray();
            int i = 0;
            int ret = 0;
            long tmp = 0;

            while (r[1] >= tmp)
            {
                ret++;
                if (i == 0)
                {
                    tmp = r[0];
                    i++;
                }else
                {
                    tmp *= 2;
                    i++;
                }
            }

            if (ret > 0)
            {
                ret--;
            }
            Console.WriteLine(ret);
        }
    }
}

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

pub 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")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};

fn main() {
    let mut n: usize = read();
    let mut m = read();

    let mut oks = vec![false; n + 1];
    let mut fails = vec![0; n + 1];

    for _ in 0..m {
        let p: usize = read();
        let s: String = read();
        if oks[p] == false && s == "WA" {
            fails[p] += 1;
        }
        if s == "AC" {
            oks[p] = true;
        }
    }
    let mut cnt =0;

    for (i, &v) in fails.iter().enumerate() {

        if oks[i] {
            cnt += v;
        }
    }

    println!("{} {}", oks.iter().filter(|&x| *x == true).count(), cnt)
}


Measured memory_bytes: 4352
from typing import Set


def divisors(n: int) -> Set[int]:
    divs = set()
    i = 1
    while i * i <= n:
        if n % i == 0:
            divs.add(i)
            divs.add(n // i)
        i += 1
    return divs


def answer(a: int, b: int, k: int) -> int:
    divisors_a = divisors(a)
    divisors_b = divisors(b)

    common_divisors = list(divisors_a & divisors_b)
    common_divisors.sort()

    return common_divisors[-k]


def main():
    a, b, k = map(int, input().split())
    print(answer(a, b, k))


if __name__ == '__main__':
    main()


Measured memory_bytes: 10216
n = int(input())
F = [ int("".join(input().split()), 2) for _ in range(n) ]
P = [ list(map(int, input().split())) for _ in range(n) ]
ans = -float("inf")
for i in range(1, 2**10):
  t = 0
  for j in range(n):
    c = bin(F[j] & i).count("1")
    t += P[j][c]
  ans = max(ans, t)
print(ans)

Measured memory_bytes: 3064
n = int(input())
abc = [list(map(int, input().split())) for _ in range(n)]
dp = [[0]*3 for _ in range(n+1)]
dp[1] = abc[0]
for i in range(1,n):
  dp[i+1][0] = max(dp[i][1],dp[i][2])+abc[i][0]
  dp[i+1][1] = max(dp[i][0],dp[i][2])+abc[i][1]
  dp[i+1][2] = max(dp[i][0],dp[i][1])+abc[i][2]
  
print(max(dp[-1]))

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

int digitcul(int n) {
    int sum = 0;
    while (n > 0) {
        sum += n%10;
        n/=10;
    }
    return sum;
}

int main() {
    int n; cin >> n;
    int ans = 1e9;
    for (int i=1; i<=n/2+1; ++i) {
        int a = i, b = n - i;
        int sum = digitcul(a) + digitcul(b);
        ans = min(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <climits>
#include <algorithm>
#include <numeric>

using namespace std;


int L[100000];
int X[100000];
int main()
{
    int n, m;
    scanf("%d", &n);
    scanf("%d", &m);

    for (int i = 0; i < m; i++) {
        scanf("%d", X + i);
    }
    sort(X, X + m);

    for (int i = 1; i < m; i++) {
        L[i - 1] = X[i] - X[i - 1];
    }
    sort(L, L + m - 1);

    if ((n - 1) > (m - 1))
        cout << 0 << endl;
    else {
        int ans = accumulate(L, L + m - 1 - (n - 1), 0);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long

using namespace std;

int A[101010];
int N, K, S;

signed main()
{
    cin >> N >> K >> S;
    if (S == 1000000000)
    {
        for (size_t i = 0; i < N; i++)
        {
            if (i < K)
            {
                A[i] = S;
            }
            else
            {
                A[i] = 1;
            }
        }
    }
    else
    {
        for (size_t i = 0; i < N; i++)
        {
            if (i < K)
            {
                A[i] = S;
            }
            else
            {
                A[i] = 1000000000;
            }
        }
    }

    for (size_t i = 0; i < N; i++)
    {
        cout << A[i] << " ";
    }
    cout << endl;
}

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

using namespace std;

#define debug(x) '[' << #x << " is: " << x << "] "
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	#ifndef ONLINE_JUDGE
	//	freopen("input.txt","r",stdin);
	#endif
	ll h;
	cin>>h;
	ll ans = 0;
	for(ll k=50;k>=0;k--){
		if((h>>k)&1){
			ans = (1ll << (k+1))-1;
			break;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import itertools
INF = 1000000007
n, a, b, c = map(int, input().split())
B = [a, b, c]
take = [int(input()) for i in range(n)]
sh = [i for i in itertools.product(range(4), repeat=n)]
res = INF
for C in sh:
    if 0 not in C or 1 not in C or 2 not in C:
        continue
    ex = [0] * 3
    ifres = 0
    for index, x in enumerate(C):
        if x != 3:
            if ex[x] != 0:
                ifres += 10
            ex[x] += take[index]
    for i in range(3):
        ifres += abs(B[i]-ex[i])
    if ifres < res:
        res = ifres
print(res)

Measured memory_bytes: 10996
#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
string Change(ll x) {
    string t = "", s = "";
    while(x) {
        if(!(x%26)) {
            t += 'z';
            x = x/26-1;
            continue;
        }
        t += char(x%26 + 'a' - 1);
        x /= 26;
    }
    for(int i = t.length()-1; i >= 0; --i) s += t[i];
    return s;
}
int main() {
    ll x;
        cin >> x;
        cout << Change(x) << '\n';
return 0;
}

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

using namespace std;

#define LL long long 
#define ULL unsigned LL
#define LD long double 

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int h, w, k;
	cin>>h>>w>>k;
	char c[h][w];
	for(int i=0; i<h; i++) {
		for(int j=0; j<w; j++) {
			cin>>c[i][j];
		}
	}
	int n = h+w;
	int maks = (1<<n);
	int wynik = 0;
	for(int i=0; i<maks; i++) {
		char cx[h][w];
		for(int j=0; j<h; j++) {
			for(int z=0; z<w; z++)
				cx[j][z] = c[j][z];
		}
		for(int j=0; j<n; j++) {
			if((1<<j) & i) {
				if(j < h) {
					// row
					for(int z=0; z<w; z++)
						cx[j][z] = '$';
				}
				else {
					// column
					for(int z=0; z<h; z++)
						cx[z][j-h] = '$';
				}
			}
		}
		int ix = 0;
		for(int j=0; j<h; j++) {
			for(int z=0; z<w; z++) {
				if(cx[j][z] == '#')
					ix++;
			}
		}
		if(ix == k)
			wynik++;
	}
	cout<<wynik;
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		while(true){
			//縦と横のint型の変数
			int intWeight = scan.nextInt();
			int intWidth = scan.nextInt();

			//縦と横の長さがともに０の時ループを抜ける
			if(intWeight == intWidth && intWeight == 0){
				break;
			}

			for(int i = 0 ;i < intWeight;i++){

				for(int j = 0;j < intWidth;j++){
					System.out.print("#");
				}
				System.out.println("");
			}
			System.out.println("");
		}
			scan.close();
	}
}



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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var nm = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var n = nm[0];
        var m = nm[1];
        var fs = new Tuple<int, int, int>[m];
        for (int i = 0; i < fs.Length; i++)
        {
            var xyz = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            fs[i] = Tuple.Create(xyz[0], xyz[1], xyz[2]);
        }

        var uf = new UnionFind(n + 1);
        for (int i = 0; i < fs.Length; i++)
        {
            uf.Unite(fs[i].Item1, fs[i].Item2);
        }

        Console.WriteLine(uf.GetDensity() - 1);
    }
}

class UnionFind
{
    int[] nodes;

    public int Count { get; private set; }

    public UnionFind(int size)
    {
        this.nodes = Enumerable.Repeat(-1, size).ToArray();
        Count = size;
    }

    public int Find(int x)
    {
        var p = nodes[x];
        if (p < 0)
        {
            return x;
        }

        return nodes[x] = Find(p);
    }

    public void Unite(int x, int y)
    {
        var p = Find(x);
        var q = Find(y);
        if (p == q)
        {
            return;
        }

        var r = nodes[p];
        var s = nodes[q];
        if (r > s)
        {
            p += q;
            q = p - q;
            p -= q;
        }
        nodes[p] += nodes[q];
        nodes[q] = p;
        Count--;
    }

    public bool Union(int x, int y)
        => Find(x) == Find(y);

    public int GetSize(int x)
        => -nodes[Find(x)];
    
    public int GetDensity()
        => nodes.Count(x => x < 0);
}


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

int main() {
    string s;
    cin >> s;
    if (s=="Sunny") cout << "Cloudy" << endl;
    if (s=="Cloudy") cout << "Rainy" << endl;
    if (s=="Rainy") cout << "Sunny" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define all(arr) arr.begin(), arr.end()

using namespace std;
typedef long long ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main() {
  Cin(int, n);
  Cins(int, n, ws);
  int ans = 1e9;
  for (int i = 0; i < n - 1; ++i) {
    int suml = 0, sumr = 0;
    for (int j = 0; j <= i; ++j) suml += ws[j];
    for (int j = i + 1; j < n; ++j) sumr += ws[j];
    ans = min(ans, abs(suml - sumr));
  }
  cout << ans << endl;
}

int main() {
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
def dfs(v,p,d):
    dist[v]=d
    for nv in G[v]:
        if nv==p:
            continue
        dfs(nv,v,d+1)
def getSP(v,d):
    p=v
    if dist[v]==d:
        return v
    for nv in G[v]:
       if dist[nv]<dist[v]:
           p=getSP(nv,d)
    return p
    
def Sdepth(v):
    res=1
    if not G[v]:
        return 1
    for nv in G[v]:
        if dist[nv]<dist[v]:
            continue
        res+=Sdepth(nv)
    return res
    
N=int(input())
G=[[] for i in range(N)]
for i in range(N-1):
    a,b=map(lambda x:int(x)-1,input().split())
    G[a].append(b)
    G[b].append(a)
dist=[-1]*N
dfs(0,-1,0)
P=(dist[N-1]-1)//2
sp=getSP(N-1,dist[N-1]-P)
dep=Sdepth(sp)
Sunu=dep-(dist[N-1]-dist[sp]+1)
Fene=N-dep-dist[sp]
if dist[N-1]%2:
    print('Fennec' if Fene>Sunu else 'Snuke')
else:
    print('Fennec' if Fene>=Sunu else 'Snuke')

Measured memory_bytes: 113584
import java.io.*;
import java.util.*;
import java.util.Map.Entry;

		
public class Main {
	public static void main(String[] args) throws Exception{
		MScanner sc = new MScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        String x=sc.nextLine();
        int f=Integer.parseInt(x.substring(0,2));int s=Integer.parseInt(x.substring(2));
        if(f<=12 && f>0 && s<=12 && s>0) {
        	pw.println("AMBIGUOUS");
        }
        else {
        	if((f>12 || f<=0) && (s>12 || s<=0)) {
        		pw.println("NA");
        	}
        	else {
        		if(f<=12 && f>0) {
        			pw.println("MMYY");
        		}
        		else {
        			pw.println("YYMM");
        		}
        	}
        }
        pw.flush();
    }
	
	static class MScanner {
        StringTokenizer st;
        BufferedReader br;

        public MScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}		

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

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

int main()
{
    ll N;
    cin >> N;
    vec A(N);
    REP(i,0,N) cin >> A[i];

    ll g = A[0];
    REP(i,1,N) g = gcd(g, A[i]);   
    PR(g);

    return 0;
}

/*



*/

Measured memory_bytes: 3980
# coding: utf-8
# Your code here!

s = input()

# print(s)

result_s = ""
for i in range(len(s)):
    # print(s[i])
    
    if s[i] == '0':
        # pass
        result_s += '0'
    
    if s[i] == '1':
        # pass
        result_s += '1'
    
    if s[i] == 'B':
        # pass
        if len(s) > 0:
            result_s = result_s[:-1]
    
print(result_s)

Measured memory_bytes: 2940
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;
#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef vector<int> V;

int main() {
  pair<int, int> a, b;
  cin >> a.first >> a.second >> b.first >> b.second;
  int x, y;
  x = b.first-a.first;
  y = b.second-a.second;
  cout << b.first-y << " " << b.second+x << " " << a.first-y << " " << a.second+x << endl;
  return 0;
}


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

ll A, B;
multiset<ll> S;

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

	cin >> A >> B;
	S.insert(A);
	S.insert(B);
	ll ans = 0;
	ll x = *S.rbegin();
	ans += x;
	S.erase(S.find(x));
	S.insert(x-1);
	ans += *S.rbegin();
	cout << ans << "\n";

}

Measured memory_bytes: 256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    r, D, x = map(int, input().split())

    for i in range(10):
        x = r * x - D
        print(x)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4196
/*
https://t.me/unstoppabIesoIvemachinechannel
*/
#pragma ARCENIY_KIRILLOV_POVELITEL_KROKODILOV
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("no-stack-protector")
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC pop_options
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rng(a) a.begin(),a.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i > -1; i--)
#define rer(i, x, n) for (int i = x; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef long double ld;












signed main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    vector<int> dp(k + k + 2);
    for (int i = 0; i < k; i++){
        for (int j = 0; j < n; j++){
            dp[i + a[j]] = max(dp[i + a[j]], dp[i]^1);
        }
    }
    cout << (dp[k] == 1 ? "First" : "Second");
}


Measured memory_bytes: 1024
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = list(input())
if "9" in N:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 5148
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A, B, k;
  cin >> A>> B>> k;
  int max;
  vector<int>vec(0);
  if(A > B){max = A;}
  else{max = B;}
  for(int i=1; i < max+1; i++){
    if (A%i == 0 && B%i == 0){
      vec.push_back(i);
    }
  }
    reverse(vec.begin(),vec.end());
    cout << vec.at(k-1) << endl;
}
  
      

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	char s[10001];
	int i,j,a,b,x,y,n;
	while(EOF!=scanf("%s",s)){
		n=strlen(s);
		a=0;
		b=0;
		for(i=0;i<n-2;i++){
			// printf("i=%d s=%c\n",i,s[i]);
			if(s[i]=='J'){
				if(s[i+1]=='O'){
					if(s[i+2]=='I')	a++;
				}
			}
			if(s[i]=='I'){
				if(s[i+1]=='O'){
					if(s[i+2]=='I')	b++;
				}
			}
		}
		printf("%d\n",a);
		printf("%d\n",b);
	}
	return 0;
}


Measured memory_bytes: 2696
n = int(input())
data = [list(map(int,input().split())) for i in range(n)]

def manhattan(x1,x2,y1,y2):
	return abs(x2-x1) + abs(y2-y1)
x,y = 0,0
can = True
dt = data[0][0]
for i in range(n):
	dist = manhattan(x,data[i][1],y,data[i][2])
	if dist > dt:
		can = False
		break
	elif (dt - dist) % 2 != 0:
		can = False
		break
	if i == n-1:
		break
	x = data[i][1]
	y = data[i][2]
	dt = data[i+1][0] - data[i][0]
if can:
	print("Yes")
else:
	print("No")



Measured memory_bytes: 27324