akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
#define Y first
#define X second
signed main(){
  int w,h;
  while(cin>>w>>h,w||h){
    string s[h][w];
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)
    cin>>s[i][j];
    vector<P> v[50000];
    int gy,gx,gd=0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
    if(s[i][j]==".") continue;
    if(s[i][j]=="S"){
      v[0].push_back(P(i,j));
      continue;
    }
    if(s[i][j]=="G"){
      gy=i;gx=j;
      continue;
    }
    int k=stoi(s[i][j]);
    v[k].push_back(P(i,j));
    gd=max(gd,k);
      }
    }
    v[++gd].push_back(P(gy,gx));
    int dp[h][w];
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)
    dp[i][j]=1LL<<55LL;
    dp[v[0][0].Y][v[0][0].X]=0;
    for(int i=0;i<gd;i++){
      for(int j=0;j<(int)v[i].size();j++){
    for(int k=0;k<(int)v[i+1].size();k++){
      int cost=abs(v[i+1][k].Y-v[i][j].Y)+abs(v[i+1][k].X-v[i][j].X);
      dp[v[i+1][k].Y][v[i+1][k].X]=
        min(dp[v[i+1][k].Y][v[i+1][k].X],dp[v[i][j].Y][v[i][j].X]+cost);
    }
      }
    }
    cout<<dp[v[gd][0].Y][v[gd][0].X]<<endl;
  }
  return 0;
}

Measured memory_bytes: 4544
import sys

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
A = MAP()

while True:
	min_a = min(A)
	cnt = 0
	for i in range(N):
		if A[i] % min_a != 0:
			cnt += 1
			A[i] %= min_a
		elif A[i] % min_a == 1:
			break
	if cnt==0: break
print(min_a)

Measured memory_bytes: 14304
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define mod 1000000007

int main() {
	int k, n;
	cin >> k >> n;
	int a[1000000];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = mod;
	for (int i = 0; i < n - 1; i++) {
		ans = min(ans, k - (a[i + 1] - a[i]));
	}
	ans = min(ans, k - (k - a[n - 1] + a[0]));
	cout << ans << endl;
}

Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string.h>
#include <deque>
#define REP(i,j,n) for(int i=j;i<n;i++)
#define SORT(x) sort(x.begin(),x.end())

using namespace std;



int main() {
	string s;
	
	while (1) {
		int sum = 0;
		cin >> s;
		if (s[0] == '0') break;
		for (int i = 0; i < s.length(); i++) {
			sum += s[i]-'0';
			
		}

		
		cout << sum << endl;
	}

	return 0;
}

Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  lvector A(n,0),B(n-1);rep(i,n-1) cin>>B[i];
  A[0]=B[0];A[n-1]=B[n-2];
  rep(i,n-2) A[i+1]=min(B[i],B[i+1]);
  print(accumulate(ALL(A),0));
  return 0;
}

Measured memory_bytes: 256
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

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

int main()
{
    int n;
    cin >> n;
    if (n <= 999)
    {
        cout << "ABC" << endl;
    }
    else
    {
        cout << "ABD" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let a : Vec<i32> = input.trim().split_whitespace().map(|x| x.parse().ok().unwrap()).collect();
    let b = (a[0] * 3) + a[1];
    let c : i32 = b / 2;
    println!("{}", c);
}



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

int main() {
	int n,k;
	cin >> n >> k;
	vector<int> x(n);
	rep(i, n) cin >> x[i];
	for(int i = 0; i < n - k; i++){
		if(x[i] < x[i+k]) cout << "Yes" <<endl;
		else cout << "No" <<endl;
	}
	return 0;
}


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

const int N = 1e5 + 10;
bool mark[N];
int q, ps[N];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	cin >> q;
	for (int i = 1; i < N; i++)
		mark[i] = 1;
	mark[1] = 0;
	
	for (int i = 2; i < N; i++){
		if(!mark[i])
			continue;
		for (int j = i * 2; j < N; j += i)
			mark[j] = 0;
	}
	for (int i = 1; i < N; i++){
		ps[i] = ps[i - 1];
		if(i % 2 == 1)
			ps[i] += (mark[i] && mark[(i + 1) / 2]);
	}
	
	while(q){
		int l, r;
		cin >> l >> r;
		cout << ps[r] - ps[l - 1] << '\n';
		q--;
	}
}



Measured memory_bytes: 1152
import sys
f=lambda:map(int,sys.stdin.readline().split())
n,q=f()
g=[[] for _ in range(n)]
for i in range(n-1):
  a,b=f()
  g[a-1]+=[b-1]
  g[b-1]+=[a-1]
c=[0]*n
for i in range(q):
  v,x=f()
  c[v-1]+=x
b=[0]+[1]*(n-1)
s=[0]
while s:
  t=s.pop()
  for i in g[t]:
    if b[i]:
      c[i]+=c[t]
      s+=[i]
      b[i]=0
print(*c)

Measured memory_bytes: 55828
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <deque>
#include <map>
#include <stack>
#include <queue>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <complex>
#include <iterator>

#define mp make_pair
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define linf ((ll) 1e18)
#define inf ((int) 1e5)
#define eps ((double) 1e-10)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<pll, ll> ppl;
typedef vector<ll> vl;
typedef vector<pll> vpl;
typedef vector<ppl> vppl;
typedef vector<vl> vvl;
typedef vector<vpl> vvpl;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<pdd> vpd;
typedef vector<vd> vvd;
typedef deque<ll> dql;

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fors(i, n, s) for (int i = 0; i < (int)(n); i[curPos++] = s)
#define forn1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forn11(i, n) for (int i = 1; i < (int)(n); ++i)
#define forr(i, n) for (int i = (int)(n) - 1; i >= 0; --i)

