akhauriyash/Code-Regression huggingface dataset:
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <stack>
#include <queue>
#include <bitset>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring> 
#include <iostream>
#include <algorithm>
using namespace std;

int N, A[1000005];
int p[1000005], f[1000005];
bool vis[1000005];
int has[1000005];

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

inline void init()
{
	for(int i = 2;i <= 1000000;++i)
	{
		if(!vis[i])
		{
			f[i] = i;
			p[++p[0]] = i;
		}
		int t;
		for(int j = 1;(t = i * p[j]) <= 1000000;++j)
		{
			vis[t] = 1;
			f[t] = p[j];
			if(i % p[j] == 0)
				break;
		}
	}
}


int main()
{
	init();
	scanf("%d", &N);
	for(int i = 1;i <= N;++i)
		scanf("%d", &A[i]);

	bool flag1 = false, flag2 = false, check = true;
	for(int i = 1;i <= N;++i)
	{
		int x = A[i];
		while(x > 1)
		{
			if(has[f[x]] == 0)
				has[f[x]] = i;
			else if(has[f[x]] != i)
			{
				check = false;
				break;
			}
			x /= f[x];
		}
		if(check == false)
			break;
	}
	if(check == true)
		flag1 = true;

	if(flag1 == true)
	{
		printf("pairwise coprime\n");
		return 0;
	}

	int g = gcd(A[1], A[2]);
	for(int i = 3;i <= N;++i)
	{
		g = gcd(g, A[i]);
		if(g == 1)
			break;
	}
	if(g == 1)
		flag2 = true;

	if(flag2 == true)
		printf("setwise coprime\n");
	else
		printf("not coprime\n");

	return 0;
}

Measured memory_bytes: 13176
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define str string
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define ff fflush(stdout)
#define IN(a) freopen(a, "r", stdin)
#define OUT(a) freopen(a, "w", stdout) 
#define eps 1e-6
#define PI atan(1) * 4
#define mod 1000000007
using namespace std;
int main () {
	ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
	scanf("%lld", &a);
	c = -1e18; d = 1e18;
	for (i = 1; i <= a; i++) {
		scanf("%lld", &b);
		c = max(c, b); d = min(d, b);
	}
	printf("%lld\n", c - d);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
class Dice{
		int _num[6];
		
	public:
        void set(int num[6]){
            for(int i = 0; i < 6; i++) _num[i] = num[i];
        }
		int Get(int n){
			return _num[n];
		}
		void N(){
			swap(_num[0],_num[4]);
			swap(_num[0],_num[5]);
			swap(_num[0],_num[1]);
		}
		void S(){
			swap(_num[0],_num[1]);
			swap(_num[0],_num[5]);
			swap(_num[0],_num[4]);			
		}
		void W(){
			swap(_num[0],_num[3]);
			swap(_num[0],_num[5]);
			swap(_num[0],_num[2]);			
		}
		void E(){
			swap(_num[0],_num[2]);
			swap(_num[0],_num[5]);
			swap(_num[0],_num[3]);			
		}
		void SetTop(int n){
			if(_num[2] == n) W();
			else if(_num[3] == n) E();
			else{
				for(int i = 0; i < 4; i++){
					if(_num[0] == n) break;
				S();
				}
			}
		}
		void SetFront(int n){
			for(int i = 0; i < 4; i++){
				if(_num[1] == n) break;
				S(); W(); N();
			}
		}

		bool SameAs(Dice other){
			other.SetTop(this->Get(0));
			other.SetFront(this->Get(1));
			
			bool same = true;
			for(int i = 0; i < 6; i++){
				if(other.Get(i) != this->Get(i)){
					same = false;
					break;
				}
			}
			return same;
		}
};
 
int main(){
	int n;
	cin >> n;
	
	Dice dice[n];
	for(int i = 0; i < n; i++){
		int num[6];
		for(int j = 0; j < 6; j++){
				cin >> num[j];
		}
		dice[i].set(num);
	}
	
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			if(dice[i].SameAs(dice[j])){
				cout << "No" << endl;
				return 0;
			}
		}
	}

	cout << "Yes" << endl;
}

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

int main(){
	int n;
	scanf("%d",&n);
	for(int i=3;i<=n;i++){
		if(i%3==0) printf(" %d",i);
		else{
			int x=i;
			while(x>0){
				if(x%10==3){
					printf(" %d",i);
					break;
				}
				x/=10;
			}
		}
	}
	printf("\n");
	return 0;
}

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

typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;

#define  ff           first
#define  ss           second
#define  pb           push_back
#define  IOS          ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  D(x)         cout << #x << " - " << x << endl;
#define  D2(x)        cout << "[" << #x << ": "; for(auto it:x) cout << it << " "; cout << "]" << endl;
#define  all(x)       (x).begin(), (x).end()
#define  D2p(x)       cout << #x << " ~ [ "; for(auto n: x) cout << n.first << "-" << n.second << " / "; cout << "]" << endl;
#define  ps(x,y)      fixed<<setprecision(y)<<x
#define  rep(i,a,b)   for(ll i=a ; i<b ; ++i)
#define  sz(x)		  x.size();

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ll MAXN = 1e6 + 4;


