akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.12f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 1010101;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[8] = { 1,-1,0,0,1,1,-1,-1 };
ll dy[8] = { 0,0,1,-1,1,-1,1,-1 };
ll d[110][2];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	ll res = 4 * a * b;
	ll res2 = (c - a - b) * (c - a - b);
	if (c - a - b > 0 && res < res2)puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(void){
  int n, k;
  string S;
  cin >> n >> k;
  cin >> S;
  k -= 1;
  if(S[k] == 'A'){
    S[k] = 'a';
  }
  if(S[k] == 'B'){
    S[k] = 'b';
  }
  if(S[k] == 'C'){
    S[k] = 'c';
  }
  cout << S << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node{
  int key;
  struct node *next;
  struct node *prev;
} ;
typedef struct node *NodePointer;

void insert(int);
void deletekey(int);
NodePointer search(int);
void delete(NodePointer);

NodePointer nil;

int main()
{
  int i, n, keydata;
  char command[12];
  NodePointer x;

  //ダミーノードの作成
  nil = (NodePointer)malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
  nil->key = -1;

  scanf("%d",&n);

  for(i = 0; i < n; i++) {
    scanf("%s",command);

    if(strcmp(command,"insert") == 0) {
      scanf("%d",&keydata);
      insert(keydata);
    }
    else if(strcmp(command,"delete") == 0) {
      scanf("%d",&keydata);
      deletekey(keydata);
    }
    else if(strcmp(command,"deleteFirst") == 0) delete(nil->next);
    else delete(nil->prev);
  }

  x = nil->next;
  printf("%d",x->key);
  x = x->next;
  while(x != nil) {
    printf(" %d",x->key);
    x = x->next;
  }
  printf("\n");


  x = nil->next->next;
  while(x != nil) {
    free(x->prev);
    x = x->next;
  }
  free(nil);

  return 0;
}

void insert(int keydata)
{
  NodePointer x;

  x = (NodePointer)malloc(sizeof(struct node));

  x->key = keydata;
  
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

void deletekey(int keydata)
{
  NodePointer x;

  if((x = search(keydata)) == nil) return;

  delete(x);
}

NodePointer search(int keydata)
{
  NodePointer x;

  x = nil->next;
  while(x != nil && x->key != keydata) {
    x = x->next;
  }
  
  return x;
}

void delete(NodePointer x)
{
  x->prev->next = x->next;
  x->next->prev = x->prev;
  free(x);
}





Measured memory_bytes: 32952
(n, m, x) = gets.chomp.split(' ').map(&:to_i)
a = gets.chomp.split(' ').map(&:to_i)

i = a.bsearch_index{|a_i| a_i >= x}

puts [a[0...i].size, a[i..a.size].size].min.to_s

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

using namespace std;

int main()
{
    int n;
    cin>>n;
    
    vector<int> A(n);
    for(int i=0;i<n;i++) cin>>A[i];
    
    for(int i=0;i<n;i++){
        
        int j=i;
        while(j>0 && A[j-1]>A[j]){
            swap(A[j-1],A[j]);
            j--;
        }
     
        for(int j=0;j<n-1;j++) cout<<A[j]<<" ";
        cout<<A[n-1]<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    ll a;
    int b, c;
    scanf("%lld %d.%d", &a, &b, &c);
    cout << a * (100 * b + c) / 100 << endl;
}

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

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(N + 1);
  for (int i = 1; i <= N; i++) {
    int a;
    cin >> a;
    A[i] = a;
  }
  int resc = 0;
  vector<bool> res(N + 1, false);
  for (int i = N; i >= 1; i--) {
    int cnt = 0;
    int k = 2;
    while (i * k <= N) {
      if (res[i * k]) cnt++;
      k++;
    }
    if ((cnt + 1) % 2 == A[i]) {
      res[i] = true;
      resc++;
    } else if (cnt % 2 == A[i]) {
      res[i] = false;
    } else {
      cout << -1 << '\n';
      return 0;
    }
  }
  cout << resc << '\n';
  for (int i = 1; i <= N; i++) {
    if (res[i]) cout << i << '\n';
  }
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\
     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}
/* Precode Ends */
#define mod 1000000007
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;
ll po(ll a,ll n)
{
  ll ans=1;
  for(int i=1;i<=n;i++)
       ans*=a;
    return ans;
}

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


ll n,d=26,cnt=1;
cin>>n;
string s;
while(n>0)
{

    if(n%26==0)
    {
        s+='z';
        n--;
    }
    else
    s+=(char)((n%26)+'a'-1);
    n/=26;
}
reverse(s.begin(),s.end());
cout<<s<<endl;
return 0;
}



Measured memory_bytes: 3652
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 1000


int main(){
	char a[N];
	char b[N];
	f(i, N)a[i] = 0;
	f(i, N)b[i] = 0;
	int n;
	bool v = true;
	scanf("%s", a);
	scanf("%s", b);
	n = strlen(a);
	f(i, n){
		a[n + i] = a[i];
	}
	f(i, n){
		v = true;
		f(j, n){
			if (a[i + j] != b[j])v = false;
		}
		if (v){
			printf("Yes\n");
			return 0;
		}
	}

	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N;
int K;
vector<bool> own;
int main()
{
    cin >> N;
    cin >> K;
    for (int n = 0; n < N; n++)
    {
        own.push_back(false);
    }
    for (int i = 0; i < K; i++)
    {
        int d=0;
        cin>>d;
        for(int j=0;j<d;j++){
            int res=0;
            cin>>res;
            own[res-1]=true;
        }
    }
    int count=0;
    for (int n = 0; n < N; n++)
    {
        if(own[n]){
            count++;
        }
    }
    
    cout<<endl;
    cout<<N-count;
    return 0;
}

Measured memory_bytes: 3596
H, W = map(int, input().split())
INF = 10 ** 4
c = [[int(i) for i in input().split()] for _ in range(10)]
for k in range(10):
    for i in range(10):
        for j in range(10):
            c[i][j] = min(c[i][j], c[i][k] + c[k][j])

ans = 0
for _ in range(H):
    for a in map(int, input().split()):
        if a != -1:
            ans += c[a][1]
print(ans)

Measured memory_bytes: 3064
# Enter your code here. Read input from STDIN. Print output to STDOUT

MOD=10**9+7
fact=[1]
infact=[1]
temp=1
intemp=1
for i in xrange(1,10**6):
    temp*=i
    temp%=MOD
    fact+=[temp]
    intemp*=pow(i,MOD-2,MOD)
    intemp%=MOD
    infact+=[intemp]
    

def binom(a,b):
    up=fact[a]
    down=(infact[b]*infact[a-b])%MOD
    ans=(up*down)%MOD
    return ans


N,M,k=list(map(int,raw_input().strip().split(' ')))
if N==1 or M==1:
    if M<N:
        N,M=M,N
    ans=(binom(M*N,k)*binom(k,2))%MOD
    ans*=binom(M+1,3)
    ans%=MOD
    ans*=pow(binom(M*N,2),MOD-2,MOD)
    ans%=MOD
    print(ans)

else:       


    ans=(binom(M*N,k)*binom(k,2))%MOD
    ans*=((M*M*binom(N+1,3))%MOD+(N*N*binom(M+1,3))%MOD)%MOD
    ans*=pow(binom(M*N,2),MOD-2,MOD)
    ans%=MOD
    print(ans)
    
    
    



Measured memory_bytes: 94228
def count_div(start, end, div):
    # [start, end)
    return (end - 1) // div - (start - 1) // div


def calc_start(mid):
    cnt, i = 0, 1
    while 10 ** i < mid:
        d, p = 10 ** i, 10 ** (i - 1)
        fif, three, five = count_div(p, d, 15), count_div(p, d, 3), count_div(p, d, 5)
        cnt += i * (d - p) + (three + five) * 4 - (three + five - fif) * i
        i += 1
    d = 10 ** (i - 1)
    fif, three, five = count_div(d, mid, 15), count_div(d, mid, 3), count_div(d, mid, 5)
    cnt += i * (mid - d) + (three + five) * 4 - (three + five - fif) * i
    return cnt


N = int(input()) - 1
left, right = 1, 10 ** 18
while left + 1 < right:
    mid = (left + right) // 2
    start = calc_start(mid)
    if start <= N:
        left = mid
    else:
        right = mid
ans = ''
for i in range(left, left + 30):
    tmp = ''
    if i % 3 == 0:
        tmp += "Fizz"
    if i % 5 == 0:
        tmp += "Buzz"
    if not tmp:
        tmp = str(i)
    ans += tmp
start = calc_start(left)
print(ans[N - start:N - start + 20])

Measured memory_bytes: 7776
/** Author: Dwai
 *  Omae wa mou shindeiru!
**/

#include <bits/stdc++.h>
using namespace std;

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define all(a) (a).begin(),(a).end()
#define fr(i,a,b) for (i = a; i <= b; i++)
#define frr(i,a,b) for (i = a; i >= b; i--)
#define rep(i,n) for (i = 0 ; i < n; i++)
#define repr(i,n) for (i = n - 1; i >= 0; i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define flushinput   cin.ignore(numeric_limits<streamsize>::max(),'\n');

void debug_out() { cerr << endl; }

void clock_out(){
  cerr<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s\n";
}

void fileio(){
  freopen("/home/dwai/Desktop/cp/input.txt","r", stdin);
  freopen("/home/dwai/Desktop/cp/output.txt", "w", stdout);
  freopen("/home/dwai/Desktop/cp/debug.txt", "w", stderr);
}

void ofileio(){
  freopen("input.txt","r", stdin);
  freopen("output.txt", "w", stdout); 
}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << H;
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define fio() fileio()
#define ofio() fileio()
#define clock() clock_out()
#else
#define debug(...) 42
#define fio() 42
#define ofio() ofileio()
#define clock() 42
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vll;
typedef map<ll,ll> mll;

int IT_MAX = 1 << 20;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

void solve(){
	ll n,k;
	cin>>n>>k;

	ll a[n],i;
	rep(i,n) cin>>a[i];

	ll dp[n+1]={0};
	dp[0]=0;
	ll j;

	fr(i,1,n-1)
	{
		dp[i]=INF;
		fr(j,max(0ll,i-k),i-1)
		{
			dp[i]=min(dp[i],dp[j]+abs(a[j]-a[i]));
		}
	}
	cout<<dp[n-1];
}

int main(){
	//fio();
	fast

	solve();
	return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
#define PMT 1<<10
#define MAX 330
#define N 10

int dp[N+1][PMT][MAX+1];

int bitdp(int n, int pmt, int s){
  int ans=0;
  if(n > N || s < 0|| s > MAX)return 0;
  if(dp[n][pmt][s] >= 0)return dp[n][pmt][s];
  if(n==1){
    if( s<N && !(pmt & ( 1<<s )) )
      ans=1;
  }
  else{
    for(int i=0; i<N; ++i){
      if( !(pmt&( 1<<i )) ){
	ans+=bitdp(n-1,pmt+(1<<i),s - i*n);
      }
    }
  }
  dp[n][pmt][s]=ans;
  return ans;
}

int main(){
  int n,s,cp;
  memset(dp,-1,sizeof(dp));

  while(scanf("%d%d",&n,&s)!=EOF)
    printf("%d\n",bitdp(n,0,s));
  
  return 0;
}

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

int main(void) {
    string helix;

    cin >> helix;
    size_t len = helix.length();

    for (int i=0; i<len; i++) {
      if (helix[i] == 'A') {
        cout << "T";
      } else if (helix[i] == 'T') {
        cout << "A";
      } else if (helix[i] == 'C') {
        cout << "G";
      } else if (helix[i] == 'G') {
        cout << "C";
      }
    }

    printf("\n");


    return 0;
}


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

int main() {
    int n, ans = INT_MAX;
    string str;
    cin >> n >> str;
    vector<int> left(n), right(n);
    left.at(0) = right.at(n - 1) = 0;
    for(int i = 1; i < n; i++) {
        if(str.at(i - 1) == 'W') left.at(i) = left.at(i - 1) + 1;
        else left.at(i) = left.at(i - 1);
    }
    for(int i = n - 2; i >= 0; i--) {
        if(str.at(i + 1) == 'E') right.at(i) = right.at(i + 1) + 1;
        else right.at(i) = right.at(i + 1);
    }
    rep(i, n) ans = min(ans, left.at(i) + right.at(i));
    cout << ans << endl;
}

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

int main()
{
    int n;
    cin >>n;
    string s;
    cin  >>s;
    int force[300000+5]={0};
    int bef=0;
    for(int i=0;i<n;i++){
        if(s[i]=='W'){
            bef++;
        }
        force[i+1]+=bef;
    }
    bef=0;
    for(int i=n-1;i>=1;i--){
        if(s[i]=='E'){
            bef++;
        }
        force[i-1]+=bef;
    }
    int ans=100000000;
    for (int i = 0; i <n; i++)
    {  
        ans=min(ans,force[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1796
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String T = in.next();
		int a = 0;
		int b = 10000;

		String[] SArray = S.split("");
		String[] TArray = T.split("");

		for(int i=0; i<SArray.length - TArray.length + 1; i++) {
			for(int j=0; j<TArray.length; j++) {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			}
			if(a < b) {
				b = a;
			}
			a = 0;
		}

		System.out.println(b);
	}
}


Measured memory_bytes: 35596
#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>

ll m,n;
ll MOD=1000000007LL;

ll pow(ll m,ll n){
  ll ret=1LL;
  if(n==0)
    return ret;

  if(n&1){
      ret=ret*pow(m*m%MOD,(n-1)/2);
      ret%=MOD;
      ret=ret*m;
      ret%=MOD;
  }
  else{
    ret=ret*pow(m*m%MOD,n/2);
    ret%=MOD;
  }

    return ret%MOD;
}
int main(){
  cin>>m>>n;
  cout<<pow(m,n)%MOD<<endl;

  return 0;
}




Measured memory_bytes: 3116
#include <iostream>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a < b) {
		cout << "a < b" << endl;
	}
	else if (a > b) {
		cout << "a > b" << endl;
	}
	else {
		cout << "a == b" << endl;
	}
	return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))


#define forr(i,n) for(i=0; i<n; i++)
#define whilee(i,t) while(i!=t)
//#define pb(x) push_back(x);

//sort(A.begin(),A.end());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//accumulate(A.begin(), A.end(), 0);
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());



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

    //vector <int> A;
    //deque <int> A;
    //queue <int> A;
    //stack <int> A;
    //set <int> A;
    //map <int,int> A;
    //pair <int,int> A ;
    //vector <pair <int,int>> A ;
    //string S, T;
    int i, j, k, a, b, c, d, l, m, n, p, q, r, s, t, x, y, z, cnt=0;
    cin>>a>>b>>c>>d;
    x=c-a;
    y=d-b;
    cout<<(c-y)<<" "<<(d+x)<<" "<<(a-y)<<" "<<(b+x)<<endl;
    return 0;
}





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

