akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h> 
using namespace std;

#define ll long long int
#define mp make_pair 
#define pb push_back
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);
#define ff first
#define ss second
#define ll_MAX 922337203685477999
#define endl "\n"
inline ll absdiff(ll a,ll b) {return (a>b)?a-b:b-a;}
const ll MOD = 1000000007;
ll fast_expo(ll x,ll p){if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
ll gcd(ll a,ll b){if(a==0||b==0) return a+b;  else return gcd(b%a,a); }

ll nCr(ll n,ll r){
    ll last = 1;
    for(ll i=1; i<=r; ++i){
        ll temp = fast_expo(i,MOD-2)%MOD;
        last = (((last*(n-i+1))%MOD)*temp)%MOD;
    }
    return last;
}

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

    ll t_c;t_c = 1;
    // cin >> t_c;
    for (ll ti = 0; ti < t_c; ++ti)
    {  
        ll n,a,b; cin >> n >> a >> b;
        ll cnt = 10;
        ll ans = (fast_expo(2,n)-1-nCr(n,a)-nCr(n,b)+cnt*MOD)%MOD;   
        cout << ans;
    }
    return 0;       
}       

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

using namespace std;
#define deb(x) cout << #x << ": " << x << endl
#define fo(i, n) for (ll i = 0; i < n; i++)
#define fkn(i, k, n) for (i = k; i < n; i++)
#define ll long long
#define F first;
#define S second;
#define PB push_back;
#define MP(x,y) make_pair(x,y);
typedef vector<ll> vll;

bool powerOfTwo(ll x)
{
    return !(x & (x - 1));
}

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

    ll a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    


}



Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
ll n,m;
vl g[MAX];
ll done[MAX],dp[MAX];
ll dfs(ll u){
  if(done[u])return dp[u];
  ll ans = 0;
  for(auto v:g[u]){
    ans = max(ans,1+dfs(v));
  }
  done[u] = 1;
  return dp[u] = ans;
}
int main(){FAST;
cin>>n>>m;
for(ll i=1;i<=m;++i){
  ll u,v;cin>>u>>v;
  g[u].pb(v);
}
ll ans = 0;
for(ll i=1;i<=n;++i){
  dfs(i);
  ans = max(ans,dp[i]);
}
cout<<ans;
return 0;
}

/*
 WA? check edge cases, N=1,M=1 etc. Read code fully once and check all variables.
 Read the question again and see what you might have missed.
 Consider changing your solution or find more cases.
 */


Measured memory_bytes: 12740
# https://beta.atcoder.jp/contests/abc102/tasks/arc100_a
import statistics
import numpy as np

n = int(input())
nums = np.array(list(map(int, input().split())))
iteration = np.array(list(range(1, n + 1)))

difference_list = nums - iteration
median = statistics.median(difference_list)
print(int(sum(abs(difference_list - median))))


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

using namespace std;

int main() {
	int num,c,max=0;
	cin >> num;
	vector<int> v(num, 2);
	for (int i = 0; i < num; i++) {
		cin >> v[i];
	}

	for (int i = 0; i < num; i++) {
		cin >> c;
		if (v[i] - c > 0)
			max += v[i] - c;
	}
	cout << max << "\n";
	return 0;

}


Measured memory_bytes: 256
/*Shivam Bhalla */
  /* f2016941@pilani.bits-pilani.ac.in */



  #include <iostream>
  #include <cstdio>
  #include <cstring>
  #include <cstdlib>
  #include <cctype>
  #include <algorithm>
  #include <map>
  #include <vector>
  #include <list>
  #include <set>
  #include <queue>
  #include <deque>
  #include <stack>
  #include <iostream>
  #include <string>
  #include <string.h>
  #include <cmath>
  #include <cassert>
  #include <bits/stdc++.h>
  #define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
  using namespace std;
  long long maxv = 1e9;



