akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

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

struct SegTree {
  int size;
  vector<ll> pos;
  SegTree(ll N) { size = 1; while(size<N) size<<=1; pos.resize(2*size,0); }
  ll operator[](const ll &x) const { return pos[x+size]; }

  void build() { per(i,size) operate(i); }
  void set(ll x, const ll v) { pos[x+size] = v; }
  void update(ll x, const ll v) { set(x,v); x+=size; while (x>>=1) operate(x); }
  ll query(ll a, ll b) {
    ll L = 0, R = 0;
    for (a+=size, b+=size; a<b; a>>=1, b>>=1) {
      if (a&1) { L = q(L,pos[a]); a++; }
      if (b&1) { b--; R = q(R,pos[b]); }
    }
    return q(L,R);
  }
  void operate(ll i) { pos[i] = pos[i*2] + pos[i*2+1]; }
  ll q(ll x, ll y) { return x + y; }
};

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

struct ball { int num; int i; };

int main() {
  int N; cin >> N;
  ball black[N], white[N];
  rep(i,2*N) {
    char c; cin >> c;
    int a; cin >> a; a--;
    if (c=='B') black[a] = {a,i};
    else white[a] = {a,i};
  }

  int wnum[2*N][N+1] = {}, bnum[2*N][N+1] = {};
  rep(i,N) {
    repr(j,white[i].i,2*N) wnum[j][white[i].num+1] = 1;
    repr(j,black[i].i,2*N) bnum[j][black[i].num+1] = 1;
  }
  rep(i,2*N) repr(j,1,N+1) { wnum[i][j] += wnum[i][j-1]; bnum[i][j] += bnum[i][j-1]; }
  // rep(i,2*N) debug(wnum[i],wnum[i]+N+1); cout << endl;
  // rep(i,2*N) debug(bnum[i],bnum[i]+N+1); cout << endl;

  int dp[N+1][N+1] = {}; rep(i,N+1) fill_n(dp[i],N+1,INF); dp[0][0] = 0;
  rep(i,N+1) rep(j,N+1) {
    if (i!=0) dp[i][j] = min(dp[i][j],dp[i-1][j]+max(0,white[i-1].i-wnum[white[i-1].i][i-1]-bnum[white[i-1].i][j]));
    if (j!=0) dp[i][j] = min(dp[i][j],dp[i][j-1]+max(0,black[j-1].i-wnum[black[j-1].i][i]-bnum[black[j-1].i][j-1]));
  }
  // rep(i,N+1) debug(dp[i],dp[i]+(N+1));
  int result = dp[N][N];
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 78464
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long K = sc.nextLong();
        
        long a = N % K;
        long b = -(N % K - K);
        
        if(a < b) {
            System.out.println(a);
        }else {
            System.out.println(b);
        }
    }
}


Measured memory_bytes: 21204
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define P(s)     cout<<(s)<<endl
#define vi   vector<int>
#define vvi  vector<vi >
#define vvvi vector<vvi >
#define pii  pair<int,int>
#define INF  (int)1e9
#define MOD  (int)1e9+7
typedef long long llong;
using namespace std;

int main(){
	int n;
	llong k;
	cin>>n>>k;
	
	vector<pii> ab(n);
	REP(i,n){
		int a,b;
		cin>>a>>b;
		ab[i]=make_pair(a,b);
	}
	sort(ALL(ab));
	
	REP(i,n){
		if(k-ab[i].second<=0){
			P(ab[i].first);
			break;
		}else{
			k-=ab[i].second;
		}
	}
}

Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;

int main()
{
  int n, k, i, j;
  int h[100000];
  int dp[100000];
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> h[i];
    dp[i] = 0;
  }
  for (i = 1; i < n; i++) {
    int m = 1000000000;
    for (j = 1; j <= min(k, i); j++) {
      if ((dp[i-j] + abs(h[i]-h[i-j])) < m)
          m = dp[i-j] + abs(h[i]-h[i-j]);
    }
    dp[i] = m;
  }
  cout << dp[n-1] << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <cmath>
 
using namespace std;
 
// typedef
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<string> vs;
 