#define prOk(ok) cout << ((ok) ? "VALID\n" : "INVALID\n")
#define in insert
#define rem remove
#define er erase
#define isUpperCase(c) (c <= 'Z' && c >= 'A')


int main()
{
    string s;
    cin >> s;
    bool bad = false;
    if(s[0] != 'A')
        bad = true;
    bool isC=false;
    bool first = true;
    int i = 0;
    for(char c : s)
    {
        i++;
        if(first)
        {
            first = false;
            continue;
        }
        if(!isC && i >= 3 && i <=s.size()-1 && c == 'C')
            isC = true;
        else if(c >= 'A' && c <= 'Z')
        {
            bad = true;
            break;
        }
    }

    if(bad || !isC)
        cout << "WA"<<endl;
    else
        cout <<"AC"<<endl;
    return 0;
}

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

int main() {
    int N, X, Y; cin >> N >> X >> Y;
    vector<int> dist(N);
    for (int i = 1; i <= N; i++) {
        for (int j = i+1; j <= N; j++) {
            int d = min({j - i, abs(j - Y) + abs(X - i) + 1});
            dist[d]++;
        }
    }
    for (int i = 1; i < N; i++) {
        cout << dist[i] << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
typedef long long LL;

int main()
{
	LL N, K;
	cin >> N >> K;

	LL cnt = 0;

	if (K == 0) {
		cnt = N * N;
	}
	else {
		for (int b = K + 1; b <= N; b++) {
			cnt += (N / b) * (b - K);
			if (N % b >= K)
				cnt += N % b - K + 1;
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = LLONG_MAX/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll h,w; cin >> h >> w;
    vector<vector<ll>> a(h,vl(w)), b(h,vl(w));
    rep(i,h)rep(j,w)cin >> a[i][j];
    rep(i,h)rep(j,w)cin >> b[i][j];
    vvl sub(h,vl(w));
    rep(i,h)rep(j,w)sub[i][j] = abs(a[i][j] - b[i][j]);
    const int r_max = 13000;
    bitset<r_max> bs(0);
    vector<vector<bitset<r_max>>> dp(h,vector<bitset<r_max>>(w,bs));
    dp[0][0][sub[0][0]] = 1;
    rep(i,h)rep(j,w){
        rep(k,r_max){
            if(dp[i][j][k]){
                if(j+1 < w)dp[i][j+1][k + sub[i][j+1]] = 1;
                if(j+1 < w)dp[i][j+1][abs(k - sub[i][j+1])] = 1;
                if(i+1 < h)dp[(i+1)][j][k + sub[i+1][j]] = 1;
                if(i+1 < h)dp[(i+1)][j][abs(k - sub[i+1][j])] = 1;
            }
        }
        // debug(i);
        // debug(j);
        // debug(dp[i][j]);
    }


    ll res = r_max;
    rep(i,r_max){
        if(dp[(h-1)][w-1][i]){
            res = i;
            break;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 10752
a,b = map(str,input().split())
a = int(a)
b = list(b)
ans1 = int(a) * int(b[0])
ans2 = str(((int(b[2]) * 10) + (int(b[3]) * 1))*a)
ans2 = list(ans2)
ans = ''

if len(ans2) >= 3:
  ans2.pop()
  ans2.pop()
  for i in ans2:
    ans += i
else:
  ans = 0
  
  
print(ans1 + int(ans))

Measured memory_bytes: 9208
distance = [
    [ 0,  6, 13, 18, 23, 43, 58],
    [ 6,  0,  7, 12, 17, 37, 52],
    [13,  7,  0,  5, 10, 30, 45],
    [18, 12,  5,  0,  5, 25, 40],
    [23, 17, 10,  5,  0, 20, 35],
    [43, 37, 30, 25, 20,  0, 15],
    [58, 52, 45, 45, 40, 35,  0]
]
price = [
    [   0,  300,  500,  600,  700, 1350, 1650],
    [ 300,    0,  350,  450,  600, 1150, 1500],
    [ 500,  350,    0,  250,  400, 1000, 1350],
    [ 600,  450,  250,    0,  250,  850, 1300],
    [ 700,  600,  400,  250,    0,  600, 1150],
    [1350, 1150, 1000,  850,  600,    0,  500],
    [1650, 1500, 1350, 1300, 1150,  500,    0]
]

def judge(x, y, d, a):
    if distance[d][a] <= 40 and \
        1050 <= x <= 1170 or 1050 <= y <= 1170:
        return True
    else:
        return False

while True:
    d = int(input()) - 1
    if d < 0: break
    hd, md = map(int, input().split())
    a = int(input()) - 1
    ha, ma = map(int, input().split())

    x, y = (hd*60+md), (ha*60+ma)
    fee = price[d][a]

    if judge(x, y, d, a):
        fee = ((fee // 2 - 1) // 50 + 1) * 50
    print(fee)



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

class Main {
	public static void main(String[] args) throws java.lang.Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		Solver s = new Solver();

		System.out.println(s.solve(br.readLine()));
	}

}

class Solver {

	String solve(String s) {
		for (int length = 2; length <= 3; length++) {
			for (int i = 0; i < s.length() + 1 - length; i++) {
				if (s.charAt(i) == s.charAt(i + length - 1)) {
					return "" + (i+1) + " " + (i + length);
				}
			}

		}
		return "-1 -1";
	}

}

Measured memory_bytes: 23124
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    long long N, P;
    cin >> N >> P;
    long long mx = pow(P, 1.0/N);
    long long ans = mx;
    for(int i = mx + 1; i >= 1; i--)
    {
        long long temp = pow(i, N);
        if((P % temp) == 0)
        {
            ans = i;
            break;
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1000000000+7;

int main() {
  int n;
  cin >> n;
  string s,abc;
  cin >> s;
  abc = "ABC";
  int ans=0;
  for (int i=0; i<s.size()-2; i++) {
    if (s.at(i) == 'A' && s.at(i+1) == 'B' && s.at(i+2) == 'C') ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;vector<vector<int> >a(11,vector<int>(331));void r(int n,int u,int s,int d){a[n][s]++;for(int i=0;i<10;i++)if(!(u>>i&1))r(n+1,u^1<<i,s+d*i,d+1);}main(){r(0,0,0,1);for(int n,s;cin>>n>>s;)cout<<a[n][s]<<endl;}

Measured memory_bytes: 808
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#include <unordered_map>
#include <map>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <sstream>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(x) (x).begin(),(x).end()
#define sort_key(struct_name,key_name) [](const struct_name &x, const struct_name &y){return x.key_name < y.key_name;}
#define pb(x) push_back(x)
typedef long long ll;
const ll MOD = 1e9 + 7;
using namespace std;

//main
ll Xor0(ll a){
  ll ex;
  if(a%2==0){
    if((a/2)%2==1) ex = a+1;
    else ex = a;
  }else{
    if((a/2)%2==1) ex = 0;
    else ex = 1;
  }
  return ex;
}

int main(){
  ll A,B; cin >> A >> B;
  ll exA1 = Xor0(A-1);
  ll exB = Xor0(B);
  ll ans;
  if(A==0) ans = Xor0(B);
  else ans = exA1 ^ exB;
  cout << ans << endl;
}



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

using namespace std;

int main(){
    string T;
    cin >> T;
    int T_size = int(T.length());
    int i;
    while(T.find("?") != string::npos){
        T.replace(T.find("?"), 1, "D");
    }

    cout << T << endl;
    

    return 0;
}



Measured memory_bytes: 3760
/// ببِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
     ios_base::sync_with_stdio(false);cin.tie(NULL);
     ll int i,n,t,p=INT_MAX,j=0,x,a=0,b,l=0,r=0,y,k,c,sum=0;
     string s,m;
     cin>>n;
     p=n/500;
     l+=p*1000;
     x=n-p*500;
     x/=5;
     l+=x*5;
     cout<<l<<endl;

     return EXIT_SUCCESS;
}




Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<Integer> d = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			d.add(sc.nextInt());
		}
		Collections.sort(d);
		int print = d.get(n / 2) - d.get(n / 2 - 1);
		System.out.println(print);
	}
}

Measured memory_bytes: 63108
#include <iostream>
#include<algorithm>
#include<vector>
using namespace std;
using ll = long long;
#define INF 1e9

int main() {
	int N;
	int t[100005], x[100005], y[100005];
	cin >> N;
	t[0] = x[0] = y[0] = 0;
	for (int i = 1; i <= N; ++i) {
		cin >> t[i] >> x[i] >> y[i];
	}
	bool can = true;
	for (int i = 0; i < N; ++i) {
		int dt = t[i + 1] - t[i];
		int dist = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
		if (dt < dist)can = false;
		if (dist % 2 != dt % 2)can = false;
	}
	if (can)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include<ctime>
#include<cstdlib>
#include<algorithm>
using namespace std;


int main()
{
	int a[101], b[101] = {}, c[101];
	int N, d;
	cin >> N;
	for (int i = 1; i != N+1; i++) {
		a[i] = i;
		c[i] = i;
	
		while(a[i] % 2 == 0) {
				a[i] /= 2;
				b[i] += 1;
		}
		if (b[i] >= b[i - 1]) {
			d = i;
		}
		else {
			b[i] = b[i - 1];
		}
	}
	cout << c[d] << endl;


	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

import scala.collection.mutable

object Main extends App {
  val sc = new Scanner(System.in)
  val A = sc.nextInt
  val B = sc.nextInt
  val C = sc.nextInt
  val D = sc.nextInt
  val E = sc.nextInt
  val F = sc.nextInt
  var ans = (0, 0)

  val a_max = F / 100 / A
  val b_max = F / 100 / B
  val c_max = F / C
  val d_max = F / D
  for {
    a <- 0 to a_max
    b <- 0 to b_max
    c <- 0 to c_max
    d <- 0 to d_max
  } {
    val w = a * A + b * B
    val s = c * C + d * D
    if (100 * w + s <= F) {
      if (s <= w * E) {
        val mass = w * 100 + s
        val d_s = s.toDouble
        if (mass != 0 && (ans._1 == 0 || (ans._2.toDouble / ans._1.toDouble) < (d_s.toDouble / mass.toDouble))) {
          ans = (mass, s)
        }
      }
    }
  }

  println(s"${ans._1} ${ans._2}")

}



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

int main() {


    int n;
    cin>>n;
    long long int sum = 0;
    for (int i=1; i<=n; i++){
        if(i%3!=0 and i%5!=0){
            sum+=i;
        }
    }
    cout<<sum;
}

Measured memory_bytes: 3648
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
typedef long long ll;
typedef double dd;
#define For(i,j,k) for (int i=j;i<=k;++i)
#define Forr(i,j,k) for (int i=j;i>=k;--i)
#define Set(a,p) memset(a,p,sizeof(a))
using namespace std;

template<typename T>bool chkmax(T& a,T b) {return a<b?a=b,1:0;}
template<typename T>bool chkmin(T& a,T b) {return a>b?a=b,1:0;}

const int maxn=100000+100;
struct node {
	int to,next;
}e[maxn<<1];
int n,tot;
int head[maxn],cnt[maxn],dp[maxn];

inline void read(int &x) {
	x=0;
	int p=1;
	char c=getchar();
	while (!isdigit(c)) {if (c=='-') p=-1; c=getchar();}
	while (isdigit(c)) {x=(x<<1)+(x<<3)+(c-'0'); c=getchar();}
	x*=p;
}

inline void file() {
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
}

inline void add(int from,int to) {
	tot++; e[tot].to=to; e[tot].next=head[from]; head[from]=tot;
}

void dfs(int u,int fa) {
	vector<int>s;
	int flag=0;
	for (int i=head[u];i!=0;i=e[i].next) {
		int v=e[i].to;
		if (v==fa) continue;
		dfs(v,u);
		s.push_back(dp[v]);
//		dp[u]+=dp[v];
		if (!dp[v]) {
			if (!flag) flag=1;
			else s.push_back(1);
			//dp[u]++;
		}
	}
	if (flag) {
		if (s.size()) For (i,0,s.size()-1) dp[u]+=s[i];
	}
	else if (s.size()) {
		sort(s.begin(),s.end());
		For (i,0,s.size()-1) dp[u]+=s[i];
	}
}

int main() {
//	file();
	read(n);
	For (i,1,n-1) {
		int x,y; read(x); read(y);
		add(x,y); add(y,x); cnt[x]++; cnt[y]++;
	}
	int root=-1;
	For (i,0,n-1) if (cnt[i]>=3) root=i;
	if (root==-1) printf("1");
	else {
		dfs(root,-1);
		printf("%d\n",dp[root]);
	}
	return 0;
}

Measured memory_bytes: 9216
import java.util.Scanner;

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

		while(true) {
			String a=sc.next();
			if(a.equals("#")) {
				break;
			}
			int y=sc.nextInt();
			int m=sc.nextInt();
			int d=sc.nextInt();

			if(y<=30) {
				System.out.println(a+" "+y+" "+m+" "+d);
			}

			else if(y==31 && m<=4) {
				System.out.println(a+" "+y+" "+m+" "+d);
			}
			else {
				System.out.println("? "+(y-30)+" "+m+" "+d);
			}
		}
	}
}


Measured memory_bytes: 27112
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int h=sc.nextInt();
		int w =sc.nextInt();
		char[][] map=new char[h+2][w+2];
		for(int i=1; i<=h; i++){
			String s=sc.next();
			for(int j=1; j<=w; j++){
				map[i][j]=s.charAt(j-1);
			}
		}
		for(int i=1; i<=h; i++){
			for(int j=1; j<=w; j++){
				if(map[i][j]=='#'){
					if(map[i-1][j]!='#' && map[i+1][j]!='#' && map[i][j-1]!='#' && map[i][j+1]!='#'){
						System.out.println("No");
						return;
					}
				}
			}
		}
		System.out.println("Yes");
	}
}
 

Measured memory_bytes: 21844
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int dt;
	int sum=0;
	rep(i,5){
		cin>>dt;
		if(dt<40)dt=40;
		sum+=dt;
	}
	cout<<sum/5<<endl;
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include<string>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<map>
using namespace std;

int main() {
	string S;
	cin >> S;
	int a = 0;
	if (S[2] == S[3]) {
		a++;
	}
	if (S[4] == S[5]) {
		a++;
	}
	if (a == 2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Data.List
import Control.Applicative


parse :: String -> String
parse [] = []
parse (c:tl)
  | c == '/'   = parse tl
  | otherwise  = c : parse tl

main :: IO ()
main = do
  s <- getLine
  let n = let x = parse s in if x <= "20190430" then "Heisei" else "TBD"
  putStrLn n


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

#define ll long long

int main(){

    int N,M;
    int i,j,k,l;
    int count=0,count_n=0,count_m=0;
    bool flag = false;

    cin >> N >> M;

    string A[N];
    string B[M];

    for(i=0;i<N;i++){
        cin >> A[i];
        for(j=0;j<N;j++)if(A[i][j]=='#')count_n++;
    }
    for(i=0;i<M;i++){
        cin >> B[i];
        for(j=0;j<M;j++)if(B[i][j]=='#')count_m++;
    }

    if(count_m > count_n){
        cout << "No" << endl;
        return 0;
    }

    if(M == 1){
        for(i=0;i<N;i++){
            for(j=0;j<N;j++){
                if(B[0][0]==A[i][j]){
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }

    for(i=0;i+M<N;i++){
        for(j=0;j+M<N;j++){

            for(k=0;k<M;k++){
                for(l=0;l<M;l++){
                    if(A[i+k][j+l] == B[k][l])count++;
                }
            }

        if(count==M*M){
            cout << "Yes" << endl;
            return 0;
        }

        count = 0;

        }
    }

    cout << "No" << endl;

}

Measured memory_bytes: 256
// Let's bring the sky down :)
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 3e5 + 5;
ll a[N];
int main()
{
    ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n;
    string s;
    cin >> n >> s;
    if(n < 3200){
        cout << "red";
    }
    else{
        cout << s;
    }
return 0;
}


Measured memory_bytes: 256
let kMax = 1000000

let _ =
  let s = Scanf.scanf "%d" @@ (+) 0 in
  let flags = Array.make (kMax + 10) false in
  flags.(s) <- true;
  let n = ref s in
  for i = 2 to kMax do
    n := if !n mod 2 = 0 then !n / 2 else 3 * !n + 1;
    if flags.(!n) then (Printf.printf "%d\n" i; exit 0);
    flags.(!n) <- true
  done

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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    int n;
    cin >> n;

    cout << 800 * n - n / 15 * 200 << endl;
}

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

using namespace std;


typedef long long ll;
const ll maxn=1e5;
string str[maxn];
int idex;
void solve(string a ){
	int len=a.length();
	for(int i=0;i<len-2;i++){
		if(a[i]=='A'&&a[i+1]=='B') idex++;
	}
}
int main()
{
	int n;
	cin>>n;
	idex=0;
	int ta=0,tb=0;
	int ans;
	int res=0;
	for(int i=0;i<n;i++){
		cin>>str[i]; 
		int len=str[i].length();
		if(str[i][0]=='B') tb++;
		if(str[i][len-1]=='A') ta++;
		if(str[i][0]=='B'&&str[i][len-1]=='A') res+=1;
 	}
 	if(ta==res&&tb==res&&res!=0){
 		ans=min(ta,tb);
 		ans-=1;
	 }
	 else{
		ans=min(ta,tb);
	 }
	  
	for(int i=0;i<n;i++){
		solve(str[i]);
	}	
	idex+=ans;
	cout<<idex<<endl;
	return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>
int main(void){
    int n,big=2,small=2,ans=0;
    scanf("%d",&n);
    int p[n];
    scanf("%d",&p[0]);
    for(int i=1; i<n; i++){
        scanf("%d",&p[i]);
        if(p[i-1]<p[i]){
            big=1;
            if(small==0)
                ans++;
            small=0;
        }
        else{
            small=1;
            if(big==0)
                ans++;
            big=0;
        }
    }
    printf("%d",ans);
}


Measured memory_bytes: 128
INPUT = gets.chomp!.split(" ").map! { |i| i.to_i }
A_len_of_long = INPUT[0]
B_len_of_short = INPUT[1]
H = INPUT[2]
M = INPUT[3]

def radian(degree)
  degree * Math::PI / 180.0
end

def distance(a_x, a_y, b_x, b_y)
  Math.sqrt((a_x - b_x) ** 2 + (a_y - b_y) ** 2)
end

angle_long = M * 6.0
angle_short = H * 30.0
angle_short += (angle_long / 360.0) * 30.0

long_x = A_len_of_long * Math.cos(radian(angle_long))
long_y = A_len_of_long * Math.sin(radian(angle_long))
short_x = B_len_of_short * Math.cos(radian(angle_short))
short_y = B_len_of_short * Math.sin(radian(angle_short))
puts distance(long_x, long_y, short_x, short_y)


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  string s;
  cin >> s;

  reverse(s.begin(), s.end());
  vector<int> mods(s.length(), 0);
  mods[0] = s[0] - '0';
  int digit = 10;
  for(int i = 1; i < s.length(); ++i)
  {
    mods[i] = (mods[i - 1] + (s[i] - '0') * digit) % 2019;
    digit *= 10;
    digit %= 2019;
  }
  vector<int> mp(2020, 0);
  mp[0]++;
  for(const auto& v : mods)
  {
    mp[v]++;
  }

  ll ans = 0;
  for(const auto& v : mp)
  {
    ans += v * (v - 1) / 2;
  }
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 4308
#include <bits/stdc++.h>
using namespace std;
int main() {	
	int t=1;
	//cin >> t;
	while (t--) {
	   
	    int n;
       cin>>n;
       long long w;
       cin>>w;
       long long*val=new long long[n];
        long long*we=new long long[n];
       
       
       for(int i=0;i<n;i++)
       {
       	 cin>>we[i];
       	 cin>>val[i];
	   }
	   long long dp[101][100001];
	   for(int i=0;i<n;i++)
	   {
	   	dp[0][i]=0;
	   }
	   for(int i=0;i<n;i++)
	   {
	   	dp[i][0]=0;
	   }
	   int k;
	    
	   for(int i=1;i<=n;i++)
	   {
	   	for(int j=1;j<=w;j++)
	   	{
	   		if(we[i-1]<=j)
	   		{
	   			dp[i][j]=max(val[i-1]+dp[i-1][j-we[i-1]],dp[i-1][j]);
			}
			else
			dp[i][j]=dp[i-1][j];
		}
	   }
	   cout<<dp[n][w];
      }
	} 
	
	
	

Measured memory_bytes: 81684
#include <bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;

int main(void){
    int n,m;
    cin>>n>>m;
    vector<int> check(n+1, true);
    for(int i=0; i<m; i++){
        int a;
        cin>>a;
        check[a]=false;
    }
    
    vector<long long> dp(n+1);
    dp[0]=1;
    for(int now=0; now<n; ++now){
        for(int next=now+1; next<=min(n,now+2); ++next){
            if(check[next]){
                dp[next]+=dp[now];
                dp[next]%=mod;
            }
        }
    }
    
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 4516
import java.util.Scanner;
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();
        String ans = String.valueOf(C) +" "+ String.valueOf(A) +" "+ String.valueOf(B);
      	System.out.println(ans);
    } 
}

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

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

int prime(long int n)
{
  if(n==2) 
      return 1;
  
  else if(n%2==0 || n<2)
       return 0;
  
  else
  {
    long int i;
    for(i=3;i<=sqrt(n);i+=2)
    {
      if(n%i==0)
           return 0;
    }
    
    return 1;
  }
  
}
      

int main()
{
  long int x,i;
  scanf("%ld",&x);
  for(i=x;;++i)
  {
    if(prime(i))
        break;
  }
  
  printf("%ld",i);
}


Measured memory_bytes: 256
import sys
import heapq

N = int(input())

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

dic = {}
lis = []

rem = 1
pl = 0
loop = N
flag = True

for i in range(2 ** N):

    if S[i] not in dic:
        dic[S[i]] = 1
        lis.append(S[i])

    else:
        dic[S[i]] += 1

lis.sort()
lis.reverse()

#print (lis,dic)

q = []

for i in lis:

    if len(q) == 0:
        if dic[i] != 1:
            print ("No")
            sys.exit()
        q = [-N]
        continue

    plq = []
    #print (q)
    
    for j in range(dic[i]):

        if len(q) == 0:
            print ("No")
            sys.exit()
            
        maxnum = -1 * heapq.heappop(q)
        plq.append(maxnum - 1)

        if maxnum > 1:
            heapq.heappush(q,-1 * (maxnum - 1))

        #print (q,plq)

    for j in plq:
        if j > 0:
            heapq.heappush(q,-1 * j)

    #print (i,q)


print ("Yes")


Measured memory_bytes: 119372
X,Y,A,B,C = list(map(int,input().split()))
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))
A = [[i,'p'] for i in P]
for i in Q:
    A.append([i,'q'])
for i in R:
    A.append([i,'r'])
As = list(sorted(A,reverse=True))
qN = 0
pN = 0
rN = 0
ans = 0
for i in As:
    if i[1] == 'q' and qN < Y:
        qN += 1
        ans += i[0]
    elif i[1] == 'p' and pN < X:
        pN += 1
        ans += i[0]
    elif i[1] == 'r':
        rN += 1
        ans += i[0]
    if qN + pN + rN == X + Y:
        break
print(ans)

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

int main(){
    int N, K;
    cin >> N >> K;
    double ans = 0;
    for(int i = 1; i <= N; i++){
        int poi = i;
        double rate = (double)1 / N;
        while(poi < K){
            poi *= 2;
            rate *= 0.5;
        }
        ans += rate;
    }
    
    printf("%.15f\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k,i,j,ans,o;
  vector<int> kosuu(1);
  cin>>n;
  cin>>k;
  vector<int> a(n);
  for(i=0;i<n;i++)cin>>a[i];
  sort(a.begin(),a.end());
  j=0;
  kosuu[0]=1;
  for(i=0;i<n-1;i++)
  {
    if(a[i]==a[i+1])kosuu[j]+=1;
    if(a[i]!=a[i+1]) 
    {
      kosuu.push_back(1);
      j++;
    }
  }
  sort(kosuu.begin(),kosuu.end());
  reverse(kosuu.begin(),kosuu.end());
  o=kosuu.size();
  ans=0;
  while(o>k)
  {
    ans+=kosuu[o-1];
    kosuu.pop_back();
    o=kosuu.size();
  }
  cout<<ans<<endl;
  return 0;
}
  
    

Measured memory_bytes: 2168
use proconio::{fastout, input};
use rand::Rng;
use std::collections::BTreeSet;

#[fastout]
fn main() {
   input! {
      dn: usize,
      c: [i64; 26],
      mut s: [[i64;26]; dn],
   }

   s.insert(0, vec![]);
   let mut t = vec![0];
   let mut last = vec![BTreeSet::new(); 26];
   let start = std::time::Instant::now();
   let time_limit = std::time::Duration::from_millis(1900);

   for i in 0..26 {
      last[i].insert(0);
      last[i].insert(dn + 1);
   }
   for d in 1..=dn {
      let mut mx = std::i64::MIN;
      let mut tn = 0;
      for t in 0..26 {
         let mut score = 0i64;
         score += s[d][t];
         for j in 0..26 {
            if j != t {
               score -= c[j] * (d - last[j].range(..d).rev().next().unwrap()) as i64;
            }
         }
         if score > mx {
            mx = score;
            tn = t;
         }
      }
      last[tn].insert(d);
      t.push(tn);
   }

   let mut rng = rand::thread_rng();
   loop {
      let elapsed = start.elapsed();
      if elapsed > time_limit {
         break;
      }
      let diff = elapsed.as_micros() as f64 / time_limit.as_micros() as f64;
      let temp: f64 = 1e6 / (((diff - 0.5) * 10.0).exp() + 1.0);
      let d = rng.gen_range(1, dn + 1);
      let mut q = rng.gen_range(0, 26);
      while t[d] == q {
         q = rng.gen_range(0, 26);
      }
      let p = t[d];
      let score = update(d, q, &s, &c, &mut t, &mut last);
      if score > 0 && rng.gen_range(0.0, 1.00) > (-score as f64 / temp).exp() {
         t[d] = p;
         last[q].remove(&d);
         last[p].insert(d);
      }
   }

   let mut flag = true;
   while flag {
      flag = false;
      for d in 1..=dn {
         for q in 0..26 {
            let p = t[d];
            let score = update(d, q, &s, &c, &mut t, &mut last);
            if score >= 0 {
               t[d] = p;
               last[q].remove(&d);
               last[p].insert(d);
            } else {
               flag = true;
            }
         }
      }
   }

   for &t in t.iter().skip(1) {
      println!("{}", t + 1);
   }
}

fn update(
   d: usize,
   q: usize,
   s: &Vec<Vec<i64>>,
   c: &Vec<i64>,
   t: &mut Vec<usize>,
   last: &mut Vec<BTreeSet<usize>>,
) -> i64 {
   let p = t[d];
   let mut score = 0;
   score -= s[d][p];
   score += s[d][q];
   let f1 = last[p].range(..d).rev().next().unwrap();
   let b1 = last[p].range(d + 1..).next().unwrap();
   let f2 = last[q].range(..d).rev().next().unwrap();
   let b2 = last[q].range(d + 1..).next().unwrap();
   score -= c[p] * (d - f1) as i64 * (b1 - d) as i64;
   score += c[q] * (d - f2) as i64 * (b2 - d) as i64;
   t[d] = q;
   last[p].remove(&d);
   last[q].insert(d);
   score
}


Measured memory_bytes: 3356
#include<bits/stdc++.h>
#define reg register int
#define il inline
#define fi first
#define se second
#define mk(a,b) make_pair(a,b)
#define numb (ch^'0')
#define pb push_back
#define solid const auto &
#define enter cout<<endl
#define pii pair<int,int>
using namespace std;
typedef long long ll;
template<class T>il void rd(T &x){
    char ch;x=0;bool fl=false;while(!isdigit(ch=getchar()))(ch=='-')&&(fl=true);
    for(x=numb;isdigit(ch=getchar());x=x*10+numb);(fl==true)&&(x=-x);}
template<class T>il void output(T x){if(x/10)output(x/10);putchar(x%10+'0');}
template<class T>il void ot(T x){if(x<0) putchar('-'),x=-x;output(x);putchar(' ');}
template<class T>il void prt(T a[],int st,int nd){for(reg i=st;i<=nd;++i) ot(a[i]);putchar('\n');}
namespace Modulo{
const int mod=1e9+7;
int ad(int x,int y){return (x+y)>=mod?x+y-mod:x+y;}
void inc(int &x,int y){x=ad(x,y);}
int mul(int x,int y){return (ll)x*y%mod;}
void inc2(int &x,int y){x=mul(x,y);}
int qm(int x,int y=mod-2){int ret=1;while(y){if(y&1) ret=mul(x,ret);x=mul(x,x);y>>=1;}return ret;}
}
using namespace Modulo;
namespace Miracle{
const int N=2002;
const int M=4000000+5+N+N;
int n,k;
int f[2][N];
int jie[M],inv[M];
int C(int n,int m){
    if(n<0||m<0||n<m) return 0;
    return mul(jie[n],mul(inv[m],inv[n-m]));
}
int main(){
    rd(n);rd(k);
    if(k==1){
        puts("1");return 0;
    }
    int lim=n*k+n+n;
    jie[0]=1;
    for(reg i=1;i<=lim;++i) jie[i]=mul(jie[i-1],i);
    inv[lim]=qm(jie[lim]);
    for(reg i=lim-1;i>=0;--i) inv[i]=mul(inv[i+1],i+1);
    int tmp=0;
    f[0][0]=1;
    for(reg i=2*n;i>=1;--i){
        tmp^=1;
        memset(f[tmp],0,sizeof f[tmp]);
        int re=2*n-i;
        for(reg j=0;j<=min(re,n);++j){
            if(!f[tmp^1][j]) continue;
            int le=re-j;
            if(le+1<=j) f[tmp][j]=ad(f[tmp][j],f[tmp^1][j]);
            if(j!=n){
                f[tmp][j+1]=ad(f[tmp][j+1],mul(f[tmp^1][j],C(k-2+le+j*(k-1),le+j*(k-1))));
            }
        }
    }
    ll ans=mul(f[tmp][n],jie[n]);
    ot(ans);
    return 0;
}

}
signed main(){
    Miracle::main();
    return 0;
}

/*
   Author: *Miracle*
*/

Measured memory_bytes: 31488
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=105;
int a[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    bool check=true;
    for(int i=1;i<=n;i++)
        if((a[i]%2==0)&&!(a[i]%3==0||a[i]%5==0))
        {
            check=false;
            break;
        }
    puts(check?"APPROVED":"DENIED");
    return 0;
}


Measured memory_bytes: 128
import java.util.*

class UnionFind(n: Long) {
    val size = n.toInt()

    private val parent: Array<Long>
    private val cardinality: Array<Long>

    init {
        parent = Array(size) { -1L }
        cardinality = Array(size) { 1L }
    }

    fun find(x: Long): Long {
        return if (parent[x.toInt()] == -1L) {
            x
        } else {
            parent[x.toInt()] = find(parent[x.toInt()])
            parent[x.toInt()]
        }
    }

    fun unite(x: Long, y: Long): Boolean {
        val u = find(x).toInt()
        val v = find(y).toInt()
        if (u == v) {
            return false
        }

        val newSize = cardinality[v] + cardinality[u]

        if (cardinality[u] < cardinality[v]) {
            parent[u] = v.toLong()
            cardinality[v] = newSize
        } else {
            parent[v] = u.toLong()
            cardinality[u] = newSize
        }

        return true
    }

    fun same(x: Long, y: Long): Boolean {
        return find(x) == find(y)
    }

    fun getCardinalityOf(x: Long): Long {
        return cardinality[find(x).toInt()]
    }
}

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    var N: Long
    N = sc.nextLong()
    var M: Long
    M = sc.nextLong()
    val X = Array((M).toInt()){0L}
    val Y = Array((M).toInt()){0L}
    val Z = Array((M).toInt()){0L}
    for (i in 0 until M) {
        X[(i).toInt()] = sc.nextLong()
        Y[(i).toInt()] = sc.nextLong()
        Z[(i).toInt()] = sc.nextLong()
    }
    solve(N, M, X, Y, Z)
}

fun solve(N: Long, M: Long, X: Array<Long>, Y: Array<Long>, Z: Array<Long>) {
    var res = N

    val uf = UnionFind(N + 1)

    for (i in X.indices) {
        if (uf.unite(X[i], Y[i])) {
            --res
        }
    }
    println(res)
}



Measured memory_bytes: 113420
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int total_num,src_num;

    cin >> src_num;
    cin >> total_num;

    vector<int> vec(total_num);
    int j = 1;
    
    for (int i = 0; i < total_num; i++) {
        cin >> vec.at(i);
    }
    
    sort(vec.begin(), vec.end());
    
    if(binary_search(vec.begin(),vec.end(),src_num)==false){
        int result = src_num;
        cout << result << endl;
        return 0;
    }
    
    int tmp;
    
    while(true){
        tmp = src_num - j;
        if(binary_search(vec.begin(),vec.end(),tmp)==false){
            int result = tmp;
            cout << result << endl;
            return 0;
        }
        tmp = src_num + j;
        if(binary_search(vec.begin(),vec.end(),tmp)==false){
            int result = tmp;
            cout << result << endl;
            return 0;
        }
        j++;
    }

    return 0;
}

Measured memory_bytes: 3636
/**

author:	©LoneWolfDON
Git: MahinHossainMunna

**/
/*

*/
#include <stdio.h>

int main()
{
    int A,B,C;
    scanf("%d%d%d", &A, &B, &C);

    int temp =0;

    //swapping between A and B
    temp = A;
    A = B;
    B = temp;

    //swapping between A and C
    temp = A;
    A = C;
    C = temp;

    printf("%d %d %d\n",A, B, C);

    return 0;
}


Measured memory_bytes: 1708
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <math.h>
using namespace std;

const long long INF = 1LL << 60;  // どういう意味だろうか

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;
}


int main() {
	int N;
	int A, B;
	int temp_max;
	int temp_min;

	cin >> N >> A >> B;

	temp_max = (A > B) ? A: B;
	temp_min = (A == temp_max)? B: A;

	int temp = temp_min - (N - temp_max);

	if(temp < 0){
		temp = 0;
	}

	cout << temp_min <<" " << temp << endl;


}


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

#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;
const long double PI = (acos(-1));
const long long MOD = 1000000007;
#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 (auto 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(int N) {
	std::vector<T> vec(N);
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
	return vec;
}
template<typename T> void inputVec(std::vector<T>& vec) {
	for (auto 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() {
	string S = inputVal<string>();
	int ret;

	if (S == "SUN") ret = 7;
	if (S == "SAT") ret = 1;
	if (S == "FRI") ret = 2;
	if (S == "THU") ret = 3;
	if (S == "WED") ret = 4;
	if (S == "TUE") ret = 5;
	if (S == "MON") ret = 6;


	outputVal(ret);
}

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

	double tmp;
	cin >> tmp;

	return 0;
}


Measured memory_bytes: 256
import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
from functools import lru_cache
INF = 1 << 60

#ここから書き始める
t = int(input())
print(t ** 2)


Measured memory_bytes: 5696
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<fstream>
#include<map>
#include<iostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef queue<int> qi;
typedef queue<ll> ql;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=1;i<=n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
ll ans=0;
int a[100005];
int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    rep(i,n) cin>>a[i];
    int p=1;
    while (p<n){
    	if (a[p]!=p){
    		p++;
    		continue;
    	}
    	ans++;
    	swap(a[p],a[p+1]);
    	p++;
    }
    if (a[n]==n) ans++;
    cout<<ans;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include <string>
using namespace std;
string s;
int main()
{
    bool a=0;
    cin>>s;
    for(int i=0;i<s.size();++i){
        if(s[i]=='C')
        {
            for(int j=i+1;j<s.size();++j) if(s[j]=='F') a=1;
        }
        if(a) break;
    }
    if(a) printf("Yes");
    else printf("No");
    return 0;
}


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

using namespace std;

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

    int a, b;
    cin >> a >> b;

    bool flag = false;

    for (int i = a; i <= b; i++) {
        if (i % k == 0) {
            flag = true;
            break;
        }
    }

    if (flag) {
        cout << "OK" << endl;
    }
    else {
        cout << "NG" << endl;
    }

    return 0;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n;
    cin >> n;
    set<char> st;
    for(int i = 0; i < n; ++i) {
        char c;
        cin >> c;
        st.insert(c);
    }
    if(st.size() == 3) cout << "Three";
    else cout << "Four";
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int input;
	int weight;
	int need[10];
	int i,max;
	while(scanf("%d",&input)!=EOF)
	{
		weight=512;
		max=0;
		for(i=0;i<10;i++)
		{
			need[i]=0;
		}
		for(i=9;i>=0;i--)
		{
			if(weight<=input)
			{
				input-=weight;
				need[i]=weight;
				if(i>max)max=i;
			}
			weight/=2;
		}
		i=-1;

		for(i=0;i<10;i++)
		{
			if(need[i])
			{
				printf("%d",need[i]);
				if(i<max)putchar(' ');
			}
			
		}

		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <iostream>
using namespace std;
void StoneMonument() {
	long long a, b;
	cin >> a >> b;
	long long bef = 1;
	long long n;
	for (size_t i = 2; i < 1000; i++)
	{
		n = bef + i;
		if (bef - a < 0 || n - b < 0) {
			bef = n;
			continue;
		}

		if ((bef - a) == (n - b)) {
			cout << (bef - a);
			break;
		}
		else if (i == 999) {
			cout << (n - b);
		}
		bef = n;
	}
}
int main() {
	StoneMonument();
	return 0;
}

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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define debug if(true)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

int main(){
	int n,i,j;
	int a[200001];
	scanf("%d",&n);
	for(i=0;i<n;i++){scanf("%d",&a[i]);}
	ll tot = 0;
	for(i=1;i<n;i++){
		if(a[i] < a[i-1]){
			int diff = (a[i-1] - a[i]);
			tot += (a[i-1] - a[i]);
			a[i] += diff;
		}
	}
	printf("%lld\n",tot);
	
	return 0;
};

Measured memory_bytes: 4592