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

struct  DICE {
    int Top;
    int Bottom;
    int Front;
    int Back;
    int Left;
    int Right;
};

int main() {
    DICE D;
    cin >>D.Top >>D.Front >>D.Right >>D.Left >>D.Back >>D.Bottom;
    string S;
    cin >>S;
    for (int i=0; i<S.size(); i++) {
        if ('N'==S.at(i)) {
            int a=D.Back;
            D.Back=D.Top;
            D.Top=D.Front;
            D.Front=D.Bottom;
            D.Bottom=a;
        } else if('S'==S.at(i)) {
            int a=D.Back;
            D.Back=D.Bottom;
            D.Bottom=D.Front;
            D.Front=D.Top;
            D.Top=a;
        } else if('W'==S.at(i)) {
            int a=D.Right;
            D.Right=D.Bottom;
            D.Bottom=D.Left;
            D.Left=D.Top;
            D.Top=a;
        } else {
            int a=D.Left;
            D.Left=D.Bottom;
            D.Bottom=D.Right;
            D.Right=D.Top;
            D.Top=a;
        }
    }
    cout <<D.Top <<endl;
    return 0;
}


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

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define pp pop_back()
#define ll long long
#define ld long double
#define ok puts("OK");
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

inline ll min(ll a, ll b) {
    return (a > b) ? b : a;
}

inline ll max(ll a, ll b) {
    return (a > b) ? a : b;
}

const int N = 1e5 + 7;
const int inf = 1e9 + 7;
const ll linf = 1e18 + 9;

int main() {
    string s; cin >> s;
    s.erase(s.rfind("FESTIVAL"));
    cout << s;
}


Measured memory_bytes: 256
import sys
import heapq
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

INF = 10**30
N, M = map(int, input().split())
G = [[]for i in range(N)]
for i in range(1, N):
    G[i].append([i-1, 0])

for i in range(M):
    L, R, C = map(int, input().split())
    G[L-1].append([R-1, C])

S = 0

def dijkstra(N, S):
    d = [INF for i in range(N)]

    que = []
    d[S] = 0
    heapq.heappush(que, [0, S])

    while not(len(que) == 0):
        q = heapq.heappop(que)
        ver = q[1] # ノード
        dis = q[0] # 過去に更新された最短距離

        # vまで2番目に短い距離（最新）　＜　過去最短距離　の時、
        # キューから取り出した過去のものを無視する
        if d[ver] < dis:
            continue

        # 隣接リストに対してループ
        for i in range(len(G[ver])):
            e = G[ver][i]
            if d[e[0]] > d[ver] + e[1]:
                d[e[0]] = d[ver] + e[1]
                heapq.heappush(que, [d[e[0]], e[0]])

    return d[N-1]

ans = dijkstra(N, S)
if ans == INF:
    print(-1)
else:
    print(ans)

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

