akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
const long long mod = 998244353;
const int maxN = 300001;
int kj[300005], kji[300005];

void setkj() {
	kj[0] = 1;
	kji[0] = kji[1] = 1;
	for (int i = 1; i <= maxN; i++)kj[i] = kj[i - 1] * i%mod;
	for (int i = 2; i <= maxN; i++)kji[i] = mod - (kji[mod%i] * (mod / i)) % mod;
	for (int i = 2; i <= maxN; i++)kji[i] = kji[i] * kji[i - 1] % mod;
}
int comb(int r, int c) {
	if (r < c)return 0;
	return kj[r] * kji[c] % mod*kji[r - c] % mod;
}

signed main() {
	setkj();
	int n, a, b, k; cin >> n >> a >> b >> k;
	int ans = 0;

	for (int i = 0; i <= n; i++) {
		int j = k - a*i;
		if (j >= 0 && j%b == 0) {
			ans += comb(n, i)*comb(n, j/b) % mod;
			ans %= mod;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 4992
import fractions
N = int(input())
A = list(map(int,input().split(' ')))

gcd_L = [0]
gcd_R = [0]
for i in range(N):
    gcd_L.append(fractions.gcd(gcd_L[i], A[i]))
    gcd_R.append(fractions.gcd(gcd_R[i], A[-(i+1)]))
gcd_R = gcd_R[::-1]

x = []
for i in range(N):
    x.append(fractions.gcd(gcd_L[i], gcd_R[i+1]))
print(max(x))

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




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

   int maxL = 0;
   int minR = N-1;
   for (int i = 0; i < M;i++) {
      int l,r;
      cin>>l>>r;
      maxL = max(maxL,l-1);
      minR = min(minR,r-1);
   }
   if (maxL<= minR) cout<<minR-maxL+1<<endl;
   else cout<<0<<endl;
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	int r;
	cin >> r ;
	if (r<1200)
	cout << "ABC";
	else 
		if (r< 2800)
		cout << "ARC";
		else
		cout << "AGC";
	
	return 0;
}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int n) {
    // n! を素因数分解
    int[int] factors;
    for (int i = 2; i <= n; i++) {
        int x = i;
        for (int j = 2; j * j <= x; j++) {
            while (x % j == 0) {
                factors[j]++;
                x /= j;
            }
        }
        if (x > 1) factors[x]++;
    }
    // if (factors.empty) return 0;
    // v2.070.1 だと empty でコンパイルエラーになるので、代わりに length 使う
    if (factors.length == 0) return 0;

    int[] t; // p_i^k の k の部分
    foreach (k, v; factors) t ~= v;

    // do[i][約数の個数]
    auto dp = new int[][](t.length, 76);
    for (int i = 0; i <= t[0]; i++)
        dp[0][i + 1] = 1;

    for (int i = 1; i < t.length; i++) {
        for (int j = 1; j <= 75; j++) { // i-1 までの約数の個数
            for (int k = 0; k <= t[i]; k++) {
                int x = j * (k + 1);
                if (x <= 75) {
                    dp[i][x] += dp[i - 1][j];
                }
            }
        }
    }

    return dp[t.length - 1][75];
}

void main() {
    int n = readint;
    writeln(calc(n));
}


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

int main(){
  long long a, b, x;
  cin >> a >> b >> x;
  if(a==0){
    cout << b/x+1 << endl;
    return 0;
  }
  cout << b/x-(a-1)/x<< endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  int n;
  int data[4][100005];
  int dp[4][100005];
  int ans;
  cin >> n;
  for(int i=1; i<=n; i++){
    for(int j=1; j<=3; j++){
      cin >> data[j][i];
    }
  }

  dp[1][1] = data[1][1];
  dp[2][1] = data[2][1];
  dp[3][1] = data[3][1];

  for(int i=2; i<=n; i++){
    dp[1][i] = max(dp[2][i-1],dp[3][i-1]) + data[1][i];
    dp[2][i] = max(dp[1][i-1],dp[3][i-1]) + data[2][i];
    dp[3][i] = max(dp[2][i-1],dp[1][i-1]) + data[3][i];
  }

  ans = max(dp[1][n] , dp[2][n]);
  cout << max(ans , dp[3][n]) << endl;
  return 0;
}


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

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> l(N);
    for (int i = 0; i < N; i++) cin >> l[i];
    sort(l.begin(), l.end());
    reverse(l.begin(), l.end());
    int ans = 0;
    for (int i = 0; i < K; i++) {
        ans += l[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
//using ll=long long;
static const int MAX = 100000;
static const int INF = 1 << 30;
int n;

class Edge {
public:
	int t, w;
	Edge(int t, int w) :t(t), w(w) {}
};

vector<Edge> G[MAX];
int d[MAX];

//bool vis[MAX];
//xint cnt;

void bfs(int s) {
	fill(d, d + n, INF);
	d[s] = 0;
	queue<int> q;
	q.push(s);
	while (not q.empty()) {
		int u = q.front(); q.pop();
		for (int i = 0; i < G[u].size(); i++) {
			Edge ed = G[u][i];
			if (d[ed.t] == INF) {
				d[ed.t] = d[u] + ed.w;
				q.push(ed.t);
			}
		}
	}
}

void solve(){
	bfs(0);
	int maxv=-1, maxi;
	for (int i = 0; i < n; i++) {
		if (maxv < d[i]) {
			maxv = d[i];
			maxi = i;
		}
	}
	bfs(maxi);
	maxv = -1;
	for (int i = 0; i < n; i++) {
		maxv = max(maxv, d[i]);
	}
	cout << maxv << endl;
}

int main() {
	int s, t, w;
	cin >> n;
	for (int i = 0; i < n-1; i++) {
		cin >> s >> t >> w;
		G[s].push_back(Edge(t, w));
		G[t].push_back(Edge(s, w));
	}
	solve();
}

Measured memory_bytes: 9896
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int a[]=new int[n];
		for(int i=1;i<n+1;i++) {
			a[i-1]=sc.nextInt()-i;
		}
		Arrays.sort(a);

		int chuuou0=a[n/2];
		long summary0=0;
		for(int i=0;i<n;i++) {
			summary0+=zettaichi(a[i]-chuuou0);
		}
		if(n>=2) {
			int chuuou1=a[n/2+1];
			long summary1=0;

			for(int i=0;i<n;i++) {
				summary1+=zettaichi(a[i]-chuuou1);
			}
			if(summary0>summary1) {
				summary0=summary1;
			}
		}
		if(n>=3) {
			int chuuou2=a[n/2+1];
			long summary2=0;

			for(int i=0;i<n;i++) {
				summary2+=zettaichi(a[i]-chuuou2);
			}
			if(summary0>summary2) {
				summary0=summary2;
			}
		}

		System.out.print(summary0);


	}



	public static int zettaichi(int a) {
		if(a>=0)
			return a;
		else
			return -a;
	}


}


Measured memory_bytes: 88816
#include<iostream>
#include<queue>
const int MAX_H = 1001;
const int MAX_W = 1001;
const int vx[4] = { 0, 1, 0, -1 };
const int vy[4] = { 1, 0, -1, 0 };
const int INF = 10000000;
const char num[9] = { '1', '2', '3', '4', '5', '6', '7', '8', '9' };
char c[MAX_H][MAX_W], b;
int y[MAX_H][MAX_W];
int h, w, n;
typedef std::pair<int, int> P;
P p[9];
P nest;
int bfs(P start, P end){
	std::queue<P> Q;
	P b;
	for (int i = 0; i<h; i++){
		for (int j = 0; j<w; j++){
			y[i][j] = INF;
		}
	}
	Q.push(start);
	y[start.first][start.second] = 0;
	while (Q.size()){
		b = Q.front();
		Q.pop();
		if (b == end){
			break;
		}
		for (int i = 0; i<4; i++){
			if (y[b.first][b.second] + 1<y[b.first + vx[i]][b.second + vy[i]] && y[b.first + vx[i]][b.second + vy[i]] == INF && c[b.first + vx[i]][b.second + vy[i]] != 'X'){
				y[b.first + vx[i]][b.second + vy[i]] = y[b.first][b.second] + 1;
				Q.push(P(b.first + vx[i], b.second + vy[i]));
			}
		}
	}
	return y[end.first][end.second];
}
int main(){
	int ok = 0;
	int ans = 0;
	std::cin >> h >> w >> n;
	for (int i = 0; i<h; i++){
		for (int j = 0; j<w; j++){
			std::cin >> b;
			if (b != 'S' && b != '.' && b != 'X'){
				for (int k = 0; k < 9; k++){
					if (b == num[k])ok = k;
				}
				p[ok].first = i;
				p[ok].second = j;
			}
			else if (b == 'S'){
				nest.first = i;
				nest.second = j;
			}
			c[i][j] = b;
		}
	}
	ans += bfs(nest, p[0]);
	for (int i = 1; i <= n - 1; i++){
		ans += bfs(p[i - 1], p[i]);
	}
	std::cout << ans << "\n";
}

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

bool is_pal(string s)
{
	string t = s;
	reverse(s.begin(), s.end());
	return s == t;
}

int main()
{
	string s;
	cin >> s;
	int a = (s.size() - 1) / 2;
	int b = (s.size() + 3) / 2 - 1;
	
	string x = s.substr(0, a);
	string y = s.substr(b);
	if (is_pal(s) && is_pal(x) && is_pal(y))
		cout << "Yes\n";
	else
		cout << "No\n";
}


Measured memory_bytes: 384
a,b,n = (int(num) for num in input().split())

def f(x):
    return (a * x) // b - a * (x//b)

ans = 0
if b > 10 ** 6:
    x = b - 1
    while x <= n:
        ans = max(ans,f(x))
        x += b
for x in range(n,max(1,n-2 * 10**6 -10),-1):
        ans = max(ans,f(x))
    
print(ans)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N ;
    cin >> N ;
  for(int i = 0; i < N+1 ; i++){
    string x ;
    cin >> x ;
    if (x=="Y"){
      cout << "Four" << endl;
     break ;  
    }
    else if (x=="G"){
     
    }
    else if (x=="P"){
      
    }
    else if (x=="W"){
    }
    else {
     cout << "Three" << endl; 
    } 
      
    
  }
}

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