typedef long long ll;

const ll MAX = 110000;
const ll 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; cin >> N;
    vector<int> a(N), b(N);

    vector<ll> vec(110000);

    for (int i = 1; i <= N; ++i) {
        vec[i - 1] = i;
    }
    
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < N; ++i) {
        cin >> b[i];
    }

    //aを昇順に
    if (a > b) swap(a, b);

    //順列生成、カウント
    int ans = 0;
    do {
        if(a == b) break;
        ++ans;
    } while (next_permutation(a.begin(), a.end()));

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 4028
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const int INF=0x3f3f3f3f;
//const int maxn=5e3+7;
const int mod=1e9+7;
const int maxn = 200 + 10;
ll a[maxn];

const int L = 63;
ll d[L];
bool add(ll x){
    for(int i = L - 1; i >= 0; i--) if(x & 1ll << i){
        if(d[i] == -1){d[i] = x; return true;}
        x ^= d[i];
    }
    return false;
}

int main(){
    int t; cin >> t; while(t--){
        memset(d, -1, sizeof d);
        
        int n; cin >> n;
        for(int i = 0; i < n; i++) cin >> a[i];
        char s[maxn]; cin >> s;
        int flag = 0;
        for(int i = n - 1; i >= 0; i--){
            if(add(a[i]) && s[i] == '1'){
                flag = 1;
                break;
            }
        }
        cout << flag << endl;
    }
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin >> n;
    vector<int> a(n);
    for(int &i : a) cin >> i;
    vector<int> b(a);
    for(int i = 1; i < a.size(); ++i)
        a[i] += a[i-1];
    b.push_back(0);
    for(int i = n-1; i >= 0; --i)
        b[i] += b[i+1];
    int minor = 1e9;
    for(int i = 0; i < a.size(); i++) minor = (minor > abs(a[i] - b[i+1])) ? abs(a[i] - b[i+1]): minor; 
    cout << minor << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int N;
	scanf("%d",&N);
	int a[N];
	int i;
	for(i = 0;i < N;i++){
		scanf("%d",&a[i]);
	}
	int min = a[0],max = a[0];
	for(i = 1;i < N;i++){
		if(a[i] > max){max = a[i];}
		if(a[i] < min){min = a[i];}
	}
	printf("%d",max-min);



	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}
