akhauriyash/Code-Regression huggingface dataset:
package main
 
import (
	"fmt"
	"sort"
)
 
type R struct {
	No    int
	Name  string
	Point int
}
 
type Rs []R
 
func (r Rs) Len() int      { return len(r) }
func (r Rs) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
func (r Rs) Less(i, j int) bool {
	if r[i].Name < r[j].Name {
		return true
	} else if r[i].Name == r[j].Name {
		if r[i].Point > r[j].Point {
			return true
		}
	}
	return false
}
 
func main() {
	var N, P int
	var S string
	fmt.Scan(&N)
	var rs Rs
	for i := 0; i < N; i++ {
		fmt.Scan(&S, &P)
		rs = append(rs, R{No: i + 1, Name: S, Point: P})
	}
	sort.Sort(Rs(rs))
	for i := 0; i < len(rs); i++ {
		fmt.Println(rs[i].No)
	}
}

Measured memory_bytes: 512
#%%
# 理屈は分かったが書き方がわからなかった...
# 答え: https://www.programming-pack.com/entry/2019/11/04/235625


s = list(input())

# 不等式の向きを記録する
memo = ''

# 不等式の連続した個数を記録する
cnt = 0

# 1つ前に数えた不等式の連続した個数を記録する
before_cnt = 0

# 答え
ans = 0

# 文字列Sの連続したふとうしきの向きを数える
for i in s:
    # はじめはmemoが空白なので、memoに不等式の向きを記録
    if memo == '':
        memo = i

    # 不等式の向きが同じ場合は数を1カウントしてループに戻る
    if memo == i:
        cnt += 1

    # 不等式の向きが異なる場合
    else:
        # ansに和を加算する
        ans += cnt * (cnt + 1) // 2

        # 不等式の向きの変化が処理が必要な場合
        if memo == '>':
            if before_cnt < cnt:
                ans -= before_cnt
            else:
                ans -= cnt

        before_cnt = cnt
        cnt = 1
        memo = i
else:
    ans += cnt * (cnt + 1) // 2
    if before_cnt < cnt:
        if memo == '>':
            ans -= before_cnt
    else:
        if memo == '>':
            ans -= cnt
    before_cnt = cnt
    cnt = 0

print(ans)

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

int main(){
	int N;
	int S, T;
	
	S = T = 0;
	
	for(int i = 0; i < 2; i++){
		for(int j = 0; j < 4; j++){
			cin >> N;
			if(i == 0) S += N;
			else T += N;
		}
	}
	
	cout << max(S, T) << endl;
	
	return 0;
}

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

int main() {
  vector<int> a(1000001);
  int k;
  int flg =0;
  cin >> k;
  a[1] = 7% k;
  for (int i =2;i<=k;i++){
    a.at(i) = (a.at(i-1)*10+7) % k;
  }

  for(int i=1; i<=k;i++){
    if (a.at(i)==0){
      cout << i << endl;
      flg = 1;
      break;
    }
  }
  if (flg==0){
  cout << -1 << endl;
  }
}

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

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