// Union-Find Disjoint Sets Library written in OOP manner, using both path compression and union by rank heuristics
// initialize: UnionFind UF(N)

class UnionFind {                                              // OOP style
private:
	vector<int> p, rank, setSize;
	// p = path toward the root of disjoint set; p[i] = i means it is root
	// rank = upper bound of the actual height of the tree; not reliable as accurate measure
	// setSize = size of each disjoint set

	int numSets;
public:
	UnionFind(int N) {
		setSize.assign(N, 1);
		numSets = N;
		rank.assign(N, 0);
		p.assign(N, 0);
		for (int i = 0; i < N; i++) p[i] = i;	// each belongs to its own set
	}

	int findSet(int i) {
		return (p[i] == i) ? i : (p[i] = findSet(p[i]));		// path compression: cut short of the path if possible
	}

	bool isSameSet(int i, int j) {
		return findSet(i) == findSet(j);
	}

	void unionSet(int i, int j) {
		if (!isSameSet(i, j)) {
			numSets--;
			int x = findSet(i), y = findSet(j);
			// rank is used to keep the tree short
			if (rank[x] > rank[y]) { p[y] = x; setSize[x] += setSize[y]; }
			else {
				p[x] = y; setSize[y] += setSize[x];
				if (rank[x] == rank[y]) rank[y]++;
			}
		}
	}