const int MOD = 1000000007;

int main() {
    int n; cin >> n;string s[n];
    map<string,ll> ma;
    int cnt = 0;
    for(int i = 0;i < n;i++){
        string x; cin >> x;
        sort(x.begin(),x.end());
        ma[x]++;
    }
   ll sum  = 0;
      for(auto e:ma){
          ll tmp = e.second*(e.second-1)/2;
          sum += tmp;
      }
    cout<<sum<<endl;
}



Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!
 
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}
 
inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}
 
using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;
 
signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
 
    double a, b;
    cin >> a >> b;
    double x = (b - a) / 2.;
 
    // vector<double> v{x - 360, x - 180, x, x + 180, x + 360};
    // printV(v);
    double t = 1e10;
    for (int k = -100; k <= 100; ++k) {
        if (abs(t) > abs(x + k * 180.)) {
            t = x + k * 180.;
        }
    }
    double tmp = a + t;
    for (int k = -100; k <= 100; ++k) {
        double hoge = tmp + k * 360.;
        if (0 <= hoge && hoge < 360) {
            cout << fixed << setprecision(10) << hoge << endl;
            return 0;
        }
    }
 
 
}

Measured memory_bytes: 3272
if __name__ == '__main__':
    N = int(input())
    # linked_list = LinkedList()

    import collections
    d = collections.deque()

    for i in range(N):
        val = input().split()

        if val[0] == 'insert':
            # linked_list.insert(int(val[1]))
            d.appendleft(val[1])
        elif val[0] == 'delete':
            # linked_list.delete_key(int(val[1]))
            try:
                d.remove(val[1])
            except ValueError:
                pass
            
        elif val[0] == 'deleteFirst':
            # linked_list.delete_first()
            d.popleft()
            # result.remove(result[0])
        elif val[0] == 'deleteLast':
            # linked_list.delete_last()
            d.pop()

    # print(linked_list)
    print(' '.join(d))