void solve(){
  int n;
  cin >> n;
  ll ans=0;
  vi v(n);
  for(int i=0;i<n;i++)
  	cin >> v[i];
  ans +=1000;
  for(int i=0;i+1<n;i++){
  	 if(v[i+1]>v[i]){
  	 	ll tempans = ans;
  	 	ans -= (tempans/v[i])*(v[i]);
  	 	ans += (v[i+1])*(tempans/v[i]);
  	 	
  	 }
  }
  cout << ans;
}

int main(){
  IOS
     solve();
     cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
}

// integer overflow
// remember to clear visited array
// take input as vector<string> while using grid
// don't assign after modifying

Measured memory_bytes: 3848
#include<bits/stdc++.h>
#define R(n)for(L i=0;i<n;i++)
#define M make_pair
typedef long long L;using namespace std;int main(){L n,k,s,t,a[50];cin>>n>>k>>s>>t;R(n)cin>>a[i];map<pair<L,L>,L> p[50];R(n){for(L j=k-1;j;j--)for(auto&l:p[j-1])p[j][M(l.first.first&a[i],l.first.second|a[i])]+=l.second;p[0][M(a[i],a[i])]=1;}n=0;R(k)n+=p[i][M(s,t)];cout<<n;}

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


namespace AtCoder
{
    class Program
    {
        public static void Main()
        {
            new Program().Solve();
        }

