akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    int n = 0;
    int m;
    cin >> n;
    cin >> m;
    vector<int> c(2*n);
    REP(i,2*n){
	c[i] = i+1;
    }
    vector<int> ans(2*n);
    REP(i,m){
	int k;
	cin >> k;
	if(k == 0){
	    REP(i,n){
		ans[2*i] = c[i];
		ans[2*i+1] = c[n+i];
	    }
	}else{
	    REP(i,2*n-k){
		ans[i] = c[k+i];
	    }
	    REP(i,k){
		ans[2*n-k+i] = c[i];
	    }
	}
	c = ans;
    }
    REP(i,2*n){
	cout << ans[i] << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

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

int main(){

  ll n;cin>>n;

  lb sum=0;
  rep(i,0,n){
    lb a;cin>>a;
    string s;cin>>s;
    if(s=="JPY")sum+=a;
    else sum+=380000.0*a;


  }


  out(fixed<<setprecision(10)<<sum);







  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxN = 5e5+7;
const int maxV = 90010;
//const int INF = 1e9+9;
const ll INF = (1ll)<<60;
const int MOD = 1e9+7;

int n,k;
char a[maxN]; 
ll power(ll x,ll p)
{
	if(p == 0)
		return 1;
	ll t = power(x,p/2);
	t = t*t;
	if(p%2 == 1)
		t = t*x;
	return t;
}
int getcnt(int x)
{
	int cnt = 0;
	while(x < k)
	{
		x = 2*x;
		cnt++;
	}
	return cnt;
}
int b[maxN];

int main()
{
	scanf("%d%d",&n,&k);
	int t1 = n-k+1;
	for(int i=1;i<=min(k-1,n);i++)
	{
		b[i] = getcnt(i);
	}
	double ans = 0;
	if(t1>0)
	{
		ans += 1.0*(t1)/n; 
	} 
	for(int i=1;i<=min(n,k-1);i++)
	{
		ans += (1.0/(n*power(2,b[i])));
	}
	printf("%.10f\n",ans);
	return 0;
}

Measured memory_bytes: 256
tower1 = [[0]*10 for i in range(3)]
tower2 = [[0]*10 for i in range(3)]
tower3 = [[0]*10 for i in range(3)]
tower4 = [[0]*10 for i in range(3)]

n = int(input())

for _ in range(n):
	b,f,r,v = map(int,input().split())
	
	if b == 1:
		tower1[f-1][r-1] += v
	elif b == 2:
		tower2[f-1][r-1] += v
	elif b == 3:
		tower3[f-1][r-1] += v
	elif b == 4:
		tower4[f-1][r-1] += v
		
for i in tower1:
	print(str.format(" {} {} {} {} {} {} {} {} {} {}",i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],i[9]))

print("#"*20)

for i in tower2:
	print(str.format(" {} {} {} {} {} {} {} {} {} {}",i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],i[9]))

print("#"*20)

for i in tower3:
	print(str.format(" {} {} {} {} {} {} {} {} {} {}",i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],i[9]))
	
print("#"*20)

for i in tower4:
	print(str.format(" {} {} {} {} {} {} {} {} {} {}",i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],i[9]))


Measured memory_bytes: 5624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int Z = sc.nextInt();
		if(X % (Y+Z) < Z) {
			System.out.print(X / (Y+Z) - 1);
		}else if(X % (Y + Z) >= Z ) {
			System.out.print(X / (Y+Z));
		}
	}

}

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

int main(){
    int a, b;
    cin >> a >> b;
    if((a * b) % 2 == 0) cout << "No" << endl;
    else cout << "Yes" << endl;
} 

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

using namespace std;

typedef pair<int,int> P;
typedef pair<bool,P> PP;
int field[200][200];
int pic[51][51];
int n,m;
const P NA = P(1000,1000);

void print(){
  for(int i = 0; i < m; i++){
    for(int j = 0; j < m; j++)
      cout << pic[i][j] << " ";
    cout << endl;
  }

  cout << endl;
}
void rotate(){
  int cop[m][m];

  for(int i = 0; i < m; i++)
    for(int j = 0; j < m; j++)
      cop[i][j] = pic[i][j];

  // print();

  for(int i = 0; i < m; i++)
    for(int j = 0; j < m; j++)
      pic[m-1-j][i] = cop[i][j];

  
  //print();
}

PP much(int x, int y){

  PP ret;
  ret.first = true;
  
  bool flg = true;
  for(int i = x,k = 0; i < x+m; i++,k++)
    for(int j = y,l = 0; j < y+m; j++,l++){
      if(!(field[i][j] == pic[k][l] || pic[k][l] == -1)) return PP(false,NA);
      if(flg && pic[k][l] != -1){
	flg = false;
	ret.second = P(i+1,j+1);
      }
    }


  return ret;
}

P solve(){
  P ans = NA;

  
  for(int i = 0; i < n; i++)
    for(int j = 0; j < n; j++){
      PP pp = much(i,j);
      if(pp.first) ans = min(ans,pp.second);

    }

  return ans;
}

int main(){

  while(cin >> n >> m && n+m){
    memset(field,-1,sizeof(field));

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

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

       
    P ans = solve();


     for(int i = 0; i < 3; i++){
      rotate();
      solve();
      ans = min(ans,solve());
     }

    if(ans != NA) cout << ans.second << " " << ans.first << endl;
    else cout << "NA" << endl;

  }
  return 0;
}