Measured memory_bytes: 69732
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>

using namespace std;

typedef long long ll;
typedef vector <ll> v_ll;
typedef vector <vector <ll> > vv_ll;
typedef vector < pair <ll,ll> > vp_ll;
typedef vector < vector < pair <ll,ll> > > vvp_ll;
typedef pair <ll,ll> p_ll;

ll N;
vvp_ll G;
vector<bool> D;
vector<ll> color;

vp_ll hoge(){
  return vp_ll();
}


int main(){
  cin >>N;
  G.assign(N+10,hoge());
  D.assign(N+10,true);
  color.assign(N+10,0);
  for(ll i=1;i<=N-1;i++){
    ll x,y,z;
    cin >> x >> y >> z;
    G[x].push_back(make_pair(y,z));
    G[y].push_back(make_pair(x,z));
  }
  queue<ll> que;
  que.push(1);
  while(!que.empty()){
    ll x=que.front();
    que.pop();
    D[x]=false;
    for (ll i=0;i<G[x].size();i++){
      ll y=G[x][i].first;
      ll z=G[x][i].second;
      if (D[y]){
        que.push(y);
        if (z%2==0)color[y]=color[x];
        else color[y]=1-color[x];
      }
    }
  }
  for (ll i=1;i<=N;i++){
    cout << color[i] << endl;
  }
}