        void Solve()
        {
            var mat = new int[3][];
            for (int i = 0; i < 3; i++)
            {
                mat[i] = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            }

            int a0 = 0;
            int b0 = mat[0][0] - a0;
            int b1 = mat[0][1] - a0;
            int b2 = mat[0][2] - a0;

            int a2_0, a2_1, a2_2;
            a2_0 = mat[1][0] - b0;
            a2_1 = mat[1][1] - b1;
            a2_2 = mat[1][2] - b2;

            int a3_0, a3_1, a3_2;
            a3_0 = mat[2][0] - b0;
            a3_1 = mat[2][1] - b1;
            a3_2 = mat[2][2] - b2;

            if (a2_0 == a2_1 && a2_1 == a2_2 &&
                a3_0 == a3_1 && a3_1 == a3_2)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }



        }
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

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

int main(){
    map<ll,ll> m;
    ll N;
    cin>>N;
    v A(N);
    rep(i,1,N){
        cin>>A[i];
        }

    rep(i,1,N){
        m[A[i]]++;
    }
    rep(i,1,N+1){
        cout<<m[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 17252
s=list(input())
a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for x in a:
    if not x in s:
        print(x)
        exit()
print("None")


Measured memory_bytes: 3956
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  int64_t sum = 0;
  for (int i = 1; i < n+1; i++) {
    if ((i%3 != 0) && (i%5 != 0)) {
      sum += i;
    }
  }
  cout << sum << endl;
}




Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define debug(x) cerr << #x << " = " << x << endl

int main(int qtd, char* nome[])
{
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	int n;
	cin >> n;
	double l = n/3.0;
	cout << fixed << setprecision(12) << l*l*l << endl;
	
	return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string s; cin>>s;
  string ans="AC";
  int cnt=0,num=0;
  for(int i=1;i<s.size();i++){
    if(s[i]<'a') cnt++;
  }
  for(int i=2;i<s.size()-1;i++){
    if(s[i]=='C') num++;
  }
  
  if(s[0]!='A'){
    ans="WA";
  }
  else {
    if(num!=1) ans="WA";
    else{
      if(cnt!=1) ans="WA";
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, c,k=0, i, j,l=1e9+7;
  string s, r, y;
  cin>>n>>a;
  cout<<(int)floor(log(n)/log(a)+1);
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
   //cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 3804
import math
mod = 10**9 + 7
n,m = map(int,input().split())
if abs(n-m) > 1:
    print(0)

else:
    N = math.factorial(n) % mod
    M = math.factorial(m) % mod
    if n==m:
        print(2*N*M%mod)
    else:
        print(N*M%mod)

Measured memory_bytes: 4092
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
#include<cstring>
#include<set>
using namespace std;
using ll = long long;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
const ll mod = 1e9+7;
const int INF = 1e9;
const ll INFLONG = 1e18;

//vector<vector<ll>> vec(100000,vector<ll>(3,0));
int main(){
  ll n;
  cin >> n;
  double v[n];
  rep(i,n){
    cin >> v[i];
  }
  sort(v,v+n);
  rep(i,n-1){
    v[i+1] = (v[i] + v[i+1])/2;
  }
  // cout << v[n-1];
  printf("%.8f",v[n-1]);
}


Measured memory_bytes: 256
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    H, W, K = il()
    line = [iss() for _ in range(H)]

    ret = 0
    for h in range(1 << H):
        for w in range(1 << W):
            cnt = 0
            for i in range(H):
                for j in range(W):
                    if h >> i & 1 and w >> j & 1 and line[i][j] == '#':
                        cnt += 1
            if cnt == K:
                ret += 1
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10228
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using PL = pair<ll, ll>;
// Welcome to my source code!

int main() {
    int l;
    cin >> l;
    double t = (double)l / 3.0;
    cout << fixed << setprecision(12) << pow(t, 3) << endl;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

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 ll MRINF = 5000000000000000;

int main() {

  vector<ll> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());

  ll ans = a[2]-a[0]+a[2]-a[1];
  if(ans%2!=0)ans+=3;
  cout << ans/2 << endl;

    

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 3604
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#define maxn 20
#define R register
#define INF 0x3f3f3f3f
#define lxl long long
using namespace std;

inline lxl read()
{
	lxl x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') {x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return x*f;
}

int n;
lxl a[maxn];

inline lxl dp(int l,int r,int x,int y)
{
	if(l+1==r) return 0;
	lxl ans=1e18;
	for(R int i=l+1;i<r;++i)
		ans=min(ans,dp(l,i,x,x+y)+dp(i,r,x+y,y)+1ll*(x+y)*a[i]);
	return ans;
}

int main()
{
	n=read();
	for(R int i=1;i<=n;++i)
		a[i]=read();
	printf("%lld\n",dp(1,n,1,1)+a[1]+a[n]);
	return 0;
}

Measured memory_bytes: 888
// #define H

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main() {
#ifdef H
    freopen("in.in", "r", stdin);
#endif
    int money;
    cin >> money;
    int fiveH = money / 500;
    money -= 500 * fiveH;
    int fiveC = money / 5;
    cout << fiveH * 1000 + fiveC * 5 << endl;

}


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

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define FIO ios::sync_with_stdio(false);cin.tie(0)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(),(x).end()
#define D(x) cout<<#x<<" = "<<x<<endl;
#define SZ(x) ((int)x.size())
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 2e6 + 10;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

vector<pii> E[N];
map<pii, int> mp;
int n, m, tot, dis[N], vis[N];

int addP(int u, int c) {
    if(!mp[mk(u, c)]) mp[mk(u, c)] = ++tot; 
    return mp[mk(u, c)];
}

void addE(int u, int v, int c) {
    E[u].pb(mk(v, c)), E[v].pb(mk(u, c));
}

int dij() {
    deque<int> q;
    mem(dis, 0x3f);
    dis[1] = 0;
    q.push_back(1);
    while(!q.empty()) {
        int u = q.front(); q.pop_front();
        for(auto e : E[u]) {
            if(e.se == 0 && dis[e.fi] == inf) {
                dis[e.fi] = dis[u];
                q.push_front(e.fi);
            } else if(e.se && dis[e.fi] == inf) {
                dis[e.fi] = dis[u] + 1;
                q.push_back(e.fi);
            }
        }
    }
    if(dis[n] == inf) return -1;
    return dis[n] / 2;
}

int main() {
    FIO;
    cin >> n >> m;
    tot = n;
    rep(i, 1, m) {
        int u, v, c;
        cin >> u >> v >> c;
        int nu = addP(u, c), nv = addP(v, c);
        addE(u, nu, 1), addE(v, nv, 1), addE(nu, nv, 0);
    }
    cout << dij();

    return 0;
}

Measured memory_bytes: 100224
#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#include <set>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){
  
  int n;
  
  cin >> n;
  
  char c[110];
  REP(i,n){
    cin >> c[i];
  }
  
  int f[26] = {}; int b[26] = {};
  int ans = 0;
  REP(i,n-2){
    int sum = 0;
    REP(j,i+1){
      f[c[j]-'a']++;
    }
    FOR(j,i+1,n){
      b[c[j]-'a']++;
    }
    REP(j,26){
      if(f[j] > 0 && b[j] > 0) sum++;
    }
    ans = max(ans,sum);
    REP(j,26){
      f[j] = 0; b[j] = 0;
  }
  }
  
  cout << ans << endl;
  
 return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())

if n == 2 or m == 2:
  print(0)
elif n == 1 or m == 1:
  if max(n, m) >= 3:
    print(max(n, m) - 2)
  else:
    print(1)
else:
  print((n-2)*(m-2))


Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**6)

n = int(input())
ab = [list(map(int, input().split())) for i in range(n-1)]
ab2 = [[] for i in range(n)]
for i in range(n-1):
  ab2[ab[i][0]-1].append([ab[i][1]-1, i])
  ab2[ab[i][1]-1].append([ab[i][0]-1, i])
coloring = [0]*(n-1)

def f(x, y, z):
  c = 0
  for i in ab2[x]:
    if i[0] != y:
      c += 1
      if c == z:
        c += 1
      coloring[i[1]] = c
      x1 = i[0]
      y1 = x
      z1 = c
      f(x1, y1, z1)

f(0, None, None)
print(max(coloring))
for i in range(n-1):
  print(coloring[i])

Measured memory_bytes: 93652
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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



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

struct edge{
    long long to, cost;
};

class dijkstra
{
private:
    long long vertex;   // 頂点数
    vector<vector<edge>> list;  //隣接リスト
    vector<long long> distance;    // 距離
public:
    void init(long long n);  // nは頂点の数
    void add_edge(long long v1, long long v2, long long cost);    // 頂点v1から頂点v2に辺を張る
    void run(long long s);        // sは開始地点。
    long long get_distance(long long v);    // 頂点vへの距離を返す
};

void dijkstra::init(long long n){
    vertex = n;
    list.resize(n);
}

void dijkstra::add_edge(long long v1, long long v2, long long cost){
    list[v1].push_back({ v2, cost });
}

void dijkstra::run(long long s){
    priority_queue<P, vector<P>, greater<P>> que;
    distance = vector<long long>(vertex, INF);
    distance[s] = 0;    // 開始点の距離は0
    que.push(P(0, s));
    
    while(!que.empty()){
        P p = que.top(); que.pop();
        long long v = p.second;
        if(distance[v] < p.first) continue;
        for(auto e : list[v]){
            if(distance[e.to] > distance[v] + e.cost){
                distance[e.to] = distance[v] + e.cost;
                que.push(P(distance[e.to], e.to));
            }
        }
    }
}

long long dijkstra::get_distance(long long v){
    return distance[v];
}


int main() {
    int n;
    dijkstra dik;
    
    cin >> n;
    dik.init(n);
    REP(i, n - 1){
        ll a, b, c;
        cin >> a >> b >> c;
        a--;b--;
        dik.add_edge(a, b, c);
        dik.add_edge(b, a, c);
    }
    
    int q, k;
    cin >> q >> k;
    k--;
    dik.run(k);
    REP(i, q){
        ll x, y;
        cin >> x >> y;
        x--;y--;
        cout << dik.get_distance(x) + dik.get_distance(y) << endl;
    }
}

Measured memory_bytes: 11120
#include<bits/stdc++.h>
using namespace std;
inline long long read()
{
	long long ret=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') w=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
	return w*ret;
}
inline long long read_l()
{
	long long ret=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') w=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
	return w*ret;
}
long long n;
long long m;
long long a[100010];
long long s[100010];
long long ans=0;
bool check(long long x)
{
	long long tot=0;
	for(long long i=1;i<=n;i++) tot+=lower_bound(a+1,a+n+1,x-a[i])-a-1;
	if(n*n-tot<m) return 1;
	else return 0;
}
int main()
{
	n=read(),m=read_l();
	for(long long i=1;i<=n;i++) a[i]=read_l();
	sort(a+1,a+n+1);
	for(long long i=1;i<=n;i++) s[i]=s[i-1]+a[i];
	long long l=1,r=999999999;
	while(l+1<r)
	{
		long long mid=(l+r)>>1;
		if(check(mid)) r=mid;
		else l=mid;
	}
	for(long long i=1;i<=n;i++) 
	{
		long long x=lower_bound(a+1,a+n+1,l-a[i])-a;
		ans+=s[n]-s[x-1];
		ans+=a[i]*(n-x+1);
	}
	long long tot=0;
	for(long long i=1;i<=n;i++) tot+=lower_bound(a+1,a+n+1,l-a[i])-a-1;
	if(n*n-tot>m) ans-=(n*n-tot-m)*l;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

struct Info{
	int id,sum;
};

int main(){

   int n,m1,m2,m3,m4,s1,s2,s3,s4,tmp_id,tmp_sum;
   Info table[4];

   while(true){
	   scanf("%d",&n);
	   if(n == 0)break;

	   for(int i=0; i < 4; i++){
		     scanf("%d %d %d %d %d %d %d %d %d",&table[i].id,&m1,&s1,&m2,&s2,&m3,&s3,&m4,&s4);
		     table[i].sum = (60*(m1+m2+m3+m4)+(s1+s2+s3+s4));
	   }

	   for(int i = 1; i <= 3; i++){
		   for(int k=3; k >= 1; k--){
			   if(table[k].sum < table[k-1].sum)swap(table[k],table[k-1]);
		   }
	   }
	   n -= 4;

	   for(int i=0; i < n; i++){
		   scanf("%d %d %d %d %d %d %d %d %d",&tmp_id,&m1,&s1,&m2,&s2,&m3,&s3,&m4,&s4);
		   tmp_sum = (60*(m1+m2+m3+m4)+(s1+s2+s3+s4));

		   if(tmp_sum > table[3].sum){ //??????????°?

			   table[2].id = table[3].id; //?????????????????????
			   table[2].sum = table[3].sum;
			   table[3].id = tmp_id;
			   table[3].sum = tmp_sum;

		   }else if(tmp_sum > table[2].sum){ //tmp???????????????
			   table[2].id = tmp_id;
			   table[2].sum = tmp_sum;

		   }else if(tmp_sum < table[0].sum){

				table[1].id = table[0].id;
				table[1].sum = table[0].sum;
				table[0].id = tmp_id;
				table[0].sum = tmp_sum;

		   }else if(tmp_sum < table[1].sum){

			   table[1].id = tmp_id;
			   table[1].sum = tmp_sum;
		   }

	   }

	   printf("%d\n",table[0].id);
	   printf("%d\n",table[1].id);
	   printf("%d\n",table[2].id);
   }
    return 0;
}

Measured memory_bytes: 2576
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
char c,ch;
int main() {
	cin>>c>>ch;
	if(c>ch){
		cout<<">"<<endl;
	}
	else if(ch>c){
		cout<<"<"<<endl;
	}
	else{
		cout<<"="<<endl;
	}
}

Measured memory_bytes: 256
#-*- coding:utf-8 -*-
import sys
N, Cost = map(int, input().split())

a_out, b_out = -1, -1

for i in range(N+1):
  for j in range(N-i+1):
    if 10000*i + 5000*j + 1000*(N-i-j) == Cost:
        print(i, j, N-i-j)
        sys.exit()

print('-1 -1 -1')

Measured memory_bytes: 3064
/*input

*/
#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 n,k,x,y;
  cin>>n>>k>>x>>y;
  	k=min(k,n);
	cout<<k*x+(n-k)*y;
	return 0;
}


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

#define ff first
#define ss second
#define mp make_pair
#define pb push_back

const int MAX_N = 1e5 + 1;

bool prime[MAX_N] = {false};
int cul[MAX_N] = {0};

void calc_primes() {
	for (int i=2; i<MAX_N; i++) {
		prime[i] = true;
	}
	for (int i=2; i<MAX_N; i++) {
		if (prime[i]) {
			for (int j=2*i; j<MAX_N; j+=i) {
				prime[j] = false;
			}
		}
	}
	for (int i=1; i<MAX_N; i++) {
		if (i%2 == 1 && prime[i] && prime[(i+1)/2]) {
			cul[i] = cul[i-1] + 1;
		} else {
			cul[i] = cul[i-1];
		}
	}
		
}

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int Q;
    cin >> Q;
    calc_primes();
    
    
    while (Q--) {
		int l, r;
		cin >> l >> r;
		cout << cul[r] - cul[l-1] << "\n";
	}
    
	return 0;
}


Measured memory_bytes: 1152
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
        	char[] str = scan.next().toCharArray();
        	int n = scan.nextInt();
        	int count = 0;
        	int sc = 0;
        	boolean sw = false;
        	for(int i = 0;i < n;i++){
        		char[] ring = scan.next().toCharArray();
        		sw = false;
        		for(int j = 0;j < 10;j++){
        			sc = 0;
        			for(int k = 0;k < str.length;k++){
        				if(str[k] == ring[(j+k)%10]){
        					sc++;
        				}
        				if(sc == str.length){
        					count++;
        					sw = true;
        					break;
        				}
        			}
        			if(sw){
        				break;
        			}
        		}
        	}
        	System.out.println(count);
        }
	}
}

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

int main()
{
	long long int n,id,sale,k,cnt,flg;
	while (1)
	{
		long long int outid[4001] = { 0 }, total[4001] = {0};
		cin >> n;
		if (n == 0)break;
		cnt = 0;
		flg = 0;
		for (int i = 0; i < n; i++)
		{
			cin >> id >> sale >> k;
			outid[i] = id;
			total[i] = sale*k;
		}

		for (int i = 0; i < n-1; i++)
		{
			for (int j = i+1; j < n; j++)
			{
				if (outid[i]==outid[j])
				{
					total[i] += total[j];
					cnt++;
				}
			}
		}

		for (int i = 0; i < n-cnt; i++)
		{
			if (total[i] >= 1000000)
			{
				cout << outid[i] << endl;
				flg = 1;
			}
		}

		if (flg==0)
		{
			cout << "NA" << endl;
		}
		
	}
	return 0;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll

int t, n, m, k, a[300010], q, l, r;
int cnt[1000010];

int32_t main(){
INIT
cin>>n;
for(int i=1; i<=1000000; i++){
    for(int j=i; j<=1000000; j+=i){
        cnt[j]++;
    }
}
int res=0;
for(int i=1; i<n; i++){
    res+=cnt[n-i];
}
cout<<res;
return 0;
}





Measured memory_bytes: 11464
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, M, K;
    cin >> N >> M >> K;
    long sum_A[N + 1];
    sum_A[0] = 0;
    for (int i = 1; i <= N; i++)
    {
        int A;
        cin >> A;
        sum_A[i] = sum_A[i - 1] + A;
    }
    long sum_B[M + 1];
    sum_B[0] = 0;
    for (int i = 1; i <= M; i++)
    {
        int B;
        cin >> B;
        sum_B[i] = sum_B[i - 1] + B;
    }
    int ans = -1;
    int prev_j = M;
    for (int i = 0; i <= N; i++)
    {
        long for_B = K - sum_A[i];
        for (int j = prev_j; j >= 0; j--)
        {
            if (sum_B[j] <= for_B)
            {
                ans = max(ans, i + j);
                prev_j = j;
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 6756
#include <stdio.h> 
 #include <math.h> 
 #define MAX 1000 
 
 
 int main(){ 
     int n; 
     int i, j=0, sum; 
     int score[MAX]; 
     double ave, tmp; 
     double dev[MAX]; 
 
 
     while(1){ 
         scanf("%d", &n); 
         if(n==0)break; 
         sum=0; 
        for(i=0;i<n;i++){ 
             scanf("%d", &score[i]); 
             sum+=score[i]; 
         } 
         ave=(double)sum/(double)n; 
         tmp=0.0; 
         for(i=0;i<n;i++){ 
             tmp+=pow(score[i]-ave, 2); 
         } 
         dev[j++]=sqrt(tmp/(double)n); 
     } 
     for(i=0;i<j;i++){ 
         printf("%f\n", dev[i]); 
     } 
     return 0; 
 } 



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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

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

    int r;
    std::cin >> r;
    std::cout << r * r << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
int main() {
	int a[3],temp;

	std::cin >> a[0]>>a[1]>>a[2];
	for (int i = 0; i < 3; i++) {
		for (int j = 1; j < 3; j++) {
			if (a[j] > a[j - 1]) {
				temp = a[j - 1];
				a[j - 1] = a[j];
				a[j] = temp;
			}
		}
	}

	std::cout << a[0]*10+a[1]+a[2]<< std::endl;
}

Measured memory_bytes: 256
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split('\n');

while (line = lines.shift()) {
    const numbers = line.split(' ').map(Number);

       // Edit from here
    let a = numbers[0];
    let b = numbers[1];

    if ( a === 0 && b === 0 ) { break; }

    if ( a > b ) {
        const tmp = a;
        a = b;
        b = tmp;
    } 

    const output = a + ' ' + b;
    
    console.log(output);
    // to here

}



Measured memory_bytes: 18860
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int ll;

vector<int> dp;
int find(vector<int>& arr, int i) {
	if (i < 0)
		return 1e5;

	if (i == 0)
		return 0;

	if (dp[i] != -1)
		return dp[i];

	int ans = abs(arr[i] - arr[i - 1]) + find(arr, i - 1);
	ans = min(ans, abs(arr[i] - arr[i - 2]) + find(arr, i - 2));
	dp[i] = ans;
	return ans;
}


int main() {
	int n;
	cin >> n;
	// dp.resize(n, -1);
	vector<int> arr(n);
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	// cout << find(arr, n - 1);
	dp.resize(n, 0);
	dp[0] = 0;
	dp[1] = abs(arr[0] - arr[1]);
	for (int i = 2; i < n; i++) {
		int one = dp[i - 1] + abs(arr[i] - arr[i - 1]);
		int two = dp[i - 2] + abs(arr[i] - arr[i - 2]);
		dp[i] = min(one, two);
	}
	cout << dp[n - 1];
	return 0;
}

Measured memory_bytes: 3896
n = gets.chomp.to_i
n = n.to_s[-1].to_i

hon = [2, 4, 5, 7, 9]
pon = [0, 1, 6, 8]
bon = [3]

puts 'hon' if hon.include?(n)
puts 'pon' if pon.include?(n)
puts 'bon' if bon.include?(n)


Measured memory_bytes: 14356
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let (X, Y) = get!(i64, i64);

    let ans = X + Y / 2;

    println!("{}", ans);
}

Measured memory_bytes: 4352
a,b,c=map(int,input().split())
if a%2==0:
    print(0)
elif b%2==0:
    print(0)
elif c%2==0:
    print(0)
else:
    x=max(a,b,c)
    if x==a:
        a=a//2
        da=a+1
        print(abs((a*b*c)-(da*b*c)))
    elif x==b:
        b=b//2
        db=b+1
        print(abs((b*a*c)-(db*c*a)))
    elif x==c:
        c=c//2
        dc=c+1
        print(abs((a*b*c)-(dc*a*b)))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, D;
  cin >> N >> D;
  if (N % (2 * D + 1) == 0) {
    cout << N / (2 * D + 1) << endl;
  }
  else {
    cout << (N / (2 * D + 1)) + 1 << endl;
  }
}

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

int main() {
	string S,t1,t2,rS,rt1,rt2;
	cin >> S;
	t1 = S.substr(0,(S.size()-1)/2);
	t2 = S.substr((S.size()+3)/2-1);

	rS=S, rt1=t1, rt2=t2;
	reverse(rS.begin(), rS.end());
	reverse(rt1.begin(), rt1.end());
	reverse(rt2.begin(), rt2.end());

	if(S==rS && t1==rt1 && t2==rt2)
		cout << "Yes";
	else
		cout << "No";
	cout << endl;
}

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

template< typename T > std::vector<T> make_vector(size_t a, T b) { return std::vector<T>(a, b); }
template< typename... Ts > auto make_vector(size_t a, Ts... ts) { return std::vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

int main() {
    int n, m, l;
    std::cin >> n >> m >> l;

    auto A = make_vector(n, m, 0ll);
    auto B = make_vector(m, l, 0ll);


    for (auto &a: A) for (auto &t: a) std::cin >> t;
    for (auto &b: B) for (auto &t: b) std::cin >> t;

    auto C = make_vector(n, l, 0ll);

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < l; ++j) {
            for (int k = 0; k < m; ++k) {
                C[i][j] += A[i][k] * B[k][j];
            }
        }
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < l; ++j) {
            std::cout << C[i][j] << (j + 1 == l ? "\n" : " ");
        }
    }
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)turn idx;
#define deg_to_rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad_to_deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)

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

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

// 0~50lvそれぞれのバーガーが全部で何枚か
vector<ll> layer_nums(51);

void init_layer_nums(void) {
  layer_nums[0] = (ll) 1;
  rep(i, 1, 51) {
    layer_nums[i] = (2 * layer_nums[i - 1] + (ll)3);
  }
};

// 0~50lvそれぞれのバーガーのpatteyが全部で何枚か
vector<ll> patty_nums(51);

void init_patty_nums(void) {
  patty_nums[0] = (ll) 1;
  rep(i, 1, 51) {
    patty_nums[i] = (2 * patty_nums[i - 1] + (ll) 1);
  }
};

ll solve(int N, ll X) {
  if (N == 0) {
    if (X <= 0) {
      return 0;
    } else {
      return 1;
    }
  } else if (X <= 1 + layer_nums[N - 1]) {
    return solve(N - 1, X - 1);
  } else {
    return patty_nums[N - 1] + 1 + solve(N - 1, X - 2 - layer_nums[N - 1]);
  }
};

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