Measured memory_bytes: 1344
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, ans = 1;
    string s;
    cin >> n >> s;
    
    reps(i, 1, n) {
        if (s[i] != s[i - 1]) {
            ans++;
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()


int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;

    if (n % 1000 == 0)
    {
        cout << 0 << endl;
        exit(0);
    }

    while (n >= 1000)
    {
        n -= 1000;
    }
    cout << 1000 - n << endl;
}

Measured memory_bytes: 3596
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
const int man = 2e5+10;
#define IOS ios::sync_with_stdio(0)
#define ull unsigned ll
#define uint unsigned
#define pai pair<int,int>
#define pal pair<ll,ll>
#define IT iterator
#define pb push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);++i)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);--i)
#define endl '\n'
#define ll long long
const ll mod = 1e9+7;
map<pair<int,int>,int>vis;
vector<int>sp[man];
int vi[man];

void dfs(int u,int f,int &num){
    ++num;
    vi[u] = 1;
    for(auto v:sp[u]){
        if(v==f||vi[v])continue;
        dfs(v,u,num);
    }
}

signed main() {
    #ifndef ONLINE_JUDGE
        //freopen("in.txt", "r", stdin);
        //freopen("out.txt","w",stdout);
    #endif
    int n,m;cin >> n>>m;
    if(!m){
        cout<<1<<endl;
        return 0;
    }
    for(int i = 1;i <= m;++i){
        int u,v;scanf("%d%d",&u,&v);
        if(vis.count({u,v}))continue;
        vis[{u,v}] = vis[{v,u}] = 1;
        sp[u].push_back(v);
        sp[v].push_back(u);
    }
    int maxx = 0;
    for(int i = 1;i <= n;++i){
        if(!vi[i]){
            int num = 0;
            dfs(i,i,num);
            maxx = max(maxx,num);
        }
    }
    cout<<maxx<<endl;
    return 0;
}

Measured memory_bytes: 52976
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + end + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw "ArrayIndexOutOfBoundsException ‚There is no more input";}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var s = nextCharArray();
  var output1 = 0;
  var output2 = 0;
  var ng = 0;
  var w = 0;
  var used = 0;
  var list = new Array(N).fill(0);
  list[N - 1] = (s[N - 1] == "R") ? 1 : 0;
  for(var i = N - 2; i >= 0; i--){
    list[i] = list[i + 1] + ((s[i] == "R") ? 1 : 0);
  }
  var max = list[N - 1];
  myerr(list);
  for(var i = 0; i < N - 1; i++){
    if(s[i] == "W"){
      w++;
    }
    if(s[i] == "W" && s[i + 1] == "R"){
      if(list[i] - used <= 0){
        break;
      }
      ng += Math.min(list[i] - used, w);
      used += Math.min(list[i] - used, w);
      w = 0;
      //myerr(ng);
    }
  }
  myout(ng);

}


Measured memory_bytes: 37904
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <list>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <assert.h>
typedef long long ll;
typedef long double ld;
using namespace std;

const ll SZ = 1e5 + 10;
const ll INF = 1e9;

ll a[SZ], b[SZ];

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(false);

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

	ll added = 0;
	for (ll i = n - 1; i >= 0; i--) {
		ll k = b[i] - ((a[i] + added) % b[i]);
		if (k == b[i])
			k = 0;
		added += k;
	}

	cout << added << "\n";

	return 0;
}

Measured memory_bytes: 1792
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;
  l:array of Integer;
  s,s123,s1,s2,s3:string;
  tf:Boolean;
  //nyu:TStringList;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Readln(s);
    s2:='abcdefghijklmnopqrstuvwxyz';                        
    
    for j := 1 to Length(s2) do
      for i := 1 to Length(s) do begin
        if s[i]=s2[j] then
          break;
        if i=Length(s) then begin       
          Writeln(s2[j]);
          Readln;
          exit;
        end;                                                 
      end;
  
    Writeln('None');
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PI acos(-1.0)
#define sq(n) (n)*(n)

using namespace std;
typedef long long ll;

int main() {
    FAST;

    ll n, i, sum = 0;
    cin >> n;

    for (i = 1; i <= n; ++i) {
        if ((i % 3 == 0) || (i % 5 == 0)) continue;
        sum += i;
    }

    cout << sum;

    return 0;
}


Measured memory_bytes: 3636
s = input()
a, b = int(s[:2]), int(s[2:])

def func(i):
  if (i==0) | (i>12):
    return 'YY'
  else:
    return 'MM'
  
ans  = func(a) + func(b)
if (ans=='YYMM') | (ans=='MMYY'):
  print (ans)
elif ans=='MMMM':
  print ('AMBIGUOUS')
else:
  print('NA')

Measured memory_bytes: 3064
using System;

class P
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int count = 0;
        int i;
        int ans = 0;
        for (i = 0; i < N - 1; i++)
        {
            if (a[i] >= a[i + 1]) {count++;}

            if (a[i] < a[i + 1])
            {
                if (ans <= count) { ans = count; count = 0; }
                else { count = 0; }
            }
        }

        Console.WriteLine(ans<=count?count:ans);
    }
}