Measured memory_bytes: 8832
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18
#define PI 3.1415926535

using ll = long long;



int main(){
  int N; cin >> N;
  vector<pair<ll,ll>> BA(N);
  rep(i,N){
    cin >> BA[i].second >> BA[i].first;
  }
  sort(BA.begin(),BA.end());
  ll time = 0;
  bool ok = true;
  rep(i,N){
    if(i == 0) time += BA[i].first;
    else time += BA[i].first - BA[i-1].first;
    if(time < BA[i].second) ok = false;
    time -= BA[i].second;
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

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

int main(){
   string str;
   while(getline(cin, str), str != "."){
      stack<char> st;
      bool flag = false;
      for(char c : str){
         //cout << c << "," << st.size() << endl;
         if(c == '(' || c == '['){
            st.push(c);
         }else if(c == ')' || c == ']'){
            if(!st.empty() && (c == ']' && st.top() == '[' || c == ')' && st.top() == '(')) st.pop();
            else{
               flag = true;
               break;
            }
         }
      }
      if(st.empty() && !flag) cout << "yes" << endl;
      else cout << "no" << endl;
   }
}



Measured memory_bytes: 3208
import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;

void main() {
  const MAX = 1000000;
  auto budget = readln.chomp.to!int;
  auto hasuu = budget % 100;

  int purchasedCount;
  while(hasuu > 0) {
    if (hasuu < 5) {
      purchasedCount++;
      break;
    }

    purchasedCount++;
    hasuu -= 5;
  }
  
  writeln(purchasedCount*100 <= budget ? "1" : "0");
}


Measured memory_bytes: 256
@A=glob<>;@l=<>;printf sort{$a-$b}map{@v=++$i;$x=-30;$v[$t=$i>>2*$_&3]+=$t&&$l[$x+=10,$_]for 0..@l;$x+=abs$A[$_]-($v[$_]||1e9)for 1..3;$x}1..1e5

Measured memory_bytes: 9856
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////
//
#define mx 100000
ll ar[mx+2];
ll dp[mx+2][2];
int n;
ll DP(int i, int fl){
        int x = 1;
    if(fl ==1) x =-1;
    if(i==n){

        return ar[i] * x;
    }
    ll &ret = dp[i][fl];
    if(ret!=-1)return ret;
    ret= 0;
    ret= max(ret, ar[i] * x + DP(i+1, 0));
    ret = max(ret, ar[i] * x * (-1) + DP(i+1, 1) );
    return ret;
}
int main(){

 I(n);

 for(int i=1;i<=n;i++)L(ar[i]);
 SETR(dp);
 cout<<DP(1,0)<<endl;
    return 0;
}

Measured memory_bytes: 7296
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		for(int i=s.length()-2; i>=1; i-=2){
			if(s.substring(0, i/2).equals(s.substring(i/2,i))){
				System.out.println(i);
				break;
			}
		}
	}
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
long long dp[60][2];
int main(){
	int n,p,i,j;
	scanf("%d%d",&n,&p);
	dp[0][0]=1;
	long long ans=dp[0][p];
	for (i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		bool flag=x&1;
		for (j=0;j<i;j++)
			dp[i][1]+=dp[j][!flag],dp[i][0]+=dp[j][flag];
		ans+=dp[i][p];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<math.h>
using namespace std;

int main() {
	// your code goes here
	int x,i,j;
	cin>>x;
	int max=1;
	int sum=1;
	for(i=2;i<x;i++)
	{
	    for(j=2;;j++)
	    {
	        if(pow(i,j)<=x)
	        {
	        if(max<pow(i,j))
	        max=pow(i,j);
	        }
	        else
	        break;
	    }
	    if(pow(i,2)>x)
	    break;
	}
	cout<<max<<endl;
	return 0;
}


Measured memory_bytes: 256
object Main{
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val arr = List.fill(26)(0).toArray
    while (sc.hasNext){
      val chars = sc.next.toLowerCase.toCharArray
      for (c <- chars){
        if (97 <= c && c <= 122){
          arr(c - 97) += 1
        }
      }
    }
    for (i <- 97 to 122){
      println(i.toChar + " : " + arr(i - 97))
    }
  }
}

Measured memory_bytes: 45152
#include <stdio.h>
#define N 101
#define INF 200000
#define WHITE 0
#define BLACK -1

main(){
  int i, j, k, n, u, v, min;
  int graph[N][N], color[N], d[N];

  scanf("%d", &n);

  for( i = 0; i < n; i++){
    color[i] = WHITE;
    d[i] = INF;
    for( j = 0; j < n; j++){
      graph[i][j] = -1;
    }
  }

  for( i = 0; i < n; i++){
    scanf("%d%d", &u, &k);
    for( j = 0; j < k; j++){
      scanf("%d", &v);
      scanf("%d", &graph[u][v]);
    }
  }

  d[0] = 0;
  while(1){
    min = INF;

    for( i = 0; i < n; i++){
      if( color[i] != BLACK && d[i] < min ){
        min = d[i];
        u = i;
      }
    }

    // printf("([u] = %d)\n", u);

    if( min == INF )
      break;

    for( v = 0; v < n; v++){
      if( graph[u][v] != -1 ){
        if( color[v] != BLACK && d[u]+graph[u][v] < d[v] ){
          d[v] = d[u]+graph[u][v];
          // printf("(d[%d] = %d)\n", v, d[v]);
        }
      }
    }

    color[u] = BLACK;

  }

  for( i = 0; i < n; i++){
    printf("%d %d\n", i, d[i]);
  }

  return 0;

}

Measured memory_bytes: 636
#include<stdio.h>
int main(void){
    char S[4];
    scanf("%s",S);
    if(S[0]=='S'){
        if(S[1]=='U'){
            printf("%d",7);
        }else{
            printf("%d",1);
        }
    }else if(S[0]=='F'){
        printf("%d",2);
    }else if(S[0]=='T'){
        if(S[1]=='H'){
            printf("%d",3);
        }else{
            printf("%d",5);
        }
    }else if(S[0]=='W'){
        printf("%d",4);
    }else if(S[0]=='M'){
        printf("%d",6);
    }
    return 0;    
}

Measured memory_bytes: 128
from heapq import heappop,heappush
n=int(input())
a=list(map(int,input().split()))
hl,hr=[],[]
for i in range(n):
  heappush(hl,a[i])
  heappush(hr,-a[i+2*n])
sl=[sum(hl)]
sr=[sum(hr)]
ans=0
for i in a[n:2*n]:
  sl+=[i+sl[-1]]
  heappush(hl,i)
  sl[-1]-=heappop(hl)
for i in a[n:2*n][::-1]:
  sr+=[-i+sr[-1]]
  heappush(hr,-i)
  sr[-1]-=heappop(hr)
print(max([i+j for i,j in zip(sl,sr[::-1])]))

Measured memory_bytes: 123272
#include<iostream>
using namespace std;
int main(){
long aa[4]={0},bb[4]={0},i;
double a,b;
while(cin>>a){
cin>>b;
if(a>=1.1)aa[0]++;
else if(a>=0.6)aa[1]++;
else if(a>=0.2)aa[2]++;
else aa[3]++;
if(b>=1.1)bb[0]++;
else if(b>=0.6)bb[1]++;
else if(b>=0.2)bb[2]++;
else bb[3]++;
}
for(i=0;i<4;i++){
cout<<aa[i]<<" "<<bb[i]<<endl;
}
return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x) cout<<#x<<" = "<<(x)<<endl
#define COUT(x) cerr<<#x<<" = "; cout<<(x)<<endl

struct edge { int to, cost; };

const int INF = 1e18;
const int MOD = 1e9+7;

signed main()
{
   int n; cin >> n;
   V<int> a(n), b(n);
   for (int i = 0; i < n; i++) {
      cin >> a[i];
   }
   for (int i = 0; i < n; i++) {
      cin >> b[i];
   }

   int asum = accumulate(a.begin(), a.end(), 0LL);
   int bsum = accumulate(b.begin(), b.end(), 0LL);
   if (asum < bsum) {
      cout << "-1" << endl;
      return 0;
   }

   int diff = asum - bsum;
   V<int> d;
   for (int i = 0; i < n; i++) {
      if (a[i] >= b[i]) {
         d.push_back(a[i] - b[i]);
      }
   }

   sort(d.begin(), d.end());
   int ans = n;
   for (int i = 0; i < d.size(); i++) {
      if (diff - d[i] >= 0) {
         diff -= d[i];
         ans--;
      }
   }
   cout << ans << endl;

   return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

int n;
int a[100010];

int main(){
  cin>>n;
  rep(i,n){
    cin>>a[i];
    a[i]--;
  }
  ll res=0;
  rep(i,n){
    if(i<n-1&&a[i]==i&&a[i+1]==i+1){
      res++; i++;
    }else if(a[i]==i){
      res++;
    }
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 640
#include <algorithm>
    #include <iostream>
    #include <cstring>
    #include <cstdio>
    #include <vector>
    #include <queue>
    const int N = 205; 
    typedef long long ll; 
    using namespace std;
     
    int T, n, vis[N], in[N], pa[N], pb[N], da[N], ans, flag; 
    vector<int> g[N], ga[N], gb[N];
    queue<int> q; 
     
    template < typename T >
    inline T read()
    {
    	T x = 0, w = 1; char c = getchar();
    	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
    	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    	return x * w; 
    }
     
    void dfs(int u, int fa, vector<int> *g, int *p)
    {
    	p[u] = fa;
    	for(int v, i = 0; i < g[u].size(); i++)
    		if((v = g[u][i]) != fa) dfs(v, u, g, p); 		
    }
     
    int solve()
    {
    	int cnt = 0, tmp = 0; 
    	for(int i = 0; i <= n; i++) vis[i] = in[i] = 0;
    	for(int i = 1; i <= n; i++) if(pa[i] != pb[i]) vis[i] = 1, cnt++; 
    	for(int i = 1; i <= n; i++) if(!vis[i] && vis[pa[i]]) return -1; 
    	for(int i = 1; i <= n; i++) g[i].clear();
    	for(int i = 1; i <= n; i++)
    		if(vis[i])
    		{
    			if(vis[pa[i]]) g[i].push_back(pa[i]), in[pa[i]]++; 
    			if(vis[pb[i]]) g[pb[i]].push_back(i), in[i]++; 
    		}
    	for(int i = 1; i <= n; i++) if(!in[i] && vis[i]) q.push(i); 
    	while(!q.empty())
    	{
    		int u = q.front(); q.pop(); tmp++; 
    		for(int v, i = 0; i < g[u].size(); i++)
    		{
    			v = g[u][i], in[v]--;
    			if(!in[v]) q.push(v); 
    		}
    	}
    	if(cnt != tmp) return -1;
    	else return cnt; 
    }
     
    int main()
    {
    #ifndef ONLINE_JUDGE
    	freopen("cpp.in", "r", stdin); 
    #endif
    	T = read <int> ();
    	while(T--)
    	{
    		n = read <int> ();
    		for(int i = 1; i <= n; i++) ga[i].clear(), gb[i].clear(), da[i] = 0; 
    		for(int u, v, i = 1; i < n; i++)
    		{
    			u = read <int> (), v = read <int> ();
    			ga[u].push_back(v), ga[v].push_back(u), da[u]++, da[v]++; 
    		}
    		for(int u, v, i = 1; i < n; i++)
    		{
    			u = read <int> (), v = read <int> ();
    			gb[u].push_back(v), gb[v].push_back(u); 
    		}
    		dfs(1, 0, ga, pa), dfs(1, 0, gb, pb);
    		ans = n + 1, flag = 1;
    		for(int i = 1; i <= n; i++) if(pa[i] != pb[i]) flag = 0;
    		if(flag) { puts("0"); continue; }
    		for(int tmp, i = 1; i <= n; i++)
    			if(da[i] == 1)
    			{
    				dfs(i, 0, gb, pb); 
    				for(int j = 1; j <= n; j++)
    					if(j != i)
    					{
    						dfs(j, 0, ga, pa), pa[i] = 0, pa[j] = i; 
    						tmp = solve(); 
    						if(tmp != -1) ans = min(ans, tmp + 1); 
    					}
    			}
    		printf("%d\n", ans == n + 1 ? -1 : ans); 
    	}
    	return 0;
    }

Measured memory_bytes: 3176
#include <stdio.h>

int main(void){

int l,a,b,c,d;

scanf("%d",&l);
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);

if((a-1)/c>(b-1)/d) printf("%d\n",l-(a-1)/c-1);
else  printf("%d\n",l-(b-1)/d-1);

return 0;

}

Measured memory_bytes: 596
N, K = map(int, input().split())
la = list(map(int, input().split()))

lc = [1]
lcnt = [1]
lcnt.extend([0]*(N-1))

i = 1
while lcnt[lc[i-1]-1] == 1:
    if i == N:
        break
    else:
        lc.append(la[lc[i-1]-1])
        lcnt[la[lc[i-1]-1]-1] += 1
        i += 1

lpst = lc.index(lc[-1])
lpnum = len(lc) - lpst - 1
if K <= lpst:
    loclst = K
elif lpnum == 0:
    loclst = lpst
else:
    loclst = (K - lpst) % lpnum + lpst

print(lc[loclst])

Measured memory_bytes: 32112
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    string s;
    cin>>s;
    int a=0,b=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='0')a++;
        else b++;
    }
    int ans=(a<b)?a*2:b*2;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void)
{
    long long int min = 1000000, max = -1000000, sum = 0;
    int i, n, input;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) {
        scanf("%d", &input);
        if (input <= min) min = input;
        if (input >= max) max = input;
        sum += input;
    }
    printf("%lld %lld %lld\n", min, max, sum);
    return 0;
}

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