  init_layer_nums();
  init_patty_nums();

  ll ans = solve(N, X);

  cout << ans << endl;
};


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) true
#define dump(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	string s,t; cin >> s >> t;
	cout << t+s << endl;
}


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

int main() {
  
  int n ; cin >> n ; 
  vector<int> vec(n); for ( int i = 0 ; i < n ; i++ ) cin >> vec[i] ; 

  int ans = 0 ;
  for (int i = 0 ; i < n-1 ; i++ ){
      
      int maxi = 0 ; 
      for ( int j = i+1 ; j < n ; j++){
          if (vec[i] < vec[j]) break ;
          else {maxi++ ; i++ ;} 
          if (maxi > ans ) ans = maxi ; 
          
        }
      }
  cout << ans  << endl;
}





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

void solve()
{
    string s,t;
    cin>>s>>t;
    int n,m,i,j,ans,count;
    n=s.size();
    m=t.size();
    ans=n;

    for(i=0;i<=n-m;i++)
    {
        count=0;
        for(j=0;j<m;j++)
        {
            if(s[i+j]==t[j])
            {
                count++;
            }
        }

        ans=min(ans,m-count);
    }

    cout<<ans;
}

int main()
{
    solve();
}

Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
double x,y,x1,y1,x2,y2,xq,yq,a,b,e,f;
char c;
while(cin>>x1){
cin>>c>>y1>>c>>x2>>c>>y2>>c>>xq>>c>>yq;
a=x2-x1;
b=y2-y1;
e=a*xq+b*yq;
f=b*(2*x1-xq)+a*(yq-2*y1);
x=(e*a+b*f)/(a*a+b*b);
y=(e*b-a*f)/(a*a+b*b);
printf("%.6f %.6f\n",x,y);
}
return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
void addself(int &a,int b){
	a+=b;
	if(a>=mod){
		a-=mod;
	}
}
void subself(int &a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
}
int main(){
	int n,k;
	cin>>n>>k;
	int dp[k+1]={0};
	dp[0]=1;
	int upto;
	for(int i=0;i<n;i++){
		cin>>upto;
		int diff[k+1]={0};
		for(int used=k;used>=0;used--){
			int l=used+1;
			int r=used+min(upto,k-used);
			int tmp=dp[used];
			if(l<=r){
				addself(diff[l],tmp);
				if(r+1<=k){
					subself(diff[r+1],tmp);
				}
			}
		}
		int prefix_sum=0;
		for(int j=0;j<=k;j++){
			addself(prefix_sum,diff[j]);
			addself(dp[j],prefix_sum);
		}
	}
	cout<<dp[k]<<endl;
}

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