Measured memory_bytes: 23004
n, q = map(int, input().split())
s = input()
lis = [0]
cnt = 0
for i in range(1, n):
    if s[i-1:i+1] == "AC":
        cnt += 1
        lis.append(cnt)
    else:
        lis.append(cnt)
for i in range(q):
    l, r = map(int, input().split())
    print(lis[r-1] - lis[l-1])

Measured memory_bytes: 6180
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n,m = MAP()
a = [INT() for _ in range(m)]
dp = [0 for _ in range(n+2)]
dp[0] = 0
dp[1] = 1
j = 0
for i in range(2, n+2):
    if j >= m or a[j] != i - 1:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
    else:
        dp[i] = 0
        j += 1
print(dp[n+1])


Measured memory_bytes: 70360
#include<stdio.h>
int mod=1000000007;

long sum(int n){
  long a = n*(n-1)/2;
  a=a%mod;
  return a;
}

long ssum(int n,int k){
  long a=(2*n-k+1)*k/2;
  a=a%mod;
  return a;
}

long fsum(int n,int k){
  long a=(n-k+1)*k+1;
  a=a%mod;
  return a;
}

int main(){
  int n,k;

  scanf("%d%d",&n,&k);
  int i;
  long ans=0;
  for(i=k;i<=n+1;i++){
    //ans += ssum(n,i)+1-sum(i);
    //ans += fsum(n,i);
    ans += (long)(n-i+1)*i+1;
    ans = ans%mod;
    //printf("%ld %ld %ld\n",ans,ssum(n,i),sum(i-1));
  }
  printf("%ld\n",ans);
}


Measured memory_bytes: 1732
#include<stdio.h>

int main()
{
  long long int n;
  scanf("%lld",&n);
  if(n%2==1) printf("0\n");
  else
  {
	long long int t=n/10,u=10;
    for(int i=1;i<25;i++)
    {
      u=u*5;
      t+=n/u;
    }
    printf("%lld\n",t);
  }
  return 0;
}
  


Measured memory_bytes: 128
//--- pB ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Reader reader;
	PrintWriter out;
	public Solution() {
		reader = new Reader();
		out = new PrintWriter(System.out);
		while (reader.hasNext()) {
			run_case();
		}
		out.flush();
	}

	private void run_case() {
		int k = reader.ni();
		String str = reader.ns();
		if (str.length() <= k) {
			// out.println(str);
		} else {
			str = str.substring(0, k);
			str += "...";

		}
		// k = Math.min(k, str.length());
		// str = str.substring(0, k);
		out.println(str);
		return;
	}
}