int main(){
	int n, k; cin >> n >> k;
	double ans = 0.0;
	for(int i=1;i<=n;i++){
		int tmp = i;
		double prob = 1.0/n;
		while(tmp < k){
			tmp *= 2;
			prob /= 2.0;
		}
		ans += prob;
	}
	printf("%.15f\n", ans);
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<queue>
using namespace std;

const int maxn = 1000;
string str;
int n;
int mem[maxn];
int sum[maxn];
int memo[40];
queue<int> que;

bool check()
{
	int cnt = 0;
	if(memo[5]) cnt++;
	if(memo[12]) cnt++;
	if(memo[17]) cnt++;
	if(memo[24]) cnt++;
	if(memo[31]) cnt++;

	memo[5] = 0;
	memo[12] = 0;
	memo[17] = 0;
	memo[24] = 0;
	memo[31] = 0; 

	if(cnt == 5) return true;
	else return false;
}

int solve()
{
	for(int i = 0; i <= n; i++)
	{
		if(n >= 1) sum[i] = sum[i-1] + mem[i-1];
		else sum[i] = 0; 
	}

	for(int i = 0; i <= n; i++)
		for(int j = i+5; j <= n; j++)
		{
			if(sum[n] - sum[i] < 31) break;
			int d = sum[j]-sum[i];
			if(d > 31) break;
			else if(d == 31) que.push(i); 
		}
 
	int p, np; 
	while(!que.empty())
	{
		p = que.front(); que.pop();
		np = p + 1;
		//cout << "np " << np << endl;
		int total = 0;
		while(total!=31)
		{
			total += mem[p++];
			memo[total] = 1;
		}
		if(check()) return np;
	}
	return np;
}

bool Input()
{
	scanf("%d", &n); getchar();
	if(!n) return false;
	for(int i = 0; i < n; i++)
	{
		getline(cin, str); 
		mem[i] = str.length();
	}
	return true;
}

void Init()
{
	memset(mem, 0, sizeof(mem));
	memset(sum, 0, sizeof(sum));
	memset(memo, 0, sizeof(memo));
	while(!que.empty()) que.pop();
}

void Print()
{
	cout << "show" << endl;
	for(int i = 0; i <= n; i++)
	{
		printf("%d ", sum[i]);
	}
	cout << endl;
}

int main()
{
	//freopen("my.txt", "w", stdout);
	while(1)
	{
		Init();
		if(!Input()) break;
		printf("%d\n", solve());
		//Print();
	}
	return 0;
}


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

struct edge{
  int to;
  int64_t len;
};

int main(){
  int N;
  cin >> N;
  vector< vector<edge> > V(N+1);
  for(int i=0;i<N-1;i++){
    int u,v;
    int64_t w;
    cin >> u >> v >> w;
    V.at(u).push_back({v,w});
    V.at(v).push_back({u,w});
  }
  vector<int64_t> dist(N+1,-1);
  queue<int> que;
  que.push(1);
  dist.at(1)=0;
  while(!que.empty()){
    int a=que.front();
    que.pop();
    for(auto & e:V.at(a)){
      int b=e.to;
      if(dist.at(b)==-1){
        dist.at(b)=dist.at(a)+e.len;
        que.push(b);
      }
    }
  }
  for(int i=1;i<=N;i++){
    if(dist.at(i)%2==0){
      cout << 0 << endl;
    }else{
      cout << 1 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 8704
#include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from); x<(to); (x)++)
#define rep(x,to) rep2(x,0,to)
int main() {
	int a[4], b[4];
	while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
		int hit=0, blow=0;
		rep(i,4) {
			rep(j,4) {
				if(a[i] == b[j]) {
					if(i == j) hit++;
					else blow++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

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

#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
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; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
bool dp[100100];
 
int main () {
    vector<int>A(6);
    rep(i,A.size()){
        cin >> A[i];

        if(A[i] == 0){
        cout << i+1 << endl;
        return 0;
        }

    }

 
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
 
#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;
const double PI = acos(-1);
const long double EPS = 1e-9;
using namespace std;


void solve(){
    int n;
    cin >> n;
    string s = to_string(n);
    int sum = 0;
    for(int i = s.size() - 1; i >= 0; i--){
        sum += s[i] - '0';
    }
    cout << ((n % sum == 0) ? "Yes" : "No");
}


int main(){
    
    int q = 1;
    //cin >> q;}
    while(q--) solve();
}
// vse dolzhny vyiti v internet po hhtp


Measured memory_bytes: 256
H,W,K=map(int,input().split())
s=[]
for i in range(H):
  s.append(input())
ans=[]
index=1
ans_line=[]
for i in range(H):
  ans_line.append(i)
  ans.append([])
  if "#" in s[i]:
    tt=0
    for kk in s[i]:
      if kk=="#":
        tt+=1
    o=tt
    tmpi=index
    for k in ans_line:
      index=tmpi
      tt=o
      for j in s[i]:
        if tt==0:
          ans[k].append(str(index))
          continue
        else:
          if j==".":
            ans[k].append(str(index))
          else:
            ans[k].append(str(index))
            index+=1
            tt-=1
            if tt==0:
              index-=1
    ans_line=[]
    index+=1
if ans_line==[]:
  for i in ans:
    print(" ".join(i))
else:
  q=len(ans_line)
  for i in range(len(ans_line)):
  	ans.pop()
  tmp=[]
  for i in ans:
    print(" ".join(i))
    tmp=i
  for i in range(q):
    print(" ".join(tmp))
  

Measured memory_bytes: 9332
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, n) for (int i = (n - 1); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF = 100000007;

int main() {
  int x;
  cin >> x;
  if (x == 0)
    cout << 1 << endl;
  else
    cout << 0 << endl;
}


Measured memory_bytes: 3632
//============================================================================
// Name        : d.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <queue>
#include <vector>
using namespace std;

#define INF 1e+9
#define MAX_V 100000

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = vector<int>;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];
int ans[MAX_V];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    vector<int> tempv={0,s,0};
    que.push(tempv);

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p[1];
        if (d[v] < p[0]) continue;
//        cout<<p[0]<<p[1]<<p[2]<<endl;
        ans[v]=p[2];
        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
//            cout<<e.to<<e.cost<<endl;
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                tempv={d[e.to],e.to,v};
                que.push(tempv);
            }
        }
    }
}

int main() {
    cin >> V;
    int E;
    cin >> E;
    for (int i=0; i<E; ++i) {
        int a, b, c;
        cin >> a >> b;
        a--;b--;
        c=1;
        edge e = {b, c};
        G[a].push_back(e);
        e={a,c};
        G[b].push_back(e);
    }
//    cout<<G[1].size()<<endl;
    dijkstra(0);
//    for (int i=0; i<V; ++i) {
//        if(d[i] != INF)
//            cout << "0から" << i << "までのコスト: " << d[i] << endl;
//    }
    cout<<"Yes"<<endl;
    for(int i=1;i<V;i++){
    	cout<<ans[i]+1<<endl;
    }
}

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

using i64=int64_t;

#define rep(i,x,y) for(int i=(x),i##_max_for_repmacro=(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int A,B;
    cin >> A >> B;
    vector<vector<int>> d(A,vector<int>(B));
    rep(i,0,A) rep(j,0,B) cin >> d[i][j];

    int N=202,M=101*101+200,S=0,T=N-1;
    static int f[101][101]={};
    rep(i,0,101) rep(j,0,101){
        int ma=0;
        rep(x,0,A) rep(y,0,B) ma=max(ma,d[x][y]-(x+1)*i-(y+1)*(100-j));
        f[i][j]=ma;
    }

    auto min_dist=[&](int x,int y){
        int dist[202];
        fill_n((int*)dist,202,inf);
        dist[0]=0;
        rep(i,0,202){
            rep(j,0,101) rep(k,0,101) dist[k+101]=min(dist[k+101],dist[j]+f[j][k]);
            rep(j,0,100) dist[j+1]=min(dist[j+1],dist[j]+x);
            rep(j,0,100) dist[j+1+101]=min(dist[j+1+101],dist[j+101]+y);
        }
        return dist[201];
    };

    rep(x,1,A+1) rep(y,1,B+1) if(min_dist(x,y)!=d[x-1][y-1]){
        cout << "Impossible" << endl;
        return;
    }

    cout << "Possible" << endl;
    cout << N << " " << M << endl;
    rep(i,0,100) cout << i+1 << " " << i+2 << " X" << endl;
    rep(i,0,100) cout << i+1+101 << " " << i+2+101 << " Y" << endl;
    rep(i,0,101) rep(j,0,101) cout << i+1 << " " << j+102 << " " << f[i][j] << endl;
    cout << S+1 << " " << T+1 << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using intl = long long;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)((n) - 1); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define INF = 1e9;
#define debug(x) cout << #x << ":" << x << endl
using namespace std;
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
int main(){
    intl a;
    cin >> a;
    intl b;
    cin >> b;
    intl c;
    cin >> c;
    cout << (a + b) * c / 2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define dl double
template <class T>
void rd(T &x){
  x=0;T f=1;char ch=getchar();
  while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
  while(ch<='9' && ch>='0')x=x*10+ch-'0',ch=getchar();x*=f;
}

using namespace std;

const int N=100;

int n,a[N];
LL now=1000;

int main(){
 // freopen("in.txt","r",stdin);
 // freopen("o.txt","w",stdout);
 rd(n);
 for(int i=1;i<=n;i++)rd(a[i]);
 int lst=0x7fffffff;
 for(int i=1;i<=n;i++){
  if(a[i] > lst)now=now%lst+now/lst*a[i];
  lst=a[i];
 }
 printf("%lld\n",now);
 return 0;
}
/**/

Measured memory_bytes: 3760
/*
???????????£?????´??°?????\?????????????????????????????????????????¨??????????§???¢???
??´?§?????§???¢??§????????´????????? YES ??????
????????´????????? NO ??¨????????????????????°?????????????????????????????????
*/

#include <iostream>


using namespace std;
 
int main()
{

	int a, b, c, d1, d2, d3, i, N = 0;

		cin >> N;

	for ( i = 0; i < N; i++ ) {
		
		cin >> a >> b >> c;

		d1 = a * a;
		d2 = b * b;
		d3 = c * c;

		if ( d1 == ( b * b ) + ( c * c ) ) {
			cout << "YES" << endl;
		} else if ( d2 == ( a * a ) + ( c * c ) ) {
			cout << "YES" << endl;
		} else if ( d3 == ( a * a ) + ( b * b ) ) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main() {
  string n;
  int a,b,c;
  cin >> n;
  a = count(n.begin(),n.end(),'a');
  b = count(n.begin(),n.end(),'b');
  c = count(n.begin(),n.end(),'c');
  if(a >= 2 || b >= 2 || c >= 2){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program {

	static long mod = 998244353;
	static void Main(string[] args) {

		char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res="";
		//int res = 0;
		
		int res = 0;

		int[] vals = parseAry(Console.ReadLine().Split(cs));

		res = vals[0] - vals[1] + 1;



		Console.WriteLine(res);


		return;

	}

	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}

}

Measured memory_bytes: 11220
import sys
input = sys.stdin.readline
def main():
    K = int(input())
    A, B = map(int, input().split())
    ans = "NG"
    for v in range(A, B+1):
        if v % K == 0:
            ans = "OK"
            break
    print(ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 61916
/**
 * author: moririn_cocoa       
**/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

int main(void) {
  
  int A;
  int B;
  
  cin >> A;
  cin >> B;
  
  if ( A + B >= 24 ) {
    
    cout << A + B - 24 << endl;
  }
  
  else {
    
    cout << A + B << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
const int MAXN=2e5+5;
long long n,k,a[MAXN],m,ans;
int main()
{
	cin>>n>>k;
	m=n-k;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+n+1);
	if(m<=0)
	{
		cout<<0;
		return 0;
	}
	for(int i=1;i<=m;i++)
		ans+=a[i];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1792
import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;

void main(){

    int[] s = readln().split().to!(int[]);
    int n,r,l;
    n = s[0];
    r = s[1];
    l = s[2];
    int[] d,t,x;
    int[] p,pt;
    int maxp,maxt,now;
    for(int i=0;i<n;i++) {
	p ~= 0;
	pt ~= 0;
    }
    for(int i=0;i<r;i++){
	s = readln().split().to!(int[]);
	d ~= s[0]-1;
	t ~= s[1];
	x ~= s[2];
    }
    d ~= 0;
    t ~= l;
    x ~= 0;
    int pre = 0;
    for(int i=0;i<=r;i++){
	pt[now] += t[i]-pre;
	maxt = max(maxt,pt[now]);
	pre = t[i];
	p[d[i]] += x[i];
	if(x[i] > 0){
	    if(p[d[i]] == maxp && d[i] < now){
		now = d[i];
	    }else if(p[d[i]] > maxp){
		now = d[i];
		maxp = p[d[i]];
	    }
	}else if(now == d[i]){
	    now = 0;
	    int temp = maxp;
	    int tempnow = now;
	    maxp = -10000000;
	    for(int j=0;j<n;j++){
		if(maxp < p[j]){
		    maxp = p[j];
		    if(maxp == temp) break;
		    now = j;
		}
	    }
	}
    }
    for(int i=0;i<n;i++){
	if(pt[i] == maxt){
	    writeln(i+1);
	    break;
	}
    }
}

Measured memory_bytes: 21908
#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;

double line_func(double x, double y) {
	return 2*(x+y);
}

double square_func(double x, double y) {
	return x*y;
}

int main() 
{
	double a, b;
	cin >> a >> b ;
	cout << square_func(a, b) << " " << line_func(a, b) << endl;
}

Measured memory_bytes: 1280
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
temp=[t-i*0.006 for i in h]
aaa=[abs(i-a) for i in temp]
ans=min(aaa)
for i in range(n):
  if aaa[i]==ans:
    print(i+1)


Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int n,k;
char a[15];
inline int read(){
	int x=0,t=1,c;
	while(!isdigit(c=getchar())) if(c=='-') t=-1;
	while(isdigit(c)) x=x*10+c-'0',c=getchar();
	return x*t;
}
int main(){
	n=read();
	scanf("%s",a+1);
	k=read();
	for(int i=1;i<=n;i++)
	    if(a[i]!=a[k]) printf("*");else printf("%c",a[i]);
	return 0;
}


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


string express(long a, long b, long c, long d);
void express2(long a, long b, map<long,string> *m);
void express3(long a, long b, long c, map<long,string>* m);
void express4(long a, long b, long c, long d, map<long,string>* m);

int main(void){
  long a,b,c,d;

  while(1){
    cin>>a>>b>>c>>d;
    if(a==0 and b==0 and c==0 and d==0)break;
    cout<<express(a,b,c,d)<<endl;
  }
  return 0;
}


string express(long a, long b, long c, long d){
  vector<long> num;
  num.push_back(a);
  num.push_back(b);
  num.push_back(c);
  num.push_back(d);
  sort(num.begin(),num.end());
  do{
    map<long, string> m;
    express4(num[0],num[1],num[2],num[3],&m);
    for(auto iter=m.begin();iter!=m.end();iter++){
      auto key=iter->first;
      if(key==10)return m[key];
    }
  }while(next_permutation(num.begin(),num.end()));
  return "0";
}


void express2(long a, long b, map<long,string> *m){
  (*m)[a+b]=to_string(a)+" + "+to_string(b);
  (*m)[a-b]=to_string(a)+" - "+to_string(b);
  (*m)[a*b]=to_string(a)+" * "+to_string(b);
  (*m)[b-a]=to_string(b)+" - "+to_string(a);
}


void express3(long a,long b, long c, map<long,string>* m){
  map<long, string> m2;
  express2(b,c,&m2);
  for(auto iter=m2.begin();iter!=m2.end();iter++){
    auto key=iter->first;
    auto value=iter->second;
    (*m)[a+key]=to_string(a)+" + ("+value+")";
    (*m)[a-key]=to_string(a)+" - ("+value+")";
    (*m)[a*key]=to_string(a)+" * ("+value+")";
    (*m)[key-a]="("+value+") - "+to_string(a);
  }
}

void express4(long a, long b, long c, long d, map<long,string>* m){
  map<long, string> m3;
  express3(b,c,d,&m3);
  for(auto iter=m3.begin();iter!=m3.end();iter++){
    auto key=iter->first;
    auto value=iter->second;
    (*m)[a+key]=to_string(a)+" + ("+value+")";
    (*m)[a-key]=to_string(a)+" - ("+value+")";
    (*m)[a*key]=to_string(a)+" * ("+value+")";
    (*m)[key-a]="("+value+") - "+to_string(a);
  }

  map<long, string> m2a, m2b;
  express2(a,b,&m2a);
  express2(c,d,&m2b);
  for(auto iter1=m2a.begin();iter1!=m2a.end();iter1++){
    for(auto iter2=m2b.begin();iter2!=m2b.end();iter2++){
      auto key1=iter1->first;
      auto value1=iter1->second;
      auto key2=iter2->first;
      auto value2=iter2->second;
      (*m)[key1+key2]="("+value1+") + ("+value2+")";
      (*m)[key1-key2]="("+value1+") - ("+value2+")";
      (*m)[key1*key2]="("+value1+") * ("+value2+")";
      (*m)[key2-key1]="("+value2+") - ("+value1+")";
    }
  }
}



Measured memory_bytes: 3240
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <set>
#include <map>

typedef long long ll;

using namespace std;

int main() {
	int H, W;
	scanf("%d %d", &H, &W);
	char c[210][210];
	string str[210];
	
	for (int i = 1; i <= H; i++) {
		cin >> str[i];
	}

	string ans[210];

	
	for (int i = 1; i <= 2 * H; i++) {
		ans[i] = str[(i + 1) / 2];
	}
	for (int i = 1; i <= 2 * H; i++)
		cout << ans[i] << endl;
	


	
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static boolean solve() {
		String s = in.next();
		for (int i=0; i<s.length()/2; i++) {
			if (s.charAt(i) != s.charAt(s.length()-1-i)) return false;
		}
		return true;
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		int cnt = 0;

		while(in.hasNext()) if (solve()) cnt++;
		out.println(cnt);
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Measured memory_bytes: 26248
#!/usr/bin/env pypy
from __future__ import division, print_function

import os
import sys
from __builtin__ import xrange as range
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase

import __pypy__


def main():
    p, q, r = [int(s) for s in input().split()]
    if r >= p and r >= q:
        print(p + q)
    elif p >= r and p >= q:
        print(r + q)
    else:
        print(p + r)


# region fastio

BUFSIZE = 8192


class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 29676
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <vector>

using namespace std;

int main()
{
    int S, W;
    cin >> S >> W;
    if(S <= W)
    {
        cout << "unsafe" << endl;
    }
    else
    {
        cout << "safe" << endl;
    }
    

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main() {
    int a, b, ans;
    cin >> a >> b;
    int i = 1;
    while (i <= 1000) {
        
        if ((int)(i*0.08) == a && (int)(i*0.1) == b) {
            cout << i << endl;
            return 0;
        }
        i++;
    }
    cout << -1 << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

void solve()
{
    int n;
    vector<pll> v;
    cin >> n;
    v.resize(n);

    for (int i = 0; i < n; i++)
    {
        cin >> v[i].second >> v[i].first;
    }
    sort(v.begin(), v.end());
    ll curr = 0;
    bool good = true;
    for (pll out : v)
    {
        curr += out.second;
        good &= curr <= out.first;
    }
    if (good)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

    return 0;
}


Measured memory_bytes: 3456
/////////////////            In The Name Of Allah            ///////////////////

# include <bits/stdc++.h>

using namespace std;

# define pb push_back
# define printArr(a,n) for (int i = 1 ; i <= n ; i++) cout << a[i] <<" ";
# define getArr(a,n) for (int  i = 1 ; i <= n ; i++) cin >> a[i];
# define printVector(v) for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " ";
# define slark cerr << "slark" << endl; 
# define dagon cout << endl;
# define XX first
# define YY second

const int oo = 999999999;
const double PI = 3.1415931;
const double eps = 1e-8;

typedef long long ll;
typedef pair < int , int > pii;
typedef vector <int> vint;

const int maxN = 200000 + 10;
vint v[maxN];
int dis[maxN];

int main ()
{
    ios_base::sync_with_stdio(false);
    int n , m;
    cin >> n >> m;
    for (int i = 0 ; i < m ; i++){
    	int x , y;
    	cin >> x >> y;
    	v[x].pb(y);
    	v[y].pb(x);
    }
    memset(dis , -1 , sizeof dis);
    queue < int > q;
    q.push(1);
    dis[1] = 0;
    while (!q.empty()){
    	int now = q.front();
    	q.pop();
    	for (int i = 0 ; i < v[now].size() ; i++){
    		if (dis[v[now][i]] == -1)
    		{
    			dis[v[now][i]] = dis[now] + 1;
				q.push(v[now][i]);
    		}
    	}
    }
    if (dis[n] == 2){
    	cout << "POSSIBLE" << endl;
    }
    else{
    	cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 13168
import java.io.*;
import java.util.*;

/**
 * Created by Ayushi on 13 Sep 2020.
 * Problem:
 * Round:
 */

public class Main {
    public static void main(String[] args) throws IOException {
        StringTokenizer st;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        st = new StringTokenizer(br.readLine(), " ");
        long a = Integer.parseInt(st.nextToken());
        long b = Integer.parseInt(st.nextToken());
        long c = Integer.parseInt(st.nextToken());
        long d = Integer.parseInt(st.nextToken());
        br.close();

        long w = a * c;
        long x = a * d;
        long y = b * c;
        long z = b * d;

        System.out.println(Math.max(Math.max(w, x), Math.max(y, z)));
    }
}


Measured memory_bytes: 32668
#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main(void) {
  ll x, t;
  cin >> x >> t;

  cout << max(0LL, (x - t)) << endl;
  
  return 0;
}

Measured memory_bytes: 3604
#include <stdio.h>
int main()
{
  int H,W,i,j;
  while(1){
    scanf("%d%d",&H,&W);
    if(H==0 && W==0)break;
    else
      for(i=0;i<H;i++){
	if(i%2==0){
	  for(j=0;j<W;j++){
	    if(j%2==0)printf("#");
	    else printf(".");
	  }
	  printf("\n");
	}
	else {
	  for(j=0;j<W;j++){
	    if(j%2==0)printf(".");
	    else printf("#");
	  }
	  printf("\n");
	}
      }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl;}
vector<LL> make_divisors(LL n){vector<LL> divisors;for(int i = 1; i <= sqrt(n); i++) {if(n%i == 0){divisors.push_back(i);if(i != n/i){divisors.push_back(n / i);}}}return divisors;}
const LL MOD = 1e9 + 7;
const LL INF = 1LL << 60;

int main(void){
    string S;
    cin >> S;

    int section_num = 1;
    for (int i = 1; i < S.size(); i++)
    {
        if(S[i] != S[i-1]){
            section_num++;
        }
    }
    cout << section_num-1 << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long
struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
}IoSetup;

using Int = __int128_t;
using ll = long long;
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int SMOD = 1000000007;
constexpr int NMOD = 998244353;
constexpr int dx[]={1,0,-1,0,1,1,-1,-1};
constexpr int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T&b){if(a<b)return(a=b,1);return 0;}
template<class T>bool chmin(T &a, const T&b){if(b<a)return(a=b,1);return 0;}


signed main() {

    int n;
    cin >> n;
    vector<int> a(n);
    for(auto&&i:a) cin >> i;
    int64_t sum = 0;
    int mv = a[0];

    for(auto&&i:a) {
        sum += max(0, mv - i);
        chmax(mv, i);
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3900
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef long int li;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef pair<ll, ll>P;
#define PI 3.14159265359
#define MOD 998244353
const int MAX = 510000;

int main() {
  int N;cin>>N;
  map<ll,ll>C;
  rep(i,N){
  	ll a;cin>>a;
    C[a]++;
  }  
  ll ans=0;
 for (auto p :C) {
  auto key = p.first;
  auto value = p.second;
  if(key<=value){ans+=(value-key);}
  else{ans+=value;} 
 }
  cout<<ans;
}

Measured memory_bytes: 6272
/*---------------------------------

 @Author:   Dicer
 @DateTime: 2019-05-12 12:15:30

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
inline ll qpow(ll a,ll b,ll mod){ll res=1;while(b){if(b&1)res = (res*a)%mod;a=(a*a)%mod;b>>=1;}return res;}
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int MAXN = 2e5 + 7;

int main(int argc, char const *argv[])
{
	int n, x, mmax = 0, res = 0;
	cin >> n;
	for(int i = 1; i <= n; ++i){
		cin >> x;
		if(x >= mmax){
			res++;
			mmax = max(mmax, x);
		}
	}
	cout << res << endl;
	return 0;
}

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

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

  ll ans = n;
  rep(i, 0, n - 1) {
    if (s[i] != s[i + 1]) continue;
    ans--;
  }

  put(ans);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[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;
}

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 512
a,b,k = map(int,input().split())
L = []
for i in range(a,a+k) :
    
    if a <= i <= b :
        L.append(i)
for j in range(b-k+1,b+1) :
    
    if a <= j <= b :
        L.append(j)
L = list(set(L))
L = sorted(L)
for i in range(len(L)) :
    print(L[i])
    

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

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

	int count=0,r=0;

	for(int i=0;i<n;i++){
		if(r<a[i]){
			int x=a[i]-r;
			count+=x;	r+=x;
		}else if(r>=a[i]){
			r=a[i];
		}
	}

	cout<<count<<endl;

	return 0;
}


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

template <class T>
struct Edge {
    int from, to;
    T cost;
    Edge(int from = -1, int to = -1, T cost = 1) : from(from), to(to), cost(cost) {}

    bool operator<(const Edge<T>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<T>& e) const { return this->cost > e.cost; }
};

template <class T = int>
class Graph {
public:
    explicit Graph(int N = 0) : size(N) { path.resize(size); }
    void span(int u, int v, T cost = 1) { path[u].push_back(Edge<T>(u, v, cost)); }
    std::vector<Edge<T>> operator[](int v) const { return path[v]; }

    int size;
    std::vector<std::vector<Edge<T>>> path;
};

template <class T = int>
class Lowlink {
public:
    Graph<T> graph;
    int cur;
    std::vector<int> order, low;
    std::vector<int> artics;
    std::vector<Edge<T>> bridges;

    void dfs(int v, int r) {
        order[v] = low[v] = cur++;
        int deg = 0;
        bool is_artic = false;

        for (auto e : graph[v]) {
            if (order[e.to] < 0) {
                ++deg;
                dfs(e.to, e.from);
                low[e.from] = std::min(low[e.from], low[e.to]);

                if (order[e.from] <= low[e.to]) is_artic = true;
                if (order[e.from] < low[e.to]) bridges.push_back(e);
            } else if (e.to != r) {
                // eは後退辺 1回だけ遡る
                low[e.from] = std::min(low[e.from], order[e.to]);
            }
        }

        if (r < 0) is_artic = (deg > 1);
        if (is_artic) artics.push_back(v);
    }

    explicit Lowlink(const Graph<T> graph)
        : graph(graph), order(graph.size, -1), low(graph.size, graph.size) {
        cur = 0;
        for (int v = 0; v < graph.size; ++v) {
            if (order[v] < 0) dfs(v, -1);
        }
    }
};

int main() {
    int N, M;
    std::cin >> N >> M;
    Graph<> graph(N);
    for (int i = 0; i < M; ++i) {
        int u, v;
        std::cin >> u >> v;
        graph.span(u, v);
        graph.span(v, u);
    }

    Lowlink<> lowlink(graph);
    std::vector<std::pair<int, int>> ans;
    for (auto e : lowlink.bridges) {
        if (e.from > e.to) std::swap(e.from, e.to);
        ans.emplace_back(e.from, e.to);
    }

    std::sort(ans.begin(), ans.end());
    for (auto p : ans) {
        std::cout << p.first << " " << p.second << std::endl;
    }
    return 0;
}



Measured memory_bytes: 9628
#include <stdio.h>

int main(){
	
	int a,b,x,y;
	
	scanf("%d %d %d %d",&a,&b,&x,&y);
	
	printf("%d %d %d %d\n",x-y+b,x-a+y,a+b-y,b+x-a);
	
	return 0;
}


Measured memory_bytes: 128
d, n = map(int, input().split())

if d == 0 :
    if n == 100:
        n = 101
    print(n)
elif d == 1:
    if n == 100:
        n = 101
    print(n*100)
else:
    if n == 100:
        n = 101
    print(n*10000)

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INF 10000000000
#define mod 1000000007
#define X 1000000
typedef long long int ll;
ll finv[X];
ll fac[X];
ll inv[X];
ll u(const void *a, const void *b){return *(ll*)a-*(ll*)b;}
ll d(const void *a, const void *b){return *(ll*)b-*(ll*)a;}
ll z(ll a){
  if(a<0)return -a;
  return a;
}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll gcd(ll a,ll b){
  if(!b)return a;
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
ll nCr(int n,int k){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for (int i=2;i<X;i++){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
  return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
int main(void){
  int a,b,c;
  char s[2][5]={"win","bust"};
  scanf("%d %d %d",&a,&b,&c);
  PRS(s[a+b+c>21]);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define forr(i,n,a) for(ll i=n-1;i>=a;i--)
#define scan(arr,a,n) for(ll i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

const ll inf = 1e18;

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}


int main(){
	fast;
    #ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    #endif
	ll x, a;
	cin>>x>>a;
	if(x<a){
		cout<<0<<endl;
	} else {
		cout<<10<<endl;
	}
}

Measured memory_bytes: 3616
#include<stdio.h>
int main()
{
	long long int n, c;
	scanf("%lld %lld", &n, &c);
	long long int i;
	long long int x[100005], v[100005];
	for (i = 0; i < n; i++)
		scanf("%lld %lld", &x[i], &v[i]);
	long long int y[100005];
	for (i = 0; i < n; i++)
		y[n - i - 1] = c - x[n - i - 1];
	long long int sv1[100005], sv2[100005];
	sv1[0] = 0;
	for (i = 0; i < n; i++)
		sv1[i + 1] = sv1[i] + v[i];
	sv2[n] = 0;
	for (i = n - 1; i >= 0; i--)
		sv2[i] = sv2[i + 1] + v[i];
	long long int ans = 0;
	long long int max1[100005], max2[100005];
	max1[0] = 0;
	for (i = 0; i < n; i++)
	{
		if (max1[i] < sv1[i + 1] - x[i])
			max1[i + 1] = sv1[i + 1] - x[i];
		else
			max1[i + 1] = max1[i];
	}
	max2[n] = 0;
	for (i = n - 1; i >= 0; i--)
	{
		if (max2[i + 1] < sv2[i] - y[i])
			max2[i] = sv2[i] - y[i];
		else
			max2[i] = max2[i + 1];
	}
	if (ans < max1[n])ans = max1[n];
	if (ans < max2[0])ans = max2[0];
	for (i = 0; i < n; i++)
		if (ans < sv1[i + 1] - 2 * x[i] + max2[i + 1])
			ans = sv1[i + 1] - 2 * x[i] + max2[i + 1];
	for (i = 0; i < n; i++)
		if (ans < sv2[i] - 2 * y[i] + max1[i])
			ans = sv2[i] - 2 * y[i] + max1[i];
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 5632
n, m = map(int, input().split())
hhh = list(map(int, input().split()))
aabb = [list(map(int, input().split())) for _ in range(m)]
cnt = [0] * n
for i in range(m):
    if hhh[aabb[i][0] - 1] == hhh[aabb[i][1] - 1]:
        cnt[aabb[i][0] - 1] = -1
        cnt[aabb[i][1] - 1] = -1
    elif hhh[aabb[i][0] - 1] > hhh[aabb[i][1] - 1]:
        if cnt[aabb[i][0] - 1] >= 0:
            cnt[aabb[i][0] - 1] = 1
        cnt[aabb[i][1] - 1] = -1
    else:
        if cnt[aabb[i][1] - 1] >= 0:
            cnt[aabb[i][1] - 1] = 1
        cnt[aabb[i][0] - 1] = -1
print(cnt.count(0) + cnt.count(1))

Measured memory_bytes: 32044
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		int x = int.Parse(input[0]);
		int y = int.Parse(input[1]);
    int z = int.Parse(input[2]);
    int k = int.Parse(input[3]);
		long[] numsA = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long[] numsB = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long[] numsC = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long[] numAB = new long[x*y];
    int kk = Math.Min(k,x*y);
    long[] numABC = new long[kk*z];
    long[] answers = new long[k];

    for(int i = 0; i < x; i++)
    {
      for(int j = 0; j < y; j++)
      {
        numAB[x*j+i] =numsA[i]+numsB[j];
      }
    }
    Array.Sort(numAB);
    Array.Reverse(numAB);

    for(int i = 0; i < kk; i++)
    {
      for(int j = 0; j < z; j++)
      {
        numABC[kk*j+i] =numAB[i]+numsC[j];
      }
    }
    Array.Sort(numABC);
    Array.Reverse(numABC);
    for(int i = 0; i < k; i++)
    {
      answers[i] = numABC[i];
    }
    
    var answerText = new StringBuilder();
    for(long i = 0; i < answers.Length; i++)
    {
      answerText.AppendLine(answers[i].ToString());
    }
    Console.Write(answerText);
	}
}

Measured memory_bytes: 45016