// container util
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for (typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
// repetition
#define FOR(i,m,n) for (ll (i) = ((ll) m); (i) < ((ll) n); ++(i))
#define RFOR(i,m,n) for (ll (i) = ((ll) (m)-1); (i) >= ((ll) n); --(i))
#define REP(i,n) FOR(i,0,n)
 
// i/o
#define TFOUT(b,t,f) cout << ((b)? (t) : (f)) << endl
 
//constant
const double    EPS     = 1e-10;
const double    PI      = acos(-1.0);
const int       INFTY   = (1<<21);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

inline bool is_ok(int i, int j, const vector<string>& grid, int h, int w) {
    if (grid[i][j] != '#') return true;
    vector<int> di = {1, 0, -1, 0}, dj = {0, 1, 0, -1};
    bool ret = false;
    REP(t, 4) {
        int i_n = i + di[t], j_n = j + dj[t];
        if (
            0 <= i_n && i_n < h &&
            0 <= j_n && j_n < w &&
            grid[i_n][j_n] == '#'
        ) {
            ret = true;
            break;
        }
    }
    return ret;
}

int main() {
    vector<string> grid;
    int h, w; cin >> h >> w;
    REP(i, h) {
        string s; cin >> s;
        grid.push_back(s);
    }

    bool ans = true;
    REP(i, h) {
        REP(j, w) {
            if (!is_ok(i, j, grid, h, w)) {
                ans = false;
                break;
            }
        }
    }

    TFOUT(ans, "Yes", "No");
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
    string s,t,u;
    cin >> s >> t;
    int a,b;
    cin >> a >> b;
    cin >> u;
    if(u == s) cout << a-1 << " " << b << endl;
    else cout << a << " " << b-1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  
  int x;
  x = a * b % 2;
  if (x == 0){
    cout << "Even" << endl;
  } else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int D;
  cin >> D;
  vector<int> c(26);
  for (int &x : c) cin >> x;
  vector<vector<int>> s(D, vector<int>(26));
  for (auto &x : s) {
    for (int &y : x) cin >> y;
  }
  vector<int> t(D);
  for (int &x : t) {
    cin >> x;
    --x;
  }
  
  vector<vector<int>> last(D, vector<int>(26, -1));
  for (int d = 0; d < D; ++d) {
    if (d == 0) {
      last.at(d).at(t.at(d)) = d;
      continue;
    }
    for (int i = 0; i < 26; ++i) {
      if (t.at(d) == i) {
        last.at(d).at(i) = d;
      } else {
        last.at(d).at(i) = last.at(d-1).at(i);
      }
    }
  }
  vector<int> v(D);
  v.at(0) = s.at(0).at(t.at(0));
  for (int i = 0; i < 26; ++i) {
    v.at(0) -= c.at(i) * (0 - last.at(0).at(i));
  }
  for (int d = 1; d < D; ++d) {
    v.at(d) = v.at(d-1) + s.at(d).at(t.at(d));
    for (int i = 0; i < 26; ++i) {
      v.at(d) -= c.at(i) * (d - last.at(d).at(i));
    }
  }

  for (int i = 0; i < D; ++i) {
    cout << v.at(i) << endl;
  }
  return 0;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
template<class itr, class itr2> bool next_sequence2(itr first, itr last, itr2 first2, itr2 last2){ itr now = last; itr2 now2 = last2; while(now != first){ now--, now2--; (*now)++; if((*now) == (*now2)){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int N;
    string S, T;
    cin >> N >> S >> T;
    for(int i = 0; i < N; i++){
        cout << S[i] << T[i];
    }
    cout << endl;
}




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

#include <algorithm>
#include <numeric>
#include <math.h>

using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

///////////////////////////////////////////////////
// -------------------- I/O -------------------- //
///////////////////////////////////////////////////
// https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords
template<typename T> void outputVec(const std::vector<T>& vec, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	for (typename std::vector<T>::const_iterator it = vec.begin(); it != vec.end() - 1; ++it) { std::cout << *it << " "; }
	std::cout << *(vec.end() - 1) << "\n";
}
template<typename T> void outputVal(const T& res, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	std::cout << res << "\n";
}
template<typename T> T inputVal() { T a; std::cin >> a; return a; }
template<typename T> std::vector<T> inputVec(T N) {
	std::vector<T> vec(N);
	for (typename std::vector<T>::iterator it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
	return vec;
}
template<typename T> void inputVec(std::vector<T>& vec) {
	for (typename std::vector<T>::iterator it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
}

///////////////////////////////////////////////////
// ------------------- utils ------------------- //
///////////////////////////////////////////////////
// change min/max
template<class T> inline bool chMin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chMax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

///////////////////////////////////////////////////
// ------------------- main -------------------- //
///////////////////////////////////////////////////
void Main() {
	const int N = inputVal<int>();
	const vector<int> B = inputVec<int>(N-1);

	int rngSum = B[N - 2];
	// vector<int> A(N, B[N-2]);

	for (int i = N - 2; i > 0; --i) {
		rngSum += std::min(B[i], B[i - 1]);
		// A[i] = std::min(B[i], B[i - 1]);
	}
	rngSum += B[0];

	outputVal(rngSum);

}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout << std::fixed << std::setprecision(15);
	Main();

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP1(j,n) for(int j=0;j<(int)n;++j)
#define REPD(i,n) for(int i=n;i>=0;--i)
#define REPD1(j,n) for(int j=n;j=>0;--j)
#define REPS(i,n) for(int i=1;i<=(int)n;++i)
#define REPS1(j,n) for(int j=1;j<=(int)n;++j)
#define rep(i,a,n) for(int i=a;i<=(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	int a, b, c;
	cin >> a >> b >> c;
	if ((b / a) > c)cout << c << endl;
	else cout << b / a << endl;

	return 0;
}


Measured memory_bytes: 256
eval"N,S,*A="+`dd`.split*?,
d=[k=0]*-~S
A.map{|a|S.downto(a){|i|d[i]=(d[i]+(i>a ?d[i-a]:k+1)*(S>i ?1:N-k))%998244353};k+=1}
p d[S]

Measured memory_bytes: 2308
public class Main {


  private static void solve() {
    int[] a = na(5);
    int ret = 0;
    for (int i = 0; i < 5; i ++) {
      ret += (a[i] + 9) / 10 * 10;
    }
    
    int max = 0;
    for (int v : a) {
      max = Math.max(max, (10 - v % 10) % 10);
    }

    System.out.println(ret - max);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 21332
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> b(n-1);
    for(int i=0;i<n-1;i++){
        cin>>b[i];
    }
    int ans=b[0]+b[n-2];
    for(int i=1;i<n-1;i++){
        ans+=min(b[i-1],b[i]);
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

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

    vector<int> v(N);

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

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

    double ans = v[0];
    
    for (int i = 1; i < N; i++){
        ans += v[i];
        ans /= 2;
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff(i,n) for(i=0;i<n;i++)
#define pb push_back
ll bg =  998244353;
ll fac[300000];
ll power(ll x,ll y)
{
    if(y==0)
	    return 1;
	ll d = power(x,y/2)%bg;
	ll f = (d*d)%bg;
	if(y%2==0)
	  return f;
	else
	  return (f*x)%bg;	 	
}
ll modinv(ll m)
{
	return power(m,bg-2);	
}
ll ncr(ll n,ll r)
{
	ll s1 = fac[n],s2 = fac[r],s3 = fac[n-r];
	ll d1 = (s1*modinv(((s2*s3)%bg)))%bg;
	return d1;
}
int main()
{
	fac[0]=1;
	for(ll j=1;j<300000;j++)
	  fac[j] = (j*fac[j-1])%bg;
	ll t;
	t=1;
	while(t--)
	{
		set<ll>set1;
		ll i,j,n,k;
		cin>>n>>k;
		ff(i,k)
		{
			ll f;
			cin>>f;
			ff(j,f)
			{
				ll x;
				cin>>x;
				set1.insert(x);	
			}	
		}  
		cout<<n-set1.size();
	}
	 return 0;
}

Measured memory_bytes: 5944
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint


def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def main():
    a,v=map(int,input().split())
    b, w = map(int, input().split())
    t=int(input())
    dis=abs(a-b)
    vel=v-w
    ans="NO"
    if v-w>0:
        if vel*t>=dis:
            ans="YES"
    print(ans)





if __name__ == "__main__":

    main()

Measured memory_bytes: 72636
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define pd(a,n) for(int i=0;i<n;i++)cout<<a[i]<<((i==n-1)?"\n":" ");cout<<endl;
#define pdd(a,n,m)for(int i=0;i<n;i++){for(int j=0;j<m;j++)cout<<a[i][j]<<" ";cout<<endl;}
#define mp make_pair
#define pb push_back
#define ll long long
//#define __int64 lng long
#define P pair<int,int>
#define PP pair<P,int>

int main(){
  int x,y,z;
  cin>>x>>y>>z;
  swap(x,y);
  swap(x,z);
  cout<<x<<" "<<y<<" "<<z<<endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 課題1
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string[] strArray = new string[2];
            strArray = str.Split(' ');
            double[] doubleArray = Array.ConvertAll(strArray, double.Parse);


            string str2 = Console.ReadLine();

            //文字数をカウントする
            double doubleStrLength = doubleArray[0];

            //出力用の変数を宣言する
            double doubleCount = 0;

            //xに文字数-選択する数を代入する
            doubleStrLength = doubleStrLength - doubleArray[1];
            doubleCount++;

            //x/(選択する数-1)：小数点以下切り上げ
            doubleCount = doubleCount + Math.Ceiling(doubleStrLength / (doubleArray[1] - 1));

            //出力（x/(選択する数-1)：小数点以下切り上げ+1）
            Console.WriteLine(doubleCount);
        }


    }

    
}


Measured memory_bytes: 29568
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

def main():
  _, _, k = map(int, input().strip().split())
  la = numpy.cumsum([0] + list(map(int, input().strip().split())))
  lb = numpy.cumsum([0] + list(map(int, input().strip().split())) + [10**9+5])
  
  def bs(x):
    s, t = 0, len(lb) - 1
    while t > s + 1:
      m = (s + t) // 2
      if lb[m] == x:
        return m
      if lb[m] > x:
        t = m
      else:
        s = m
    return s
  
  ans = 0
  for i, a in enumerate(la):
    if k - a >= 0:
      ans = max(ans, i + bs((k - a)))
  print(ans)

if __name__=='__main__':
  main()



Measured memory_bytes: 53000
#include <bits/stdc++.h>
namespace shl {
	typedef long long ll;
	const ll mod = 1e9 + 7;
	inline ll read() {
		ll ret = 0, op = 1;
		char c = getchar();
		while (!isdigit(c)) {
			if (c == '-') op = -1; 
			c = getchar();
		}
		while (isdigit(c)) {
			ret = (ret << 3) + (ret << 1) + c - '0';
			c = getchar();
		}
		return ret * op;
	}
	ll n, k;
	ll ans;
	ll all[2010];
	int a[2010];
	int main() {
		n = read(); k = read();
		for (register int i = 1; i <= n; ++i) a[i] = read();
		for (register int i = 1; i <= n; ++i) 
			for (register int j = 1; j <= n; ++j)
				if (a[i] > a[j]) {
					all[i]++;
					if (i < j) ans++;
				}
		ans = ans * k % mod;
		for (register int i = 1; i <= n; ++i) {
			ll sum = all[i] * (k * (k - 1) / 2 % mod) % mod;
			ans = (ans + sum) % mod;
		}
		printf("%lld\n", ans % mod);
		return 0;
	}
}
int main() {
	shl :: main();
	return 0;
}

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

using namespace std;

int main() {
    char S[100], T[100];

    scanf("%s %s", S, T);

    int lenS = strlen(S), lenT = strlen(T);
    int offset = -1;
    for (int i=0; i<lenT; i++) {
        for (int j=0; j<=lenS-lenT; j++) {
            if (S[j+i] == T[i] || S[j+i] == '?') {
                bool flag = false;
                //cout << i << " " << j << endl;
                for (int k=0; k<lenT; k++) {
                    if (S[j+k] != T[k] && S[j+k] != '?') {
                        flag = false;
                        break;
                    }
                    else {
                        flag = true;
                    }
                }
                if (flag) offset = j;
            }
        }
    }

    if(offset >= 0) {
        for (int i=0; i<lenS; i++) {
            if (offset <= i && i < offset+lenT) cout << T[i-offset];
            else if (S[i] == '?') cout << "a";
            else cout << S[i];
        }
        cout << endl;
    }
    else {
        cout << "UNRESTORABLE" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var x1, y1, x2, y2 float64
	fmt.Scanln(&x1, &y1, &x2, &y2)
	fmt.Println(math.Sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)))
	return
}



Measured memory_bytes: 1180
#include<stdio.h>
#include<stdlib.h>

int main()
{
	while(1)
	{
		int N,M,JUDGE,judge[20][2],jposi1,jposi2,rposi;
		char move1[2];
		int move2;
		JUDGE=1;
		rposi=220;
		
		scanf("%d",&N);//何個あるか
		if(N!=0)
		{
			for(int i=0;i<N;i++)
			{
				scanf("%d",&jposi1);
				scanf("%d",&jposi2);
				judge[i][0]=21*jposi2+jposi1;
				judge[i][1]=0;
			}
			scanf("%d",&M);//何回動くか
			for(int i=0;i<M;i++)
			{
				scanf("%s",&move1[0]);
				scanf("%d",&move2);
				for(int t=0;t<move2;t++)
				{
					switch(move1[0])
					{
					case 'N':
						rposi+=21;
						break;
					case 'S':
						rposi-=21;
						break;
					case 'E':
						rposi+=1;
						break;
					case 'W':
						rposi-=1;
						break;
					}
					for(int j=0;j<N;j++)
					{
						if(rposi==judge[j][0]) judge[j][1]=1;
					}
				}
			}
			for(int i=0;i<N;i++)
			{
				if(judge[i][1]==0) JUDGE=0;
			}
			if(JUDGE) printf("Yes\n");
			else printf("No\n");
		}
		else break;
	}
}



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

int mod = 1e9;

int main(){
	int n, k, s;
	cin >> n >> k >> s; 
	if (s == mod) mod--;
	for (int i = 1; i <= k; i++)
		cout << s << endl;
	for (int i = k + 1; i <= n; i++)
		cout << mod << endl; 
	return 0;
}


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

int main(){
    int n,x;
    vector<int>v;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x;
        v.push_back(x);
    }
    sort(v.begin(),v.end());
    int ans=0,tmp=v[0],c=1;
    for(int i=1;i<v.size();i++){
        if(v[i]==v[i-1])c++;
        else{
            if(c!=tmp){
                ans+=(c>tmp?c-tmp:c);
            }
            tmp=v[i];
            c=1;
        }
    }
    if(c!=tmp){
            ans+=(c>tmp?c-tmp:c);
    }
    cout<<ans<<'\n';
}


Measured memory_bytes: 892
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int n;
    cin >> n;

    vector <int> p(n), q(n);
    for (int i = 0; i < n; i++) cin >> p[i];
    for (int i = 0; i < n; i++) cin >> q[i];

    vector <int> init(n);
    for (int i = 0; i < n; i++) init[i] = i + 1;

    int ans = 0;
    bool f = false;

    do {
        bool is_p = true;
        for (int i = 0; i < n; i++) {
            if (p[i] != init[i]) {
                is_p = false;
                break;
            }
        }

        if (is_p) f ^= 1;

        bool is_q = true;
        for (int i = 0; i < n; i++) {
            if (q[i] != init[i]) {
                is_q = false;
                break;
            }
        }

        if (is_q) {
            f ^= 1;
        }

        if (f) ans++;

    } while (next_permutation(init.begin(), init.end()));

    cout << ans << "\n";
    return 0;
}

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

int main() {
	// your code goes here
	int n, i, j, k;
	cin >> n;
	int arr[n];
	for(i = 0; i<n; i++) cin >> arr[i];
	int ans[n] = {0};
	ans[0] = 0;
	ans[1] = abs(arr[0] - arr[1]);
	for(i = 2; i < n ; i++){
		ans[i] = min(ans[i-1] + abs(arr[i] - arr[i-1]), ans[i-2] + abs(arr[i] - arr[i-2]));
	}
	cout << ans[n-1];
	return 0;
}

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

using namespace std;

#define int 		long long
#define endl		"\n"
#define mod			1000000007
#define IOS			ios::sync_with_stdio(0), cin.tie(0)


int32_t main() {

	IOS;

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

	vector<int> a(n), b(m);

	for (int i = 0; i < n; i++)
		cin >> a[i];

	for (int j = 0; j < m ; j++)
		cin >> b[j];

	int sum = 0, i = 0, ans = 0;

	for (; i < n; i++) {
		if (a[i] + sum <= k) {
			sum += a[i];
		}
		else {
			break;
		}
	}

	ans = max(ans, i);
	i--;

	int j = 0;

	while (i >= 0 && j < m) {
		sum += b[j];

		while (sum > k && i >= 0) {
			sum -= a[i];
			i--;
		}

		if (sum <= k) {
			ans = max(ans, i + 1 + j + 1);
			j++;
		}
		else {
			break;
		}
	}

	if (i < 0 && sum < k && j < m) {
		while (sum < k && j < m) {
			sum += b[j];
			j++;
			if (sum <= k)
				ans = max(ans, j);
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 6340
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static long l=0,l2=0;
	public static void main(String[] args) throws IOException {
		l = System.currentTimeMillis();
		new Main().exec();
		l2 = System.currentTimeMillis();
		
	}

	public void exec() throws IOException {
		InputUtil in = new InputUtil();
		PrintWriter out = new PrintWriter(System.out);
		int N = (int)in.nextInt();
		long[] T= in.nextLong(new long[N],N);
		if(N==1)
			out.println(T[0]);
		else
			out.println(getLcm(T));
		out.flush();
	}
	private long gcd(long a, long b){
		return b == 0 ? a : gcd(b, a % b);
	}
	private long lcm(long a, long b){
		return a / gcd(a, b) * b;
	}
//	private long getGcd(long a, long b){
//		if(a<b)
//			return getGcd(b,a);
//		long tmp = 0;
//		while (a%b!=0) {
//			tmp = b;
//			b = a%b;
//			a = tmp;
//		}
//		return b;
//	}
//	
//	private long getLcm(long a, long b){
//		if(a<b)
//			return getLcm(b,a);
//		long gcd = getGcd(a,b);
//		return (a/gcd)*b;
//	}
	
	private long getLcm(long[] T) {
		long ans = 0;
		for(int i=1; i<T.length; i++) {
			ans = lcm(((ans == 0)?T[i-1]:ans),T[i]);
		}
		return ans;
	}
}




class InputUtil {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public int nextInt() throws NumberFormatException, IOException{
    	return Integer.parseInt(br.readLine());
    }
    
    public long[] nextLong(long[] a, int num) throws NumberFormatException, IOException{
        int i=0;
        while(i<num) {
            for(String s: br.readLine().split(" ")){
            	if(i<num) {
                    a[i++] = Long.parseLong(s);
            	}
            }
        }
        return a;
    }

}

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

long long int MOD = 1000000007;
vector<long long int> fac(110000), finv(110000), inv(110000);

void COMinit() {
  fac.at(0) = 1;
  fac.at(1) = 1;
  finv.at(0) = 1;
  finv.at(1) = 1;
  inv.at(1) = 1;
  for (int i = 2; i < 110000; i++) {
    fac.at(i) = fac.at(i - 1) * i % MOD;
    inv.at(i) = MOD - inv.at(MOD % i) * (MOD / i) % MOD;
    finv.at(i) = finv.at(i - 1) * inv.at(i) % MOD;
  }
}

long long int COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac.at(n) * (finv.at(k) * finv.at(n - k) % MOD) % MOD;
}

int main() {
  COMinit();
  int N, K;
  cin >> N >> K;
  vector<long long int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  sort(A.begin(), A.end());
  long long int ans = 0;
  for (int i = 0; i < N - K + 1; i++) {
    ans = (ans - (A.at(i) * COM(N - i - 1, K - 1) % MOD)) % MOD;
  }
  reverse(A.begin(), A.end());
  for (int i = 0; i < N - K + 1; i++) {
    ans = (ans + (A.at(i) * COM(N - i - 1, K - 1) % MOD)) % MOD;
  }
  if (ans < 0) ans += MOD;
  cout << ans << endl;
}

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

int H,W;
int a[500][500];
vector<string> ans;

void move(int x, int y, int nx, int ny){
  if(ny == H) return;
  if(a[y][x]%2 == 0) return;
  a[y][x]--, a[ny][nx]++;
  string tmp = to_string(y+1) + ' ' + to_string(x+1) + ' ' + to_string(ny+1) + ' ' + to_string(nx+1);
  ans.push_back(tmp);
}

void visit(int x, int y){
  if(y == H) return;
  // even
  if(y%2 == 0){
    if(x == W-1){
      move(x, y, x, y+1);
      visit(x, y+1);
    }
    else{
      move(x, y, x+1, y);
      visit(x+1, y);
    }
  }
  // odd
  else{
    if(x == 0){
      move(x, y, x, y+1);
      visit(x, y+1);
    }
    else{
      move(x, y, x-1, y);
      visit(x-1,y);
    }
  }
}

int main(){
  cin>>H>>W;
  for(int i=0;i<H;i++)
    for(int j=0;j<W;j++)
      cin>>a[i][j];
  visit(0, 0);
  cout<<ans.size()<<endl;
  for(string u : ans) cout<<u<<"\n";
  return 0;
}


Measured memory_bytes: 11892
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct{
    int correct;
    int penalty;
    int line1[11];
    int name;
}team;
team line[51];
int c(const void *v1,const void *v2){
    team *a,*b;
    a=(team *)v1,b=(team *)v2;
    if(a->correct != b->correct)
        return b->correct-a->correct;
    else if(a->penalty != b->penalty)
        return a->penalty-b->penalty;
    else
        return a->name-b->name;
}

int main(void){
    int T,P,R,i,t,p,time;
    char message[8];
    for(;memset(line,0,sizeof(line)),scanf("%d %d %d",&T,&P,&R),T+P+R;){
        for(i=1;i<=T;i++)
            line[i].name=i;
        for(i=0;i<R;i++){
            scanf("%d %d %d %s",&t,&p,&time,message);
            if(!strcmp(message,"CORRECT")){
                line[t].correct++;
                line[t].penalty+=(line[t].line1[p]*1200+time);
            }
            else{
                line[t].line1[p]++;
            }
        }
        qsort(&line[1],T,sizeof(team),c);
        for(i=1;i<=T;i++)
            printf("%d %d %d\n",line[i].name,line[i].correct,line[i].penalty);
    }
    return 0;
}

Measured memory_bytes: 1796
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        int[] num = SpIntRead(' ');
        int[] box = SpIntRead(' ');
        int pos = Array.IndexOf(box, 1);
        int count = (pos % (num[1] - 1) == 0 ? pos / (num[1] - 1) : pos / (num[1] - 1) + 1);
        pos = (pos % (num[1] - 1) == 0 ? pos : pos +(num[1] - (pos % (num[1] - 1))));
        if (!(pos >= num[0]))
        {
            count += ((num[0] - pos - 1) % (num[1] - 1) == 0 ? (num[0] - pos - 1) / (num[1] - 1) : (num[0] - pos - 1) / (num[1] - 1) + 1);
        }
        Console.WriteLine(count);
    }
}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int intRead()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
    public static int[] SpIntRead(char c)
    {
        return Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
    }

}


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

#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> ii;

const int len = 1e5+5;
int n, m;
int par[len];
vector<ii> adj[len];
vector<int> dp[len], pref[len], suf[len];

int add(int a, int b){
    return (a+b)%m;
}

int mul(int a, int b){
    return (a*1LL*b)%m;
}

void dfs1(int u, int x){
    dp[u][x] = 1;
    for (int j = 1; j < adj[u].size(); j++){
        ii v = adj[u][j];
        if (v.fi == par[u]) continue;

        par[v.fi] = u;
        dfs1(v.fi, v.se);
        dp[u][x] = mul(dp[u][x], dp[v.fi][v.se]);
    }
    dp[u][x] = add(dp[u][x], 1);
}

void dfs2(int u){
    pref[u][0] = 1;
    for (int j = 1; j < adj[u].size(); j++){
        ii v = adj[u][j];
        pref[u][j] = mul(pref[u][j-1], dp[v.fi][v.se]);
    }

    suf[u][adj[u].size()] = 1;
    for (int j = adj[u].size()-1; j >= 1; j--){
        ii v = adj[u][j];
        suf[u][j] = mul(suf[u][j+1], dp[v.fi][v.se]);
    }

    for (int j = 1; j < adj[u].size(); j++){
        ii v = adj[u][j];
        dp[u][j] = add(mul(pref[u][j-1], suf[u][j+1]), 1);
        if (v.fi != par[u])
            dfs2(v.fi);
    }

    dp[u][0] = add(suf[u][1], 1);
}

int main(){
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; i++)
        adj[i].pb(mp(i, 0));
    for (int i = 0; i < n-1; i++){
        int a, b;
        scanf("%d %d", &a, &b);
        adj[a].pb(mp(b, adj[b].size()));
        adj[b].pb(mp(a, adj[a].size()-1));
    }

    for (int i = 1; i <= n; i++){
        dp[i].resize(adj[i].size());
        pref[i].resize(adj[i].size());
        suf[i].resize(adj[i].size()+1);
    }

    dfs1(1, 0);
    dfs2(1);

    for (int i = 1; i <= n; i++)
        printf("%d\n", add(dp[i][0], m-1));
    return 0;
}


Measured memory_bytes: 31872
#include<stdio.h>
 
int main(void)
 
{
 
int a,b,d,r;
 
double f;
 
scanf("%d",&a);
 
scanf("%d",&b);
 
d=a/b;
 
r=a%b;
 
f=(double)a/(double)b;
 
printf("%d %d %lf\n",d,r,f);
 
return 0;
 
}

Measured memory_bytes: 636
#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 n;
    cin>>n;
    vector<tuple<string,int,int>>t;
    rep(i,n){
        string x1; int x2;
        cin>>x1>>x2;
        x2=-x2;
        t.push_back(make_tuple(x1,x2,i+1));
    }
    sort(t.begin(),t.end());
    rep(i,n){
        cout<<get<2>(t[i])<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<ll,ll>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;
constexpr int MOD = 1000000007;
using namespace std;

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

VL prime_decomposition(ll n) {
	ll i = 2;
	VL table{};
	while (i * i <= n) {
		while (n % i == 0) {
			n /= i;
			table.emplace_back(i);
		}
		++i;
	}
	if (n > 1) {
		table.emplace_back(n);
		return table;
	}
}

int main() {
	int w, h, k;
	cin >> w >> h >> k;

	ll c = 0;
	FOR(i, 1, w + 1) {
		c += h;
		if (c == k) {
			cout << "Yes" << endl;
			return 0;
		}

		ll c_ = c;
		FOR(j, 1, h + 1) {
			c_ += (w - 2*i);
			if (c_ == k) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
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 (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

vector<int> G[100100];
queue<pair<int, int> > que;

int S, T;
int N, M;

class UnionFind{
    public:
        vector<int> par;
        vector<int> rank;
        vector<int> size;

        UnionFind(int n){
            for(int i = 0; i < n; i++){
                par.push_back(i);
                rank.push_back(0);
                size.push_back(1);
            }
        }

        int find(int x){
            if(x == par[x])
                return x;
            else
                return par[x] = find(par[x]);
        }

        void unite(int x, int y){
            x = find(x);
            y = find(y);
            if(x == y) return;

            if(rank[x] < rank[y]){
                par[x] = y;
                size[y] += size[x];
            }
            else{
                par[y] = x;
                size[x] += size[y];
                if(rank[x] == rank[y]) rank[x]++;
            }
        }

        bool same(int x, int y){
            return find(x) == find(y);
        }

        int get_size(int x){
            return size[find(x)];
        }
};


void dfs(int v, int cnt, UnionFind& uni, int push){
    if(cnt == 3){
        if(uni.find(v) != uni.find(T)){
            uni.unite(v, T);
            que.push(make_pair(v, push+1));
        }
        return;
    }

    for(int i = 0; i < G[v].size(); i++){
        int next = G[v][i];
        dfs(next, cnt+1, uni, push);
    }
}

int main(){

    cin >> N >> M;
    REP(i,M){
        int u, v;
        cin >> u >> v;
        u--, v--;
        //G[u] = v;
        G[v].push_back(u);
    }

    cin >> S >> T;
    S--, T--;

    UnionFind uni(N);
    que.push(make_pair(T, 0));
    int ans = -1;
    while(!que.empty()){
        auto p = que.front();
        que.pop();
        int v = p.first;
        int cnt = p.second;
        if(v == S){
            ans = cnt;
            break;
        }
        dfs(v, 0, uni, cnt);
    }

    cout << ans << endl;
    return 0;
}


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

int N, A[2];
bool ok[1000][1000];

int main() {
	cin >> N >> A[0] >> A[1];
	for (int i = 0; i < 1000; ++i) for (int j = 0; j < 1000; ++j) ok[i][j] = true;

	// 2 で何回割れるか
	int num[2] = { 0 };
	for (int iter = 0; iter < 2; ++iter) {
		num[iter] = 0;
		while (A[iter] % 2 == 0) {
			++num[iter];
			A[iter] /= 2;
		}
	}

	// 盤面をふるいにかける
	for (int iter = 0; iter < 2; ++iter) {
		int p = num[iter];
		if (p & 1) {
			int two = 1 << (p / 2);
			for (int x = 0; x < N * 2; ++x) {
				for (int y = 0; y < N * 2; ++y) {
					if (y % (two * 2) >= two) ok[x][y] = false;
				}
			}
		}
		else {
			int two = 1 << (p / 2);
			for (int x = 0; x < N * 2; ++x) {
				for (int y = 0; y < N * 2; ++y) {
					int px = (x % (two * 2) >= two ? 1 : 0);
					int py = (y % (two * 2) >= two ? 1 : 0);
					if (px != py) ok[x][y] = false;
				}
			}
		}
	}

	// N^2 個になるまで出力
	int con = 0;
	for (int x = 0; x < N * 2; ++x) {
		for (int y = 0; y < N * 2; ++y) {
			if (con == N*N) break;
			if (ok[x][y]) {
				cout << x << " " << y << endl;
				++con;
			}
		}
	}
}

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll A,B;
    cin >> A >> B;
    ll num = min(A,B);
    ll cnt = max(A,B);
    for (int i = 0; i < cnt; i++) {
        cout << num;
    }
    cout << endl;
}

Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static void main(String[] Args) throws IOException{
        String s = br.readLine();
        s += s;
        final String p = br.readLine();
        if(s.indexOf(p)!=-1) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 24420
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;



int main(){
    ll n,t; cin >> n >> t;
    vpl v(n);
    rep(i,n) cin >> v[i].first >> v[i].second;
    sort(all(v));
    ll ans = -1;
    rep(i,n){
        if(v[i].second <= t) {
            ans = v[i].first;
            break;
        }
    }
    if(ans == -1) puts("TLE");
    else cout << ans << endl;
}


Measured memory_bytes: 256
#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 n;
    cin >> n;
    
    int maxh = 0;
    rep(i,n) {
        int h;
        cin >> h;
        if (h+1 < maxh) {
            cout << "No" << endl;
            return 0;
        }
        maxh = max(maxh, h);
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<functional>
#include<map>
#define int long long
using namespace std;

int parse(string a) {
	int b = 0;
	for (char c : a)b = b * 10 + c - 48;
	return b;
}
signed main() {
	int a;
	cin >> a;
	string b[1000]{};
	set<int>S;
	for (int c = 0; c < a; c++) {
		char d; cin >> d;
		for (int e = 0; e <= c; e++) {
			b[e] += d;
			if(b[e].length()<=16) S.insert(parse(b[e]));
		}
	}
	int c = 0;
	for (auto d = S.begin(); d != S.end(); c++, d++) {
		if (c != (*d))break;
		if (d == --S.end())c++;
	}
	cout << c << endl;
}

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

using namespace std;
#define _for(i,j,N) for(int i = (j); i < (N);i++)
#define _rep(i,j,N) for(int i = (j); i <= (N);i++)
#define _dec(i,j,N) for(int i = (N-1);i >= 0;i--)
#define _dep(i,j,N) for(int i = (N); i>= 0;i--)
#define ALL(x) x.begin(),x.end()
#define LL long long
#define ULL unsigned LL
#define PB push_back


int main()
{
    LL K,A,B;
    cin >> K >> A >> B;
    if(B-A < 3 || K - A < 1){
        printf("%lld\n",1+K);
    }
    else{
        LL ans = A;
        K -= (A-1);
        ans += (B-A)*(K/2);
        ans += K%2;
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
class Case01

  def initialize
  end

  def show
    p self.instance_variables
        .map{ |sym| [sym, self.instance_variable_get(sym)] }
        .to_h
  end
  
  # 実行する
  def execute
    read
    solve
    output
  end

  def read
    @a, @b = gets.chomp.split.map(&:to_i)
  end

  def solve
    @result = (@b % @a == 0) ? (@a + @b) : (@b - @a)
  end
  
  def output
    puts @result
  end

end

# 
Case01.new.execute if $0 == __FILE__



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

int main(){
    int n;
    while(cin >> n){
        vector<int> v(n);
        for(int i=0;i<n;i++) cin >> v[i];
        for(int i=0;i<n;i++){
            cout << "node " << i+1 << ": key = " << v[i] << ", ";
            if(i != 0) cout << "parent key = " << v[(i+1)/2-1] << ", ";
            if((i+1) * 2 <= n) cout << "left key = " << v[(i+1)*2-1] << ", ";
            if((i+1) * 2 + 1 <= n) cout << "right key = " << v[(i+1)*2] << ", ";
            cout << endl;
        }
    }
}

Measured memory_bytes: 0