class Reader {
	BufferedReader br;
	StringTokenizer st;
	public Reader(){
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String next() {
		if (st.hasMoreTokens()) return st.nextToken();
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return st.nextToken();
	}
	public boolean hasNext() {
		try {
			if (!st.hasMoreTokens() && !br.ready()) return false;
			else return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	public int ni() {return Integer.parseInt(this.next());}
	public long nl() {return Long.parseLong(this.next());}
	public String ns() {return this.next();}
}


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

int main() {
  string s;
  cin>>s;
  int n=s.size();
  int so=0,w=0,e=0,no=0;
  for(int i=0;i<n;i++){
    if(s[i]=='S')
      so++;
    else if(s[i]=='W')
      w++;
    else if(s[i]=='N')
      no++;
    else e++;
  }
  
  bool ans=true;
  if(e==0 && w!=0)
    ans=false;
  if(e!=0 && w==0)
    ans=false;
  if(no==0 && so!=0)
    ans=false;
  if(no!=0 && so==0)
    ans=false;
  
  if(ans)
    cout<<"Yes";
  else cout<<"No";
    
  
}

Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,z;
    char ca,cb,cc;
    cin>>a>>b>>c;
    if((a-b)-c<0) cout<<c-(a-b)<<endl;
    else cout<<0<<endl;

    return 0;
}


Measured memory_bytes: 3616
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

class UF
{
  public:
  int s;//木の頂点数
  vector<int> par;//親
  vector<int> rank;//木の深さ
  vector<int> size;//木の直径
  //コンストラクタ
  //n要素で初期化
  UF(int n)
  {
    s=n;
    par.resize(s);
    rank.resize(s);
    size.resize(s);
    for(int i=0;i<n;i++)
    {
      par[i]=i;
      rank[i]=0;
      size[i]=1;
    }
  }
  //木の根を求める
  int find(int x)
  {
    if(par[x]==x)
      return x;
    else
      return par[x]=find(par[x]);
  }
  //xとyの属する集合を併合
  void unite(int x,int y)
  {
    x=find(x);
    y=find(y);
    if(x==y)
      return;
  
    if(rank[x]<rank[y])
    {
      par[x]=y;
      size[y]+=size[x];
    }else{
      par[y]=x;
      size[x]+=size[y];
      if(rank[x]==rank[y])
        rank[x]++;
    }
  }
  //xとyが同じ集合に属するか否か
  bool same(int x,int y)
  {
    return find(x)==find(y);
  }
  //xが属する集合の大きさを求める
  int getsize(int x)
  {
    return size[find(x)];
  }
};

class Edge
{
	public:
	int cost;
	int from;
	int to;

	Edge(int n,int c)
	{
		to=n;
		cost=c;
	}

	Edge(int f,int t,int c)
	{
		from=f;
		to=t;
		cost=c;
	}
};

bool comp(Edge &lhs, Edge &rhs)
{
	return lhs.cost<rhs.cost;
}

int main()
{
	int n,m;
	ll ans=0;
	cin>>n>>m;
	vector<Edge> g; //グラフの定義
	for(int i=0;i<m;i++)
	{
		int s,t,w;
		cin>>s>>t>>w;
		g.push_back(Edge(s,t,w));
	}
	UF u=UF(n); //Union Find
	sort(g.begin(),g.end(),comp);
	//最小全域木
	for(int i=0;i<g.size();i++)
	{
		Edge e=g[i];
		if(u.same(e.from,e.to))
			continue;
		ans+=e.cost;
		u.unite(e.from,e.to);
		if(u.getsize(0)==n)
			break;
	}
	cout<<ans<<endl;
	return 0;
}


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

typedef long long ll;
const int MOD=1e9+7;

struct modint {
    int val;
    modint inv() const{
        int tmp,a=val,b=MOD,x=1,y=0;
        while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
        return modint(x);
    }
public:
    modint():val(0){}
    modint(ll x){if((val=x%MOD)<0)val+=MOD;}
    modint pow(ll t){modint res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;}
    modint& operator+=(const modint& x){if((val+=x.val)>=MOD)val-=MOD;return *this;}
    modint& operator-=(const modint& x){if((val+=MOD-x.val)>=MOD)val-=MOD; return *this;}
    modint& operator*=(const modint& x){val=(ll)val*x.val%MOD; return *this;}
    modint& operator/=(const modint& x){return *this*=x.inv();}
    bool operator==(const modint& x) const{return val==x.val;}
    bool operator!=(const modint& x) const{return val!=x.val;}
    bool operator<(const modint& x) const{return val<x.val;}
    bool operator<=(const modint& x) const{return val<=x.val;}
    bool operator>(const modint& x) const{return val>x.val;}
    bool operator>=(const modint& x) const{return val>=x.val;}
    modint operator+(const modint& x) const{return modint(*this)+=x;}
    modint operator-(const modint& x) const{return modint(*this)-=x;}
    modint operator*(const modint& x) const{return modint(*this)*=x;}
    modint operator/(const modint& x) const{return modint(*this)/=x;}
};

modint dp[100010];
bool ng[100010];
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> la(m);
  for (int i = 0; i < m; ++i) {
    int a;
    cin >> a;
    ng[a] = true;
  }
  dp[0] = 1;
  for (int i = 0; i < n; ++i) { 
    if (!ng[i+1]) { dp[i+1] += dp[i]; }
    if (!ng[i+2]) { dp[i+2] += dp[i]; }
  }
  cout << dp[n].val << endl;
}



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

int main(){
    int64_t X;
    cin >> X;
    int64_t sum = 100;
    int64_t count = 0;
    
    while(sum < X){
        sum += sum / 100;
        count++;
    }

    cout << count << endl;
}

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

using namespace std;
int main() {
	int N,sum;
	int d[50];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> d[i];
	}
	sum = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			sum += d[i] * d[j];
		}
	}
	cout << sum;
	return 0;

}

Measured memory_bytes: 256
#include <stdio.h>
//#include <stdlib.h>
#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  char n[105];
  int k;
  scanf("%s %d", n, &k);
  int len = strlen(n);
  int dp1[len][3], dp2[len][3];
  dp1[0][0] = n[len-1]-'0';
  dp2[0][0] = 9-dp1[0][0];
  dp1[0][1] = 0;
  dp2[0][1] = 0;
  dp1[0][2] = 0;
  dp2[0][2] = 0;
  for (int i=1; i<len; i++) {
    int a = n[len-i-1]-'0';
    if (a == 0) {
      dp1[i][0] = dp1[i-1][0];
      dp2[i][0] = dp2[i-1][0] + 9;
    } else {
      dp1[i][0] = a + dp1[i-1][0] + dp2[i-1][0];
      dp2[i][0] = 9 - a;
    }
    for (int j=1; j<3; j++) {
      if (a == 0) {
        dp1[i][j] = dp1[i-1][j];
        dp2[i][j] = dp2[i-1][j] + 9*(dp1[i-1][j-1] + dp2[i-1][j-1]);
      } else {
        dp1[i][j] = dp1[i-1][j] + dp2[i-1][j] + (a-1)*(dp1[i-1][j-1]+dp2[i-1][j-1]) + dp1[i-1][j-1];
        dp2[i][j] = (9-a)*(dp1[i-1][j-1]+dp2[i-1][j-1]) + dp2[i-1][j-1];
      }
    }
  }
  printf("%d\n", dp1[len-1][k-1]);
  return 0;
}


Measured memory_bytes: 128
#import<complex>
#import<cstdio>
#define F(a,b,c) acos((b*b+c*c-a*a)/2/b/c)
int main(){typedef double D;int n;D d,e,f,g,h,i;for(scanf("%d",&n);n--;){scanf("%lf%lf%lf%lf%lf%lf",&d,&g,&e,&h,&f,&i);std::complex<D> a(d,g),b(e,h),c(f,i);D A=abs(b-c),B=abs(c-a),C=abs(a-b),L=F(A,B,C),s=sin(2*L),t=sin(2*F(B,C,A)),u=sin(2*F(C,A,B)),v=s+t+u;printf("%.3f %.3f %.3f\n",(d*s+e*t+f*u)/v,(g*s+h*t+i*u)/v,A/sin(L)/2);}}