	int numDisjointSets() {		// # of disjoint sets
		return numSets;
	}

	int sizeOfSet(int i) {		// size of set
		return setSize[findSet(i)];
	}
};

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

	long long n, i, j, k, ans, a, b, c;
	cin >> n;
	vector<pair<long long, long>> x(n), y(n);
	for (i = 0; i < n; i++) {
		cin >> x[i].first >> y[i].first;
		x[i].second = i;
		y[i].second = i;
	}
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	UnionFind uf(n);
	vector<pair<long long, pair<long long, long long>>> v;
	for (i = 0; i < n - 1; i++) {
		v.push_back({ x[i + 1].first - x[i].first, {x[i].second, x[i + 1].second } });
		v.push_back({ y[i + 1].first - y[i].first, {y[i].second, y[i + 1].second } });
	}
	sort(v.begin(), v.end());

	ans = 0;
	for (auto p : v) {
		c = p.first;
		a = p.second.first;
		b = p.second.second;

		if (uf.isSameSet(a, b)) continue;
		ans += c;
		uf.unionSet(a, b);
	}
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 12784
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
class Program
{
	static void Main(string[] args)
	{
		var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int N = input[0];
		int M = input[1];
		int X = input[2];
		int Y = input[3];
		var x = Console.ReadLine().Split().Select(int.Parse).ToArray();
		var y = Console.ReadLine().Split().Select(int.Parse).ToArray();
		Array.Sort(x);
		Array.Sort(y);
		string ans = "War";
		if (Math.Max(x[N-1],X)<Math.Min(y[0],Y)) { ans = "No War"; }
		Console.WriteLine(ans);
	}
}


Measured memory_bytes: 11348
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int tmp = Math.max(A, B);
    int ans = Math.max(A + B, tmp + tmp - 1);
    System.out.println(ans);
  }
}

Measured memory_bytes: 23124
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
#include<bitset>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define pb(b) push_back(b) 
#define all(a) a.begin(),a.end()
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define llpvec vector<pair<ll,ll>>
#define size_(a,b) (a,vector<ll>(b))
#define S 21
llfor;////////////////////////////////////////////////////////////
vector<ll>dis(100000,1e18);
void dfs(ll a,vector<vector<pair<ll,ll>>> &path){ 
 for(int i=0;i<path[a].size();++i){
  ll x=path[a][i].first;
  ll y=path[a][i].second;
  if(dis[x]!=1e18)continue;
  dis[x]=dis[a]+y;
  //cout<<a<<" "<<x<<" "<<dis[x]<<endl;
  dfs(x,path);
 }
}

int main(){
 ll n;
 cin>>n;
 ll a,b,c;
 vector<vector<pair<ll,ll>>>path(n);
 dis.resize(n,1e18);
 rep(i,0,n-1){
  cin>>a>>b>>c;
  a--;b--;
  path[a].pb(make_pair(b,c));
  path[b].pb(make_pair(a,c));
 }
 ll q,k;
 cin>>q>>k;
 k--;
 dis[k]=0;
 dfs(k,path);

// pnn;rep(i,0,n)cout<<i<<" "<<dis[i]<<endl;pnn;
 rep(i,0,q){
  cin>>a>>b;
  a--;b--;
  ll ans=dis[a]+dis[b];
  pr(ans);
 }
return 0;}

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