string generate(long long i) {
	return (i < 0 ? "" : generate((i / 26) - 1) + (char)(65 + i % 26)) ;
}
 
void solve(int test_case) {
	long long n ;
	cin >> n ;
	string ans = generate(n - 1) ;
	for(auto ch : ans) {
        cout << (char)tolower(ch) ;
    }
    cout << "\n" ;
}

int main () {
   ios_base::sync_with_stdio(false) ;
   cin.tie(NULL) ;
   cout.tie(NULL) ;
   int tc = 1 ;
   //cin >> tc ;
   for (int i = 1 ; i <= tc ; ++i) {
      solve(i) ;
   }
}


Measured memory_bytes: 3640
ans = 0
last_v = 0
for i in range(5):
    tmp = int(input())
    if tmp % 10 == 0:
        tmp_v = 0
    else:
        tmp_v = 10 - tmp % 10 
    if tmp_v> last_v:
        last_v = tmp_v
    ans += tmp + tmp_v
print(ans - last_v)

Measured memory_bytes: 3060
#[allow(unused_imports)]
use std::cmp::max;
use std::io;

fn main() {
    let (a, b) = input();
    let bu100 = (b * 100.0).round() as u64;
    println!("{}", (a * bu100) / 100);
}

#[allow(dead_code)]
fn update_max<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left < right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn update_min<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left > right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn input_number() -> Vec<u64> {
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line");
    let vec: Vec<u64> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap_or(0))
        .collect();
    vec
}