// @@ !! LIM()

bool solve() {
  ll A, B, C; cin >> A >> B >> C;
  if (A == B) {
    if (A != C) return true;
    else return false;
  }else {
    if (B == C) return true;
    if (A == C) return true;
    return false;
  }
}

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);
  cout << (solve() ? "Yes" : "No") << endl;


  return 0;
}



Measured memory_bytes: 256
(defun splitat (c line)
  (labels ((rec (line acc)
				(let ((pos (position-if (lambda(cc) (char= c cc)) line)))
				  (if pos
					  (rec (subseq line (1+ pos)) (cons (subseq line 0 pos) acc))
					(nreverse (cons line acc))))))
	(rec line nil)))

(defun f(n)
  (ceiling (/ n 2)))
(let* ((line (parse-integer (read-line nil nil))))
  (format t "~A~%" (f line)))


Measured memory_bytes: 14304
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;




long long int N,D,A,X[200005],H[200005],now=0,res=0;
pair<long long int,long long int>XH[200005];
queue<pair<long long int,long long int> >PlacePower;
int main() {
	cout << fixed << setprecision(18);
	
	cin>>N>>D>>A;
	for(int i=0;i<N;i++){
		cin>>XH[i].first>>XH[i].second;
	}
	sort(XH,XH+N);
	for(int i=0;i<N;i++){
		while(!PlacePower.empty()&&PlacePower.front().first<XH[i].first){
			now-=PlacePower.front().second;
			PlacePower.pop();
		}

		XH[i].second-=now;
		
		if(XH[i].second>0){
			res+=(XH[i].second+A-1)/A;
			PlacePower.push({XH[i].first+2*D,((XH[i].second+A-1)/A)*A});
			now+=((XH[i].second+A-1)/A)*A;
		}
	}
	cout<<res;
} 

