akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

var N int
var C, S, F []int

func main() {
	fmt.Scanf("%d", &N)

	C = make([]int, N-1)
	S = make([]int, N-1)
	F = make([]int, N-1)

	for i := 0; i < N-1; i++ {
		fmt.Scanf("%d %d %d", &C[i], &S[i], &F[i])
	}

	ans := make([]int, N)
	for i := 0; i < N-1; i++ {
		for j := i; j < N-1; j++ {
			ans[i] = Max(ans[i], S[j])
			ans[i] += (F[j] - (ans[i]-S[j])%F[j]) % F[j]
			ans[i] += C[j]
		}
	}

	for i := 0; i < N; i++ {
		fmt.Println(ans[i])
	}
}

func Max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func Abs(x int) int {
	if x > 0 {
		return x
	}
	return x
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))

typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

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

//入力
int N,W;
vector<ll> w(105);
vector<ll> v(105);

//DP table
ll dp[105][100005];

int main() {
	cin>>N>>W;
	rep(i,N){
		cin>>w[i]>>v[i];
	}
	rep(i,N)rep(j,W+1){
		//i番目の品物を選ぶとき
		//i + 1行目で、j+w[i]がWを超えないような範囲でdp table を更新していく
		//具体的には、
		if(j+w[i]<=W){
			dp[i+1][j+w[i]] = max(dp[i+1][j+w[i]],dp[i][j]+v[i]);
		}
		//i番目の品物を選ばないとき
		//dp table の価値は変わらず、そのまま下に降りる
		dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
	}
	cout<<dp[N][W]<<endl;
}

Measured memory_bytes: 79360
# サイコロ        初期状態
#    [1]           N
# [4][2][3][5]   W[1]E
#    [6]           S
#
# 上記の順番でラベルに対する整数が与えられる
# l1 l2 l3 l4 l5 l6
# {N, E, W, S} ...
import sys

class Dice:
    def __init__(self, l1, l2, l3, l4, l5, l6):
        self.l1 = l1
        self.l2 = l2
        self.l3 = l3
        self.l4 = l4
        self.l5 = l5
        self.l6 = l6
        self.tmp = 0
    def move_n(self):
        self.tmp = self.l5
        self.l5 = self.l1
        self.l1 = self.l2
        self.l2 = self.l6
        self.l6 = self.tmp
    def move_s(self):
        self.tmp = self.l2
        self.l2 = self.l1
        self.l1 = self.l5
        self.l5 = self.l6
        self.l6 = self.tmp
    def move_e(self):
        self.tmp = self.l3
        self.l3 = self.l1
        self.l1 = self.l4
        self.l4 = self.l6
        self.l6 = self.tmp
    def move_w(self):
        self.tmp = self.l4
        self.l4 = self.l1
        self.l1 = self.l3
        self.l3 = self.l6
        self.l6 = self.tmp

d1 = Dice(*map(int, input().split()))

for line in sys.stdin:
    for s in list(line):
        if s == 'N':
            d1.move_n()
        elif s == 'S':
            d1.move_s()
        elif s == 'E':
            d1.move_e()
        elif s == 'W':
            d1.move_w()
print(d1.l1)


Measured memory_bytes: 5604
#include <iostream>
#include <algorithm>

using namespace std;

int N;
int d[105];

int main(void)
{
	cin >> N;
	for(int i = 0; i < N; i++) cin >> d[i];
	sort(d, d+N);
	
	int cnt = 0, prev = 0;
	for(int i = 0; i < N; i++){
		if(d[i] != prev) cnt++;
		prev = d[i];
	}
	
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
ll N;
  ll T;
  cin >>N>>T;
  vl t(N);
  rep(i,N) {
    cin >>t.at(i);
  }
  
  ll count=0;
  
  
  rep(i,N-1) {
    if(t.at(i+1)-t.at(i)<=T) {
      count+=t.at(i+1)-t.at(i);
    }
    else {
      count+=T;
    }
  }
  cout<<count+T<<endl;
}
    
    
  
  

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scr =new Scanner(System.in);
		
		int N = scr.nextInt();
		int A = N%100;
		int B = A%10;
		
		if(B == 3) {
			System.out.println("bon");
		}else if(B == 0||B == 1||B == 6||B == 8) {
			System.out.println("pon");
		}else {
			System.out.println("hon");
		}
		
	}
}