#[allow(dead_code)]
fn input() -> (u64, f32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();
    let c: u64 = iter.next().unwrap().parse().unwrap();
    let n: f32 = iter.next().unwrap().parse().unwrap();
    (c, n)
}


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

int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  
  vector<int> cnt(0);
  if(s.at(0) == '0') cnt.push_back(0);
  for(int i = 0; i < n;){
    int j = i;
    while(j + 1 < n && s.at(j) == s.at(j+1)) j++;
    cnt.push_back(j-i+1);
    i = j + 1;
  }
  if(s.at(n-1) == '0') cnt.push_back(0);
  vector<int> sum((int)cnt.size()+1);
  for(int i = 0; i < cnt.size(); i++) sum.at(i+1) = sum.at(i) + cnt.at(i);
  
  int ans = 0;
  for(int i = 0; i < sum.size(); i+=2){
    int j = i + k * 2 + 1;
    if(j >= sum.size()) j = sum.size() - 1;
    ans = max(ans, sum.at(j) - sum.at(i));
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 4364
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <stdio.h>

using namespace std;

//typedefリスト
typedef vector<long long int> vint;
typedef vector<string> vstr;
typedef long long int llint;

int main(void) {
	int X, A;
	cin >> X >> A;
	if (X < A)cout << 0 << endl;
	else cout << 10 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = println(solve(new Scanner(System.in)))

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextInt
    val W = Array.fill(N)(sc.next)

    if (W.distinct.length != W.length) {
      return "No"
    }

    var last = W(0).head
    W.foreach { w =>
      if (w.head != last) {
        return "No"
      }
      last = w.last
    }
    "Yes"
  }
}