using namespace std;

int main() {
	int N;
	cin >> N;
	int L[2000];
	for (int i = 0; i < N; i++) {
		cin >> L[i];
	}
	
	sort(L, L + N);

	int ans = 0;

	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			for (int k = j + 1; k < N; k++) {
				if (L[i] + L[j] > L[k]) {
					if (L[i] < L[j] + L[k] && L[j] < L[i] + L[k]) {
						ans++;
					}
				}
				else {
					break;
				}
			}
		}
	}

	cout << ans;

	return 0;
}


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

typedef long long ll;
const int INF =1e9;
const double PI = acos(-1.0);
string S,T;
vector<vector<int>> alpha(30);
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>S>>T;
    int N = S.size();
    int M = T.size();
    rep(i,N){
        alpha[S[i]-'a'].push_back(i);
    }
    rep(i,N)alpha[S[i]-'a'].push_back(INF);
    ll ans = 0;
    int preidx = -1;
    rep(i,M){
        vector<int> &v = alpha[T[i]-'a'];
        if((int)v.size() == 0){
            ans = -1;
            break;
        }
        auto x = upper_bound(all(v),preidx) - alpha[T[i]-'a'].begin();
        if(v[x] == INF){
            ans += N-preidx-1;
            ans += v[0] + 1;
            preidx = v[0];
            continue;
        }
        ans += v[x] - preidx;
        preidx = v[x];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1736
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N,L = inputMap()
    S = []
    for _ in range(N):
        tmp = input()
        S.append(tmp)
        
    S.sort()
    ans = ""
    for vol in S:
        ans += vol
        
    print(ans)
    
if __name__ == "__main__":
	main()


Measured memory_bytes: 38640
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <queue>
#include <iostream>
#include <cmath>

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
typedef long long ll;
using namespace std;


void solve(long long N, long long M, std::vector<long long> p, std::vector<std::string> S){
    vector<int> flags(N, 0);
    vector<int> t_sums(N, 0);
    int res = 0;
    int ans = 0;
    REP(i, M) {
        if(S[i] == "AC" &&  !flags[p[i]]){
            flags[p[i]] = 1;
            ans++;
            res += t_sums[p[i]];
        }
        if(S[i] == "WA" && !flags[p[i]]) {
            t_sums[p[i]]++;
        }
    }
    cout << ans << " ";
    cout << res << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> p(M);
    std::vector<std::string> S(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&p[i]);
        std::cin >> S[i];
    }
    solve(N, M, std::move(p), std::move(S));
    return 0;
}