Measured memory_bytes: 6016
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

string s;

int main() {
	cin >> s;
	int state = 0;
	for (int i = 0; i < s.length(); ++i)
		if (state == 0 && s[i] == 'C')
			state = 1;
		else if (state == 1 && s[i] == 'F')
			state = 2;
	if (state == 2)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
	double number = 0;

	double count = 0;

	double answer;

	std::cin >> number;

	for (int i = 0; i < number; i++)
	{
		if ((i + 1) % 2 == 1)
		{
			count += 1;
		}
	}

	printf("%7f\n", (count/number));
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
long long int	get_digit(long long int n)
{
	long long int index = 0;
	while (n!=0)
	{
		n = n/10;
		index++;
	}
	return(index);
}

long long int	power(long long int x, long long int y)
{
	long long int index = 0;
	long long int tmp = 1;
	//only for positive long long integers
	if (y == 0)
		return (1);
	else if (x ==0)
		return (0);
	while (index < y)
	{
		tmp = tmp * x;
		index++;
	}
	return(tmp);
}

void	init_lli_arr(long long int *arr, long long int num)
{
	int i = 0;
	while (i < num)
	{
		arr[i] = 0;
		i++;
	}
}
long long int	c_p_str(long long int prime, long long int digits, long long int len, long long int q_base, long long int num)
{
	long long int r_num = 0;
	long long int index = 0;
	long long int tmp = 0;
	long long int pow_base = 1;
	if (len == digits)
	{
		if (num % prime == 0)
			return (1);
		return (0);
	}
	while (index < len - digits + 1)
	{
		tmp = num / pow_base;
		tmp = tmp%q_base;
		if(tmp%prime == 0)
		{
			r_num++;
		}
		pow_base = pow_base * 10;
		index++;
	}
	return (r_num);
}
int	main(void)
{
	long long int N, P;
	scanf("%lld %lld", &N, &P);
	char str[N+5];
	scanf("%s", str);
	long long int r_count = 0;
	long long int d = 1;
	long long int len = N;
	long long int q_base;
	if ( len < 10)
	{
		long long int num = atoll(str);
		while (d <= len)
		{
			q_base = power(10, d);
			r_count = r_count + c_p_str(P, d, len, q_base, num);
			d++;
		}
		printf("%lld\n", r_count);
		return (0);
	}
	else if (10%P == 0)
	{
		int index = 0;
		while (index < N)
		{
			if ((str[index] - '0')%P == 0)
			{
				r_count = r_count + index + 1;
			}
			index++;
		}
		printf("%lld\n",r_count);
		return(0);
	}
	else
	{
		long long int index = N -1;
		long long int qdsum[N+1];
		long long int ten = 1;
		qdsum[N]=0;
		while (index >= 0)
		{
			long long int a = (str[index] -'0') * ten % P;
			qdsum[index] = (a + qdsum[index+1]) % P;
			ten = ten * 10;
			ten = ten % P;
			index--;
		}
		long long int count_arr[P];
		init_lli_arr(count_arr, P);
		index = N;
		while (index >=0)
		{
			r_count += count_arr[qdsum[index]];
			count_arr[qdsum[index]]++;
			index--;
		}

		printf("%lld\n",r_count);
		return(0);
	}
}


Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
#include <fstream>
#include <stack>
#include <queue>
#include <string>
#include <deque>
#include <map>
#define  endl "\n"
using namespace std;

void FastInput() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
void OutputFile()
{
    freopen("output.txt","w",stdout);
}


string bigIntegr(string x,string y)
{
    string ans="";
    reverse(x.begin(),x.end());
    reverse(y.begin(),y.end());
    int result=0,carry=0,temp=0;

    for(int i=0;i<x.length();i++)
    {
        temp=x[i]-'0'+y[i]-'0';
        temp+=carry;
        result=temp%10;
        carry=temp/10;
        ans.push_back(result+'0');

    }
    if(carry>0)
        ans.push_back(carry+'0');
    reverse(ans.begin(),ans.end());
    return ans;
}



int main()
{
    string s;
    cin>>s;
    if(s=="ARC")
        cout<<"ABC"<<endl;
    else
        cout<<"ARC"<<endl;

    return 0;
}



Measured memory_bytes: 3600
a = int(input())

ac = 0
wa = 0
tle = 0
re = 0

for i in range(a):
    s = input()

    if s == "AC":
        ac += 1
    elif s == "WA":
        wa += 1
    elif s == "TLE":
        tle += 1
    else:
        re += 1
print("AC x {0}".format(ac))
print("WA x {0}".format(wa))
print("TLE x {0}".format(tle))    
print("RE x {0}".format(re))

Measured memory_bytes: 9200