Measured memory_bytes: 0
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>

using namespace std;
typedef long long ll;

typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.1415926535897932384626;
long long int mod = 1000000007;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll abc,ll bed){
    //abcのbed乗を計算する
    if(bed==0){return 1;}
    else{
        ll ced = rui(abc,bed/2);
        ced *= ced;
        ced %= mod;
        if(bed%2==1){ced*=abc; ced%=mod;}
        return ced;
    }
}

ll i,j,k,ii,jj;
ll n,m,num;
ll a,b,c,d,e,f,g,h,r;
ll vnum[500005],x[500005];
bool dame;
bool check[500005];

ll dfs(ll v){
	//vの子について
	check[v] = true;
	ll in,out;
	ll a = 0;
	ll b = 0;
	ll d = 0;
	for(int i=0;i<G[v].size();i++){
		ll av = G[v][i];
		if(check[av])continue;
		//if(v==2)deba(av);
		d++;
		c = dfs(av);
		a += c;
		b = max(b,c);		
	}
	if(G[v].size() == 1){
		out = x[v];
	}else{
		in = a - x[v];
		out = x[v] - in;
		if(in < 0)dame = true;
		if(a - b < in)dame = true;
	}
	//out = x[v] - in;
	//deba(v);
	//deba(out);
	//deba(a);
	//p("----");
	if(out < 0)dame = true;
	check[v] = false;
	return out;
}


int main(){
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>x[i];
	}
	for(i=0;i<n-1;i++){
		cin>>a>>b;
		G[a].pb(b);
		G[b].pb(a);
	}
	a = 0;
	r = 0;
	for(i=1;i<=n;i++){
		if(G[i].size() > a){
			a = G[i].size();
			r = i;
		}
	}
	if(dfs(r) != 0){
		dame = true;
	}
	if(n==2 && x[1] == x[2])dame = false;
	// r = 根

	
	
	if(dame){
		p("NO");
	}else{
		p("YES");
	}
    //dfs(1,0));
    //p(ans);
    return 0;
}

Measured memory_bytes: 33152
#include<stdio.h>
#define MAX 100000

int A[MAX],n;

int partition(int p,int r){
  int x,i,j,t;
  x = A[r];
  i = p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i++;
      t = A[i];
      A[i]=A[j];
      A[j]=t;
    }
  }
  t=A[i+1];
  A[i+1]=A[r];
  A[r]=t;
  return i+1;
}

int main(){
  int i,q;

  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);

  q=partition(0,n-1);

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

  return 0;
}



Measured memory_bytes: 2092
import java.util.*;
public class Main{
	public static void main (String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
      	int K = sc.nextInt();
      	
      	ArrayList<Integer> heightList = new ArrayList<Integer>();
      	for (int i = 0; i<N;i++){
        	heightList.add(sc.nextInt());
        }
      	int count = 0;
      	for(int height : heightList){
        	if(height>=K) count++;
        }
      	System.out.println(count);
    }
}

Measured memory_bytes: 62640
h, w = map(int, input().split())
a = [input() for i in range(h)]

list_h = []
for i in range(len(a)):
    if '#' not in a[i]:
        list_h.append(i)

list_w = []
for i in range(len(a[0])):
    if a[0][i] == '.':
        for j in range(len(a)):
            if a[j][i] == '#':
                break
        else:
            list_w.append(i)

for i in range(len(a)):
    if i not in list_h:
        for j in range(len(a[0])):
            if j not in list_w:
                print(a[i][j], end='')
        else:
            print('')

Measured memory_bytes: 4468
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int,int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
/*--------------------------------------------*/

int H,W;

int g[510][510];

struct st{
  int a;
  int b;
  int c;
  int d;
};

int main(){
    //cout << fixed << setprecision(10)
    cin.tie(0);
    ios::sync_with_stdio(false);
  
    cin >> H >> W;
    
    rep(i,H)rep(j,W) cin >> g[i][j];

    queue<st> q;

    rep(i,H)rep(j,W){
      if(g[i][j] % 2 == 1){
        if(j != W-1){
          g[i][j]--;
          g[i][j+1]++;
          q.push(st{i+1,j+1,i+1,j+2});
        }else{
          if(i != H-1){
            g[i][j]--;
            g[i+1][j]++;
            q.push(st{i+1,j+1,i+2,j+1});
          }
        }
      }
    }
        
    int M = q.size();

    cout << M << endl;

    rep(i,M){
      st x = q.front();
      q.pop();

      cout << x.a << ' ' << x.b << ' ' << x.c << ' ' << x.d << endl;
    }
}


Measured memory_bytes: 5248
<?php
/*
    Problem URL : http://abc047.contest.atcoder.jp/tasks/abc047_a

    Score  :
    Result :
    Time   : ms
    Memory : KB
 */

fscanf(STDIN, "%d %d %d", $a, $b, $c);

$t = $a + $b + $c;
$h = $t / 2;