int main(){
  int k; cin >> k;
  long long sum = 0;
  int dp[k+1][k+1];
  for(int i = 1; i<=k; i++){
    for(int j = 1; j<=k; j++) dp[i][j] = gcd(i, j);
  }
  for(int i = 1; i<= k; i++){
    for(int j = 1; j<=k; j++){
      for(int n = 1; n<=k; n++) sum += dp[dp[i][j]][n];
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3740
a, b, k = map(int, input().split())
a1 = a
b1 = b
if k <= a:
    a1 -= k
elif k <= a + b:
    a1 = 0
    b1 -= k - a
else:
    a1 = 0
    b1 = 0
print(a1, b1)

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

int N,Q;
string S;
char T[222222],D[222222];

int fall(int x){
	rep(i,Q){
		if(T[i]!=S[x])continue;
		if(D[i]=='L')x--;
		else x++;
		if(x<0)return -1;
		if(x>=N)return 1;
	}
	return 0;
}

signed main(){
	cin>>N>>Q;
	cin>>S;
	rep(i,Q)cin>>T[i]>>D[i];

	int lb=-1,ub=N;
	while(ub-lb>1){
		int mid=(ub+lb)/2;
		if(fall(mid)==-1)lb=mid;
		else ub=mid;
	}

	int ans=lb+1;

	lb=-1;
	ub=N;
	while(ub-lb>1){
		int mid=(ub+lb)/2;
		if(fall(mid)==1)ub=mid;
		else lb=mid;
	}
	ans+=N-ub;
	cout<<N-ans<<endl;
	return 0;
}

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

int main() {
	string s, t;
	cin >> s >> t;

	sort(s.begin(), s.end());
	sort(t.begin(), t.end(), greater<char>());
	if(s < t) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>          
#include <stdbool.h>

#define MAX 8

const int nil = -1;
bool x[MAX][MAX];
int row[MAX];
bool col[MAX];
bool dpos[2 * MAX - 1], dneg[2 * MAX - 1];

void print_board()
{
  int i, j;

  for (i = 0; i < MAX; ++i)
    {
      for (j = 0; j < MAX; ++j)
	{
	  if (x[i][j] && row[i] != j)
	    return;
	}
    }

  for (i = 0; i < MAX; ++i)
    {
      for (j = 0; j < MAX; ++j)
	printf("%c", (row[i] == j) ? 'Q' : '.');

      printf("\n");
    }
}

void bktrack(int i)
{
  int j;

  if (i == MAX)
    {
      print_board();
      return;
    }

  for (j = 0; j < MAX; ++j)
    {
      if (!col[j] && !dpos[i + j] && !dneg[i - j + MAX - 1])
	{
	  row[i] = j;
	  col[j] = dpos[i + j] = dneg[i - j + MAX - 1] = true;

	  bktrack(i + 1);
	  row[i] = nil;
	  col[j] = dpos[i + j] = dneg[i - j + MAX - 1] = false;
	}
    }
}

void initialize_solve()
{
  int i, j;

  for (i = 0; i < MAX; ++i)
    {
      row[i] = nil;
      col[i] = false;

      for (j = 0; j < MAX; ++j)
	x[i][j] = false;
    }

  for (i = 0; i < 2 * MAX - 1; ++i)
    {
      dpos[i] = false;
      dneg[i] = false;
    }
}

int main(int argc, char** argv)
{
  int k;
  int r, c;
  int i;

  initialize_solve();

  scanf("%d", &k);
  
  for (i = 0; i < k; ++i)
    {
      scanf("%d %d", &r, &c);
      x[r][c] = true;
    }

  bktrack(0);
  return 0;
}




Measured memory_bytes: 2112
#include<stdio.h>

int main(){
	int a,b,c;

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

if(a==b && a!=c && b!=c){
    printf("Yes");
}
else if(a!=b && a==c && b!=c){
    printf("Yes");

}
else if(a!=b && a!=c && b==c){
    printf("Yes");
}
else {
    printf("No");
}

return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  for (int x = 0; x <= 1e6; ++x) {
    if (8 * x / 100 == a and 10 * x / 100 == b) {
      cout << x << '\n';
      exit(0);
    }
  }
  cout << "-1\n";
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
string S;

int main()
{
    cin >> S;
    int N = S.size() - 1;
    for (int i = 0; i <= N / 2 - 1; i++)
    {
        if (S[i] != S[N - i])
        {
            cout << "No" << endl;
            return 0;
        }
    }

    int NN = N / 2;
    for (int i = 0; i <= (NN - 1) / 2; i++)
    {
        if (S[i] != S[NN - 1 - i])
        {
            cout << "No" << endl;
            return 0;
        }
        if (S[NN + 1 + i] != S[N - i])
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int A, B;
  cin >> A >> B;
  for (double i = 1; i <= 100000; i++) {
    if(floor(i*0.08)==A&&floor(i*0.1)==B){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 256
N = int(input())
S = input()

s_list = list(set(S))
n_list = []

for i in range(1, N - 2):
    line1 = S[:i]
    line2 = S[i:]
    num = 0
    for c in s_list:
        _1 = line1.count(c)
        _2 = line2.count(c)
        if (_1 > 0 and  _2 > 0):
            num += 1
    n_list.append(num)

if (len(n_list) > 0):
    print(max(n_list))
else:
    print(0)

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

int main(){

    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    int AB = 2 * C;

    long long ans = 1e12;
    for(int i = 0; i <= max(X, Y); i++){
        int x = X - i, y = Y - i;
        long long sum = (AB * i) + (A * max(0, x)) + (B * max(0, y));
        ans = min(ans, sum);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <utility>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    map<int,int> mp;
    int a;
    rep(i,n){
        cin >> a;
        mp[a]++;
    }
    int cnt = 0;
    for(auto e : mp){
        if(e.second % 2 == 1){
            cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 4864
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<list>
#include<iomanip>
#include<vector>
using ll = long long;
using namespace std;
const ll MM = 1000000000;
const ll mod = MM + 7;

int main(){
    ll n; cin >> n;
    vector<ll> a(3*n);
    ll mx = 0;
    for(int i = 0; i < 3*n; i++){
        cin >> a[i];
    }
    
    sort(a.begin(), a.end());
    for(int i = n; i < 3*n; i += 2){
        mx += a[i];
    }
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;

#define ll long long
#define pal pair<ll,ll>
#define pad pair<double,double>
#define PB push_back
#define MP make_pair
#define F first
#define S second

const ll MOD = 1e9+7;
const ll INF = 1e18;
const double EPS = 1e-8;

long long pow(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return ret;
}

template<typename T,typename U>
bool chmax(T& max, const U& x){
	if(max<x){
		max = x;
		return true;
	}
	return false;
}

template<typename T,typename U>
bool chmin(T& min, const U& x){
	if(min>x){
		min = x;
		return true;
	}
	return false;
}

vector<ll> divisor(ll n) { //約数列挙
    vector<ll> ret,ter;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i*i != n && n != 1) ter.push_back(n / i);
        }
    }
    reverse(ter.begin(), ter.end());
    copy(ter.begin(),ter.end(),back_inserter(ret));
    return ret;
}

int main(){
	ll n,ans=0,amax=0;
	cin >> n;
	vector<ll> a(n);
	vector<bool> d(1000001,false);
	for(ll i=0;i<n;i++){
		cin >> a[i];
		chmax(amax,a[i]);
	}
	sort(a.begin(), a.end());
	for(ll i=0;i<n;i++){
		if(d[a[i]]){
			continue;
		}else if(i!=n-1&&a[i]==a[i+1]){
			for(ll j=1;;j++){
				if(a[i]*j>amax) break;
				d[a[i]*j]=true;
			}
			continue;
		}else{
			ans++;
			for(ll j=1;;j++){
				if(a[i]*j>amax) break;
				d[a[i]*j]=true;
			}
		}
	}
	cout << ans << endl;
}

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

using namespace std;
#define endl "\n"
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> pii;
priority_queue<pii> q;
bool cmp(int a, int b) {return a > b;}
int n, a[200020];
ll res;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    sort(a + 1, a + n + 1, cmp);
    q.push( pii(a[2], a[1]) );
    if (n == 2) cout << a[1];
    else {
        q.push( pii(a[3], a[2]) );
        q.push( pii(a[3], a[1]) );
        res = (ll)a[1] + (ll)a[2];
        for (int i = 4; i <= n; ++i) {
            res += q.top().first;
            q.push( pii(a[i], q.top().first) );
            q.push( pii(a[i], q.top().second) );
            q.pop();
        }
        cout << res;
    }
    return 0;
}


Measured memory_bytes: 6044
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    string s;
    cin >> N >> s;

    int w = 0;
    REP(i, N) if (s[i] == 'W') w++;
    vector<vector<int>> a(2, vector<int>(N + 1));

    FOR(i, 1, N + 1) {
        if (s[i - 1] == 'W') {
            a[0][i] = a[0][i - 1] + 1;
            a[1][i] = a[1][i - 1];
        } else {
            a[0][i] = a[0][i - 1];
            a[1][i] = a[1][i - 1] + 1;
        }
    }
    int ans = INF32;
    FOR(i, 1, N + 1) { chmin(ans, a[0][i - 1] + a[1][N] - a[1][i]); }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4244
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		Scanner cin = new Scanner(System.in);
		
		int n;
		int ans = 100000;
		
		n = cin.nextInt();
		
		while (n > 0){
			ans += ans / 100 * 5;
			if (ans % 1000 != 0){
				ans /= 1000;
				ans *= 1000;
				ans += 1000;
			}
			n--;
		}
		
		System.out.println(ans);
	}
}

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

int main()
{
    long X, K, D;
    cin >> X >> K >> D;

    if (abs(X) / D >= K)
    {
        cout << abs(X) - K * D << endl;
        return 0;
    }

    long v = K - abs(X) / D;

    long ans = 0;
    if (v % 2 == 0)
    {
        ans = abs(X) % D;
    }
    else
    {
        ans = D - abs(X) % D;
    }

    cout << ans << endl;

    return 0;
}

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

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

    int distance, time, speed;
    std::cin >> distance >> time >> speed;

    if (time * speed >= distance) {
        std::cout << "Yes";
    }
    else {
        std::cout << "No";
    }

    return 0;
}



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

int main(){
  string S;
  cin >> S;
  int ans=0;
  for(int i=0;i<4;i++){
    if(S[i]=='+'){
      ans++;
    }else if(S[i]=='-'){
      ans--;
    }
  }
  cout << ans << endl;
}

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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.flush();
	ll h,ans=0;
	cin>>h;
	ll p=0;
	while(h!=1)
	{
		h=h/2;
		p++;
		}
		
	p++;
	//ans=p*(p+1)/2;
	ans=pow(2,p)-1;
	
	cout<<ans<<endl;

return 0;
}


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

int main(){
  string n;
  cin >> n;
  int keta1=n.size()-1;

  if(n[keta1]=='3')cout << "bon";
  else if(n[keta1]=='0'||n[keta1]=='1'||n[keta1]=='6'||n[keta1]=='8')cout << "pon";
  else cout << "hon";
  
  
  return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

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

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int n, q;

vector<int> g[200005];
void dfs(int now, int from, vector<int> &ans, int sum) {
  sum += ans[now];
  ans[now] = sum;
  for(int u : g[now]) {
    if(u == from) continue;
    dfs(u, now, ans, sum);
  }
}

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

  cin >> n >> q;
  REP(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  vector<int> ans(n, 0);
  REP(i, q) {
    int p, x;
    cin >> p >> x;
    p--;
    ans[p] += x;
  }

  dfs(0, -1, ans, 0);
  REP(i, n) cout << ans[i] << " ";
  cout << endl;
}


Measured memory_bytes: 27452
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		System.out.println(Range(a,b,c));
	}
	
	public static String Range(int a, int b, int c){
		String word;
		word = (a < b && b < c) ? "Yes" : "No";
		return word;
	}

}

Measured memory_bytes: 17156
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
#include <cmath>
#include <string>
#include <cstdio>
#include <cstdlib>
using namespace std;


int s,n,t,p,m;
int blockw;
int blockt;
int minute[10081];
string wd,tim;

double check(int start){
	int i, j;
	int suc=0;
	for(i=0;i<m;i++,start+=t){
		for(j = 0;j <= s;j++) if(!minute[(start+j)%10080]) break;
		if(j>s) suc ++;
	}
	return 1-pow(1-1/(double)p, (double)suc*n);
}

main(){
	int i,j;
	while(cin >> s >> n >> t >> wd >> tim >> p >> m, s){
		fill(minute, &minute[10080], 0);
		if(wd=="All") blockw = (1<<7)-1;
		else blockw = 1;
		if(tim=="Night") blockt = 1;
		else if(tim=="Day") blockt = 2;
		else blockt = 3;
		for(i=0;i<10080;i++){
			if((blockw & (1 << i/1440)) == 0) continue;
			if((blockt & (1 << ((i/360+1)%4/2))) == 0) continue;
			minute[i] = 1;
		}
		double ans = 0;
		for(i=0;i<1440;i++){
			double ret = check(i);
			ans = max(ans, ret);
		}
		printf("%.10f\n", ans);
	}
	return 0;
}

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

Measured memory_bytes: 256
N, K = input().split(' ')
N = int(N)
K = int(K)

ans = {}
for i in range(0, K):
  input()
  A_hpge_strlist = input().split(' ')
  for A_hoge_str in A_hpge_strlist:
    ans[int(A_hoge_str)] = 0
print(N - len(ans.keys()))

Measured memory_bytes: 66832
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"
using namespace std;
#define int long long


class ATwoCoins {
public:
	void solve(std::istream& in, std::ostream& out) {
    int a,b,c;
    in >> a >> b >> c;
    out << ((a + b) >= c ? "Yes" : "No" )<< endl;
	}
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
	ATwoCoins solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3596
#include<cstdio>
#include<iostream>
#include<vector>

#define sint(i) scanf("%d",&i);
#define sintt(i,j) scanf("%d%d",&i,&j);
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main(){
	
	while(1){
		int n,m;
		int hon[100];
		sintt(n,m);
		if(n==0)break;
		rep(i,m){
			sint(hon[i]);
		}
		
		
		int left=0;
		int right=0;
		
		rep(i,m){
			right+=hon[i];
		}
		
		while(1){
			double harf= (double)(right+left)/2;
			//printf("%d %lf %d\n",left,harf,right);
			
			if(right==left){
				break;
			}
			
			int flg=0;
			int sum=0;
			int dan=0;
			for(int i=0;i<m;i++){
				
				if(dan>n){
					break;
				}
				
				if(sum+hon[i]>harf){
					sum=0;
					i--;
					dan++;
					continue;
				}else{
					sum+=hon[i];
				}
			}
			
			if(dan<n){
				flg=1;
			}
			
			if(flg==1){
				right=harf;
			}else{
				left=(int)((double)harf+0.5);
			}
		}
		printf("%d\n",right);
	}
}
/*
3 9
500
300
800
200
100
600
900
700
401

*/

Measured memory_bytes: 0
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

import java.util.*;
import java.util.Collections; // sorting use
import java.io.*;
import static java.lang.System.*;

public class Main{
	public static void main(String[] args){
		int n;
		ArrayList<Integer> p = new ArrayList<Integer>();
		Iterator iter = p.iterator();
		Scanner sc = new Scanner(System.in);

		int sum = 0;
		n = sc.nextInt();
		for (int i = 0; i < n; ++i){
			p.add(sc.nextInt());
			sum += p.get(i);
		}
		sum -= Collections.max(p) / 2;
		out.println(sum);
	}
}


Measured memory_bytes: 21588
d, g = gets.split.map(&:to_i)
pc = []
d.times do |i|
  pc << [(i+1) * 100,*gets.split.map(&:to_i)]
end
# p pc
cnts = []
[true,false].repeated_permutation(d).each do |bools|
  sum = 0
  cnt = 0
  pc.size.times do |i|
    if bools[i]
      sum += pc[i][0] * pc[i][1] + pc[i][2]
      cnt += pc[i][1]
    end
  end
  if sum >= g
    cnts << cnt
    next
  end
  until sum >= g
    (pc.size-1).downto(0) do |i|
      next if bools[i]
      tmpflag = false
      pc[i][1].times do |ii|
        sum += pc[i][0]
        cnt += 1
        if sum >= g
          tmpflag = true
          break
        end
      end
      break if tmpflag
    end
  end

  cnts << cnt
end
p cnts.sort[0]

# 3 7 2 66


Measured memory_bytes: 3964
#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 LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int u[216000];
bool loop[216000];
void init(){
    for(int i = 0;i < 216000;i++)u[i] = i;
}

int rt(int x){
    if(u[x] == x)return x;
    return u[x] = rt(u[x]);
}

void unite(int x, int y){
    x = rt(x);
    y = rt(y);
    u[x] = y;
}

int n, h, w;
int r, c, a;

typedef pair<Int, P> T;

vector<T> edges;
Int res;
int main(){
    init();
    cin >> n >> h >> w;
    for(int i = 0;i < n;i++){
        cin >> r >> c >> a;r--,c--;
        edges.push_back(T(a,P(r, c)));
    }
    sort(edges.rbegin(), edges.rend());
    for(auto e: edges){
        a = e.first;
        r = e.second.first;
        c = e.second.second;
        c += h;
        int rtr = rt(r), rtc = rt(c);
        if(loop[rtr] && loop[rtc])continue;
        res += a;
//        cout << a << " " << r + 1 << " " << c - n + 1 << endl;
        if(rtr == rtc){
            loop[rtr] = true;
            continue;
        }
        if(!loop[rtr] && !loop[rtc]){
            unite(r,c);continue;
        }
        else{
            unite(r, c);
            loop[rt(r)] = true;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5748
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
/*----------------------------------------------------------------*/

// int MOD = 998244353;
int MOD = 1000000007;

int h,w;
char maze[51][51];
int d[51][51] = {};

int dh[4] = {0,0,-1,1};
int dw[4] = {1,-1,0,0};

bool isin(int i,int j){
	return (0 <= i && i < h && 0 <= j && j < w);
}

int bfs(){
	rep(i,h)rep(j,w)d[i][j] = INF;
	d[0][0] = 1;
	queue<pii> q;
	q.push(MP(0,0));
	while(q.size()){
		pii p = q.front();
		q.pop();
		rep(i,4){
			int nh = p.fi + dh[i];
			int nw = p.se + dw[i];
			if(isin(nh,nw) && d[nh][nw] == INF && maze[nh][nw] == '.'){
				q.push(MP(nh,nw));
				d[nh][nw] = d[p.fi][p.se]+1;
			}
		}
	}
	return d[h-1][w-1];
}



/*----------------------------------------------------------------*/
signed main(){

    cin >> h >> w;
	rep(i,h)rep(j,w)cin >> maze[i][j];
	int cnt = 0;
	rep(i,h)rep(j,w)if(maze[i][j] == '#')cnt++;
	int ans = bfs();
	if(ans == INF){
		cout << -1 << endl;
		return 0;
	}
	cout << h*w-cnt-ans << endl;
    
	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://abc088.contest.atcoder.jp/tasks/abc088_d

Measured memory_bytes: 256
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 3e6+10;
LL fac[SIZE],inv[SIZE];
LL mypow(LL x,LL y){
    LL res=1;
    while(y){
        if(y&1)res=res*x%MOD;
        y>>=1;
        x=x*x%MOD;
    }
    return res;
}
LL C(int x,int y){
    if(y<0||y>x)return 0;
    return fac[x]*inv[y]%MOD*inv[x-y]%MOD;
}
void build(){
    assert(MOD>=SIZE);
    fac[0]=1;
    REPP(i,1,SIZE)fac[i]=fac[i-1]*i%MOD;
    inv[SIZE-1]=mypow(fac[SIZE-1],MOD-2);
    for(int i=SIZE-2;i>=0;i--)inv[i]=inv[i+1]*(i+1)%MOD;
}
LL N,M;
int main(){
    MOD = 998244353;
    build();
    R(N,M);
    LL an=C(N+3*M-1,N-1);
    ADD(an,-C(N+(3*M-2*M-1)-1,N-1)*N);
    FOR(i,0,M-1){
        int one=3*M-2*i;
        if(one>N)continue;
        ADD(an,-C(N,one)*C(N-1+i,N-1));
    }
    W(an);
    return 0;
}


Measured memory_bytes: 47232
#include <cstdio>
#include <stack>
#include <vector>
using namespace std;

using i64 = long long;

#define REP(i, stop) for (register int i = 1; i <= stop; ++i)

const int is = 1 << 17;
char ib[is], *ip = ib + is, it;
inline char getc() {
	if (ip == ib + is) { fread_unlocked(ib, 1, is, stdin); ip = ib; }
	return *ip++;
}
inline int read() {
	int r = 0;
	if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0';
	else while ((it = *ip++) & 16) r = r * 10 + it - '0';
	return r;
}

const int os = 1 << 17;
char ob[os], *op = ob, ot;
inline void putc(const char c) {
	*op++ = c;
	if (op == ob + os) { fwrite_unlocked(ob, 1, os, stdout); op = ob; }
}
// x shoud be greater than or equal to zero
inline void write(i64 x) {
	char d[20];
	int i = 0;
	while (true) {
		d[i] = x % 10 + 48;
		x /= 10;
		++i;
		if (x <= 0) break;
	}
	while (i--) {
		putc(d[i]);
	}
	putc(' ');
}

i64 cnt[200001];
bool used[200001];
i64 st[200001], *tp;
signed main() {
  i64 N = read(), Q = read();
  vector<vector<i64>> G(N + 1);
  REP(_, N - 1) {
    i64 a = read(), b = read();
    G[a].push_back(b);
    if (a != 1) G[b].push_back(a);
  }
  REP(_, Q) {
    i64 p = read(), x = read();
    cnt[p] += x;
  }
  tp = st;
  ++tp;
  *tp = 1;
  while (*tp) {
    i64 a = *tp;
    --tp;
    used[a] = true;
    for (i64 b : G[a]) {
      if (!used[b]) {
        cnt[b] += cnt[a];
        ++tp;
        *tp = b;
      }
    }
  }
  REP(i, N) {
    write(cnt[i]);
  }
  fwrite_unlocked(ob, 1, op - ob, stdout);
}


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

int main() {
  int n, l;
  cin >> n >> l;
  int sum = 0;
  int minv = 1e9;
  int x;
  for (int i = 0; i < n; i ++) {
    sum += l + i;
    if (minv > abs(l + i)) {
      minv = abs(l + i);
      x = l + i;
    }
  }

  cout << sum - x << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn(i,n) for(ll i=0;i<n;i++)
#define forne(i,n) for(ll i=1;i<=n;i++)
#define forse(i,s,e) for(ll i=s;i<e;i++)
#define all(v) v.begin(),v.end()
#define MOD 1000000007
ll modpow(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll modinv(ll a){return modpow(a,MOD-2,MOD);}
ll fac[100005] = {0};
ll ncr(ll n,ll r){
	if(n<0) return 0;
	if(r<0) return 0;
	if(n<r) return 0;
	return ((fac[n]*modinv(fac[r]))%MOD*modinv(fac[n-r]))%MOD;
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll t = 1;
	// cin>>t;
	fac[0] = 1;
	forne(i,100004) fac[i] = (i*fac[i-1])%MOD;
	while(t--){
		ll n,k;
		cin>>n>>k;
		ll arr[n];
		forn(i,n) cin>>arr[i];
		sort(arr,arr+n);
		ll ans = 0;
		forn(i,n){
			ans += arr[i] * ncr(i,k-1);
			ans %= MOD;
		}
		forn(i,n){
			ans -= arr[i] * ncr(n-1-i,k-1);
			ans %= MOD;
		}
		cout<<(ans+MOD)%MOD<<"\n";
	}
}

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

int main(){
    int n;
    cin >> n;
    vector<int> v;
    v.push_back(0);
    for(int i=0;i<n;++i){
        int a;
        cin >> a;
        v.push_back(a);
    }
    v.push_back(0);

    int sum = 0;
    for(int i=1;i<=n+1;++i){
        sum += abs(v[i] - v[i-1]);
    }

    for(int i=1;i<=n;++i){
        if(v[i-1] <= v[i] && v[i] <= v[i+1] || v[i-1] >= v[i] && v[i] >= v[i+1])cout << sum << endl;
        else if(v[i] <= v[i-1] && v[i-1] <= v[i+1] || v[i] >= v[i-1] && v[i-1] >= v[i+1])cout << sum - abs(v[i]-v[i-1])*2 << endl;
        else cout << sum - abs(v[i+1]-v[i])*2 << endl;
    }

    return 0;
}


Measured memory_bytes: 1784
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

struct ConvexHullTrick {
    struct Line {
        long long a, b;
        long long get(long long x) { return a * x + b; }
    };
    deque<Line> que;
    bool check(Line a, Line b, Line c) {
        return (b.b - c.b) * (b.a - a.a) <= (a.b - b.b) * (c.a - b.a);
    }
    void add(long long a, long long b) {
        Line l{a, b};
        while(que.size() > 1 && check(que[que.size() - 2], que.back(), l))
            que.pop_back();
        que.push_back(l);
    }
    long long query(long long x) {
        if(que.empty()) return INT64_MAX;
        while(que.size() > 1 && que[0].get(x) >= que[1].get(x))
            que.pop_front();
        return que[0].get(x);
    }
};

int main() {
  ll n,c;
  ConvexHullTrick cht;
  cin >> n >> c;
  vec h(n);
  vec dp(n);
  for(ll i=0;i<n;i++) cin >> h[i];
  cht.add(-2*h[0],h[0]*h[0]);
  for(ll i=1;i<n;i++) {
    dp[i]=cht.query(h[i])+h[i]*h[i]+c;
    cht.add(-2*h[i],dp[i]+h[i]*h[i]);
  }
  cout << dp[n-1] << endl;
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      string s;
      int i;
        cin >> s;
      	
      	if (s == "000"){
          i=0;}
      	if (s == "100" || s == "010" || s == "001" ){
          i = 1;}
      	if (s == "110" || s == "101" || s == "011" ){
          i = 2;}
        if (s == "111"){
          i = 3;}
      
        cout << i << endl;
      
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	vector<int> s(m);
	vector<char> c(m);
	rep(i, m) cin >> s[i] >> c[i];

	for (int i = 0; i < 1000; ++i) {
		bool elf = true;
		string t = to_string(i);
		if (t.size() != n) continue;
		rep(i, m) {
			int a = s[i] - 1;
			if (t[a] != c[i]) elf = false;
		}
		if (elf) {
			cout << i << endl;
			return 0;
		}
	}

	dunk(-1);
	
	return 0;
}


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



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



int n, m;
long long ans;
bool used[N][N];
char a[N][N];

inline bool check(int x, int y){
    return 1 <= x && x <= n && 1 <= y && y <= m;
}


int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n >> m;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            cin >> a[i][j];
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(!used[i][j]){
                queue < pair < int, int > > q;
                used[i][j] = true;
                q.push(make_pair(i, j));
                int col0 = 0, col1 = 0;
                while(!q.empty()){
                    int x = q.front().first,
                        y = q.front().second;
                    if(a[x][y] == '#'){
                        col0 += 1;
                    }
                    else{
                        col1 += 1;
                    }
                    q.pop();
                    for(int i = 0; i < 4; i++){
                        int xx = x + dx[i],
                            yy = y + dy[i];
                        if(check(xx, yy) && a[xx][yy] != a[x][y] && !used[xx][yy]){
                            used[xx][yy] = true;
                            q.push(make_pair(xx, yy));
                        }
                    }
                }
                ans += 1LL * col0 * col1;
            }
        }
    }
    cout << ans;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (ll)1e9 //10^9:∞
#define LLINF (ll)1e12
#define MOD (ll)(1e9+7) //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)
#define endl "\n"

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__


	ll N, W;
	cin >> N >> W;
	VI w(110), v(110);

	FOR(i, 1, N)cin >> w[i] >> v[i];

	//dp[i][j]:=i番目までを使って価値がちょうどjになるような選び方の重さの"最小値"

	vector<vector<ll>> dp(110, vector<ll>(110000, LLINF));

	FOR(i, 0, N)dp[i][0] = 0;

	FOR(i, 1, N)FOR(j, 0, 110000) {
		if (j - v[i] >= 0)dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v[i]] + w[i]);
		else dp[i][j] = dp[i - 1][j];
	}

	ll ans=0;

	REP(j,110000){
		if(dp[N][j]<=W)ans=max(ans,j);
	}

	cout<<ans<<endl;


	return 0;
}


Measured memory_bytes: 98748
from sys import stdin,stdout
n=int(stdin.readline());ans='No';d=0
# a=list(map(int,stdin.readline().split()))
for i in range(n):
    x,y=list(map(int,stdin.readline().split()))
    if x==y:d+=1
    else:d=0
    if d>=3:
        ans='Yes'
        break
print(ans)

Measured memory_bytes: 9176
n,m = tuple(map(int,input().split()))

p = [tuple(map(int,input().split())) for _ in [0]*m]

p = sorted(p)

ans = 0
area = (0,0)
for x,y in p:
  if area[0]<=x and x<area[1]:
    area = x,min(area[1],y)
  else:
    ans+=1
    area = x,y
print(ans)

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

using namespace std;

typedef long long ll;

ll inq(ll x, ll y, ll mod)
{
    if (y == 0) return 1 % mod;
    ll l = inq(x, y / 2, mod);
    if (y % 2) return l * l % mod * x % mod;
    return l * l % mod;
}

ll gcdex(ll a, ll b, ll &x, ll &y)
{
    // Solves the equation ax + by = gcd(a, b)
    // returns gcd(a, b)
    // save x and y in given values
    //
    // Correctness tested on random tests.
    //
    if (a == 0)
    {
        x = 0, y = 1;
        return b;
    }
    ll x1, y1;
    ll g = gcdex(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return g;
}

pair<ll, ll> crt(vector<ll> r, vector<ll> m)
{
    // Finds such x, that x mod m[i] = r[i] for each i
    // if such x does not exist returns {0, 0}
    //
    // Correctness tested on random tests.
    //
    int n = r.size();
    for (int i = 0; i < n; i++) r[i] %= m[i];
    ll r0 = 0, m0 = 1;
    for (int i = 0; i < n; i++)
    {
        ll r1 = r[i], m1 = m[i];
        if (m0 < m1)
        {
            swap(m0, m1);
            swap(r0, r1);
        }
        if (m0 % m1 == 0)
        {
            if (r0 % m1 != r1) return {0, 0};
            continue;
        }
        ll x, y;
        ll g = gcdex(m0, m1, x, y);
        ll u = m1 / g;
        if ((r0 - r1) % g != 0)
            return {0, 0};
        ll z = (r1 - r0) / g % u * x % u;
        r0 += z * m0;
        m0 *= u;
        if (r0 < 0) r0 += m0;
    }
    return {r0, m0};
}

const int K = 228;

ll solve(ll a, ll m)
{
    if (m == 1) return K;
    ll phi = m;
    ll z = m;
    for (int i = 2; i * i <= z; i++)
    {
        if (z % i == 0)
        {
            phi /= i;
            phi *= (i - 1);
            while (z % i == 0)
            {
                z /= i;
            }
        }
    }
    if (z > 1)
    {
        phi = phi / z * (z - 1);
    }
    ll g = __gcd(m, phi);
    ll y = solve(a, g);
    vector<ll> R = {y, inq(a, y, m)};
    vector<ll> M = {phi, m};
    pair<ll, ll> ze = crt(R, M);
    while (ze.first < K) ze.first += ze.second;
    return ze.first;
}

int main()
{
    int q;
    cin >> q;
    while (q--)
    {
        ll a, m;
        cin >> a >> m;
        ll r = solve(a, m);
        cout << r << "\n";
    }
}


Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
 
using namespace std;
 
struct edge { int to, cost; };
typedef pair<int, int> P;
 
const int MAX_V = 10000;
const int INF = 1 << 28;
 
int V;
vector<edge> G[MAX_V];
int d[MAX_V];
bool vis[MAX_V];
 
int prim(){
	int res = 0;
	priority_queue<P, vector<P>, greater<P> > que;
	fill(d, d + V, INF);
	fill(vis, vis + V, false);
	d[0] = 0;
	que.push(P(0, 0));
	while(!que.empty()){
		P p = que.top(); que.pop();
		int v = p.second;
		if(vis[v]) continue;
		vis[v] = true;
		res += p.first;
		for(int i=0;i<G[v].size();i++){
			edge e = G[v][i];
			if(d[e.to] > e.cost){
				d[e.to] = e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
	return res;
}
 
int main(){
	int E;
	cin >> V >> E;
	for(int i=0;i<E;i++){
		int s, t, w;
		cin >> s >> t >> w;
		G[s].push_back((edge){t, w});
		G[t].push_back((edge){s, w});
	}
	cout << prim() << endl;
	return 0;
}

Measured memory_bytes: 4436
#include <stdio.h>

int main(void)
{
    int N,X;
    int L[200];
    int count=0;
    int D=0;

    scanf("%d %d",&N,&X);
    for(int i=0; i<N; i++){
        scanf("%d",&L[i]);
    }

    for(int i=0; i<N; i++){
        D+=L[i];
        if(D <= X) count++;
    }

    printf("%d\n",count+1);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll X, Y;
  cin >> X >> Y;
  if(X % Y == 0) cout << -1 << "\n";
  else cout << X << "\n";
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};

int n;
vector<vi> G;
vi used;

int dfs(int v, int s){
    used[v] = s;
    int cnt = 1;
    for(auto& nv : G[v]){
        if(used[nv] != -1) continue;
        cnt += dfs(nv, s);
    }
    return cnt;
}

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

    int K, L; cin >> n >> K >> L;
    UnionFind uf1(n);
    rep(loop, K){
        int p, q; cin >> p >> q; p--, q--;
        uf1.unionSet(p, q);
    }

    UnionFind uf2(n);
    rep(loop, L){
        int r, s; cin >> r >> s; r--, s--;
        uf2.unionSet(r, s);
    }

    using Elem = tuple<int, int>;
    map<Elem, int> dic;
    rep(i, n){
        dic[Elem(uf1.root(i), uf2.root(i))]++;
    }
    rep(i, n){
        cout << dic[Elem(uf1.root(i), uf2.root(i))] << endl;
    }

    return 0;
}


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

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976

int prime[100005];

int main()
{
    prime[0] = 0;
    prime[1] = 0;
    prime[2] = 0;
    for(int i = 3; i < 100005; i++){
        bool p = true;
        for(int j = 2; j * j <= i; j++){
            if(i % j == 0) p = false;
        }
        bool q = true;
        for(int j = 2; j * j <= (i+1)/2; j++){
            if((i+1)/2 % j == 0){
                q = false;
            }
        }
        if(p && q) prime[i] = 1;
        else prime[i] = 0;
    }
    int sum[100005];
    sum[0] = 0;
    for(int i = 1; i < 100005; i++){
        sum[i] = sum[i-1] + prime[i];
    }
    int q; cin >> q;
    for(int i = 0; i < q; i++){
        int l,r;
        cin >> l >> r;
        cout << sum[r] - sum[l-1] << endl;
    }
}

Measured memory_bytes: 1408
#include <math.h>
#include <stdio.h>

const double PI = 4.0 * atan(1.0);

int
main()
{
	double a, b, deg;
	scanf("%lf %lf %lf", &a, &b, &deg);

	double rad = deg * PI/180.0;
	double c   = sqrt(pow(a, 2) + pow(b, 2) - 2*a*b*cos(rad));

	double area      = a*b*sin(rad) / 2.0;
	double perimeter = a + b + c;
	double h         = 2*area / a;
	printf("%f\n", area);
	printf("%f\n", perimeter);
	printf("%f\n", h);
	return 0;
}

Measured memory_bytes: 648
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  int a,num[100005];

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

  for(int i=1;i<=n;i++) cout<<num[i]<<" ";
  cout<<endl;

  return 0;
}


Measured memory_bytes: 1152