akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string.h>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	int field[16][16];
	int n;
	while(cin >> n && n)
	{
		memset(field,0,sizeof(field));

		int x = n/2;
		int y = n/2 + 1;
		field[y][x] = 1;

		int count = 2;
		while(true)
		{
			if(count >  n*n)
			{
				break;
			}

			x += 1;
			y += 1;

			if(x >= n)
			{
				x = 0;
			}
			if(x < 0)
			{
				x = n-1;
			}
			if(y >= n)
			{
				y = 0;
			}
			if(y < 0)
			{
				y = n-1;
			}
			if(field[y][x] == 0)
			{
				field[y][x] = count;
				count++;
			}
			else
			{
				x -= 2;
			}
		}

		rep(i,n)
		{
			rep(j,n)
			{
				cout.width(4);
				cout << field[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1172
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use std::cmp::{max, min};
use im_rc::HashMap;

#[fastout]
fn main() {
    input! {
    n: usize,
    m: usize
    }
    let ans = if m ==n {"Yes"} else {"No"};
    println!("{}", ans);
}


Measured memory_bytes: 2132
#include <stdio.h>
#include <string.h>

int main (void)
{
    char str[11];
    char yaki[] = "YAKI";

    scanf("%s", str);

    if (strncmp(str, yaki, 4)) {
        printf("No");
    } else {
        printf("Yes");
    }

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
using P = pair<int,int>;
using pq = priority_queue<int>;
typedef long long ll;

int  main()
{
	int n;
	cin >> n;
	vector <string> s(n);
	int ac = 0;
	int wa = 0;
	int tle = 0;
	int re = 0;
	rep(i, n)
	{
		cin >> s[i];
		if (s[i] == "AC")
			ac++;
		else if (s[i] == "WA")
			wa++;
		else if (s[i] == "TLE")
			tle++;
		else if (s[i] == "RE")
			re++;
	}
	cout << "AC x " << ac << endl;
	cout << "WA x " << wa << endl;
	cout << "TLE x " << tle << endl;
	cout << "RE x " << re << endl;
	return (0);
}

Measured memory_bytes: 6424
#include <iostream>
using namespace std;
typedef long long ll;
const ll INF = 1000000000000000000;
ll n, ans = INF;
int main(void){
    // Your code here!
    cin >> n;
    for (ll i = 0; i <= n; i++) {
        ll a = i, b = n - i, res = 0;
        while(a){
            res += a % 6;
            a /= 6;
        }
        while(b){
            res += b % 9;
            b /= 9;
        }
        ans = min(ans, res);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <cstring>
#define INT long long
#define oo 987654321

using namespace std;
INT T[1<<20], n, k, base, mn = -987654321, cnt = 0;
INT getMax(int l, int r)
{
    INT ret = 0;
    while( l <= r )
    {
        if( l%2==1 ) ret = max( ret, T[l++]);
        if( r%2==0 ) ret = max( ret, T[r--]);
        l>>=1, r>>=1;
    }
    return ret;
}
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>k;
    for( base = 1 ; base < n ; base<<=1 );
    for(int i = base ; i < base+n ; i++ ) cin>>T[i];
    for(int i = base-1 ; i > 0 ; i-- ) T[i] = max( T[2*i], T[2*i+1] );
    for(int i = base ; i < base+n-1 ; i++ )
    {
        INT val = getMax(i+1, base+n-1);
        if( val - T[i] >= mn )
        {
            if( val - T[i] == mn ) cnt++;
            else mn = val - T[i], cnt = 1;
        }
    }

    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 2048
#include<iostream>
#include<stdio.h>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<time.h>
#include<cstdlib>
typedef long long ll;
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define rr rt<<1|1
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0);
#define inf 0x3f3f3f3f
#define eqs 1e-8
#define lb(x) (x&(-x))
#define ch(a) (int(a-'1')+1)
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef pair<int,int> pii;
const double pi=acos(-1);
const int maxn=500005;
//const ll Mod=1000000007;
const ll Mod=998244353;
using namespace std;

string s,ss;

int main()
{
    sync;
    ll k;
    cin>>s>>k;
    ll w=0;
    ll sum=0;
    int n=s.length();
    int f=0;
    for(int i=1;i<n;i++)
        if(s[i]!=s[i-1])
        {
            f=1;
            break;
        }
    ss=s;
    for(int i=1;i<n;i++)
    {
        if(s[i]==s[i-1])
        {
            sum++;
            s[i]='F';
        }
    }
    if(s[n-1]==s[0]&&s[n-1]!='F')
    {
        w++;
    }
    ll zx=sum*k+w*(k-1);
    
    sum=0;
    w=0;
    reverse(ss.begin(),ss.end());
    for(int i=1;i<n;i++)
    {
        if(ss[i]==ss[i-1])
        {
            sum++;
            ss[i]='F';
        }
    }
    if(ss[n-1]==ss[0]&&ss[n-1]!='F')
    {
        w++;
    }
    
    zx=min(zx,sum*k+w*(k-1));
    if(f==0)
    {
        zx=min(zx,1ll*n*k/2);
    }
    cout<<zx<<endl;
    
    return 0;
}


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

#define abs(a) (((a) < 0) ? (-(a)) : (a))
int main(void) {
    int x, a, b;
    cin >> x >> a >> b;

    if(abs(a-x) > abs(b-x)) {
        cout << "B\n";
    } else {
        cout << "A\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

#include <map>
#include <unordered_map>
#include <algorithm>
#include <vector>

#define int long long

using namespace std;
//const char a[26]={'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'};
const int maxN=50;
int dp[maxN+1][maxN+1][maxN*maxN+1];

void solver() {
    
    int n,p;
    cin>>n>>p;
    int arr[maxN];
    
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(int i=0;i<=n;i++)
    {
        dp[i][0][0]=1;
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=i;j++)
        {
            for(int k=0;k<=maxN*maxN;k++)
            {
                if(k<arr[i-1])
                {
                    dp[i][j][k]=dp[i-1][j][k];
                    continue;
                }
                dp[i][j][k]=dp[i-1][j-1][k-arr[i-1]]+dp[i-1][j][k];
            }
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        ans+=dp[n][i][p*i];
    }
    cout<<ans;
    
}


int32_t main() {
    int n=1;
    //cin>>n;
    while(n--)
    {
        solver();
    }
}


Measured memory_bytes: 28988
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define debug(x) cerr <<__LINE__<< ": " <<#x<< " = " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" = ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
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 int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int k, x;
    cin >> k >> x;
    if (k * 500 >= x) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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


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


int main(){
  int N;
  cin>>N;
  vector<int64_t> A(N);
  vector<int64_t> A_tot(100001,0);
  int64_t tot=0;
  for (int i=0; i<N; i++){
    cin>>A.at(i);
    tot+=A.at(i);
    A_tot.at(A.at(i))++;
  }
  
  int Q;
  cin>>Q;
  int64_t B,C;
  for (int i=0; i<Q; i++){
    cin>>B>>C;
    int64_t cnt=A_tot.at(B);
    tot+=cnt*(C-B);
    A_tot.at(C)+=cnt;
    A_tot.at(B)=0;
    cout<<tot<<endl;
  }
}

Measured memory_bytes: 4840
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
}init;



int main(){
  string s,t;
  while(cin >> s >> t){
    int ans = 0;
    REP(i,3) if(s[i] == t[i]) ++ans;

    cout << ans << endl;
  }


  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()

const int MOD = 1e9+7;

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

	std::vector<int> s(n);
	std::vector<int> t(m);
	rep(i,n) std::cin >> s[i];
	rep(i,m) std::cin >> t[i];

	std::vector<std::vector<int> > sum(n+1,std::vector<int>(m+1,0));
	std::vector<std::vector<int> > dp(n+1,std::vector<int>(m+1,0));
	dp[0][0] = 1;
	rep(i,n+1) sum[i][0] = 1;
	rep(i,m+1) sum[0][i] = 1;

	rep(i,n) rep(j,m) {
		if(s[i]==t[j]) {
			dp[i+1][j+1] = sum[i][j];
		}
		sum[i+1][j+1]  = (dp[i+1][j+1] + sum[i][j+1] + sum[i+1][j] - sum[i][j] + MOD) % MOD;
	}
	print(sum[n][m]);
		
	return 0;
}


Measured memory_bytes: 62976
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
	ll N, res = 0;
    cin >> N;

    for (ll i = 1; i < N; ++i){
        res += (N / i) + (N % i ? 0 : -1);
    }
    cout << res << endl;
	return 0;
}

Measured memory_bytes: 3632
import itertools
A,B,C,D = map(int,list(input()))
op = ['+', '-']

operators = list(itertools.product(op, repeat=3))

for ops in operators:
    tmp = A
    if ops[0] == '+':
        tmp += B
    if ops[0] == '-':
        tmp -= B

    if ops[1] == '+':
        tmp += C
    if ops[1] == '-':
        tmp -= C

    if ops[2] == '+':
        tmp += D
    if ops[2] == '-':
        tmp -= D

    if tmp == 7:
        res = str(A) + ops[0] + str(B) + ops[1] + str(C) + ops[2] + str(D) + '=7'
        print(res)
        exit()

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

switches = [[] for _ in range(m)]

for i in range(m):
    switches[i] = list(map(lambda x:int(x) - 1, input().split()))[1:]

p = list(map(int, input().split()))

cnt = 0

for condition in range(1 << n):
    light = True
    for i in range(m):
        oncnt = 0
        for switch in switches[i]:
            if (condition & (1 << switch)) != 0:
                oncnt += 1
        if oncnt % 2 != p[i]:
            light = False
    if light:
        cnt += 1

print(cnt)
            
        
            

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
  int s,s1,s2,s3;
  
  cin >> s;
  s1 = s/100;
  s2 = (s-s1*100)/10;
  s3 = s-s1*100-s2*10;
  
  cout << s1+s2+s3 << endl;
}

Measured memory_bytes: 3596
n = int(input())
a = list(map(int,input().split()))
odd = 0
mul2 = 0
mul4 = 0
for i in a:
    if i%4==0:mul4+=1
    elif i%2==0:mul2+=1
    else:odd+=1
ans = 'Yes'
if n==mul4+odd:
    if mul4+1<odd:ans='No'
else:
    if mul4<odd:ans='No'
print(ans)

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

#define int long long

#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second

using vint = vector<int>;
using pint = pair<int, int>;
using vpint = vector<pint>;

template <typename A, typename B>
inline void chmin(A& a, B b) {
    if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A& a, B b) {
    if (a < b) a = b;
}

template <class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>& p) {
    ost << "{" << p.first << "," << p.second << "}";
    return ost;
}

template <class T>
ostream& operator<<(ostream& ost, const vector<T>& v) {
    ost << "{";
    for (int i = 0; i < v.size(); i++) {
        if (i) ost << ",";
        ost << v[i];
    }
    ost << "}";
    return ost;
}

inline int topbit(unsigned long long x) {
    return x ? 63 - __builtin_clzll(x) : -1;
}

inline int popcount(unsigned long long x) {
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x) {
    return __builtin_parity(x);
}

struct UnionFindTree {
    vector<int32_t> par, sz;
    UnionFindTree(int32_t n = 0) : par(n), sz(n) {
        for (int32_t i = 0; i < n; i++) {
            par[i] = i;
            sz[i] = 1;
        }
    }
    int32_t find(int32_t x) {
        return x == par[x] ? x : par[x] = find(par[x]);
    }
    void unite(int32_t x, int32_t y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (sz[x] < sz[y]) swap(x, y);
        sz[x] += sz[y];
        par[y] = x;
    }
    bool same(int32_t x, int32_t y) {
        return find(x) == find(y);
    }
    int32_t size(int32_t x) {
        return sz[find(x)];
    }
};

signed main() {
    int N, M;
    cin >> N >> M;
    UnionFindTree uf(N);
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        uf.unite(a, b);
    }

    int ans = 0;
    rep(i, N) chmax(ans, uf.size(i));
    cout << ans << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

ll n, K;
vector<ll> unzipx, unzipy, unzipz;
int x, y, z;
vector<ll>  bx, by, bz, ex, ey, ez;
int sum[105][105][105];

int press(vector<ll>& v1, vector<ll>& v2,vector<ll>& unzip) {
	auto t1 = v1, t2 = v2;
	t1.insert(t1.end(), t2.begin(), t2.end());
	sort(t1.begin(), t1.end());
	t1.erase(unique(t1.begin(), t1.end()), t1.end());
	for (int i = 0; i < v1.size(); i++) {
		ll tmp = lower_bound(t1.begin(), t1.end(), v1[i]) - t1.begin();
		unzip[tmp] = v1[i];
		v1[i] = tmp;
	}

	for (int i = 0; i < v2.size(); i++) {
		ll tmp = lower_bound(t1.begin(), t1.end(), v2[i]) - t1.begin();
		unzip[tmp] = v2[i];
		v2[i] = tmp;
	}
	
	return t1.size();
}

int main() {
	unzipx.resize(55 * 3), unzipy.resize(55 * 3), unzipz.resize(55 * 3);
	cin >> n >> K;
	for (int i = 0; i < n; i++) {
		ll a, b, c, d, e, f;
		cin >> a >> b >> c >> d >> e >> f;
		bx.push_back(a), by.push_back(b), bz.push_back(c);
		ex.push_back(d), ey.push_back(e), ez.push_back(f);
	}
	x = press(bx, ex, unzipx), y = press(by, ey, unzipy), z = press(bz, ez, unzipz);
	// ?´?????????????
	ll ans = 0;
	for (int i = 0; i < bx.size(); i++) {
		for (int j = bx[i]; j < ex[i]; j++) {
			for (int k = by[i]; k < ey[i]; k++) {
				for (int l = bz[i]; l < ez[i]; l++) {
					sum[j][k][l]++;
				}
			}
		}
	}
	for (int i = 0; i < x - 1; i++) {
		for (int j = 0; j < y - 1; j++) {
			for (int k = 0; k < z - 1; k++) {
				if (sum[i][j][k] >= K) {
					ans += ((unzipx[i + 1] - unzipx[i]) * (unzipy[j + 1] - unzipy[j]) * (unzipz[k + 1] - unzipz[k]));
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7044
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
 	int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int x = sc.nextInt();
    
    int count = 0;
    
    // 500円
    for(int i = 0; i <= a; i++){
      
      // 100円
      for(int j = 0; j <= b; j++){
        
        // 50円
        for(int k = 0; k <= c; k++){
          
          if(((i * 500) + (j * 100) + (k * 50)) == x){
            count++;
          }
          
        }
        
      }
      
    }
    
    System.out.println(count);
  }

}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  // 変数の宣言
  int y =48; //12月30日0時から次の年までの時間(24h)
  int m;
  
  //値の取得
  cin >> m;
  
  //出力
  cout << y-m;
}

Measured memory_bytes: 256
k, s = map(int, input().split())
res = 0
for x in range(k + 1):
    if (s - x) < 0:
        break
    for y in range(0, s - x + 1):
        if (s - x - y) < 0:
            break
        z = s - y - x
        if z >= 0 and x <= k and y <= k and z <= k:
            #print("{0}, {1} {2}".format(str(x), str(y), str(z)))
            res += 1
print(res)



Measured memory_bytes: 41196
unittest
{
	assert( [ "2" ].parse.expand.solve == 1 );
	assert( [ "13" ].parse.expand.solve == 78 );
	assert( [ "1" ].parse.expand.solve == 0 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	return tuple( n );
}

auto solve( long n )
{
	return ( n - 1 ) * n / 2;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
#include <cctype>
using namespace std;
using ll = long long;
const int mod = 1000000007;

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);};//最小公倍数
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//typedef pair<ll,ll> A;
//vector<A> pc;
//int ABS(int a){return max(a,-a);}
//ll a[100000];
//ll dom[100001];

int main(){
  ll h,n;
  cin>>h>>n;
  ll a[n];
  ll ans=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    ans+=a[i];
  }
  if(ans>=h) cout<<"Yes";
  else cout<<"No";
  return 0;
}

Measured memory_bytes: 1024
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<P> VP;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

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

#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RLFOR(i,b,a) for(ll i=(b)-1;i>=(a);--i)

#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define dump(x) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";
#define dump2(x,y) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x)\
			<< " , " << #y << " = " << (y) << "\n";

const int INF = 1e9;
const double EPS = 1e-10;

int n,m;
ll k;
string s;

int main() {
	cin >> n>>m;
	//	REP(i, n){
	//	}
	//	REP(i, n){
	//	}
	
	int a=1;
	REP(i,n){
		if(a*2>a+m){
			a+=m;
		}else a*=2;
	}

	int ans = 0;

	cout << a;
	cout << endl;
}


Measured memory_bytes: 256
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main(){
    
    int n;
    cin>>n;
    
    if(n%2==0){
        cout<<n<<endl;
    }else{
        cout<<n*2<<endl;
    }
    
    
    return 0;
}








Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {

        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();

        int[] array_a = new int[3000];
        int[] array_b = new int[3000];
        int i;
        for(i = 0; (a != 0) || (b != 0); i++){
            array_a[i] = a;
            array_b[i] = b;
            a = scan.nextInt();
            b = scan.nextInt();
        }

        int j;
        for(j = 0; j < i; j++){
            sort_and_print(array_a[j], array_b[j]);
        }
    }

    public static void sort_and_print(int a, int b){
        int tmp;
        if(a > b){
            tmp = a;
            a = b;
            b = tmp;
        }

        System.out.println(a + " " + b);
    }
}



Measured memory_bytes: 36124
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>

#define rep(i,p) for(int i=1;i<=p;i++)
#define ll long long

using namespace std;

int main(){

   ll int A,B;
   cin >> A >> B;
   cout << A*B;










	return 0;

}



Measured memory_bytes: 3624
<?php

fscanf(STDIN, '%d %d', $n, $d);

$count = 0;
for ($i = 0; $i < $n; $i++) {
  fscanf(STDIN, '%d %d', $x, $y);
  
  if (sqrt($x * $x + $y * $y) <= $d) {
    $count++;
  }
}

echo $count . PHP_EOL;


Measured memory_bytes: 16100
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
def ddprint(x):
  if DBG:
    print(x)

a = inn()
b = inn()
c = inn()
d = inn()
e = inn()
k = inn()
print(':(' if e-a > k else 'Yay!')


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

int main(){
    int x; cin>>x;
    if(x <=599){
        cout << 8 << endl; return 0;
    }
    if(x <=799){
        cout << 7 << endl; return 0;
    }
    if(x <=999){
        cout << 6 << endl; return 0;
    }
    if(x <=1199){
        cout << 5 << endl; return 0;
    }
    if(x <=1399){
        cout << 4 << endl; return 0;
    }
    if(x <=1599){
        cout << 3 << endl; return 0;
    }
    if(x <=1799){
        cout << 2 << endl; return 0;
    }
    if(x <=1999){
        cout << 1 << endl; return 0;
    }
}


Measured memory_bytes: 3620
n = int(input())

arr = list(map(int, input().split()))
arr.sort()

ans = 0

for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if (arr[i] != arr[j]) and (arr[j] != arr[k]) and (arr[i] != arr[k]):
                if (arr[i]+arr[j]) > arr[k]:
                    ans += 1
                
print(ans)

Measured memory_bytes: 9104
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;

int main() {
  int N;
  cin >> N;
  REPS(i, 1, 10) {
    if(N % i == 0) {
      int r = N / i;
      if(r >= 1 && r <= 9) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define pb push_back
#define xx first
#define yy second
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define repp(i,k,n) for(int i=k;i<n;i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> iv;
typedef pair<int,int> iip;
typedef map<int,int> mii;
template <typename T>
void dbg(T t){cerr<<t<<endl ;}
template<typename T, typename... Args>
void dbg(T t, Args... args) {cerr << t <<" ";dbg(args...) ;}
int main(){	
	int a,b;
	map<int,int>m;
	cin>>a;
	rep(i,a){
		cin>>b;
		m[b]++;
		m[b-1]++;
		m[b+1]++;
	}
	int ans = 0;
	for(auto d:m){
		ans = max(ans,d.second);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4736
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int N, K;
	int h[100000];
	cin >> N >> K;
	for (int i = 0; i < N; i++) cin >> h[i];
	sort(h, h + N);

	int max = h[K-1] , min = h[0];
	int result = max - min;
	for (int i = 1; i <= N - K; i++) {
		max = h[i+K-1];
		min = h[i];
		if (result > (max - min)) {
			result = max - min;
		}
	}
	cout << result << endl;
	return 0;
}


Measured memory_bytes: 640
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

S = gets.chomp

hash = Hash.new(0)

S.split('').each do |s|
  hash[s] += 1
end

puts (hash.keys.length == 2 && hash.values.all? { |v| v == 2 }) ? 'Yes' : 'No'



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

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

static const int COUNTER_CLOCKWISE=1;
static const int CLOCKWISE=-1;
static const int ONLINE_BACK=2;
static const int ONLINE_FRONT=-2;
static const int ON_SEGMENT=0;

class Point {
public:
    double x,y;

    Point(double x=0,double y=0):x(x),y(y) {}
    Point operator + (Point p) {return Point(x+p.x,y+p.y);}
    Point operator - (Point p) {return Point(x-p.x,y-p.y);}
    Point operator * (double a) {return Point(a*x,a*y);}
    Point operator / (double a) {return Point(x/a,y/a);}

    double abs() {return sqrt(norm());}
    double norm() {return x*x+y*y;}

    bool operator<(const Point &p) const {
        return x!=p.x ? x<p.x : y<p.y;
    }
    bool operator==(const Point &p) const {
        return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
    }
};

typedef Point Vector;
struct Segment {Point p1,p2;};
typedef Segment Line;

class Circle {
public:
    Point c;
    double r;
    Circle(Point c=Point(),double r=0.0): c(c),r(r) {}
};

double dot(Vector a,Vector b) {
    return  a.x*b.x+a.y*b.y;
}

double cross (Vector a,Vector b) {
    return a.x*b.y-a.y*b.x;
}

double getDistance(Point a,Point b) {
    return (a-b).abs();
}

double getDistanceLP(Line l,Point p) {
    return abs(cross(l.p2-l.p1,p-l.p1)/(l.p2-l.p1).abs());
}

double getDistanceSP(Segment s,Point p) {
    if(dot(s.p2-s.p1,p-s.p1)<0.0) return (p-s.p1).abs();
    if(dot(s.p1-s.p2,p-s.p2)<0.0) return (p-s.p2).abs();
    return getDistanceLP(s,p);
}

int ccw(Point p0,Point p1,Point p2) {
    Vector a=p1-p0;
    Vector b=p2-p0;
    if(cross(a,b)>EPS) return COUNTER_CLOCKWISE;
    if(cross(a,b)<-EPS) return CLOCKWISE;
    if(dot(a,b)<-EPS) return ONLINE_BACK;
    if(a.norm()<b.norm()) return ONLINE_FRONT;
    return ON_SEGMENT;
}

bool intersect(Point p1,Point p2,Point p3,Point p4) {
    return (ccw(p1,p2,p3)*ccw(p1,p2,p4)<=0 && ccw(p3,p4,p1)*ccw(p3,p4,p2)<=0);
}

int main(void) {
    int q;cin>>q;
    while(q) {
        Point p1,p2,p3,p4;
        cin>>p1.x>>p1.y>>p2.x>>p2.y>>p3.x>>p3.y>>p4.x>>p4.y;
        if(intersect(p1,p2,p3,p4)) cout<<1<<endl;
        else cout<<0<<endl;
        q--;
    }
    return 0;
}

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

#define pi 3.1415926535
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define llu unsigned long long
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define tc int test_case; cin >> test_case; while(test_case--)
#define f(i,a,n) for(int i = a ; i < n ; i++)
#define rf(i,n,a) for(int i = n-1 ; i >= a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define fast ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(x) cout << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cout<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = inf + 7;
const int N = 2e5 + 10;

int main()
{
    fast;
    int n;
    cin >> n;

    int x = (n+1000-1)/1000;
    cout << x*1000 - n;
}




Measured memory_bytes: 3660
import sys
from collections import Counter, deque, defaultdict
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
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()))

n, m = MAP()
bef = []
for i in range(n):
    a, b = MAP()
    bef.append([a, b])
candi = []
res = 0
heapq.heapify(bef)
heapq.heapify(candi)

for i in range(m):
    while True:
        if len(bef) == 0:
            break
        temp = heapq.heappop(bef)
        if temp[0] > i+1:
            heapq.heappush(bef, temp)
            break
        heapq.heappush(candi, temp[1] * -1)
    if len(candi) != 0:
        res += heapq.heappop(candi)*-1

print(res)




Measured memory_bytes: 114264
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
vector<vector<ll>> G;
vector<bool> seen;
struct UnionFind{
  vector<ll> par,siz;
  
  UnionFind(ll N):par(N+1),siz(N+1,1){
    for(int i=0; i<=N; i++)
      par[i]=i;
  }
  
  void mkpar(ll n, ll pre, ll set){
    for(auto next_n: G[n]){
      if(seen[next_n]) continue;
      seen[next_n]=true;
      par[next_n]=set;
      mkpar(next_n, n, set);
    }
  }
  
  ll root(ll x){
    if(par[x]==x)
      return x;
    return par[x]=root(par[x]);
  }
  
  void unite(ll x, ll y){
    ll rx=root(x), ry=root(y);
    if(rx==ry)
      return;
    par[ry]=rx;
    siz[rx]+=siz[ry];    
  }
  
  bool issame(ll x, ll y){
    return root(x)==root(y);
  }
  
  ll size(ll x){
    return siz[root(x)];
  }
};
//N^2のグラフはメモリオーバーしそう
//三角関係調べてブロックじゃなければ加算かな
//DFS?
//全探索は無理
//1-2-3-4-5
//1-2-3 のとき3-1 -4のとき、4-1 4-2 -5のとき5-1 5-2 5-3
//あとでループしてる場合が考慮もれか
//逆に出す？UnionFind
//1塊だとして、N*(N-1)/2のつながり？
//1-2-3-4-5
//par[1]=1 par[2]=1...par[5]=1
//sze[1]=5
//つながりの数はもともとカウントできる
//fr[1]=1 fr[2]=2 fr[3]=2...
//siz-fr-1(自身）-blが答えか。
//1 5
//2 5
//3 5
//4 5 のとき
//根つき木じゃないのか。3者つながってることもある。
//とりあえずなんかつなげときゃ、rootで根にいきつけるか。
//1-3-2のばあいがどうしても　par[3]=1　のあと par[3]=2にうわがく
//ただただ最小値とればいいかな
//DFSで親とればいいかも
//1だけ初期とって、2以降は、自身が親だったら探索で。
//ああ、もともと友達の可能性がない間柄でブロックだとひきすぎるのか
//同じユニオンか判定
int main(){
  ll N,M,K; cin>>N>>M>>K;
  G.assign(N+1, vector<ll>(0,0));
  seen.assign(N+1,false);
  vector<ll> ans(N+1,-1);
  vector<vector<ll>>br(K,vector<ll>(2,0));
  for(int i=0; i<M; i++){
    ll a,b; cin>>a>>b;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
    ans[a]--, ans[b]--;
  }
  for(int i=0; i<K; i++){
    ll c,d; cin>>c>>d;
    br[i][0]=c, br[i][1]=d;
  }
  UnionFind tree(N);
  vector<ll> siz(N+1,0);
  for(int i=1; i<=N; i++) if(tree.par[i]==i) tree.mkpar(i,i,i);
  for(int i=1; i<=N; i++) siz[tree.root(i)]++;
  for(int i=1; i<=N; i++) ans[i]+=siz[tree.par[i]];
  for(int i=0; i<K; i++) if(tree.issame(br[i][0], br[i][1])) ans[br[i][0]]--, ans[br[i][1]]--;  
  for(int i=1; i<=N; i++){
    cout<<ans[i];
    if(i<N) cout<<" ";
  }
}

Measured memory_bytes: 15744
using System;

public class Hello
{
    static int[] coin = new int[] { 10, 50, 100, 500 };
    public static void Main()
    {
        var first = true;
        while (true)
        {
            var a = int.Parse(Console.ReadLine().Trim());
            if (a == 0) break;
            string[] line = Console.ReadLine().Trim().Split(' ');
            var ca = Array.ConvertAll(line, int.Parse);
            var cv = 0;
            for (int i = 0; i < 4; i++) cv += ca[i] * coin[i];
            var cb = getChenge(cv -a);
            print(ca, cb, first);
            if (first) first = false;
        }
    }
    public static void print(int[] a, int[] b, bool first)
    {
        if (!first) Console.WriteLine();
        for (int i = 0; i < 4; i++)
        {
            var w = a[i] - b[i];
            if (w >= 1) Console.WriteLine("{0} {1}", coin[i], w);
        }
    }
    public static int[] getChenge(int a)
    {
        var temp = a;
        var ret = new int[4];
        for (int i = 3; i >= 0; i--)
        {
            ret[i] = temp / coin[i];
            temp = temp % coin[i];
        }
        return ret;
    }
}


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

int main(){
    int n,ans,len,res;
    ans = 0;

    cin >> n;
    vector<int> vec(n);
    for (int i = 0; i < n; i++) cin >> vec[i];
    if(n > 2){
        for(int i = 0; i < n; i++){
            for(int j = i + 1; j < n; j++){
                for(int k = j + 1; k < n; k++){
                    len = vec[i] + vec[j] + vec[k]; 
                    res = max(vec[i],max(vec[j],vec[k]));
                    if(vec[i] != vec[j] && vec[j] != vec[k] && vec[i] != vec[k] && len - res > res){
                        ans++;  
                    }

                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define MOD 1000000007
#define endl "\n"
#define ff first
#define ss second
int lcm(int a,int b)
{
    int p=1;int ans=1;
    while(p<=b)
    {

        if((a%p==0)&&(b%p==0)){
            ans=p;
            //cout<<p<<endl;
        }
        p++;
    }
    return ((a*b)/ans);
}
void solve1();
void solve()
{
    int t;cin>>t;
    while(t--)
    {
        solve1();
    }
}
int main()
{
    solve1();
    return 0;
}
void solve1()
{
    int x;cin>>x;
    int ans=lcm(360,x);
    int ans2=ans/x;
    cout<<ans2<<endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n;
ll a[200001];
int main()
{
    cin >> n;
    for(ll i = 1;i <= n;i ++) cin >> a[i];
    sort(a + 1,a + 1 + n);
    for(ll i = 2;i <= n;i ++)
    {
        if(a[i] == a[i - 1])
        {
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
    return 0;
}


Measured memory_bytes: 1792
//https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_f
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class reverse_range {private:struct I {int x;int operator*() {return x-1;}bool operator!=(I& lhs) {return x>lhs.x;}void operator++() {--x;}};I i, n;public:reverse_range(int n) :i({ 0 }), n({ n }){}reverse_range(int i, int n) :i({ i }), n({ n }){}I& begin() {return n;}I& end() {return i;}};
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }reverse_range operator!(){return reverse_range(*i,*n);}};

LL dp[4123][4123];
constexpr int mod =998244353;
LL RS[2123];
int main(){
    string s;
    cin>>s;
    int n=s.size();
    dp[0][0]=1;
    for(int i:range(n)){
        int r=s[i]-'0';
        RS[i+1]=RS[i]+r;
    }
    for(int i:range(1,2*n+1)){
        int rs=RS[min(i,n)];
        int cs=2*min(i,n)-RS[min(i,n)];
        for(int j:range(i+1)){
            int r=j;
            int c=i-j;
            if(r<=rs&&r>0){
                dp[r][c]+=dp[r-1][c];
            }
            if(c<=cs&&c>0){
                dp[r][c]+=dp[r][c-1];
            }
            dp[r][c]%=mod;
        }
    }
    cout<<dp[RS[n]][2*n-RS[n]]<<endl;
    return 0;
}

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

long a[222];
int main() {
    int x;
    cin >> x;
    for(int i = 0; i < 120; i++)
        a[i] = long(i) * i * i * i * i;
    for(int i = 0; i < 120; i++)
        for(int j = 0; j < i; j++) {
            if(a[i] - a[j] == x) {
                cout << i << ' ' << j << endl;
                return 0;
            }
            if(a[i] + a[j] == x) {
                cout << i << ' ' << -j << endl;
                return 0;
            }
        }
    return 0;
}


Measured memory_bytes: 3644
import math

x1, y1, x2 , y2 = map(int, input().split())

zx = x1 - x2
zy = y1 - y2

thita = - math.pi/2
x3 = zy + x2
y3 = -zx + y2

x4 = zy + x1
y4 = -zx + y1

print(x3, y3, x4, y4)

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

int main() {
  string s, t;
  cin >> s >> t;
  map<char,char> st,ts;
  int N = s.size();
  for (int i = 0; i < N; i++) {
    if (!st.count(s[i]) && !ts.count(t[i])) {
      st[s[i]] = t[i];
      ts[t[i]] = s[i];
    }
    else if (st[s[i]] != t[i] || ts[t[i]] != s[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 3908
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string N = Console.ReadLine();

            string ans = "Yes";
            int sum = 0;

            for (int i = 0; i < N.Length ; i++)
            {
                sum += int.Parse(N[i].ToString());
            }

            if (sum % 9 == 0) ans = "Yes";
            else ans = "No";
            Console.WriteLine($"{ans}");
        }
    }
}


Measured memory_bytes: 32756
/* Contest */
#include<bits/stdc++.h>
#define all(s) (s).begin(),(s).end()
#define rall(s) (s).rbegin(),(s).rend()
#define sep ios::sync_with_stdio(0),cin.tie(0)
using namespace std;
typedef long long ll;
int main()
{	
	sep;
	ll n,m;
	cin>>n>>m;
	n%=m;
	cout<<min(n,abs(n-m));



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =999999999;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




//10億7。　　　100000007
//2*2行列 H*W
//vector<vector<int>> vec(H,vector<int>(W));
//for(int i=0;i<H;i++){
//for(int j=0;j<W;j++){
//cin>>vec[i][j];
//  }
//}

//文字列→数列
//string S;int A=atoi(S.c_str());
//数列→文字列
//int A;string S=to_string(A);
//数字判定　isdigit(a)
//pair宣言　pair<int,int> p(5,7);
//ソート　sort(vec.begin(),vec.end());



int main(){
cout<<fixed<<setprecision(10);

int N;cin>>N;
  if(N==1){
    cout<<"Hello World"<<endl;
  }else if(N==2){
    int A,B;cin>>A>>B;
    cout<<A+B<<endl;
  }
  
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char a[55][55],b[55][55];
    memset(b,0,sizeof(b));
    int H,W,i,j;
    while(~scanf("%d%d",&H,&W))
    {
        getchar();
        for(i=0; i<H; i++)
        {
            scanf("%s",a[i]);
        }
        for(i=0; i<H; i++)
            for(j=0; j<W; j++)
            {
                b[i+1][j+1]=a[i][j];
            }
        memset(a,0,sizeof(a));
        for(i=1; i<H+1; i++)
            for(j=1; j<W+1; j++)
            {
                if(b[i][j]=='#')
                {
                    a[i-1][j-1]++;
                    a[i-1][j]++;
                    a[i-1][j+1]++;
                    a[i][j+1]++;
                    a[i+1][j+1]++;
                    a[i+1][j]++;
                    a[i+1][j-1]++;
                    a[i][j-1]++;
                }
            }
        for(i=1; i<H+1; i++)
            for(j=1; j<W+1; j++)
            {
                if(b[i][j]=='#')
                {
                    a[i][j]=b[i][j];
                }
            }
        for(i=1; i<H+1; i++)
            for(j=1; j<W+1; j++)
            {
                if(a[i][j]=='#')
                    printf("%c",a[i][j]);
                else
                    printf("%d",a[i][j]);
                if(j==W)
                    printf("\n");
            }
    }
}


Measured memory_bytes: 128
import scala.util.control.Breaks._

object Main extends App {
  val s = scala.io.StdIn.readLine()
  val t = scala.io.StdIn.readLine()

  var memo = Map[Char, Char]()

  breakable {
    s.zip(t)
      .foreach({
        case (x, y) =>
          if (memo.isDefinedAt(x)) {
            if (memo(x) != y) {
              println("No")
              break()
            }
          } else {
            memo += (x -> y)
          }
      })

    if (memo.values.size == memo.values.toList.distinct.size) {
      println("Yes")
    } else {
      println("No")
    }
  }
}


Measured memory_bytes: 42148
//Author: AnandRaj doubleux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test(t) int t;cin>>t;while(t--)
#define forn(i,f,n) for(int i=f;i<f+n;i++)
#define rforn(i,l,n) for(int i=l;i>l-n;i--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int i=f;i<f+n;i++) cin>>V[i]
#define what(x) cerr<<#x<<" = "<<x<<endl

const int MOD = 1e9+7,MAX = 1e5+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            	is_prime[j] = false;
    	}
	}
}
//////////////////Sieve////////////////////

ll INv(ll x)
{
	return powN(x,MOD-2);
}

vl F(MAX);
vl I(MAX);

ll C(ll n,ll r)
{
	return (((F[n]*I[r])%MOD)*I[n-r])%MOD;
}

int main()
{	
	ll n,k;
	cin>>n>>k;
	F[0]=1;
	I[0]=1;
	for(ll i=1;i<MAX;i++) {F[i]=(i*F[i-1])%MOD;I[i]=INv(F[i]);}
	vl A(n+1);
	take(A,1,n);
	sort(A.begin()+1,A.end());
	ll sum=0;
	for(ll i=k;i<=n;i++)
	{
		sum+=(C(i-1,k-1)*A[i])%MOD;
		sum%=MOD;
	}
	for(ll i=1;i+k-1<=n;i++)
	{
		sum=sum-(C(n-i,k-1)*A[i])%MOD;
		if(sum<0) sum+=MOD;
		sum%=MOD;
	}
	cout<<sum<<endl;

}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <unordered_set>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


ll dp[1100000][2];
int main() {
	REP(i, 1100000)REP(k, 2)dp[i][k] = INF;
	dp[0][0] = 0;
	string s;
	cin >> s;
	reverse(ALL(s));
	REP(i, 3)s.push_back('0');
	REP(i, s.size()) {
		REP(j, 10) {
			REP(k, 2) {
				ll nx = j + s[i] - '0';
				if (k)nx++;
				bool ok = false;
				if (nx >= 10) {
					ok = true;
					nx -= 10;
				}
				dp[i + 1][ok] = min(dp[i + 1][ok], dp[i][k] + j + nx);
			}
		}
	}
	cout << min(dp[s.size()][0], dp[s.size()][1]) << endl;
}



Measured memory_bytes: 18692