int main() {
  int x,s1,s2,s3;
  
  cin >> x;

  s1 = x / 100;
  s2 = (x - s1 * 100) / 10;
  s3 = (x - s1*100 - s2*10);

  cout << s1 + s2 + s3 << endl;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 2e18;

typedef long long ll;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll a, b;
    cin >> a >> b;
    if(a == 1){
        a = INF;
    }
    if(b == 1){
        b = INF;
    }
    if(a > b){
        cout << "Alice";
    }
    else if(a == b){
        cout << "Draw";
    }
    else{
        cout << "Bob";
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define rep(i,l,n) for(i=l;i<n;i++)

char change(char n){
	if(n>='A' && n<='Z') return n+'a'-'A';
	else return n;
}


int main(void){
	char w[11];
	int i,len,ans=0;
	
	scanf("%s",w);
	
	
	while(1){
		char t[1001];
		scanf("%s",t);
		if(strcmp(t,"END_OF_TEXT")==0) break;
		
		len=strlen(t);
		
		rep(i,0,len){
			t[i]=change(t[i]);
		}
		
		
		if(strcmp(t,w)==0) ans++;
	}
	printf("%d\n",ans);
	
	return 0;
}



Measured memory_bytes: 2032
#include <bits/stdc++.h>
#define FIN         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FL          freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const double E = 1e-9;
//int dx[] = {1, 0}, dy[] = {0, 1};
//int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
//int dx[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy[] = {0 ,1, 1, 1, 0, -1, -1, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int v[N][3];
int dp[N][3];
int n;
int f(int i, int last){
    if(i == n)return 0;
    int &ans = dp[i][last];
    if(ans == -1){
        ans = 0;
        if(last == 0){
            ans = max(ans, f(i + 1, 1) + v[i][1]);
            ans = max(ans, f(i + 1, 2) + v[i][2]);
        }
        if(last == 1){
            ans = max(ans, f(i + 1, 0) + v[i][0]);
            ans = max(ans, f(i + 1, 2) + v[i][2]);
        }
        if(last == 2){
            ans = max(ans, f(i + 1, 0) + v[i][0]);
            ans = max(ans, f(i + 1, 1) + v[i][1]);
        }
        ans = max(ans, f(i + 1, last));
    }return ans;
}
int main(){
    //FL;
    FIN;
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> v[i][0] >> v[i][1] >> v[i][2];
    for(int i = n; i >= 0; i--){
        for(int last = 0; last < 3; last++){
            int &ans = dp[i][last];
            if(i == n){
                ans = 0;
                continue;
            }
            ans = max(ans, dp[i + 1][last]);
            if(last == 0){
                ans = max(ans, dp[i + 1][1] + v[i][1]);
                ans = max(ans, dp[i + 1][2] + v[i][2]);
            }
            if(last == 1){
                ans = max(ans, dp[i + 1][0] + v[i][0]);
                ans = max(ans, dp[i + 1][2] + v[i][2]);
            }
            if(last == 2){
                ans = max(ans, dp[i + 1][0] + v[i][0]);
                ans = max(ans ,dp[i + 1][1] + v[i][1]);
            }
        }
    }
    int ans = 0;
    fore(i, 0, 3)
        ans = max(ans, dp[0][i]);
    cout << ans << '\n';
    EjecuteTime;
    return 0;
}       

Measured memory_bytes: 6144
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>


using namespace std;


int main() {
	
	string a;
	cin >> a;
	string b = a.substr(0, 5),c=a.substr(6,7),d=a.substr(14,5);
	cout << b << " " << c << " " << d << 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++)
#define ll long long int

int main(){
  int N;
  cin>>N;
  int L[N];
  rep(i,N)
    cin>>L[i];
  sort(L,L+N);
  int count=0;
  rep(i,N-1)
    count+=L[i];
  if(count>L[N-1])
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}


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

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


Measured memory_bytes: 3008
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
B[0]+=A[0]
for i in range(1,N):
    A[i] += A[i-1]
    B[i]+=max(A[i],B[i-1])
print(B[N-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const long long  mod = 1000000007;



int main(){
  int n;
  cin >> n;
  vector<ll> a(n), acc(n+1);
  rep(i,n){
    cin >> a[i];
    acc[i+1] = acc[i] + a[i];
  }


  ll ans = 1e15;
  for(int i = 1; i < n;i++){
    ll x = acc[i];
    ll y = acc[n]-acc[i];
    ans = min(ans, abs(x-y));
  }
  cout << ans << endl;
}


Measured memory_bytes: 6360
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int ans;
  if (k <= a) {
	  ans = k;
	} else if (k <= a + b) {
	  ans = a;
	} else {
	  ans = a - (k - a - b);
	}
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {

	private void solve() {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int[] count = new int[100002];
		for (int i = 0; i < N; i++) {
			int num = in.nextInt();
			count[num] ++;
			count[num+1] ++;
			count[num+2] ++;
		}
		int max = -1;
		for (int i = 0; i < count.length; i++) {
			max = Math.max(max, count[i]);
		}
		System.out.println(max);
	}

	public static void main(String[] args) {
		new Main().solve();
	}
}

Measured memory_bytes: 50920
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {
	if (a > b) a = b;
}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {
	if (a < b) a = b;
}
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e18 + 1;

int test(int d) {
	int ans = 0;
	FOR(n, 1, 1e7) {
		string s = to_string(n);
		VREVERSE(s);
		int r = stol(s);
		if (r == n + d)ans++;
	}
	return ans;
}


ll f(ll A, ll t, int fir) {
	if (t == 0)return A == 0;
	int v = (A % 10 + 10) % 10;//Aの1の位

	ll ret = 0;
	//+ 0...v
	ret += (10 - v - fir)*f((A - t * v) / 10, t / 100, 0);
	//- v...9
	ret += (v - fir)*f((A + (10 - v)*t) / 10, t / 100, 0);
	return ret;
}

void solve() {
	ll D; cin >> D;
	if (D % 9) { print(0); return; }

	D /= 9;
	ll ret = 0;
	ll p10 = 10;
	FOR(i, 2, 19) {
		p10 *= 10;
		ll tot = (i % 2) ? 10 : 1;//桁数が奇数なら真ん中は何でも良いので×10
		ret += tot * f(D, p10 / 10 / 9, 1);
	}
	print(ret);
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	mt.seed((int)(time(0)));
	//int q;
	//cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ld long double
#define lli long long int
#define vi vector<int>
#define vlli vector<lli>
#define vvi vector<vi >
#define str string
#define vs vector<str>
#define vb vector<bool>
#define slli set<lli>
#define mii map<int, int>
#define mlli map<int, lli>
#define msi map<str, int>
#define mp make_pair
#define pii pair<int, int>
#define pll pair<lli, lli>
#define vpii vector<pii >
#define vpll vector<pll >
#define pb push_back
#define loop(i, s, l, j) for(int i = s; i < l; i += j)
#define rloop(i, s, l, j) for(int i = s; i >= l; i -= j)
#define rep(i, n) loop(i,0,n,1)
#define rrep(i, n) rloop(i,n-1,0,1) 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ft first
#define sd second   
#define mit mii::iterator
#define vit vi::iterator
#define all(a) a.begin(),a.end()
#define min3(a, b, c) min(a, min(b, c))
#define mod 1000000007
#define inf 100000000000000000
#define limit 200005
#define minval -100000000000000000
/**********************************************************************************************************************************************/
int dx4[4] = {0, -1, 0, 1};
int dy4[4] = {1, 0, -1, 0};
int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int Power(int base,int exp){int ans=1;  while(exp > 0){if(exp&1)ans=(1LL*ans*base)%mod; exp=exp>>1; base=(1LL*base*base)%mod;}  return ans;}
/**********************************************************************************************************************************************/ 

void input()
{
	int n;
	cin >> n;
	vi a(n);
	vi b(n);
	rep(i,n)
		cin >> a[i];
	rep(i,n)
		cin >> b[i];
	reverse(all(b));

	bool ok = 1;

	rep(i,n)
		if(a[i] == b[i])
		{
			ok = 0;
			break;
		}

	if(ok)
	{
		cout << "Yes\n";
		rep(i,n)
			cout << b[i] << ' ';
		cout << '\n';
		return;
	}


	int i1 = 0, i2 = 0;
	rep(i,n)
		if(a[i] == b[i])
		{
			i1 = i;
			break;
		}
	rep(i,n)
		if(a[i] == b[i])
			i2 = i;

	vi id;
	rep(i,n)
		if(b[i] != b[i1] && a[i] != b[i1])
			id.pb(i);

	if((int)id.size() == 0)
	{
		cout << "No\n";
		return;
	}

	int j = 0;
	loop(i,i1,i2+1,1)
	{
		swap(b[id[j]], b[i]);
		j++;
		if(j == (int)id.size())
			break;
	}


	rep(i,n)
		if(a[i] == b[i])
		{
			cout << "No\n";
			return;
		}
	cout << "Yes\n";
	rep(i,n)
		cout << b[i] << ' ';
	cout << '\n';


}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
 
    fastio();
    int q = 1;
    //cin >> q;
    while(q--)
        input();
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;

	vector<int> boxsize(n + 1);
	vector<bool> redbox(n + 1);
	redbox[1] = true;
	fill(boxsize.begin(), boxsize.end(), 1);

	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		if (redbox[x]) redbox[y] = true;
		boxsize[x]--;
		boxsize[y]++;
		if (boxsize[x] == 0) redbox[x] = false;
	}

	int count = 0;
	for (auto p : redbox) {
		if (p) count++;
	}
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;

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

    vector<int> a(n);

    long double sum = 0;
    REP(i, n) {
        long double a;
        cin >> a;
        sum += 1 / a;
    }

    cout << 1 / sum << endl;
}


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

const int mod = 1000000007;

int dp[3010][2];
int ndp[3010][2];

void add(int &x, int y) {
	x += y;
	if (x >= mod) x -= mod;
}

int main () {
	int n, m; cin >> n >> m;
	for (int i = 0; i <= n; i++) {
		dp[i][i == 0] = 1;
	}
	for (int i = 0; i < m; i++) {
		memset(ndp, 0, sizeof(ndp));
		for (int j = 0; j <= n; j++) {
			for (int p = 0; p < 2; p++) {
				if (!dp[j][p]) continue;
				if (j) add(ndp[j][p | (j == 1)], dp[j][p]);
				if (j) add(ndp[j - 1][p | (j == 1)], dp[j][p]);
				if (j < n) add(ndp[j][p], dp[j][p]);
				if (j < n) add(ndp[j + 1][p], dp[j][p]);
			}
		}
		swap(ndp, dp);
	}
	int ans = 0;
	for (int i = 0; i <= n; i++) {
		add(ans, dp[i][1]);
	}
	printf("%d\n", ans);
	return 0;
}


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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int R;
    cin >> R;
    if(R < 1200) cout << "ABC" << endl;
    else if(R < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
}

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

int main() {
  int n,ans = 1e5;
  cin >> n;
  rep(i,1,n){
    int a = i,b = n-i,sum = 0;
    string aa = to_string(a),bb = to_string(b);
    rep(j,0,aa.size()) sum += aa[j]-'0';
    rep(j,0,bb.size()) sum += bb[j]-'0';
    ans = min(ans,sum);
  }
  cout << ans << endl;
}

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

int main() {
	long N, K;
	long ans = 0;
	cin >> N >> K;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N; j++) {
			long r = K - (i + j);
			if (0 <= r && r <= N) {
				++ans;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
from itertools import accumulate
N = int(input())
L, R = [0], [0]
for i in range(N):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)

L.sort(reverse=True)
R.sort()

L = list(accumulate(L))
R = list(accumulate(R))

ans = 0
for i in range(N):
    ans = max(ans, 2*(L[i] - R[i]))

print(ans)


Measured memory_bytes: 69336
Var n,k,r,s,p,i,sum:Longint;
    t:Ansistring;
    a:Array[1 .. 200000] of Boolean;
Begin
    Fillchar(a,sizeof(a),True);
    Readln(n,k);
    Readln(r,s,p);
    Readln(t);
    For i:=1 to n do begin
        If a[i] then begin
            If t[i]='p' then sum:=sum+s
            Else if t[i]='r' then sum:=sum+p
            Else sum:=sum+r;
        End;
        If (t[i]=t[i+k]) and (a[i]) then a[i+k]:=false;
    End;
    Writeln(sum);
End.

Measured memory_bytes: 384
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::vec::Vec;
use std::{vec, cmp, num};


struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner {cin: cin}
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

// create Vec<char> from String
#[allow(dead_code)]
fn to_chars(s: String) -> vec::Vec<char> {
    let mut cs = s.chars();
    let mut res = vec::Vec::new();
    while let Some(c) = cs.next() {
        res.push(c);
    }
    res
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let x: i32 = sc.read();
    let t: i32 = sc.read();
    println!("{}", cmp::max(0, x - t));
}

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

#define M_PI 3.141592653589793

int main(void) {

	int i = 0, j, k, l;
	int H[10000], W[10000];

	while (1) {
		scanf("%d %d", &H[i], &W[i]);
		if (H[i] == 0 && W[i] == 0) {
			break;
		}
		else {
			i++;
		}
	}

	for (l = 0; l < i; l++) {
		for (j = 0; j < H[l]; j++) {
			for (k = 0; k < W[l]; k++) {
				if (k == 0 || k == W[l] - 1 || j == 0 || j == H[l] - 1) {
					printf("#");
				}
				else {
					printf(".");
				}
			}printf("\n");
		}printf("\n");
	}

	return 0;
}

Measured memory_bytes: 2560
from collections import defaultdict

A = [list(map(int, input().split())) for _ in range(3)]
d = defaultdict(int)

for i in range(3):
    for j in range(3):
        d[A[i][j]] = (i, j)
        
N = int(input())
flag = [[False]*3 for _ in range(3)]

for _ in range(N):
    b = int(input())
    if b in d:
        x, y = d[b]
        flag[x][y] = True

ans = False

for i in range(3):
    if flag[i][0] and flag[i][1] and flag[i][2]:
        ans = True
    
for i in range(3):
    if flag[0][i] and flag[1][i] and flag[2][i]:
        ans = True
    
if flag[0][0] and flag[1][1] and flag[2][2]:
    ans = True

if flag[0][2] and flag[1][1] and flag[2][0]:
    ans = True
    
if ans:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38384
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    return

#B
def B():
    return

#C
def C():
    s = input()
    k = I()
    l = []
    n = len(s)
    alp = list("abcdefghijklmnopqrstuvwxyz")
    for i in alp:
        for j in range(n):
            if s[j] == i:
                l.append(s[j])
                for m in range(j+1,min(j+k,n)):
                    l.append(s[j:m+1])
        l = sorted(list(set(l)))
        if len(l) >= k:break
    print(l[k-1])
#D
def D():
    def root(x):
        if par[x] == x:
            return x
        par[x] = root(par[x])
        return par[x]

    def same(x,y):
        return root(x) == root(y)

    def unite(x,y):
        x = root(x)
        y = root(y)
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1

    n,m = LI()
    p = LI()
    for i in range(n):
        p[i] -= 1
    par = [i for i in range(n)]
    rank = [0 for i in range(n)]
    for i in range(m):
        x,y = LI()
        if not same(x-1,y-1):
            unite(x-1,y-1)
    for i in range(n):
        root(i)
    g = [[] for i in range(max(par)+1)]
    for i in range(n):
        g[par[i]].append(i)
        g[par[i]].append(p[i])
    ans = 0
    for i in g:
        i.sort()
        d = defaultdict(int)
        for j in i:
            d[j] += 1
            if d[j] == 2:
                ans += 1
    print(ans)
#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    D()


Measured memory_bytes: 110316
from math import log, ceil

N, K = map(int, input().split())

ans = 0
mul2 = 2 ** ceil(max(log(K / N, 2), 0))
sum2 = 2 ** (ceil(log(K, 2)) - ceil(max(log(K / N, 2), 0)))

for i in range(N, 0, -1):
    if i * mul2 < K:
        mul2 *= 2
        sum2 //= 2
    ans += sum2

print(ans / (N * 2 ** ceil(log(K, 2))))


Measured memory_bytes: 3188
import bisect

N = int(input())
S = sorted(tuple(map(int, input().split(' '))))
Q = int(input())
T = tuple(map(int, input().split(' ')))

c = 0
for t in T:
    index = bisect.bisect_left(S, t)
    if index < N and S[index] == t:
        c += 1

print(c)



Measured memory_bytes: 16968
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    int n,d; cin >> n >> d;
    double a = 0;
    int ans = 0;
    
    a = (double)n/(2*d+1);
    ans = ceil(a);

    cout << ans << ln;
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    REP(i, n){
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
    }
    sort(s.begin(), s.end());

    ll ans = 0;
    FOR(i, 0, n){
        int j = i;
        while(j < n && s[i] == s[j])
            j++;
        ans += (ll)(j-i) * (j-i-1) / 2;
        i = j - 1;
    }
    cout << ans << endl;
    return 0;
}

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

using ll = long long; 
using P = pair<int,int>;

int main() {

  int N;
  cin >> N;

  int ans = 0;
  int c;
  int count = 0;
  rep(i,N+1) {
    c = i;
    count = 0;
    while(c){
      count++;
      c = c/10;
    }
    if (count%2 == 1){
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}



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

using namespace std;

bitset<4000000> arr;
int start = 0;
int flip = 0;

int main(){
	ios_base::sync_with_stdio(false);
	int n, k; cin >> n >> k;
	string s; cin >> s;
	for(int i = 0;i < n;i++) arr[i] = (s[i] == 'B');
	
	while(k > 0){
		if(arr[start] ^ flip){
			flip ^= 1;
			arr[start + n] = flip;
			start++;
		}
		else arr[start] = (1 ^ flip);
		k--;
		if(start >= n+2) break;
	}
	
	if(n&k&1) arr[start] = arr[start] ^ 1;
	
	for(int i = start;i < start + n;i++) cout << (char) ('A' + (arr[i] ^ flip));
}


Measured memory_bytes: 792
#include <stdio.h>

int gcd(int x, int y) {

	if (y == 0) return x;
	if (x >= y) return gcd(y, x % y);
	else return gcd(x, y % x);
}

int main() {
	int x, y;
	scanf("%d %d", &x, &y);
	printf("%d\n", gcd(x, y));
}

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

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

    long long int M = 3.0*N;
    long long int a[M];
    for (int i = 0; i < M; i++){
        cin >> a[i];
    }
    
    sort(a, a + M, greater<long long int>());
    for (int i = 0; i < M; i++){
    }

    long long int ans = 0;
    for (long int i = 0; i <= 2*N; i++){
        if (i % 2 == 1){
            ans += a[i];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d,e,f,g,h,i;
	cin>>a>>b>>c>>d>>e>>f>>g>>h>>i;
	bool ff=true;
	int sum=a+e+i;
	int allsum=a+b+c+d+e+f+g+h+i;
	if(allsum!=sum*3)
		ff=false;
	if(ff)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
 } 

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;

const int N=1e6+10;
ll a[N];
int sum[11];
main(){
    ios
    int h,w,n;cin>>h>>w>>n;
    h-=2,w-=2;
    int x,y;
    int cnt=0;
    ll m=(ll)h*w;
    rep(iii,n){
        cin>>x>>y;
        rep(i,3)if( x-i>=1 && x-i<=h){
            rep(j,3)if(y-j>=1 && y-j<=w){
            a[cnt++]=((ll)(x-i)<<32)+(y-j);
            }
        }
    }
    sort(a,a+cnt);
    ll t=1;
    rep(i,cnt){
        if(a[i]==a[i+1])t++;
        else sum[t]++,t=1,m--;
    }
    cout<<m<<" ";
    rep2(i,1,9)cout<<sum[i]<<" ";
}



Measured memory_bytes: 7296
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1000000000
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int m, k;

signed main() {
	cin >> m >> k;
	if ((1 << m) - 1 < k || (m == 1 && k == 1)) {
		cout << -1 << endl;
		return 0;
	}
	if (k == 0) {
		for (int i = 0; i < (1 << m); i++)cout << i << " " << i << " ";
		cout << endl;
		return 0;
	}
	cout << 0 << " " << k << " " << 0 << " ";
	for (int i = 1; i < (1 << m); i++) {
		if (i != k)cout << i << " ";
	}
	cout << k << " ";
	for (int i = (1 << m) - 1; i > 0; i--) {
		if (i != k)cout << i << " ";
	}
	cout << endl;
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)

static const ll INF = 1e18;
static const ll mod = 1e9+7;

template<typename T>
static inline void chmin(T& ref, const T  value) {
    if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T& ref, const T value) {
    if (ref < value) ref = value;
}

template<typename T>
struct TriSearch {
	T solve(T left, T right, function<T(T)> pred, function<bool(T, T)> condition) {
		while (condition(left, right))
		{
			T lmid = (left * 2 + right) / 3;
			T rmid = (left + right * 2) / 3;
			T L = pred(lmid);
			T R = pred(rmid);
			if (L > R) left = lmid;
			else right = rmid;
		}
		return right;

	}
};

int main() {
	ll n;
	cin >> n;
	vector<ll> vs(n);
	ll sum = 0;
	rep(i, n) {
		cin >> vs[i];
		vs[i]-=(i+1);
		sum += vs[i];
	}
	TriSearch<ll> se;
	ll lower = INF;
	ll count = 0;
	ll ans = se.solve(-1e10, 1e10, [&](ll v) {		
		ll s = 0;
		rep(i, n) {
			s += abs(v - vs[i]);
		}
		chmin(lower, s);
		return s;
	}, [&](ll l, ll r) {
		count++;
		return count < 300;
		});
	cout << lower << endl;
	return 0;
}


Measured memory_bytes: 4856
n,k = map(int,input().split())
a = list(map(int,input().split()))
l = [1]
al = [0 for i in range(n+1)]
al[1] = 1
now = 1
for i in range(n):
    nex = a[now-1]
    if al[nex] == 0:
        l.append(nex)
        now = nex
        al[nex] += 1
        if i == n-1:
            goal = nex
    else:
        goal = nex
        break
key = 0
count = 0
roop = []
mae = []
for i in l:
    if key == 0:
        if goal == i:
            key = 1
            roop.append(i)
        else:
            mae.append(i)
            count += 1
    else:
        roop.append(i)
#print(roop,count,mae)
if count > k:
    print(mae[k])
else:
    k -= count
    rp = len(roop)
    k %= rp
    print(roop[k])

Measured memory_bytes: 32228
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep_1(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define rep_2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main()
{
  int n;
  double m;
  cin >> n >> m;
  vector<int> a(n);
  double sum = 0;
  ll count = 0;
  rep(i,n){
    cin >> a[i];
    sum += a[i];
  }
  double check = sum * 1/(4 * m);
  rep(i,n) {
    if(a[i] >= check) count++;
  }

  if(count >= m) cout <<"Yes" <<endl;
  else cout <<"No" <<endl;
  return 0;
}

Measured memory_bytes: 256
a, b = map(int, input().split())
s = list(input())
num = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]
cnt = 0
if s[a] != "-":
  print("No")
  exit()
else:
  s.pop(a)
for i in s:
  for j in num:
    if i == j:
      cnt += 1
if cnt != len(s):
  print("No")
  exit()
print("Yes")

Measured memory_bytes: 3064
import sys
# gcd
from fractions import gcd
# 切り上げ，切り捨て
# from math import ceil, floor
# リストの真のコピー（変更が伝播しない）
# from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l)  # カウンタークラスが作られる。S=Counter({'b': 5, 'c': 4, 'a': 3})
# print(S.most_common(2))  # [('b', 5), ('c', 4)]
# print(S.keys())  # dict_keys(['a', 'b', 'c'])
# print(S.values())  # dict_values([3, 5, 4])
# print(S.items())  # dict_items([('a', 3), ('b', 5), ('c', 4)])
# from collections import Counter
# import math
# from functools import reduce
#
# input関係の定義
# fin = open('in_3.txt', 'r')
# sys.stdin = fin
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template

YES = "Yes"  # type: str
NO = "No"  # type: str

def iterate_tokens():
    for line in sys.stdin:
        for word in line.split():
            yield word


if __name__ == '__main__':

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    S = list(next(tokens))  # type: str

    # write code
    dblock = set()
    for i in range(A,max(C,D)-1):
        if S[i] == '#' and S[i + 1] == '#':
            dblock.add(i+1)
    # print(dblock)
    if D > C:
        if dblock == set():
            print(YES)
        else:
            print(NO)
    else:
        if dblock == set():
            for i in range(B - 2, D - 1):
                if S[i] == '.' and S[i + 1] == '.' and S[i + 2] == '.':
                    print(YES)
                    sys.exit()
                else:
                    continue
            else:
                print(NO)
        else:
            print(NO)

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


int main(){
  int N;
  cin >> N;
  map<int,int> mp;
  REP(i,N){
    int a;
    cin >> a;
    mp[a]++;
  }
  int ans=0;
  for(auto &v: mp){
    if(v.second-v.first>0){
      ans += v.second-v.first;
    }else if(v.second-v.first<0){
      ans += v.second;
    }
  }
  cout << ans << endl;
}



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

using namespace std;

int main(){
  string s;
  cin >> s;
  
  bool is9ine = false;
  
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '9') is9ine = true;
  }
  
  if(is9ine) cout << "Yes";
  else cout << "No";

}


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
M = 0
b = [0]*N
B = []
for i in range(N, 0, -1):
    wa = sum(b[i-1::i])
    if wa%2 != a[i-1]:
        M+=1
        b[i-1] = 1
        B.append(i)
print(M)
if M!=0:
    print(*B)

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;




int main() {
	
	double w, h, x, y;
	cin >> w >> h >> x >> y;

	if (2 * x == w && 2 * y == h) {
		cout << fixed << setprecision(15) << w * h / 2 << ' ';
		cout << 1 << endl;
	}
	else {
		cout << fixed << setprecision(15) << w * h / 2 << ' ';
		cout << 0 << endl;
	}

}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  auto f = [](int v) {
    return (v + 9) / 10 * 10;
  };
  int g = f(a) + f(b) + f(c) + f(d) + f(e);
  int r = g;
  chmin(r, g - f(a) + a);
  chmin(r, g - f(b) + b);
  chmin(r, g - f(c) + c);
  chmin(r, g - f(d) + d);
  chmin(r, g - f(e) + e);
  cout << r;
}
#endif


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

using ll = long long;
const ll INF = 1LL << 50;

int main(void){
    int N, M;
    cin >> N >> M;
    const int NMAX = 1000;
    const int MMAX = 2000;
    int a[MMAX], b[MMAX];
    ll c[MMAX];

    for (int i = 0; i < M; ++i) {
        cin >> a[i] >> b[i] >> c[i];
        c[i] = -c[i];
    }

    ll dist[NMAX];

    for (int i = 0; i < N; ++i) {
        dist[i] = INF;
    }

    dist[0] = 0;
    for (int loop = 0; loop < N - 1; ++ loop) {
        for (int i = 0; i < M; ++i) {
            if (dist[a[i] - 1] == INF) continue;
            if (dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
                dist[b[i] - 1] = dist[a[i] - 1] + c[i];
            }
        }
    }

    ll ans = dist[N - 1];
    bool negative[NMAX];

    for (int i = 0; i < N; ++i) {
        negative[i] = false;
    }

    for (int loop = 0; loop < N ; ++ loop) {
        for (int i = 0; i < M; ++i) {
            if (dist[a[i] - 1] == INF) continue;
            if (dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
                dist[b[i] - 1] = dist[a[i] - 1] + c[i];
                negative[b[i] - 1] = true;
            }
            if (negative[a[i] - 1] == true) {
                negative[b[i] - 1] = true;
            }
        }
    }
    if (negative[N - 1]) {
        cout << "inf" << endl;
    }
    else {
        cout << -ans << endl;
    }

    return 0;
}


Measured memory_bytes: 888
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

ll Pow(ll A, ll B, ll mod){
  if (B == 0) return 1;
  else{
    if (B % 2 == 0){
      return Pow(A * A % mod, B / 2, mod) % mod;
    }else{
      return A * Pow(A * A % mod, B / 2, mod) % mod;
    }
  }
}

ll nCr(ll N, ll C, ll mod){
  ll ans = 1; C = min(C, N - C);
  for (ll i = 1; i <= C; i++){
    ans *= N - i + 1; ans %= mod;
    ans *= Pow(i, mod - 2, mod); ans %= mod;
  }
  return ans;
}

int main(){
  string S; cin >> S;
  for (int i = 0; i < S.length(); i++) cout << 'x';
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
def resolve():
    from collections import deque
    k = int(input())
    a = [1,2,3,4,5,6,7,8,9]
    a = deque(a)
    c = 0
    if k < 10:
        print(k)
    else:
        while c != k:
            c += 1
            t = a.popleft()
            if t % 10 == 0:
                a.append(t*10)
                a.append(t*10+1)
            elif t % 10 == 9:
                a.append(t * 10 + 8)
                a.append(t * 10 + 9)
            else:
                a.append(t * 10 + (t%10)-1)
                a.append(t * 10 + (t%10))
                a.append(t * 10 + (t%10)+1)
        print(t)
resolve()

Measured memory_bytes: 11932
package main

import (
	"fmt"
)

func main() {
	var a, b, c, x int

	// 500円玉 A枚
	// 100円玉 B枚
	//  50円玉 C枚
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	fmt.Scan(&x)

	var ans = 0

	for i := 0; i <= a; i++ {
		for j := 0; j <= b; j++ {
			for k := 0; k <= c; k++ {
				if i*500+j*100+k*50 == x {
					ans++
				}
			}
		}
	}
	fmt.Printf("%v\n", ans)
}


Measured memory_bytes: 512
import java.util.*;
import static java.lang.System.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		while (sc.hasNext()) {
			int arrive = 0;
			for (int i=0; i<3; i++) {
				if (i==0) arrive += sc.nextInt()*3600;
				else if (i==1) arrive += sc.nextInt()*60;
				else if (i==2) arrive += sc.nextInt();
			}
			int leave = 0;
			for (int i=0; i<3; i++) {
				if (i==0) leave += sc.nextInt()*3600;
				else if (i==1) leave += sc.nextInt()*60;
				else if (i==2) leave += sc.nextInt();
			}
			
			int time = leave - arrive;
			int h = time/3600;
			time %= 3600;
			int m = time/60;
			time %= 60;
			int s = time;
			
			out.println(h+" "+m+" "+s);
		}
	}
}


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

int main() {
    int n, k;
    cin >> n >> k;
    vector<ll> h(n);
    rep(i, n) cin >> h[i];

    sort(h.rbegin(), h.rend());

    ll ans = 0;
    for (int i = k; i < n; i++) ans += h[i];
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int N = 1e5+10;
int a[N];
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    cout << c <<' '<< a<<' ' << b <<'\n';





    return 0;
}

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

using namespace std;

string s, temp;

void change(char &ch);

int main(void)
{
	cin >> s;
	temp = s;
	reverse(s.begin(), s.end());
	for (int i = 0; i < s.size(); i++)
		change(s[i]);
	if (s == temp)
		cout << "Yes";
	else
		cout << "No";
	cout << endl;
	//system("pause");
	return 0;
}

void change(char &ch)
{
	if (ch == 'b')
		ch = 'd';
	else if (ch == 'd')
		ch = 'b';
	else if (ch == 'p')
		ch = 'q';
	else if (ch == 'q')
		ch = 'p';
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int64 long long int
#define all(x) (x).begin(),(x).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

    int result=0;
	result=(N+1)/2;
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int N;cin>>N;
  int a=0,sum=0;
  while(sum<N){
    a++;
    sum+=a;
  }
  vector<int> ans;
  while(N){
    if(N-a>=0){
      ans.pb(a);
      N-=a;
    }
    a--;
  }
  sort(ALL(ans));
  each(a,ans){
    print(a);
  }
  


}


Measured memory_bytes: 384