Measured memory_bytes: 25544
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define eps 1e-6
#define mp make_pair
const long long INF=1e18+2;
const int MX=100004;
int N, M, k;
int X[MX];
int dp[MX][18];
int get(int u, int D)
{
    if(D == 0) return u;
    for(int i=17;i>=0;i--)
    {
        if(u == -1) return u;
        if(D&(1<<i)) u=dp[u][i];
    }
    return u;
}
int main()
{
    memset(dp, -1, sizeof dp);
    scanf("%d", &N);
    for(int i=1;i<=N;i++) scanf("%d", &X[i]);
    scanf("%d", &k);
    for(int i=2;i<=N;i++)
    {
        dp[i][0]=lower_bound(X+1, X+1+N, X[i]-k)-X;
        for(int j=1;j<=17;j++)
        {
            if(dp[i][j-1] == -1) break;
            dp[i][j]=dp[dp[i][j-1]][j-1];
        }
    }
    int q;
    scanf("%d", &q);
    while(q--)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        if(a > b) swap(a, b);
        int lo=0, hi=b-a, R=0, mid;
        while(lo <= hi)
        {
            mid=(lo+hi)>>1;
            int res=get(b, mid);
            if(res <= a)
            {
                R=mid;
                hi=mid-1;
            }
            else lo=mid+1;
        }
        cout<<R<<"\n";
    }
    return 0 ;
}

Measured memory_bytes: 8192