Measured memory_bytes: 7296
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> maze(H, vector<char>(W));
    vector<vector<int>> left(H, vector<int>(W, 0));
    vector<vector<int>> right(H, vector<int>(W, 0));
    vector<vector<int>> up(H, vector<int>(W, 0));
    vector<vector<int>> down(H, vector<int>(W, 0));

    rep(i, H) {
        rep(j, W) { cin >> maze[i][j]; }
    }

    int cur = 0;
    rep(i, H) {
        rep(j, W) {
            if (maze[i][j] == '.')
                cur++, left[i][j] = cur;
            else
                cur = 0;
        }
        cur = 0;
    }

    rep(i, H) {
        for (int j = W - 1; j > -1; j--) {
            if (maze[i][j] == '.')
                cur++, right[i][j] = cur;
            else
                cur = 0;
        }
        cur = 0;
    }

    rep(j, W) {
        rep(i, H) {
            if (maze[i][j] == '.')
                cur++, up[i][j] = cur;
            else
                cur = 0;
        }
        cur = 0;
    }

    rep(j, W) {
        for (int i = H - 1; i > -1; i--) {
            if (maze[i][j] == '.')
                cur++, down[i][j] = cur;
            else
                cur = 0;
        }
        cur = 0;
    }

    int ans = 0;
    rep(i, H) {
        rep(j, W) {
            int temp = left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3;
            ans = max(ans, temp);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 69120
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int main()
{
    string s;
    cin >> s;
    int y = stoi(s);
    int m = stoi(&s[5]);
    int d = stoi(&s[8]);
    int ans = 1;
    if (y < 2019)
        ans = 0;
    else if (2019 == y && m <= 4)
        ans = 0;
    cout << (ans ? "TBD" : "Heisei") << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while (true) {
			int m = stdIn.nextInt();
			int f = stdIn.nextInt();
			int r = stdIn.nextInt();
			if((m+f+r) == -3){
				break;
			}else if(m==-1 || f ==-1){
				System.out.println("F");
			}else if((m+f) >= 80){
				System.out.println("A");
			}else if((m+f) >= 65){
				System.out.println("B");
			}else if((m+f) >= 50){
				System.out.println("C");
			}else if((m+f) >= 30){
				if (r >= 50) {
					System.out.println("C");
				}else{
					System.out.println("D");
				}
			}else{
				System.out.println("F");
			}

		}
	}
}

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

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

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(v) for(int k=head[v];k;k=e[k].ne)
#define v e[k].t
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=5e3+5,M=1e7+5,INF=1e9,mod=1e9+7;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
il void gen(){freopen("data.in","w",stdout);}
vector<pa>a[N];
vector<pa>::iterator it;
ll x,y,n,m,num,tot,ans;
ll f[N];
int main(){
	f[0]=f[1]=1;tot=1;
	while(f[tot]<linf){tot++;f[tot]=f[tot-1]+f[tot-2];}
	a[1].pb(pa(1,2));a[1].pb(pa(1,3));a[1].pb(pa(1,4));
	rep(i,1,tot-3){
		it=a[i].begin();
		while(it!=a[i].end()){
			ll x=it->w1,y=it->w2;x+=y;
			while(x<=f[i+3]+f[i]){a[i+1].pb(pa(y,x));x+=y;}
			it++;
		}
	}int T=read();rep(cas,1,T){
		ll n,m;read(n,m);if(n>m)swap(n,m);
		ans=1;while(f[ans+1]<=n&&f[ans+2]<=m)ans++;
		cout<<ans<<" ";
		if(ans==1){cout<<n*m%mod<<endl;continue;}
		else{
			ll num=0;it=a[ans-1].begin();
			while(it!=a[ans-1].end()){
				ll x=it->w1,y=it->w2;
				if(y<=n)(num+=(m-x)/y)%=mod;
				if(y<=m)(num+=(n-x)/y)%=mod;
				it++;
			}printf("%lld\n",num);
		}
	}
}

Measured memory_bytes: 4224
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solveA();
		// new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;
		int numX = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();
			numX = scanner.nextInt();

			if (numX - numA <= numB && numA <= numX) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 21716
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    string S, T;
    cin >> S >> T;

    string S2 = S + S;
    ll p = S2.find(T);
    if(p == S2.npos){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
using namespace std;
#define REP(i, n) for(int i=0;i<n;i++)
template<typename T>
void get(T& t){cin >> t;}
int64_t undefined = -10000000000000;
vector<std::pair<int, int>> connected[100001];
bool searched[100001];
int64_t rel_x[100001];
bool search(int idx, int64_t x){
	if(searched[idx]){
		return x == rel_x[idx];
	}
	searched[idx] = true;
	rel_x[idx] = x;
	for(int i=0;i<connected[idx].size();i++){
		const std::pair<int, int> p = connected[idx][i];
		bool ok = search(p.first, x + p.second);
		if(!ok)return false;
	}
	return true;
}
int main(void){
	int64_t n, m;
	get(n);get(m);
	REP(i, n){
		rel_x[i] = undefined;
		searched[i] = false;
	}
	REP(i, m){
		int l, r, d;
		get(l);get(r);get(d);
		l--;r--;
		connected[l].push_back(std::pair<int, int>(r,d));
		connected[r].push_back(std::pair<int, int>(l,-d));
	}
	bool ok = true;
	REP(i, n){
		if(searched[i])continue;
		rel_x[i] = 0;
		ok = search(i, 0);
		if(!ok)break;
	}
	if(ok)cout << "Yes" <<endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 12416
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append([i,n//i])
            if i != n // i:
                divisors.append([n//i, i])

    # divisors.sort()
    return divisors

N, M = map(int, input().split())
ceil = M // N
divisors = make_divisors(M)
divisors.sort(reverse=True)
for i,j in divisors:
    if j >= N:
        print(i)
        break


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

#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using P   = pair<int, int>;

template <class T>
bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    } else {
        return false;
    }
}
template <class T>
bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    } else {
        return false;
    }
}

template <class T>
void dump_vec(const vector<T> &v) {
    auto len = v.size();
    rep(i, 0, len) {
        cout << v[i] << (i == (int)len - 1 ? "\n" : " ");
    }
}

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

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

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

// 配列 A[p..r] を A[p..q − 1] の各要素が A[q] 以下で、
// A[q + 1.. r] の各要素が A[q] より大きい A[p..q − 1] と A[q + 1..r] に分割し、インデックス q を戻り値として返す
template <class T>
int partition(vector<T> &as, int p, int r) {
    auto x = as[r];
    int i  = p - 1;
    rep(j, p, r) {
        if (as[j] <= x) {
            i++;
            swap(as[i], as[j]);
        }
    }
    swap(as[i + 1], as[r]);
    return i + 1;
}

template <class T>
void qsort(vector<T> &as, int p, int r) {
    if (p >= r) return;

    int q = partition(as, p, r);
    qsort(as, p, q - 1);
    qsort(as, q, r);
}

struct Card {
    string suit;
    int num;
    int idx;

    Card() : suit(""), num(-1), idx(-1) {}
    Card(string s, int n, int i) : suit(s), num(n), idx(i) {}
    bool operator<(const Card &r) const {
        return num < r.num;
    }
    bool operator<=(const Card &r) const {
        return num <= r.num;
    }
    bool operator==(const Card &r) const {
        return num == r.num;
    }
    bool operator!=(const Card &r) const {
        return num != r.num;
    }
};

bool is_stable(const vector<Card> &sorted) {
    const auto len = sorted.size();
    bool ok        = true;
    rep(i, 0, len - 1) {
        if (sorted[i].num == sorted[i + 1].num && sorted[i].idx > sorted[i + 1].idx) {
            ok = false;
        }
    }
    return ok;
}

signed main() {
    int N;
    cin >> N;
    vector<Card> A(N);
    rep(i, 0, N) {
        string s;
        cin >> s;
        int n;
        cin >> n;
        A[i] = Card(s, n, i);
    }
    qsort(A, 0, N - 1);

    cout << (is_stable(A) ? "Stable\n" : "Not stable\n");
    for (const auto &c : A) {
        cout << c.suit << " " << c.num << "\n";
    }
}



Measured memory_bytes: 8988
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z main.cpp
//.\a.exe





int s(int n){
	int sum=0;
	while(n!=0){
		sum+=n%10; 
		n=n/10;
	}
	return sum;
}

int main(void){ios::sync_with_stdio(false);cin.tie(0);
///////////////////////////////////////////////////////
int n,x,sum=0,ans=0;
cin >> n >> x;
int m[n];
rep(i,n){
	cin >> m[i];
}
sort(m,m+n);
for(int i=0;i<n;i++){
	sum += m[i];
}
ans=(x-sum)/m[0]+n;
cout << ans << endl;
///////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
import math
s = int(input())

list = [0] * (s+1)

num = s//3
amari = s%3

if s<3:
    print(0)
    exit()
elif s<5:
    print(1)
    exit()


for i in range(3,6):
    list[i] = 1

for j in range(6,s+1):
        list[j] = list[j-3] + list[j-1]


ans = list[s]

print(ans%(10**9+7))


Measured memory_bytes: 9168
use std::io;

fn main() {
    loop {
        let mut line = String::new();
        io::stdin().read_line(&mut line).unwrap();

        let mut iter = line.split_whitespace().map(|i| i.parse::<i32>().unwrap());
        let m = iter.next().unwrap();
        let f = iter.next().unwrap();
        let r = iter.next().unwrap();

        if m == -1 && f == -1 && r == -1 { break; }

        let grade = match (m, f, r) {
            (m, f, _) if m == -1 || f == -1 => "F",
            (m, f, _) if m + f >= 80 => "A",
            (m, f, _) if m + f >= 65 => "B",
            (m, f, _) if m + f >= 50 => "C",
            (m, f, r) if m + f >= 30 => if r >= 50 { "C" } else { "D" },
            _                        => "F",
        };

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



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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s, t;
    cin >> s >> t;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] != t[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

int main() {
    int n,
        Tp = 0,
        Hp = 0;
    string s1, s2;
    cin >> n;
        
    for (int i = 0; i < n; i++) {
        cin >> s1 >> s2;
        if (s1 < s2) {
            Hp += 3;
        } else if (s1 > s2) {
            Tp += 3;
        } else {
            Tp++;
            Hp++;
        } 
    }
    
    cout << Tp << ' ' << Hp << endl;
}


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

int main() {

    string al_str = "abcdefghijklmnopqrstuvwxyz";

    string s;

    cin >> s;

    set<char> used;

    for(auto i : s){
        used.insert(i);
    }

    for(auto i : al_str){
        if(used.find(i) == used.end()){
            cout << s << i << endl;
            return 0;
        }
    }

    priority_queue<char> q;

    for(int i=s.size()-1; i>0; i--){

        q.push(s[i]);
        q.push(s[i-1]);
        if(s[i-1]<s[i]){

            char c = 'z';

            while(!q.empty()){

                if(s[i-1]<q.top()){
                    c = min(c,q.top());
                }

                q.pop();

            }

            for(int j=0; j<i-1; j++){
                cout << s[j];
            }
            cout << c << endl;
            return 0;

        }
    }

    cout << -1 << endl;

    return 0;
}

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

int main() {
  int N;
  int min = 32;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    int x, m = 0;
    cin >> x;
    
    for (int i = 0; i < 32; i++) {
      if(x % 2==0){
      x /= 2;
      m++;
      }
      else break;
    }
    if(min>=m){
    min = m;
    }
  }
  cout << min << endl;

}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
#define CEIL(A,B) ((A)+(B)-1)/(B)
using namespace std;
typedef int_fast64_t ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
inline void fastio(){cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15);}
ll gcd(ll a,ll b){ll c=max(a,b);ll d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modfact(ll a){ll b=1;FOR(i,2,a)b=b*i%MOD;return b;}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}
ll modcomb(ll n, ll k){ll b=1;k=min(n-k,k);DOWN(i,n,n-k+1)b=b*i%MOD;return b*modpow(modfact(k),MOD-2)%MOD;}

ll N, ans;
ll A[100001];

ll solve(ll S_init) {
    ll S = S_init;
    ll res = abs(S - A[0]);
    FOR(i, 1, N-1) {
        if(S * (S + A[i]) < 0) {
            S += A[i];
        } else {
            if(S > 0) {
                res += abs(A[i] - (-S-1));
                S = -1;
            } else {
                res += abs(A[i] - (-S+1));
                S = 1;
            }
        }
    }
    return res;
}

int main() {
    fastio();
    cin >> N;
    REP(i, N) cin >> A[i];
    if(A[0] == 0) {
        ans = min(solve(+1), solve(-1));
    } else {
        if(A[0] > 0) ans = min(solve(A[0]), solve(-1));
        else ans = min(solve(A[0]), solve(+1));
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<cstdlib>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
#include<cmath>
#include<string>
#include<deque>
#define lmid l,mid,rt<<1
#define rmid mid+1,r,rt<<1|1
using namespace std;
int main()
{
     double a,b;
     scanf("%lf%lf",&a,&b);
     double c=(a+b)/2.0;
     int d=c,e=c+1;
     double f=c-d,g=(double)e-c;
     if(f<g) printf("%d\n",d);
     else printf("%d\n",e);
     return 0;
}


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

int main() {
    long long N;
    cin >> N;
    string res = "";
    while (N) {
        --N;
        res += (char)('a' + (N % 26));
        N /= 26;
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
}


Measured memory_bytes: 3096
N = int(input())
P = []
for _ in range(N):
    P.append(list(map(int, input().split())))

total = 0
for i, p1 in enumerate(P[:-1]):
    for p2 in P[i+1:]:
        total += ((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2) ** 0.5

print(total * 2 / N)

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	int N;
	cin >> N;
	int ans = 0;
	fyg(N + 1, 1) {
		string K = to_string(y).c_str();
		int a = K[0] - '0';
		int b = K[K.size() - 1] - '0';
		if (b == 0) {
			continue;
		}
		if (a == b && a <= N) {
			ans++;
		}
		if (b * 10 + a <= N) {
			ans++;
		}

		fzg(6, 2) {
			int c = b * pow(10, z) + a;
			if (N >= b * pow(10, z) + pow(10, z) - 10 + a) {
				ans += pow(10, z - 1);
			}
			else if (c > N) {
				break;
			}
			else {
				ans += (N % (int)pow(10, z)) / 10 + 1;
				if (N%10<a) {
					ans--;
				}
			}
		}

	}
	ce(ans)

    return 0;
}



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

using namespace std;
typedef long long lint;

#define RPT(i, b, e) for (int i = (b); i <= (e); i++)
#define RPT0(i, n) RPT(i, 0, n - 1)
#define RPT1(i, n) RPT(i, 1, n)
#define EACH(it, v) for (const auto& it : v)
#define ALL(v) v.begin(), v.end()

void resolve()
{
    int N;
    cin >> N;
    vector<int> a(N), b(N), c(N);
    RPT0(i, N) cin >> a[i] >> b[i] >> c[i];

    // dp[i][j]
    // i日目にjをやった時のi日目終了時点での幸福度
    int dp[100001][3];
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];

    RPT(i, 1, N - 1)
    {
        dp[i][0] = a[i] + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = b[i] + max(dp[i - 1][0], dp[i - 1][2]);
        dp[i][2] = c[i] + max(dp[i - 1][0], dp[i - 1][1]);
    }

    int ans = max(max(dp[N - 1][0], dp[N - 1][1]), dp[N - 1][2]);
    cout << ans << endl;
}

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


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

int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    cin >> p[i];
    if (p[i] != i+1) cnt++;
  }
  if (cnt > 2) cout << "NO" << endl;
  else cout << "YES" << endl;
}


Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
const int MOD = 1e9+7;
using ll = long long;
using vi = vector<int>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(x) x.begin(), x.end()
int main() {
  int a,b,c,d;
  cin >> a >> b >> c;
  c += a;
  b--;
  rep(i,a){
    cin >> d;
    c += b/d;
  }
  cout << c;
}

Measured memory_bytes: 3588
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	a := nextInt()
	b := nextInt()
	astr := strings.Repeat(fmt.Sprintf("%d", a), b)
	bstr := strings.Repeat(fmt.Sprintf("%d", b), a)

	if astr < bstr {
		fmt.Println(astr)
	} else {
		fmt.Println(bstr)
	}
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1776
#include<iostream>
#include<cmath>
#include<string>
#include<vector>

using namespace std;

void func_A() {

    int n;
    cin >> n;

    switch (n % 10) {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9: 
        cout << "hon";
        break;
    case 0:
    case 1:
    case 6:
    case 8: 
        cout << "pon";
        break;
    case 3:
        cout << "bon";
        break;
    }


}

void func_B() {

}

void func_C() {

}

int main() {

    func_A();
    func_B();
    func_C();

    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n,t,a,c,m;
  cin>>n>>t>>a;
  c=t;
  m=t;
  for(int i=1;i<n;i++){
    cin>>a;
    if(a>=c){
      m+=t;
      c=a+t;
    }else{
      m+=t-(c-a);
      c=a+t;
    }
  }
  cout<<m<<endl;
}

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

#include <iostream>
#include <fstream>

#include <iostream>

class TaskA {
public:
	void solve(std::istream& in, std::ostream& out) {
		int a,b;in>>a>>b;
		if(a+b>=10)out<<"error\n";
		else out<<a+b<<'\n';
	}
};


int main() {
	TaskA solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

class FXorSum3 {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int n,d,e;
        in>>n;
        ll ans{};
        vector<int> c(60);
        vector<ll> a(n);
        for(auto&i:a) in>>i;
        fr(i,n) fr(j,60) if((a[i]>>j)&1) ++c[j];
        ll D{};
        fr(j,60){
            if(c[j]&1) ans|=(1ll<<j);
            else D^=(1ll<<j);
        }
        fr(i,n) a[i]&=D;
        ll x{};
        int k=0;
        ifr(j,60){
            if(c[j]&1) continue;
            for(int i=k;i<n;++i) if((a[i]>>j)&1){
                swap(a[k],a[i]);
                break;
            }
            if(~(a[k]>>j)&1) continue;
            fr(i,n) if(((a[i]>>j)&1)&&i!=k) a[i]^=a[k];
            ++k;
        }
        fr(i,n) x^=a[i];
        out<<ans+x*2<<endl;
    }
};

int main() {
    FXorSum3 solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

int main() {
  int k;
  cin >> k;
 int ans=0;
  if(k%2==0){ans=(k/2)*(k/2);}
  else{ans=((k-1)/2)*((k+1)/2);}
  
  
  
  cout << ans<< endl;
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int t,n,i, c1=0,c2=0,c3=0,c4=0;
    cin>>t;
    while(t--){
                  string n;
                  cin>>n;
    if(n=="AC") c1++;
    if(n=="WA") c2++;
    if(n=="TLE") c3++;
    if(n=="RE") c4++;
    }
    cout<<"AC x "<<c1<<endl;
    cout<<"WA x "<<c2<<endl;
    cout<<"TLE x "<<c3<<endl;
    cout<<"RE x "<<c4<<endl;

}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
ll mod=1000000007;

int main(){
    std::ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int n=s.size();
    string s1=s;
    string s2=s;
    int ans1=0,ans2=0;
    if(s[0]=='1'){
        for(int i=1;i<n;i++){
            if(i&1){
                if(s1[i]=='1'){s1[i]='0';
                ans1++;}
            }
            else{
                if(s1[i]=='0'){s1[i]='1';
                ans1++;}
            }
        }
        //cout<<ans1<<" "<<ans2<<endl;
        for(int i=0;i<n;i++){
            if(!(i&1)){
                if(s2[i]=='1'){s2[i]='0';
                ans2++;}
            }
            else{
                if(s2[i]=='0'){s2[i]='1';
                ans2++;}
            }
        }
    }
    else{
        for(int i=1;i<n;i++){
            if(!(i&1)){
                if(s2[i]=='1'){s2[i]='0';
                ans2++;}
            }
            else{
                if(s2[i]=='0'){s2[i]='1';
                ans2++;}
            }
        }
        for(int i=0;i<n;i++){
            if(i&1){
                if(s1[i]=='1'){s1[i]='0';
                ans1++;}
            }
            else{
                if(s1[i]=='0'){s1[i]='1';
                ans1++;}
            }
        }
    }
    //cout<<ans1<<" "<<ans2<<endl;
    cout<<min(ans1,ans2)<<endl;

    return 0;
}


Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vstr=vector<string>;
void yes(bool c) { if (c)print("Yes"); else print("No"); };

void solve() {
    string s;cin >> s;
    if(s=="ABC"){
        print("ARC");
    }else{
        print("ABC");
    }
    // int N; cin >> N;
    // vector<vi> to(N),cost(N);
    // int u,v,w;
	// rep(i,N-1) {
    //     cin >> u >> v >> w;
    // }

}

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

    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

Measured memory_bytes: 3652
#include <cstdio>
#include <iostream>

using namespace std;

int main() {

	double a, s;

	while(cin >> a) {
		s=a;
		for(int i=2; i<11; i++) {
			if(i%2==0) {
				a*=2;
				s+=a;
			}
			else {
				a/=3;
				s+=a;
			}
		}
		printf("%.8f\n", s);
	}

	return 0;

}

Measured memory_bytes: 0