echo ($h == $a || $h == $b || $h == $c) ? "Yes\n" : "No\n";


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

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

    ll ans = 0;

    for(ll c = 1; c <= N - 1; c++){
        ans += (N-1)/c;
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

#define FOR(i, a, b) for (int(i) = a; (i) <= (b); ++(i))
#define rep(i, n) FOR(i, 0, n-1 )
#define all(c) (c).begin(), (c).end()
#define mod 1000000007LL
#define INF 123456789012345
#define int long long

signed main() {
  int n,k;cin>>n>>k;
  cout << (n-1)*(k-1) << endl; 
}


Measured memory_bytes: 384
code = r"""
# distutils: language=c++
# distutils: include_dirs=/opt/ac-library
from libcpp cimport bool
from libcpp.vector cimport vector
cdef extern from "<atcoder/lazysegtree>" namespace "atcoder" nogil:
    cdef cppclass lazy_segtree[S, OP, E, F, mapping, composition, id]:
        lazy_segtree(vector[S] v)
        void set(int p, S x)
        S get(int p)
        S prod(int l, int r)
        S all_prod()
        void apply(int p, F f)
        void apply(int l, int r, F f)
        int max_right[G](int l)
        int min_left[G](int r)
cdef long mod = 998244353
cdef struct s_t:
    long v, s
ctypedef long f_t
cdef extern from *:
    ctypedef int op_t "myop"
    ctypedef int e_t "mye"
    ctypedef int m_t "mymapping"
    ctypedef int c_t "mycomposition"
    ctypedef int i_t "myid"
    ctypedef int g_t "myg"
    cdef s_t myop(s_t a, s_t b) nogil
    cdef s_t mye() nogil
    cdef s_t mymapping(f_t f, s_t x) nogil
    cdef f_t mycomposition(f_t f, f_t g) nogil
    cdef f_t myid() nogil
    cdef bool myg(s_t k) nogil
cdef s_t myop(s_t a, s_t b) nogil:
    cdef s_t c
    c.v = (a.v * b.s + b.v) % mod
    c.s = (a.s * b.s) % mod
    return c
cdef s_t mye() nogil:
    cdef s_t e
    e.v = 0
    e.s = 1
    return e
cdef f_t myid() nogil:
    return -1
cdef s_t mymapping(f_t f, s_t x) nogil:
    if f == myid(): return x
    cdef s_t y
    y.v = (x.s - 1) * 443664157 * f % mod
    y.s = x.s
    return y
cdef f_t mycomposition(f_t f, f_t g) nogil:
    if f == myid(): return g
    return f
from libc.stdio cimport getchar, printf
cdef inline int read() nogil:
    cdef int b, c = 0
    while 1:
        b = getchar() - 48
        if b < 0: return c
        c = c * 10 + b
cdef main():
    cdef int n = read(), i, l, r, d
    cdef s_t a
    a.v = 1
    a.s = 10
    cdef lazy_segtree[s_t, op_t, e_t, f_t, m_t, c_t, i_t] *seg = new lazy_segtree[s_t, op_t, e_t, f_t, m_t, c_t, i_t](vector[s_t](n, a))
    for i in range(read()):
        l, r, d = read(), read(), read()
        seg.apply(l - 1, r, d)
        printf('%ld\n', seg.all_prod().v)
main()
"""
import os, sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    open('solve.pyx', 'w').write(code)
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Measured memory_bytes: 23540
#include <bits/stdc++.h>
 size_t strlen(const char *s);
#define rep(i,n) for(long long int i=0;i<n;i++)
#define sz(x) ((int)(x).size())

using namespace std;
std::vector<int> graph[10050];//graph頂点数のsize
const int N=200010;
const int P=1000000007;
using ll = long long;
vector<ll> prime;

//絶対値
int ze(int a, int b){
	if(a>b){
		return a-b;
	}else{
		return b-a;
	}
}
//小さい方
long long int min(long long int a,long long int b){
	if(a>b){
		return b;
	}else{
		return a;
	}
}
//大きい方
long long int max(long long int a,long long int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod){
	return (a*b)%mod;
}

//メモ

/*
	memset(b, '\0', sizeof(b));
初期化*/


/*
	string s;
	s.size()
*/

/*
	char s[N];
	strlen(s)
*/
/*
	if(  <  )puts("Yes");
	else puts("No");
*/

/*文字列比較
if(strcmp(name[i],s)==0)
*/

/*
	graph[a].push_back(b);//graph[a][i番目に入れた]==b
	graph[j].size()	//forで回すときとか

*/


int main(){
	ll n, m, l,ans=0;
	cin>>n>>m;
	rep(i, m){
	    cin>>l;
	    ans+=l;
	}
	if(ans<=n){
	    cout<<n-ans<<endl;
	}else{
	    cout<<-1<<endl;
	}
}


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

int main () {
    int n, k, count = 0; cin >> n >> k;
    vector<int> h(n,0);
    for (int i = 0; i < n; i++) cin >> h.at(i);
    for (int i = 0; i < n; i++) {
        if (k <= h.at(i)) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 640
"use strict";
function Main(input) {
  input = input.split("\n");
  let N = parseInt(input[0]);
  let P = input.slice(1).map(x => parseInt(x) - 1);
  for (let i = 0; i < N; i += 1)
    if (P[i] % 2 !== i % 2) {
      console.log("No");
      return;
    }
  for (let i = N - 1; i > 1; i -= 1)
    if (P[i] < P[i - 1] && P[i - 1] < P[i - 2]) {
      let tmp = P[i];
      P[i] = P[i - 2];
      P[i - 2] = tmp;
    }
  for (let i = N - 1; i > 1; i -= 1)
    if (P[i] < P[i - 2] && (P[i] > P[i - 1] || P[i - 1] > P[i - 2])) {
      console.log("No");
      return;
    }
  console.log("Yes");
  return;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 53184
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define FASTIO cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define ll long long int
#define F first
#define S second
#define pll pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vpii vector<pair<int,int> >
#define vvpii vector<vpii >
#define vpll vector<pair<ll,ll> >
#define vvpll vector<vpll >
#define pb push_back
#define mp make_pair

struct compare {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		if ((a.S - a.F) != (b.S - b.F)) return ((a.S - a.F) > (b.S - b.F));
		else return (a.F < b.F);
	}
};

int main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	FASTIO;
	string s, t; cin >> s >> t;
	int ls = s.length(), lt = t.length(), i, j;
	vector<vector<pair<int, pair<int, int> > > >dp(ls + 1, vector<pair<int, pair<int, int> > >(lt + 1, {0, {0, 0}}) );
	// for (i = 0; i <= ls; i++) {
	// 	cout << "hi" << endl;
	// 	for (j = 0; j <= lt; j++) cout << dp[i][j].S.F << "," << dp[i][j].S.S << " ";
	// 	cout << endl;
	// }
	for (i = 1; i < ls + 1; i++) {
		for (j = 1; j < lt + 1; j++) {
			if (s[i - 1] == t[j - 1]) dp[i][j] = {(dp[i - 1][j - 1].F + 1), {i - 1, j - 1}};
			else {
				if (dp[i - 1][j].F > dp[i][j - 1].F) dp[i][j] = {dp[i - 1][j].F, {i - 1, j}};
				else dp[i][j] = {dp[i][j - 1].F, {i, j - 1}};
			}
		}
	}
	// for (i = 0; i <= ls; i++) {
	// 	for (j = 0; j <= lt; j++) cout << dp[i][j].F << "," << dp[i][j].S.F << "," << dp[i][j].S.S << " ";
	// 	cout << endl;
	// }
	i = ls; j = lt;
	string ans = "";
	while (i != 0 && j != 0) {
		auto p = dp[i][j].S;
		if (p.F < i && p.S < j) ans.pb(s[i - 1]);
		i = p.F; j = p.S;

	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
}

Measured memory_bytes: 105984
MOD = 1000000007

def pow(a, b):
	if not b:
		return 1
	c = pow(a, b // 2)
	if b % 2:
		c = a * c % MOD * c % MOD
	else:
		c = c * c % MOD
	return c

N, K = map(int, input().split())
a, b = [1] * (N + 1), [1] * (N + 1)
i = 1
while i <= N:
	a[i] = a[i - 1] * i % MOD
	b[i] = pow(a[i], MOD - 2)
	i += 1
i = 1
while i <= K:
	if N - K + 1 < i:
		print(0)
	else:
		c = a[N - K + 1] * b[N - K - i + 1] % MOD * b[i] % MOD
		d = a[K - 1] * b[K - i] % MOD * b[i - 1] % MOD
		print(c * d % MOD)
	i += 1

Measured memory_bytes: 3444
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let vs: Vec<i64> = s.trim().split_whitespace().map(|token| token.parse().ok().unwrap()).collect();
    let a = vs[0];
    let b = vs[1];
    if b % a == 0 {
        println!("{}", a + b);
    } else {
        println!("{}", b - a);
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){
  char x,y;
  cin>>x>>y;
  if(x>y) cout<<'>'<<endl;
  else if(x==y) cout<<"="<<endl;
  else cout<<"<"<<endl;
  return 0;
}


Measured memory_bytes: 256
k , x = map(int, input().split())
'''
a = [ x , x+1 , x-1 , x+2 , x-2 ]
print(sorted(a))
'''
'''
for i in range(2*k-1):
  print(x-k+1 + i)
'''

for i in range(x-k+1,x+k):
    print(i,end=" ")

'''
for i in range(-3,10):
    print(i,end=" ")
'''

Measured memory_bytes: 3060
from sys import stdin

N = int(stdin.readline())
Job = [None]*N
for i in range(N):
    Job[i] = tuple(map(int, stdin.readline().split()))[::-1]

Job.sort()

Now = 0
for i in range(N):
    Deadline = Job[i][0]
    Now += Job[i][1]
    if Now > Deadline:
        print("No")
        quit()

else:
    print("Yes") 

Measured memory_bytes: 29464
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

#define max(x, y) ((x)>(y)?(x):(y))
#define min(x, y) ((x)<(y)?(x):(y))

//return gcd(a,b); calc x,y s.t ax + by = g
Int extEuclid(Int a, Int b, Int &x, Int &y){
  if(a == 0){
    x = 0;
    y = 1;
    return b;
  }
  Int g = extEuclid(b % a, a, y, x);
  x -= b/a * y;
  return g;
}

int main(){
  Int a, b, x, y;
  cin >> a >> b;
  extEuclid(a, b, x, y);
  if(a == b)swap(x,y);
  cout << x << " " << y << endl;
  return 0;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
#define MOD 1000000007
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int n,m;
  cin >> n >> m;
  vector<string> mapp(n);
  vector<string> sample(m);
  bool ok1 = true;
  bool ok2 = false;
  rep(i,0,n) cin >> mapp[i];
  rep(i,0,m) cin >> sample[i];
  
  rep(a,0,n-m+1){
    rep(b,0,n-m+1){
      
      ok1 = true;
      rep(i,0,m){
        rep(j,0,m){
          if(sample[i][j]!=mapp[a+i][b+j]) ok1 = false;
        }
      }
      if(ok1) ok2 = true;
      
    }
  }
  
  if(ok2) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int n,m;cin>>n>>m;
    if(n%2){
        rep(i,1,m+1)cout<<i<<" "<<n-i<<endl;
    }
    else{
        int l=1,r=n;
        bool up=false;
        rep(i,0,m){
            if(r-l<=n/2&&!up){
                r--;
                up=true;
            }
            cout<<l<<" "<<r<<endl;
            l++;
            r--;
        }
    }
}


Measured memory_bytes: 3652
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-8
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long i=0; i<n; ++i) { cout<<a[i]; if(i!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> vl;
typedef vector<vector<long long> > vll;
typedef vector<P> vp;
typedef vector<vector<P> > vpp;
int main() {
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<ll> a(3*n);
	REP(i,3*n) cin>>a[i];
	sort(ALL(a));
	ll res=0;
	REP(i,n) {
		res+=a[3*n-2-2*i];
	}
	cout<<res<<endl;
}


Measured memory_bytes: 2560
#include <cstdio>

int main(){
    int H,W;
    while(1){
        scanf("%d %d",&H,&W);
    if(H == 0 && W ==0){break;}
    for(int x = 0; x < H;x++){
        for(int y = 0;y < W;y++){
            printf("#");}
        printf("\n");}
    printf("\n");}
    return 0;
}


Measured memory_bytes: 2580
#include <iostream>

using namespace std;

const int NMAX = 100000 + 5;

int v[2 * NMAX];
bool used[2 * NMAX];

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

    if (x == 1 || x == 2 * N - 1) {
        cout << "No\n";
        return 0;
    }

    if (N == 2) {
        cout << "Yes\n";
        cout << "1 2 3\n";
        return 0;
    }

    if (x + 2 <= N) {
        v[N] = x;
        v[N - 1] = x + 1;
        v[N + 1] = x - 1;
        v[N + 2] = x + 2;
    }
    else {
        v[N] = x;
        v[N - 1] = x - 1;
        v[N + 1] = x + 1;
        v[N + 2] = x - 2;
    }

    for (int i = 1; i <= 2 * N - 1; ++ i)
        if (v[i])
            used[v[i]] = true;

    int val = 1;
    for (int i = 1; i <= 2 * N - 1; ++ i) {
        while (used[val])
            ++ val;
        if (!v[i])
            v[i] = val ++;
    }

    cout << "Yes\n";
    for (int i = 1; i <= 2 * N - 1; ++ i)
        cout << v[i] << " \n"[i + 1 == 2 * N];
    return 0;
}


Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include <map>
using namespace std;

struct Graph
{
    int n;
    vector<vector<int>> g;
    
    Graph(){}
    
    Graph(int n) : n(n){
        g.resize(n);
    }
    
    void add_edge(int from, int to){
        g[from].push_back(to);
    }
};

struct SCC      //StronglyConnectedComponents
{
    int n;
    int k;
    vector<vector<int>> g, rg;
    vector<bool> used;
    vector<int> cmp;
    vector<int> vs;
    
    void add_edge(int from, int to){
        g[from].push_back(to);
        rg[to].push_back(from);
    }
    
    SCC(int n) : n(n){
        g.resize(n);
        rg.resize(n);
        used.resize(n);
        cmp.resize(n);
    }
    
    void dfs(int u){
        used[u] = true;
        for(int v : g[u]){
            if(!used[v]) dfs(v);
        }
        vs.push_back(u);
    }
    
    void rdfs(int u, int k){
        used[u] = true;
        cmp[u] = k;
        for(int v : rg[u]){
            if(!used[v]) rdfs(v, k);
        }
    }
    
    int decomposition(){
        fill(used.begin(), used.end(), false);
        for(int i = 0; i < n; i++){
            if(!used[i]) dfs(i);
        }
        fill(used.begin(), used.end(), false);
        k = 0;
        for(int i = n - 1; i >= 0; i--){
            if(!used[vs[i]]){
                rdfs(vs[i], k);
                k++;
            }
        }
        return k;
    }
    
    int decomposition(Graph &dag){
        k = decomposition();
        dag.n = k;
        dag.g.resize(k);
        map<pair<int, int>, bool> mp;
        for(int u = 0; u < n; u++){
            for(int v : g[u]){
                if(!mp[pair<int, int> (cmp[u], cmp[v])] && cmp[u] != cmp[v]){
                    mp[pair<int, int> (cmp[u], cmp[v])] = true;
                    dag.add_edge(cmp[u], cmp[v]);
                }
            }
        }
        return k;
    }
};

vector<int> v[500005];

int main()
{
    int n, m;
    cin >> n >> m;
    SCC g(n);
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        g.add_edge(a, b);
    }
    int k = g.decomposition();
    for(int i = 0; i < n; i++){
        v[g.cmp[i]].push_back(i);
    }
    cout << k << endl;
    for(int i = 0; i < k; i++){
        cout << (int)v[i].size();
        for(int j : v[i]) cout << " " << j;
        cout << endl;
    }
}


Measured memory_bytes: 79588