Measured memory_bytes: 35656
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline LL read(){
	LL x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const LL MAXN = 100010;
const LL INF = 2147483600;

LL N;
struct dat{
	LL l,r,pos,id;
}f[2][MAXN+1]; LL nw[2];
bool cmpl(dat a,dat b){
	return a.l>b.l;
}
bool cmpr(dat a,dat b){
	return a.r<b.r;
}
inline bool Inc(dat a,LL x){
	return a.l<=x&&a.r>=x;
}
inline bool Find(LL x,LL y,LL z){
	if(y<z) return x; else return (x^1);
}
bool vis[MAXN+1];
inline LL solve(LL x){
	nw[0]=nw[1]=1; LL ans=0,last=0;
	for(LL i=1;i<=N;i++) vis[i]=0;
	for(LL i=1;i<=N;i++){
		while(nw[x]<=N&&(vis[f[x][nw[x]].id]||!Find(x,last,f[x][nw[x]].pos))) ++nw[x];
		if(nw[x]>N) {ans+=abs(last); return ans;}
		vis[f[x][nw[x]].id]=1; 
		if(Inc(f[x][nw[x]],last)) continue;
		ans+=abs(last-f[x][nw[x]].pos);
		last=f[x][nw[x]].pos;x^=1;
	} return ans+abs(last);
}

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read();
	for(LL i=1;i<=N;i++){
		f[0][i].l=read(),f[0][i].r=read(); f[0][i].id=i; 
		f[1][i]=f[0][i]; 
		f[0][i].pos=f[0][i].r; f[1][i].pos=f[0][i].l;
	} LL last=0;
	sort(f[1]+1,f[1]+N+1,cmpl);
	sort(f[0]+1,f[0]+N+1,cmpr);
	printf("%lld\n",max(solve(0),solve(1)));
	return 0;
}




Measured memory_bytes: 10076
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define ll long long
using namespace std;

int main() {
	ll n;
	cin >> n;
	ll ans = 1;
	for (ll i = 1; i <= n; i++) {
		ans *= i ;
		ans %= (ll)1000000007;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  int N;
  cin>>N;
  vector<tuple<string,int,int>> B;
  for(int i=0;i<N;i++){
    string s;
    int p;
    cin>>s>>p;
    B.push_back(make_tuple(s,-p,i+1));
  }
  sort(B.begin(),B.end());
  for(int i=0;i<N;i++){
    cout<<get<2>(B.at(i))<<endl;
  }
}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

int gcd(int a, int b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

//-----------------------ここから-----------


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

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

	sort(a.begin(), a.end(), greater<int>());

	int alice = 0;
	int bob = 0;
	for(int i = 0; i < n; i++){
		if(i % 2 == 0){
			alice += a[i];
		} else {
			bob += a[i];
		}
	}

	cout << alice - bob << endl;

}


Measured memory_bytes: 256
// 2014/12/10 Tazoe

#include <iostream>
#include <algorithm>
using namespace std;

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

	int A, B;
	cin >> A >> B;

	int C;
	cin >> C;

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

	sort(D, D+N);

	for(int i=N-1; i>=0; i--){
		if(C*(A+B)>=(C+D[i])*A)
			break;

		C += D[i];
		A += B;
	}

	cout << C/A << endl;

	return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define all(cont) cont.begin(), cont.end()
#define pb push_back
#define fi first
#define se second
#define DEBUG(x) cerr << (#x) << ": " << (x) << '\n'

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

template<class T> bool uin(T &a, T b) {return (a < b ? false : (a = b, true));}
template<class T> bool uax(T &a, T b) {return (a > b ? false : (a = b, true));}

//ifstream f(".in");
//ofstream g(".out");

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL_DEFINE
  freopen(".in", "r", stdin);
#endif

  int n;
  cin >> n;
  vector<double> dp(n + 2, 0); // prob for exactly i heads until now
  dp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    double p;
    cin >> p;
    vector<double> new_dp(n + 2);
    for (int j = 0; j <= i; ++j) {
      new_dp[j] += dp[j] * (1 - p);
      if (j != 0) {
        new_dp[j] += dp[j - 1] * p;
      }
    }
    dp = new_dp;
  }

  double ans = 0.0;
  for (int i = 1; i <= n; ++i) {
    if (i > n - i) {
      ans += dp[i];
    }
  }

  cout.precision(10);
  cout << ans << '\n';

#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define ANTHRO(x...) cerr << "[" << #x << "] = [", _print(x)
#else
#define ANTHRO(x...)
#endif


#define ll long long
#define MOD 1000000007
#define INF (int)1e9
#define EPS 1e-9
/*
    This is K - Stones from AtCoder Educational DP
*/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k; cin>>n>>k;
    vector<ll> a(n);
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    //This is the base of the program
    vector<ll> dp(k+1);
    for(ll i=0;i<=k;i++){
        for(auto x:a){
            if(i-x>=0 && !dp[i-x]){
                dp[i]=true;
            }
        }
    }
    cout<<(dp[k]?"First\n":"Second\n");
    return 0;
}



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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,vec) VL (vec)(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t make_tuple
#define eb emplace_back
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a),greater<>())
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (ll)(a.size())
#define ENDL cout<<endl
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define cont const auto
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
#define PQ priority_queue
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef tuple<ll,ll,ll> T3;
typedef tuple<ll,ll,ll,ll> T4;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
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 lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int a,b,c;
  cin>>a>>b>>c;
  out(min({a+b,a+c,b+c}));
  
  
  
  return 0;
}



Measured memory_bytes: 256
def turukame(a, b, num, remain)
  y = (remain - a * num) / (b - a)
  x = num - y

  return [-1, -1] if remain != a * x + b * y

  [x, y]
end

N, Y = gets.split.map(&:to_i)

(0..N).each do |i|
  remain = Y - 10000 * i
  x, y = turukame(5000, 1000, N - i, remain)
  next if x < 0 || y < 0

  puts [i, x, y].join(' ')
  exit
end

puts '-1 -1 -1'


Measured memory_bytes: 1788
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

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

   int ans = 0;
   ans = max(a+b,a-b);
   ans = max(ans,a*b);

   cout << ans << endl;



   return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3

import sys
# input = sys.stdin.readline
sys.setrecursionlimit(100000)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7

#N = int(input())
#A = [int(x) for x in input().split()]
#V = [[0] * 100 for _ in range(100)]

A,B,C,D = [int(x) for x in input().split()]

if A+B == C+D:
    ans = 'Balanced'
elif A+B > C+D:
    ans = 'Left'
else: 
    ans = 'Right'

print(ans)

Measured memory_bytes: 3060
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author /\
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DBlueAndRedBalls solver = new DBlueAndRedBalls();
        solver.solve(1, in, out);
        out.close();
    }

    static class DBlueAndRedBalls {
        final int MOD = (int) 1e9 + 7;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            for (int i = 1; i <= k; i++) {
                long a = combo(n - k + 1, i, MOD);
                long b = combo(k - 1, i - 1, MOD);
                out.println((a * b) % MOD);
            }
        }

        static int combo(int n, int k, int mod) {
            long top = 1;
            long bot = 1;
            for (int i = 1; i <= k; i++) {
                top *= (n + 1 - i);
                top %= mod;
                bot *= i;
                bot %= mod;
            }
            return (int) (top * modInv(bot, mod) % mod);
        }

        static long[] extended(long a, long b) {
            if (b == 0) {
                return new long[]{a, 1, 0};
            }

            long[] temp = extended(b, a % b);
            long s1 = temp[1];
            long t1 = temp[2];
            long s = t1;
            long t = s1 - a / b * t1;
            return new long[]{temp[0], s, t};
        }

        static long modInv(long a, long m) {
            long[] res = extended(a, m);
            if (res[0] != 1) {
                throw new IllegalArgumentException(("gcd != 1"));
            }
            return ((res[1] + m) % m);
        }

    }

    static class Scanner {
        private StringTokenizer st;
        private BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 24916
/*  
     author : masaow    
     g++ : 17.3.20  
*/        
#include <bits/stdc++.h>  
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(i,a,b)        for( i = a ; i < b  ; i++ )
#define debug(x)           cout << #x << " " << x << " -- "
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll                 long long  
#define p(x)               cout << x << "\n" ; 
#define MOD                100000007
#define pi                 pair<int,int>
#define vi                 vector <int>
#define pb                 push_back
#define vp                 vector <pair<ll,ll>>
#define endl               cout << "\n"
#define mi                 map <int,int> 
#define f1                 first 
#define s1                 second    
#define in                 insert
#define all(x)             x.begin(),x.end() 
using namespace std ; 
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set ; 
const int N = 2e5+7;  
/*  
    time : 10 : 14    
    date : 22.01.2020
*/    
// int L,R,mid,target,idx ;
int tests() 
{   
    string s,t ;
    cin >> s >> t ; 
    cout << t << s <<  '\n' ; 
    
    return 0 ;
}
int main(){
    I__O ;  
    int cases = 1 ; 
    //cin >> cases;  
    while(cases--)
      tests(); 
  return 0 ; 
}

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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;



bool can(int a, int b, int c)
{
	while(0 <= c)
	{
		if(c%a==0)
			return 1;
		c -= b;
	}
	return 0;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int a,b,c,d,e,f;
	cin >> a >> b >> c >> d >> e >> f;
	PII maxcoef = MP(0,1);
	PII ans = MP(100*a, 0);
	for(int i = 100; i<=f; i+=100)
	{
		if(can(100*a,100*b,i))
		{
			FOR(j,0,f-i+1)
			{
				if(100*j <= e*i && can(c,d,j))
				{
					if(maxcoef.X*(i+j) <= maxcoef.Y*j)
					{
						maxcoef = MP(j, i+j);
						ans = MP(i+j, j);
					}
				}
			}
		}
	}
	cout << ans.X << " " << ans.Y << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long 
#define ULL unsigned long long 

const int N = 2e5+11;
const int M = 1e6+11;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const LL inff = 0x3f3f3f3f3f3f3f3f;


/*-----------------------------------------*/

char s[N];
int main(){
  	scanf("%s",s); int len=strlen(s);
  	string t="";
    for(int i=1;i<len;i++) if(s[i]!=s[i-1]) t+=s[i-1];
    t+=s[len-1];
//	cout<<t; 
	if(t.size()==1) puts("0");
	else {
		printf("%d\n",(t.size()-1));
	}
return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;

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

    vector<int> A(N);
    for (int i = 0; i < N; i++){
        cin >> A.at(i);
    }

    map<int, int> B;
    for (int x : A){
        B[x] = 1;
    }

    cout << B.size() << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mo 1000000007
#define maxn 1000000000000000000LL
#define pi 3.1415926535898
#define eps 1e-9 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
int n,m,i,book[200005],l[3300005],r[3300005],now;
struct nyh{
	int x,id;
}o[200005];
int top,f[100005],top2,a[3300005],sum,p1,p2,ans;
struct lyh{
	int x,y;
}p[100005];
bool cmp(nyh u,nyh v){
	return u.x<v.x;
}
bool cmp2(lyh u,lyh v){
	return u.x<v.x||u.x==v.x&&u.y>v.y;
}
void xtree(int u,int v,int w){
	int mid=(u+v>>1);
	a[w]=(a[w]+p2)%mo;
	if(u==v)
		return;
	if(p1<=mid){
		if(l[w]==0){
			top2++;
			l[w]=top2;
		}
		xtree(u,mid,l[w]);
	}
	else{
		if(r[w]==0){
			top2++;
			r[w]=top2;
		}
		xtree(mid+1,v,r[w]);
	}
}
void ytree(int u,int v,int w){
	int mid=(u+v>>1);
	if(u==v||w==0)
		return;
	if(p1<=mid) 
		ytree(u,mid,l[w]);
	else{
		sum=(sum+a[l[w]])%mo;
		ytree(mid+1,v,r[w]);
	}
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read();m=read();
	for(i=1;i<=n;i++){
		o[i].x=read();
		o[i].id=1;
	}
	for(i=1;i<=m;i++){
		o[i+n].x=read();
		o[i+n].id=2;
	}
	sort(o+1,o+n+m+1,cmp);
	now=0;
	for(i=1;i<=n+m;i++)
		if(o[i].id==2)
			now=o[i].x;
		else if(now!=0){
			book[i]|=1;
			l[i]=o[i].x-now;
		}
	now=0;
	for(i=n+m;i>=1;i--)
		if(o[i].id==2)
			now=o[i].x;
		else if(now!=0){
			book[i]|=2;
			r[i]=now-o[i].x;
		}
	for(i=1;i<=n+m;i++){
		if(book[i]==3){
			top++;
			p[top].x=l[i];
			p[top].y=r[i];
		}
		l[i]=0;
		r[i]=0;
	}
	sort(p+1,p+top+1,cmp2);
	top2=1;ans=1;
	for(i=1;i<=top;i++)
		if(p[i].x!=p[i-1].x||p[i].y!=p[i-1].y){
			sum=0;
			p1=p[i].y;
			ytree(1,1000000000,1);
			f[i]=(sum+1)%mo;
			ans=(ans+f[i])%mo;
			p1=p[i].y;p2=f[i];
			xtree(1,1000000000,1);
		}
	pus(ans,2);
	return 0;
}

Measured memory_bytes: 25216
/*input
5 8
5 3
2 3
2 4
5 2
5 1
1 4
4 3
1 3
*/
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define input(str) freopen(str,"r",stdin);
#define output(str) freopen(str,"w",stdout);
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define INF  3e16+1
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld\n",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define modd 1000000007
#define len(x) x.size()
#define all(v) (v.begin(),v.end())
#define ll int
#define pi 3.1415926535897932384626
#define ld double
const int N =6e5+5;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
int powmod(int base,int exp,int mod)
{
	int res=1LL;
	while(exp>0)
	{
		if(exp&1LL)
			res=(res*base)%mod;
		exp/=2LL;
		base=(base*base)%mod;
	}
	return res%mod;
}
vector<int> adj[N];
int dp[N];
int indeg[N];
bool visited[N];
void dfs(int node)
{
	if(visited[node])
		return ;
	visited[node]=true;
	int maxi=-1;
	for(auto it:adj[node])
	{
		if(!visited[it]);
		dfs(it);
		maxi=max(maxi,dp[it]);
	}
	dp[node]=maxi+1;
}
signed main()
{
	int n,m;
	cin>>n>>m;
	int x,y;
	rep(i,m)
	{
		cin>>x>>y;
		adj[x].pb(y);
		indeg[y]++;
	}
	int ans=0;
	Rep(i,n)
	{
		if(indeg[i]==0)
		{
			dfs(i);
		}
		ans=max(ans,dp[i]);
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 26240
#include <iostream>
#include <vector>
#include <utility>
#include <string>
using namespace std;
 
int main() {
 
	//数字
	string S;
	cin >> S;
	int flag=0;
  	if(S.length()%2==0){
  		for(int i=0;i<S.length()/2;i++)
    	{
	   		if(S[i]!=S[S.length()-i-1]){
              flag++;
            }
    	}
    }else{
    	for(int i=0;i<S.length()/2;i++)
    	{
    		if(S[i]!=S[S.length()-i-1]){
              flag++;
            }
    	}
    }
  	cout << flag << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func next() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = nextInt()
	}
	return ints
}

func main() {
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	nums := nextInts(n)

	result := 0
	for i := 0; i < n; i++ {
		result ^= nums[i]
	}

	if result == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 2432
import sys


sys.setrecursionlimit(10**5)


class UnionFind(object):
    def __init__(self, N):
        self.parent = [i for i in range(N)]

    def merge(self, a, b):
        pa = self.root(a)
        pb = self.root(b)
        self.parent[pa] = pb
    
    def root(self, x):
        p = self.parent[x]
        if p == x:
            return x
        else:
            r = self.root(p)
            self.parent[x] = r
            return r


def main():
    N, M = map(int, input().split())

    uf = UnionFind(N)
    for _ in range(M):
        x, y, _ = map(int, input().split())
        uf.merge(x-1, y-1)

    print(len(list(filter(lambda x: x == uf.root(x), range(N)))))


main()

Measured memory_bytes: 31912
#include<iostream>
using namespace std;
int main(){
	int a;
	cin>>a;
	if(a<1200){
		cout<<"ABC"<<endl;
	}
	else if(a<2800&&a>1199){
		cout<<"ARC"<<endl;
	}
	else{
		cout<<"AGC"<<endl;
	}
	return 0;
}



Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var (
	rdr   = bufio.NewReaderSize(os.Stdin, 1000000)
	reply string
)

func main() {
	in := nextSlice()
	solve(in)
}

func solve(buf []string) {
	var (
		a, _ = strconv.Atoi(buf[0])
		b, _ = strconv.Atoi(buf[1])
	)
	if a > b {
		a, b = b, a
	}

	for i := 0; i < b; i++ {
		fmt.Printf("%d", a)
	}
}

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func nextSlice() []string {
	return strings.Split(readLine(), " ")
}

func atoi(a []string) (b []int) {
	b = make([]int, len(a))
	for i := range a {
		b[i], _ = strconv.Atoi(a[i])
	}
	return
}

func atof(a []string) (b []float64) {
	b = make([]float64, len(a))
	for i := range a {
		b[i], _ = strconv.ParseFloat(a[i], 64)
	}
	return
}

func scanSlice2(n int) (a []int, b []int) {
	a = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func scanFloatSlice2(n int) (a []float64, b []float64) {
	a = make([]float64, n)
	b = make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

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

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func min(a ...int) int {
	min := a[0]
	for i := 1; i < len(a); i++ {
		if min > a[i] {
			min = a[i]
		}
	}
	return min
}

func max(a ...int) int {
	max := a[0]
	for i := 1; i < len(a); i++ {
		if max < a[i] {
			max = a[i]
		}
	}
	return max
}

func sum(a []int) (ans int) {
	for i := range a {
		ans += a[i]
	}
	return
}

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

func yesOrNo(b bool) {
	if b {
		reply = "Yes"
		fmt.Println(reply)
		return
	}
	reply = "No"
	fmt.Println(reply)
}

func yesorNO(b bool) {
	if b {
		reply = "Yes"
		fmt.Println(reply)
		return
	}
	reply = "No"
	fmt.Println(reply)
}

Measured memory_bytes: 640
#include <stdio.h>

int main()
{   long long n,a,b;
    scanf("%lld%lld%lld",&n,&a,&b);
    long long x[n];
    for(int i=0;i<n;++i){
        scanf("%lld",&x[i]);
    }
    long long ans=0;
    for(int i=0;i<n-1;i++){
        if((x[i+1]-x[i])*a<b){
            ans+=(x[i+1]-x[i])*a;
        }else{
            ans+=b;
        }
    }
    printf("%lld",ans);

    return 0;
}


Measured memory_bytes: 896
N, M = map(int, input().split())
PList = [[] for _ in range(N+1)]

for i in range(M):
    P, Y = map(int, input().split())
    PList[P].append([Y, i])

#print(PList)

ans = [0] * M

for P, l in enumerate(PList):
    if not l:
        continue
    l.sort()
    for j, (Y, i) in enumerate(l):
        ans[i] = "{:06d}{:06d}".format(P, j+1)

#print(ans)

print("\n".join(ans))

Measured memory_bytes: 41392
import Foundation

func readInts () -> [Int]{
   return readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let ints = readInts()
    var count = 1
    
    for int in ints{
        if int != count {
            print(count)
            return
        }
        count += 1
    }
}

main()


Measured memory_bytes: 13492
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INF = 1000000007;
const int mod = 1000000007;

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()
{
    ll n;
    cin >> n;
    ll tmp;
    ll min = INF;
    ll sum = 0;
    int j = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> tmp;
        sum += tmp;
        if (tmp % 10)
        {
            chmin(min, tmp);
        }
    }
    if (sum % 10)
    {
        cout << sum << endl;
    }
    else
    {
        if (min == INF)
        {
            cout << "0" << endl;
        }
        else
        {
            cout << sum - min << endl;
        }
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
 
using namespace std;
typedef int64_t ll;
typedef vector<int64_t> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<vd> vvd;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SIZE(a) int((a).size())
const int MAX = 110;
const int MOD = 1000000007;
ll n;vll res(MAX);
void factorize(ll k) {
    for (ll i = 2; i * i <= k; i++) {
        if (k % i != 0) continue;
        while (k % i == 0) {
            k /= i;
            res[i]++;
        } 
    }
    if (k != 1) res[k]++;
    return;
}
int main(){
  cin>>n;
  REP(i,n){
    factorize(i+1);
  }
  vll prime(5);
  REP(i,n+1){
    if(res[i]>=2){prime[0]++;}
    if(res[i]>=4){prime[1]++;}
    if(res[i]>=14){prime[2]++;}
    if(res[i]>=24){prime[3]++;}
    if(res[i]>=74){prime[4]++;}
  }
  ll ans=0;
  if(prime[0]>0){ans+=(prime[0]-1)*prime[3];}
  if(prime[1]>0){ans+=(prime[1]-1)*prime[2];}
  if(prime[0]>0&&prime[1]>1){ans+=(prime[0]-2)*(prime[1]*(prime[1]-1))/2;}
  ans+=prime[4];
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n,w;
    cin>>n>>w;
    vector<ll>dp(w+1);
    for(ll i=0;i<n;i++)
    {
        ll n1,w1;
        cin>>w1>>n1;
        for(ll j=(w-w1);j>=0;j--)
        {
            dp[j+w1]=max(dp[j+w1],dp[j]+n1);
        }
    }
    ll ans=0;
     for(ll i=0;i<=w;i++)
            ans=max(ans,dp[i]);
     cout<<ans;

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define sec second
#define f first
#define pb push_back
#define pf push_front
#define po pop_back
const ll mod=1000000007;
#define fast ios_base::sync_with_stdio(false)
#define vi vector<ll>
#define vii vector< pair<ll,ll> >
#define pi pair<ll,ll>
#define pii pair< pair<ll,ll> ,ll >
#define set set<ll>
#define tostr to_string
#define toint stoi
#define gcd __gcd
ll maxm(ll a,ll b){return a>b?a:b;}
ll minm(ll a,ll b){return a>b?b:a;}
#define max maxm
#define min minm
const ll inf=1e18;


int main()
{
    fast;

 map<string,ll> m;
 ll n,i,c=0;cin>>n;
 string s;
 while(n--)
 {
    cin>>s;
    if(m[s]==0)
        {m[s]=1;
         c++;
        }
 }
 cout<<c<<endl;
}


Measured memory_bytes: 19064
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;

static inline ll mod(ll x, ll m)
{
    ll y = x % m;
    return (y >= 0 ? y : y+m);
}

// }}}

int N, M;
vector<int> neighbors[2][100001];
int dp[100001];

int rec(int v)
{
    if (dp[v] != -1) return dp[v];
    if (neighbors[0][v].size() == 0) return 0;
    int ret = 0;
    for (int i: neighbors[0][v]) {
        ret = max(ret, rec(i));
    }
    return dp[v] = ret + 1;
}

void solve()
{
    int ans = 0;
    REP (i, N) dp[i] = -1;
    REP (i, N) {
        if (neighbors[1][i].size() == 0) {
            ans = max(ans, rec(i));
        }
    }
    cout << ans << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    REP (i, M) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        neighbors[0][x].pb(y);
        neighbors[1][y].pb(x);
    }
    solve();
    return 0;
}

// vim:set foldmethod=marker:


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

typedef long long ll;

int main(void){
    while(true){
        ll n;
        cin >> n;
        if(n==0) break;
        ll t[10010];
        for(ll i=0; i<n; i++){
            cin >> t[i];
        }
        sort(t, t+n);
        ll sum=0, s=0;
        for(ll i=0; i<n-1; i++){
            s=s+t[i];
            sum+=s;
        }
        cout << sum << "\n";
    }
     
     
    return 0;
}


Measured memory_bytes: 3132
kyu = int(input())

if 400 <= kyu <= 599:
  print(8)
elif 600 <= kyu <= 799:
  print(7)
elif 800 <= kyu <= 999:
  print(6)
elif 1000 <= kyu <= 1199:
  print(5)
elif 1200 <= kyu <= 1399:
  print(4)
elif 1400 <= kyu <= 1599:
  print(3)
elif 1600 <= kyu <= 1799:
  print(2)
elif 1800 <= kyu <= 1999:
  print(1)

Measured memory_bytes: 9188
import sys

def inp():
    word = []
    for line in sys.stdin:
        word = map(int, line.split(","))
        syori(sorted(word))

def syori(word):
    flag = [0,0]
    if sum(word[1:5]) == 46:
        word.append(int(word[0]))
        del word[0]

    if word == [10,11,12,13,1]:
        print "straight"
        
    else:
        for j in xrange(1,14):
            if word.count(j) == 2:
                flag[0] += 1
            elif word.count(j) == 3:
                flag[1] += 1
            elif word.count(j) == 4:
                print "four card"
                flag = [10,10]
                break
            elif word[0] + 2 == word[1] + 1 == word[2] == word[3] - 1 == word[4] - 2:
                print "straight"
                flag = [10,10]
                break

        if flag[0] == flag[1] == 1:
            print "full house"
        elif flag[0] == 1:
            print "one pair"
        elif flag[0] == 2:
            print "two pair"
        elif flag[1] == 1:
            print "three card"
        elif flag[0] < 1 or flag[1] < 1:
            print "null"

if __name__ == "__main__":
    inp()
   

Measured memory_bytes: 6324
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;

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

	int s = 0;

	int i, j = 0;

	vector<int> a(N);

	for (i = 0; i < N; ++i) cin >> a.at(i);

	for (i = 0; i < N; ++i) s += a.at(i);

	for (i = 0; i < N; ++i) { 
		if (4 * M * a.at(i) >= s) { ++j; }
	}

	if (j >= M) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }

}

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

using namespace std;

int chmin(int a, int b , int c){
    if(a > c){
        return -1;
    }
    if(a <= b){
        return b;
    }else{
        return c;
    }
}

int main(){
    int i;
    int n;cin >> n;
    int flag = 0;
    vector<int> h(n);
    vector<int> dp(n);

    for(i = 0 ; i < n ; i++){
        cin >> h[i];
    }
    dp[0] = h[0];
    for(int i = 1 ; i < n ; i++){
        dp[i] = chmin(dp[i-1],h[i]-1,h[i]);
        //cout << dp[i] << endl;
        if(dp[i] == -1){
            flag = 1;
            break;
        }
    }

    if(flag == 0){
        cout << "Yes"<< endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include<set>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
llfor;///////////////////////////////////////////////////////////
int main(){
 ll a,b,c;
 sc(a);sc(b);sc(c);
 if(a+b==c||a==b+c||a+c==b)py;
 else pn;
  
return 0;}

Measured memory_bytes: 3572
n, k = map(int, input().split())
d = []
a = []
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int, input().split())))

n_all = set([i for i in range(1, n+1)])

for i in range(k):
    n_all = n_all - set(a[i])
print(len(n_all))

Measured memory_bytes: 9300
#include <bits/stdc++.h>
using namespace std;
 
#define  int    long long int
 #define    sp(x)                 setprecision(x)
#define    bp(x)           __builtin_popcount(x)
 #define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff         first
#define  ss    second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
 #define  endl    "\n"
#define  mod  1000000007
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
 
int32_t main()
{
    fast
    int n,m,x,ans=1e18,id=0;
    cin>>m>>n;
    set<int>s;
    f(i,1,n)
    {
        cin>>x;
        s.insert(x);
    }
    f(i,-200,200)
    {
        x=abs(m-i);
        if(s.find(i)==s.end())
        {
            if(ans>x)
            {
                ans=x;
                id=i;
            }
        }
    }
    cout<<id;
}

Measured memory_bytes: 3624
fn main() {

    let nm = read_line();
    let k:i32 = nm[0];
    let s:i32 = nm[1];
    let mut count = 0;

    for x in 0..(k + 1) {
        if x > s { continue; }
        let mut yk = k - x;
        if yk < k  { yk = k; }
        for y in 0..(yk + 1) {
            if y > s || y + x > s { continue; }
            let z = s - x - y;
            if  z <= k { count = count + 1; }
        }
    }

    println!("{}", count);
}

fn read_line() -> Vec<i32> {

    let input_str = get_input();
    let vec: Vec<&str> = input_str.trim().split_whitespace().collect();

    let mut int_vec: Vec<i32> = Vec::new();
    for v in vec {
        int_vec.push(to_i(v));
    }

    int_vec
}

fn to_i(s: &str) -> i32 {
    let input_num: i32 = match s.trim().parse() {
        Ok(num) => num ,
        Err(_)  => panic!("input wrong number."),
    };
    input_num
}

fn get_input() -> String {
    let mut input_str = String::new();
    std::io::stdin().read_line(&mut input_str)
        .expect("Failed to read line")
        ;
    input_str
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;

int main(){
  ll n,k;
  cin >> n >> k;
  
  ll ans=0;
  for(int i=1; i<=n; i++){
    ll b = i;
    ll r = (n+1)%b;
    ll p = (n+1)/b;
    ans+=p*max((ll)0,b-k);
    ans+=max((ll)0,r-k);
  }
  
  if(k==0) ans-=n;
  cout << ans << endl;
}
  
  


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

using namespace std;

int main(void){
    // Your code here!
    int n;
    vector<string> words;
    int flag = 1;
    
    std::cin >> n;
    
    for(int i = 0; i < n; i++){
        string w;
        std::cin >> w;
        words.push_back(w);
    }
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i != j && words[i] == words[j]){
                flag = 0;
            }
        }
    }
    
    for(int i = 1; i < n; i++){
        //std::cout << words[i-1][words[i-1].length()-1] << words[i][0] << std::endl;
        if(words[i-1][words[i-1].length()-1] != words[i][0]){
            flag = 0;
        }
    }
    
    if(flag) std::cout << "Yes" << std::endl;
    else std::cout << "No" << std::endl;
    
    return 0;
}


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

using namespace std;

int main(){
  int a,b,c,ans;
  cin >> a >> b >> c;
  
  if((a==b)&&(a==c))ans=1;
  else if((a==b)||(b==c)||(a==c)) ans=2;
  else ans=3;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
static const int MAX = 1000000;

int A[MAX];
int G[MAX];
int m;
int cnt = 0;

void print(int A[], int n)
{
	for (int i = 0; i < n; i++) {
		cout << A[i] << endl;
	}
}

void insertionSort(int A[], int n, int interval)
{
	for (int i = interval; i < n; i++) {
		int keyValue = A[i];
		int j = i - interval;
		while (A[j] > keyValue && j >= 0) {
			A[j+interval] = A[j];
			j = j - interval;
			cnt++;
		}
		A[j+interval] = keyValue;
	}
}

void shellSort(int A[], int n)
{
	//ÊéÉÏ½â´ð
	m = 0;
	for (int i = 1; ; ) {
		if (i > n) {
			break;
		}
		G[m] = i;
		m++;
		i = 3*i + 1;
	}
	//ÊéÉÏ½â´ð 
	
	for (int i = m-1; i >= 0; i--) {
		insertionSort(A, n, G[i]);
	}
}

int main()
{
	int n;
	
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}

	shellSort(A, n);
	cout << m << endl;
	for (int i = m-1; i >= 0; i--) {
		if (i < m-1)
			cout << " ";
		cout << G[i];
	}
	cout << endl << cnt << endl;
	print(A, n);
	
	return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

void solve() {
    int n;
    cin >> n;
    vector<bool> ls(n - 1);
    for (int i = 0; i < n - 1; i++) {
        char x;
        cin >> x;
        if (x == '<') ls[i] = true;
    }

    const int mod = 1e9 + 7;
    vector<vector<int>> dp(n + 1, vector<int>(n + 1));

    for (int i = 1; i <= n; i++) dp[1][i] = 1;
    for (int i = 2; i <= n; i++) {
        for (int j = 1; j <= i; j++) {
            if (ls[i - 2]) {
                dp[i][j] = (dp[i - 1][j - 1] - dp[i - 1][0] + mod) % mod;
            } else {
                dp[i][j] = (dp[i - 1][i - 1] - dp[i - 1][j - 1] + mod) % mod;
            }
        }
        for (int j = 1; j <= n; j++) {
            dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
        }
    }

    cout << dp[n][n];
}

int main() {
    cout << fixed << setprecision(20);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}


Measured memory_bytes: 35584
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: u32,
        b: u32,
        c: u32,
    }
    println!("{}",
        if a+b >= c {"Yes"} else {"No"}
    );
}


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

using namespace std;

typedef pair<int,int> pi;


int main()
{
    int n;
    cin>>n;
    vector<long double> p(n);
    for(int i=0; i<n; i++)
        cin>>p[i];
    vector<long double> ans(3000,0);
    ans[0]=1;
    for(int i=0; i<n; i++)
    {
        for(int h=2999; h>=0; h--)
        {
            ans[h] = ans[h]*(1-p[i]) ;
            
            if(h>0)
                ans[h] += ans[h-1]*p[i];
        }
    }
    long double final=0;
    for(int i = n/2 + 1;i<3000; i++)
        final += ans[i];
    cout<<setprecision(10)<<final;
    return 0;
}

Measured memory_bytes: 384