akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextFloat() float64 {
	sc.Scan()
	f, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func min(a, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}

func main() {
	N := nextInt()
	s := make([]int, N)
	for i := 0; i < N; i++ {
		s[i] = nextInt()
	}
	var ANS int
	for i := 0; i < N-2; i++ {
		for j := i + 1; j < N-1; j++ {
			for k := j + 1; k < N; k++ {
				if s[i] != s[j] && s[j] != s[k] && s[i] != s[k] {
					long := max(max(s[i], s[j]), s[k])
					if s[i]+s[j]+s[k]-long > long {
						ANS++
					}
				}
			}

		}
	}
	fmt.Println(ANS)
}


Measured memory_bytes: 1812
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <map>

using namespace std;

int main(void) {
    int N, M;
    cin >> N >> M;
    vector< vector<int> > g(N);
    while(M--) {
        int A, B;
        cin >> A >> B;
        --A; --B;
        g[A].emplace_back(B);
        g[B].emplace_back(A);
    }

    vector<int> ans(N, -1);
    ans[0] = 0;
    queue<int> q;
    q.emplace(0);
    while(!q.empty()) {
        int v = q.front();
        q.pop();
        for(auto u: g[v]) {
            if(ans[u] != -1) continue;
            ans[u] = v;
            q.emplace(u);
        }
    }

    cout << "Yes" << endl;
    for(int i=1; i<N; i++) {
        cout << ans[i] + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 10232
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String ars[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        char arr[]=br.readLine().toCharArray();
        if(arr[0]>='A'&&arr[0]<='Z')
        pw.println("A");
        else
        pw.println("a");
        pw.flush();
        pw.close();
    }
}

Measured memory_bytes: 32692
#include<stdio.h>
int main()
{
	long long n,m,sum,i,j,k;
	while(scanf("%lld%lld",&n,&m)!=EOF)
	{
		if(n==1)
		{
			if(m==1)
			printf("1\n");
			else if(m==2)
			printf("0\n");
			else
			printf("%lld\n",m-2);
		}
		else if(n==2)
		printf("0\n");
		else
		{
			if(m==1)
			printf("%lld\n",n-2);
			else if(m==2)
			printf("0\n");
			else
			printf("%lld\n",(m-2)*(n-2));
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef gp_hash_table<int, null_type,hash<int>, equal_to<int>, direct_mask_range_hashing<int>, linear_probe_fn<>,
    hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>,true>> hash_set;

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define all(a) a.begin(),a.end()
#define println printf("\n");
#define readln(x) getline(cin,x);
#define pb push_back
#define endl "\n"
#define INT_INF 0x3f3f3f3f
#define LL_INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-9
#define MOD 1000000007
#define MOD2 1494318097
#define SEED 131
#define mp make_pair
#define fastio cin.tie(0); cin.sync_with_stdio(0);

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef pair<int,pii> triple;
typedef int8_t byte;

const ld PI = (ld)4*atanl(1);

mt19937 g1(chrono::steady_clock::now().time_since_epoch().count());

int randint(int a, int b){return uniform_int_distribution<int>(a, b)(g1);}
ll randlong(ll a,ll b){return uniform_int_distribution<long long>(a, b)(g1);}

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

ll N,res;
vector<ll> v;

inline void init(ll n){
    for(ll i=2; i<=sqrt(n); i++){
        if(n%i == 0){
            v.pb(i);
            if(i*i != n)
                v.pb(n/i);
        }
    }
    if(n > 1) v.pb(n);
}

int main(){
    scanf("%lld",&N);
    init(N);
    init(N-1);
    for(ll check:v){
        if(N%check) res++;
        else{
            ll tmp = N;
            while(tmp%check == 0)tmp/=check;
            if(tmp%check == 1) res++;
        }
    }
    printf("%lld\n",res);
}

Measured memory_bytes: 384
N, T = map(int,input().split())
lsT = list(map(int,input().split()))
tend = T
ans = T
for i in range(1,N):
    if  lsT[i] <= tend:
        ans += lsT[i]+T-tend
        tend = lsT[i]+T
    else:
        ans += T
        tend = lsT[i]+T
print(ans)

Measured memory_bytes: 30868
open System

[<EntryPoint>]
let main argv =
    let input = Console.ReadLine().Split(' ') |> Array.map int64
    let a, b = input.[0], input.[1]
    let rec gcd (x : int64) (y : int64) =
        if x < y then
            gcd y x
        else if x % y = 0L then
            y
        else
            gcd y (x % y)
    printfn "%d" (a * b / (gcd a b))
    0


Measured memory_bytes: 14044
#include<iostream>
using namespace std;
int main(){
    int n;
    int a[110];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int mn=a[0], mx=a[0];
    for(int i=1;i<n;i++){
        if(mn>a[i])mn=a[i];
        if(mx<a[i])mx=a[i];
    }
    cout<<mx-mn<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;
import java.io.*;
import java.math.*;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();
		out.println(z + " " + x + " " + y);

		out.close();
	}

static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}

Measured memory_bytes: 21332
#include <iostream>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <math.h>
#define ll long long
ll gcd(ll a,ll b){
    ll s=1,c;
    while(a&&b){
        if((~a&1)&&(~b&1))
            a>>=1,b>>=1,s<<=1;
        else if(~a&1)a>>=1;
        else if(~b&1)b>>=1;
        else if(a>b)a=a-b;
        else c=b-a,b=a,a=c;
    }
    if(!a)return b*s;
    if(!b)return a*s;
}
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	int ans=0;
	for(int i=0;i<k;i++)
		ans+=a[i];
	cout<<ans;
}	



Measured memory_bytes: 3632
/////////////////////////////////////////////////////////
//
//  c/temp.cpp file
//  Last Updated: 2018-10-23 ...Maybe
//
//    I hope you adding this code to the setting file
//    alias g++='g++ -std=c++1y -DDEBUG_LOCAL'
//
/////////////////////////////////////////////////////////

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

//#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REAP(i,0,n)
#define REAP(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REAP,_REP,)(__VA_ARGS__)

#define _REPR(i,n) REAPR(i,n,0)
#define REAPR(i,a,b) for(int i=int(a-1);i>=int(b);--i)
#define REPR(...) _overload3(__VA_ARGS__,REAPR,_REPR,)(__VA_ARGS__)

#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()

#define coutALL(a) {int loop_coutALL=0;for(auto e:a) cout<<(loop_coutALL++?" ":"")<<e; cout<<endl;}

#define coutYN(a) cout<<((a)?"YES":"NO")<<endl;
#define coutYn(a) cout<<((a)?"Yes":"No")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;

#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

const int INF=1145141919;
//const long long INF=114514191911451419;
const int MOD=(int)1e9+7;
const double EPS=1e-12;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<string,int> psi;
typedef pair<string,string> pss;

typedef long long ll;

template<typename T> istream &operator >> (istream &is, vector<T> &v){for(T &x:v) is>>x;return is;}
template<typename T> ostream &operator << (ostream &os, vector<T> &v){int i=0;for(T &x:v) os<<(i++?" ":"")<<x;return os;}

ll rev(ll n){ll x=0;for(;n>0;){x=x*10+n%10;n/=10;}return x;}

ll upper(ll n,ll m){return (n+m-1)/m;};
ll rounding(ll n){return (long double)n+0.5;};

bool inG(ll x,ll n){return 0<=x && x<n;}
bool outG(ll x,ll n){return x<0 || n<=x;}

inline int qp(int a,ll b){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
inline int qp(int a,ll b,int mo){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

inline ll fac(ll k,ll n){ll a=1;for(int i=0;i<n;i++)a*=k--;return a;}
inline ll fac(ll k,ll n,int mo){ll a=1;for(int i=0;i<n;i++)a*=k--,a%=mo;return a;}

inline int dsum(ll n){int a=0;for(;n;n/=10)a+=n%10;return a;}

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

//#define DEBUG_LOCAL

#ifdef DEBUG_LOCAL
template<typename T> void deb(T a){cerr<<"deb: "<<a<<"です"<<endl;}
#define debl {cerr<<"debug: "<<__LINE__<<"行目だ"<<endl;}
void what_cr(){cout<<__GCC_ATOMIC_CHAR16_T_LOCK_FREE<<" ←？"<<endl;}
//ori_func S

//ori_func E
#else
template<typename T>void deb(T a){}
#define debl
void what_cr(){}void t_t(){}
#endif

signed main(){

  Arithmetic Exception;

  int k;
  string s;

  cin>>k>>s;

  cout<<s.substr(0,k)+("..."+(s.size()<=k)*3)<<endl;

  return 0;

}


Measured memory_bytes: 3632
import java.io.*;
    public class Main
    {
        public static int frog(int[] arr){
            
            int[] dp = new int[arr.length];
            dp[0] = 0;
            dp[1] = Math.abs(arr[0] - arr[1]);
            for(int i = 2; i < dp.length; i++){
                dp[i] = Math.min(Math.abs(arr[i] - arr[i-1])+dp[i-1], Math.abs(arr[i] - arr[i-2])+dp[i-2]); 
            }
            return dp[dp.length-1];
        }
    	public static void main(String[] args) throws Exception {
    	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	    int n = Integer.parseInt(br.readLine());
    	    String[] s = br.readLine().split(" ");
    	    int[] arr = new int[s.length];
    	    for(int i = 0; i < arr.length; i++){
    	        arr[i] = Integer.parseInt(s[i]);
    	    }
    
    	System.out.println(frog(arr));
    	}
    }

Measured memory_bytes: 33620
n = gets.to_i
if n >= 100 && n <= 111
  p 111
elsif n >= 111 && n <= 222
  p 222
elsif n >= 223 && n <= 333
  p 333
elsif n >= 334 && n <= 444
  p 444
elsif n >= 445 && n <= 555
  p 555
elsif n >= 556 && n <= 666
  p 666
elsif n >= 667 && n <= 777
  p 777
elsif n >= 778 && n <= 888
  p 888
elsif n >= 889 && n <= 999
  p 999
end

Measured memory_bytes: 1788
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define ck(a,b) (0<=(a)&&(a)<b)
using namespace std;
int dx[]={-1,1,0,0},dy[]={0,0,-1,1};

int main(){
	int w,h,sx,sy; char m[101][101];
	while(cin>>w>>h,w){
		rep(i,h)rep(j,w){
			cin>>m[i][j];
			if(m[i][j]=='&')sy=i,sx=j;
		}
		
		vector<pair<int,int> > frontier,next;
		int cost[h][w]; rep(i,h)rep(j,w)cost[i][j]=99999;
		cost[sy][sx]=0;
		frontier.push_back(make_pair(sy,sx));
		
		for(int step=0;!frontier.empty();step++){
			next.clear();
			rep(i,frontier.size()){
				int x=frontier[i].second,y=frontier[i].first,cx,cy,c;
				rep(d,4){
					cx=x+dx[d],cy=y+dy[d];
					if(!ck(cy,h)||!ck(cx,w))continue;
					c=m[y][x]!='#'&&m[cy][cx]=='#'?1:0;
					if(cost[cy][cx]>cost[y][x]+c){
						cost[cy][cx]=cost[y][x]+c;
						next.push_back(make_pair(cy,cx));
					}
				}
			}
			frontier=next;
		}
		int mn=99999;
		rep(i,h){
			if(i==0||i==h-1){
				rep(j,w)if(mn>cost[i][j])mn=cost[i][j];
			}else{
				if(mn>cost[i][0])mn=cost[i][0];
				if(mn>cost[i][w-1])mn=cost[i][w-1];
			}
		}
		cout<<mn<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] streamLine = br.readLine().split(" ");
		
		int[] intLine = new int[3];
		for (int i = 0; i < 3; i++) {
			intLine[i] = Integer.parseInt(streamLine[i]);
		}
		
		Arrays.sort(intLine);
		
		System.out.printf("%d %d %d\n", intLine[0], intLine[1], intLine[2]);
	}
}


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

#define ll long long
#define ar array

int main(){
  ll x,k,d;
  cin >> x >> k >> d;
  x=abs(x);
  if(x/d>=k){
    x-=(k*d);
    }
  else{
    k-=(x/d);
    if(k&1){
      x-=d*((x/d) + 1);
    }
    else{
      x-=(x/d)*d;
    }
  }  
  cout << abs(x) << endl;
  return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pcont(x) for(auto i: x){cout << i << " ";} cout << "\n";

int main(){
    IOS;
    int n;
    cin >> n;
    vector<int> a(n+1);

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

    int cost[n+1];
    cost[1] = 0;
    cost[2] = abs(a[2] - a[1]);

    for(int i = 3; i<n+1; i++){
        cost[i] = min(cost[i-1] + abs(a[i] - a[i-1]), cost[i-2] + abs(a[i] - a[i-2]));
    }

    cout << cost[n] << "\n";

    return 0;
}

Measured memory_bytes: 3996
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int a,b,c;
    cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b;
	return 0;
}

Measured memory_bytes: 256
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
w=lmp()
l=[0]*n
l[0]=w[0]
for i in range(1,n):
    l[i]=l[i-1]+w[i]
ans=10**10
for i in range(n):
    ans=min(ans,abs(l[-1]-2*l[i]))
print(ans)

Measured memory_bytes: 77276
#include <stdio.h>

int main(void)
{
	int n, i, input, max = -1000001, min = 1000001;
	long long int sum = 0;
	scanf("%d", &n);
	
	for(i = 0; i < n ; i++)
	{
		scanf("%d", &input);
		sum += input;
		if(input > max) max = input;
		if(input < min) min = input;
	}
	printf("%d %d %lld\n", min, max, sum);
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

constexpr ll mod = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	int n;
	cin >> n;
	vector<P> p;
	rep(i, n) {
		int a;
		cin >> a;
		p.pb(P(a, -1));
	}
	rep(i, n) {
		int b;
		cin >> b;
		p.pb(P(b, 1));
	}
	sort(all(p));
	int ans = 1;
	int cnt = 0;
	rep(i, 2 * n) {
		int y = p[i].second;
		if (cnt > 0 && y == -1) {
			ans *= cnt; ans %= mod;
		}
		else if (cnt < 0 && y == 1) {
			ans *= (-cnt); ans %= mod;
		}
		cnt += y;
	}
	cout << ans << endl;
}

Measured memory_bytes: 6000
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(0, i, N)
    {
        cin >> A.at(i);
        A.at(i)--;
    }
    int ans = 0;
    rep(0, i, N)
    {
        if (A.at(A.at(i)) == i)
        {
            ans++;
        }
    }
    cout << ans / 2 << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
const long long MOD = 998244353;

using namespace std;


const long long INF2 = (((ll)1<<31)-1);

template<class T> class SegTree   // 0-indexed
{
private:
    int n;             // 葉の数
    vector<T> data;    // ノードの値を持つ配列
    T def;                // 初期値かつ単位元
    
    T operation(T a, T b)    // 区間クエリで使う処理
    {
        return min(a, b);   // 区間minクエリ
        //return a+b;       // 区間和クエリ
    }

    T update(T a, T b)      // 点更新で使う処理
    {
        //return a+b;   // 加算の場合
        return b;       // 更新の場合
    }

    // 区間[a,b)の総和。ノードk=[l,r)に着目している。
    T _query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return def; // 交差しない
        if (a <= l && r <= b)
            return data[k]; // a,l,r,bの順で完全に含まれる
        else {
            T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2); // 左の子
            T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r); // 右の子
            return operation(c1, c2);
        }
    }
 
public:
    SegTree(int _n) {     // _n:必要サイズ
        def = INF2;        // 初期値かつ単位元
        //def = 0;        // 初期値かつ単位元（0：区間和の場合）
        n = 1;
        while (n < _n) n *= 2;
        data = vector<T>(2 * n - 1, def);
    }

    // 場所i(0-indexed)の値をxで更新
    void change(int i, T x) {
        i += n - 1;
        data[i] = update(data[i], x);
        while (i > 0) {
            i = (i - 1) / 2;
            data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
        }
    }

    // [a, b)の区間クエリを実行
    T query(int a, int b) {
        return _query(a, b, 0, 0, n);
    }
 
    // 添字でアクセス
    T operator[](int i) {
        return data[i + n - 1];
    }
};

void solve()
{
    int n;
    scanf("%d", &n);
    vector<pair<ll,ll> > z;
    int i;
    for (i = 0; i < n; i++) {
        int x,d;
        scanf("%d%d", &x, &d);
        z.push_back(make_pair((ll)x,(ll)d));
    }
    sort(z.begin(),z.end());
    z.push_back(make_pair(LINF,0));

    vector<ll> dp(n+1);
    dp[0]=1;
    SegTree<int> S(n);
    vector<int> next(n);
    for (i = n - 1; i >= 0; i--) {
        ll x=z[i].first, d=z[i].second;
        int k=lower_bound(z.begin(),z.end(),make_pair(x+d,-(ll)LINF))-z.begin();
        int val=-S.query(i+1,k);        
        if(val<0) val=i+1;
        S.change(i,-val);
        next[i]=val;
    }
    for(i=0; i<n; i++) {
        int val=next[i];
        dp[val]=(dp[val]+dp[i])%MOD;
        dp[i+1]=(dp[i+1]+dp[i])%MOD;
    }
    printf("%lld\n", dp[n]);

    return;
}

int main(int argc, char* argv[])
{
    solve();

	return 0;
}


Measured memory_bytes: 8684
#include<stdio.h>

int main(void){
	int a = 0, b = 0, h = 0, w = 0;

	scanf("%d %d", &a, &b);
	scanf("%d %d", &h, &w);

	int ans = 0;

	ans = ((a - h) * (b - w));

	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
long long a[100010];
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%lld",&a[i]);
int zero=0;
for(int i=0;i<n;i++)if(a[i]==0)zero++;
if(zero >0){
// a[i] contains 0
printf("0\n");
return 0;
}
long long prod=1;
for(int i=0;i<n;i++){
if(a[i] <=1000000000000000000/prod){
// This condition is equivalent to prod*a[i]<=10ˆ18
prod*=a[i];
}else{
printf("-1\n");
return 0;
}
}
printf("%lld\n",prod);
}

Measured memory_bytes: 2416
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;

using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pint = pair<int, int>;
using Graph = vvi;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
    int n;
    cin >> n;
    vi h(n);
    rep(i, n) cin >> h[i];

    bool ok = true;
    int pre = -100;
    rep(i, n) {
        if(pre <= h[i] - 1) pre = h[i] - 1;
        else if(pre <= h[i]) pre = h[i];
        else ok = false;
    }

    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}


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

using namespace std;

const uint64_t MOD = 1e+9 + 7;

class ModuloOps
{
private:
  std::vector<uint64_t> _fact, _fact_inv;

  void _calc_fact(uint64_t n)
  {
    for (uint64_t i = 2; i <= n; ++i) {
      _fact[i] = (_fact[i - 1] * i) % MOD;
      _fact_inv[i] = inv(_fact[i]);
    }
  }

public:
  ModuloOps(uint64_t n)
  {
    _fact = std::vector<uint64_t>(n + 1);
    _fact_inv = std::vector<uint64_t>(n + 1);

    _fact[0] = 1;
    _fact[1] = 1;
    _fact_inv[0] = 1;
    _fact_inv[1] = 1;

    _calc_fact(n);
  }

  uint64_t power(uint64_t x, uint64_t y) const
  {
    if (y <= 1) {
      return (y == 0) ? 1 : (x % MOD);
    }

    uint64_t w = power(x, y >> 1);
    uint64_t z = (w * w) % MOD;

    if (y % 2 == 1) {
      z = (x * z) % MOD;
    }

    return z;
  }

  uint64_t inv(uint64_t n) const { return power(n, MOD - 2); } 

  uint64_t fact(uint64_t n) const { return _fact[n]; }
  uint64_t fact_inv(uint64_t n) const { return _fact_inv[n]; }

  uint64_t perm(uint64_t n, uint64_t k) const {
    return (_fact[n] * _fact_inv[n - k]) % MOD;
  }

  uint64_t comb(uint64_t n, uint64_t k) const {
    return (perm(n, k) * _fact_inv[k]) % MOD;
  }

  uint64_t prem_rep(uint64_t k, uint64_t l) const
  {
    uint64_t x = _fact[k + l];
    x = (x * _fact_inv[k]) % MOD;
    x = (x * _fact_inv[l]) % MOD;
    return x;
  }

  uint64_t prem_rep(const std::vector<uint64_t> &a) const
  {
    uint64_t n = std::accumulate(a.begin(), a.end(), 0);
    uint64_t x = _fact[n];
    for (uint64_t y : a) {
      x = (x * _fact_inv[y]) % MOD;
    }
    return x;
  }

  uint64_t comb_rep(uint64_t n, uint64_t k) const {
    return comb(n + k - 1, k);
  }
};

int main()
{
  uint64_t X, Y;
  cin >> X >> Y;
  
  uint64_t xx = 2 * Y - X, yy = 2 * X - Y;
  
  if (((xx % 3) == 0) && ((yy % 3) == 0)) {
    uint64_t x = xx / 3, y = yy / 3;
    
    ModuloOps mod_ops(x + y + 1);
    uint64_t t = mod_ops.fact(x + y) % MOD;
    t = (t * mod_ops.fact_inv(x)) % MOD;
    t = (t * mod_ops.fact_inv(y)) % MOD;
    cout << t << endl;
  } else {
    cout << 0 << endl;
  }
  
  return 0;
}

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

int main() {
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(),a.end());
  for (int i=0;i<3;i++){
    a[i]=a[2]-a[i];
  }
  if (a[0]%2==a[1]%2){
    cout << (a[0]+a[1])/2 << endl;
  }
  else {
    cout << (a[0]+a[1]+3)/2 << endl;
  }
}

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

#define cc(x) cout << (x) << endl
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<long long> vll;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

const ll inf = 1LL<<58;
const int iinf = 1<<30;
ll mod = 1e9+7;
int main(){
    ll n;
    string s1,s2;
    cin >> n >> s1 >> s2;
    ll ans=0;
    ll i=0;
    bool now=0;
    if(s1[0]==s2[0]){
        ans=3;
        i++;
        now=0;
    }else{
        ans=6;
        i+=2;
        now=1;
    }
    while(i<n){
        // cc(i);
        // cc(ans);
        if(s1[i]==s2[i]){
            i++;
            if(now){
                ans*=1;
            }else{
                ans*=2;
            }
            now=0;
        }else{
            i+=2;
            if(now){
                ans*=3;
            }else{
                ans*=2;
            }
            now=1;
        }
        ans=ans%mod;
    }
    cc(ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include <set>
long long A,B,K;
using namespace std;
int main(){
	int N,D,X;
	int A[102];
	cin>>N>>D>>X;
	for(int i=0;i<N;i++){//有N个参赛者  ，共持续了  D  天 
		cin>>A[i];
	}
	long long sum=0;//总快数 
	for(int i=0;i<N;i++){
		int t=1;
		while(t*A[i]+1<=D){
			sum++;
			t++;
		}
	}
	sum=sum+N;
	cout<<sum+X<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;


int main() {
    unsigned long int N = 0;
    unsigned long int D = 0;
    unsigned long int count = 0;
    vector<long int> X;
    vector<long int> Y;
    long int N_put = 0;
    long int D_put = 0;
    cin >> N >> D;
    for (unsigned long int i = 0; i < N; i++) {
        cin >> N_put >> D_put;
        X.push_back(N_put);
        Y.push_back(D_put);
    }
    D = D * D;
    for (unsigned long int i = 0; i < N; i++) {
        if (X[i] * X[i] + Y[i] * Y[i] <= D) {
            count += 1;
        }
    }
    cout << count;
    return 0;
}

Measured memory_bytes: 6260
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

char s[20];
int main() {
	scanf("%s",s);
	rep(i,0,4) putchar(s[i]);
	putchar(' ');
	rep(i,4,12) putchar(s[i]);
	puts("");
}


Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>


int size;
#define OK 1
#define NG 0


/*size???????????\?????????????????§???????????????????????????????????£?????????????????§???????????§?????????????????????????????±?????????*/
void s_sort(int *S){
  int i,j,k,swap,count;
  if(size>=10){
    for(i=size-1;i>size-5;i--){
      j=0;
      while(j<=size-5){
        k=i;
        while(k>=j){
          if(S[k] < S[k-4]){
            swap=S[k];
            S[k]=S[k-4];
            S[k]=swap;
          }
          k-=4;
        }
        j+=4;    
      }
    }
  }
  for(i=0;i<size-1;i++){
    count=0;
    for(j=size-1;j>i;j--){
      if(S[j] <S[j-1]){
        swap=S[j];
        S[j]=S[j-1];
        S[j-1]=swap;
        count+=1;
      }
    }
    if(count==0) break;
  }
}


/*??????S???k?????????S[?????????]?????\????????°?????????????????????????????????????????????????????????????????¢??°*/
int judge(int *S,int k,int x){
  if(x==0) return OK;
  if(x < S[k]) return NG;
  else if(k==size){
    if(S[k]==x) return OK;
    else return NG;
  }
  if(judge(S,k+1,x-S[k]) +judge(S,k+1,x)) return OK;
  else return NG;
}




int main(){
  int i,*S,m,x;
  scanf("%d",&size);
  S=malloc(size*sizeof(int));
  for(i=0;i<size;i++) scanf("%d",&S[i]);
  s_sort(S);
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&x);
    if(judge(S,0,x)) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}
  

Measured memory_bytes: 580
#include<stdio.h>
#include <stdlib.h>
int main()
{
  int N;
  int A[200001];
  scanf("%d",&N);
  for(int i=0;i<N;i++){scanf("%d",&A[i]);}
  
  int highest = 0;
  long sum=0;
  for(int i=0;i<N;i++){
    if(highest < A[i]) highest = A[i];
    sum += (highest - A[i]);
  }

  printf("%ld",sum);
}

Measured memory_bytes: 2500
#include <iostream>

using namespace std;

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

	
	int a, b, c;
	cin >> a >> b >> c;
	if (c >= a && c <= b) {
		cout << "Yes\n";;
	}
	else {
		cout << "No\n";
	}

	return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

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

  in(int, a, b, c, d);
  auto close = [&d](int a, int b) { return abs(a - b) <= d; };
  out((close(a, c) || (close(a, b) && close(b, c))) ? "Yes" : "No");
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <unordered_set>
#include <random>
using namespace std;
#define ll long long
#define fr first
#define sc second
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int L, R, d; cin >> L >> R >> d;
	int ans = (R / d) - (L / d);
	if (L % d == 0) ans++;
	cout <<  ans << '\n';
	return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;
typedef std::vector<long long> vl;
typedef std::vector<std::vector<long long>> vvl;
#define out(x) cout<<x<<"\n";
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}
 
ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}

using namespace std;

using P = pair<ll, ll>;
void solve()
{
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	vector<P> p(n);
	rep(i,n){
		p[i] = {a[i], i};
	}
	sort(rall(p));
	vector<vector<ll>> dp(n + 5, vector<ll>(n + 5));
	rep(i,n){
		rep(j,n){
			if(i+j>=n)
				continue;
			chmax(dp[i + 1][j], dp[i][j] + p[i + j].first * abs(p[i + j].second - i));
			chmax(dp[i][j+1], dp[i][j] + p[i + j].first * abs(p[i + j].second -(n-1-j)));
		}
	}
	ll ans = 0;
	rep(i,n+1){
		chmax(ans, dp[i][n-i]);
	}
	cout << ans;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 34888
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <set>
#include <vector>
#include <cmath>
#include <string>
#define ll long long
#define read(x) scanf("%d",&x);
#define readll(x) cin>>x;
#define FOR(x,a,b) for(int x=a;x<b;x++)
#define MP make_pair
#define PB push_back
#define pii pair<int,int>
#define readN(N,X) for(int i=0;i<N;i++) cin>>X[i];
#define pff pair<double,double>
using namespace std;

long long fastpow(int a, int b, int MOD)
{
    long long x=1,y=a; 
    while(b > 0)
    {
        if(b%2 == 1)
        {
            x=(x*y) % MOD;
        }
        y = (y*y) % MOD;
        b /= 2;
    }
    return x;
}

long double fastpow2(int a, int b)
{
    return log(a)*b;
}

long double fact(int n){
    long double akar = sqrt(2.0 * M_PI * n);
    long double depan = ((long double) n / exp(1));
    return log(akar) + (log(depan) * n);
}

long double logC(int n, int r) {
    long double tmp = 0.0;
    return fact(n) - fact(r) - fact(n-r);
}

int a[111000];

    long double best = -1;
    int RA = -1;
    int RB = -1;

void coba(int A, int B){
    long double tmp = logC(A, B);
    //cout<<A<<" "<<B<<" "<<tmp<<endl;
    if (B > A) return;
    if (B == 0) tmp = 0.0;
        if (tmp > best){
            best = tmp;
            RA = A;
            RB = B;
        }
}

set<int> lho;
vector<int> b;
int N;
int main(){
  std::ios::sync_with_stdio(false);    
  cin>>N;
  for (int i=0;i<N;i++) {cin>>a[i]; lho.insert(a[i]);}

    for (int x:lho){
        b.push_back(x);
    }

    for (int i=0;i<N;i++){
        int idx = lower_bound(b.begin(), b.end(), a[i]/2) - b.begin();
        //cout<<i<<" "<<idx<<endl;
        for (int j=idx-1;j<=idx+1;j++){
            //cout<<" - "<<j<<endl;
            if (j < 0 || j >= N || b[j] == a[i]) continue;
            coba(a[i], b[j]);
        }
        //cout<<a[i]<<" "<<b[idx]<<endl;
    }
    cout<<RA<<" "<<RB<<endl;

}


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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

const int mmax=100010;
bool isprime[mmax+1];

void init(){
	rep(i,mmax+1) isprime[i]=true;
	isprime[0]=isprime[1]=false;
	for(int i=2;i*i<=mmax;++i){
		if(isprime[i])
			for(int j=i*i;j<=mmax;j+=i)
				isprime[j]=false;
	}
	return;
}

pii solve(int m,int a,int b){
	// a/b<=p/q aq<=pb
	// p/q<=1 p<=q
	ll cmax=0;
	pii res;
	for(int p=2;p*p<=m;++p){
		if(!isprime[p])
			continue;
		for(int q=p;q<=m/p;++q){
			if(!isprime[q])
				continue;

			if(a*q<=p*b&&p*q>cmax){
				cmax=p*q;
				res=mp(p,q);
			}
		}
	}
	return res;
}

int main(void){
	init();
	int m,a,b;
	while(cin >> m >> a >> b){
		if(m==0)
			break;
		pii ans=solve(m,a,b);
		cout << ans.first << " " << ans.second << endl;
	}
	return 0;
}

Measured memory_bytes: 1256
#include "iostream"
#include "string"

int main()
{
    int m, f, r;

    while(true){
        std::cin >> m >> f >> r;
        if((m + f + r) == -3)
            break;

        if (m < 0 || f < 0)
            std::cout << 'F' << std::endl;
        else if((m + f) >= 80)
            std::cout << 'A' << std::endl;
        else if((m + f) >= 65)
            std::cout << 'B' << std::endl;
        else if((m + f) >= 50)
            std::cout << 'C' << std::endl;
        else if((m + f) >= 30){
            if(r >= 50){
                std::cout << 'C' << std::endl;
            }
            else
                std::cout << 'D' << std::endl;
        }
        else
            std::cout << "F" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  ll x;
  cin>>x;
  ll y=100;
  int ans=0;
  while(y<x){
    y+=y/100;
    ans++;
  }
  cout<<ans<<endl;
  return(0);
}


Measured memory_bytes: 3632
def num2alpha(num: int):
    if num <= 26:
        return chr(64+num)
    elif num % 26 == 0:
        return num2alpha(num//26-1) + chr(90)
    else:
        return num2alpha(num//26) + chr(64 + num % 26)



N = int(input())
print(num2alpha(N).lower())

Measured memory_bytes: 9168
#![allow(non_snake_case,unused_imports,dead_code)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;
use std::cmp::Ordering;

fn comp_f64(a: &f64, b: &f64) -> Ordering {
    if a < b {
        return Ordering::Less;
    } else if a > b {
        return Ordering::Greater;
    }
    Ordering::Equal
}

fn main() {

    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();

    let T = buf_it.next().unwrap().parse::<usize>().unwrap();
    for _ in 0..T{
        let a = buf_it.next().unwrap().parse::<isize>().unwrap();
        let b = buf_it.next().unwrap().parse::<isize>().unwrap();
        let c = buf_it.next().unwrap().parse::<isize>().unwrap();
        let d = buf_it.next().unwrap().parse::<isize>().unwrap();

        if d<b{
            println!("No");
            continue;
        }

        let n = max(0,(a-c-1)/b);
        let a = a - n*b;
        if a<b{
            println!("No");
            continue;
        }
        let e = gcd(b,d);
        let n = max(0,(a-c-1)/e);
        let a = a - n*e;
        if a<b{
            println!("No");
            continue;
        }
        println!("Yes");
    }

}

fn gcd(x:isize,y:isize)->isize{
    if y==0{x} else {gcd(y,x%y)}
}

Measured memory_bytes: 4352
#include <iostream>

using namespace std;

int main()
{
	int n, r, p, c;
	int cards[50], tmp[50];
	
	cin >> n >> r;

	while (n != 0 && r != 0) {
		for (int i = 0; i < n; i++) cards[i] = n - i;
		for (int i = 0; i < r; i++) {
			cin >> p >> c;
			for (int j = 0; j < p - 1; j++) tmp[j] = cards[j];
			for (int j = 0; j < c; j++) cards[j] = cards[p - 1 + j];
			for (int j = 0; j < p - 1; j++) cards[c + j] = tmp[j];
		}

		cout << cards[0] << endl;

		cin >> n >> r;
	}
}


Measured memory_bytes: 3020
//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var one = nextIntArray();
	var A = one[0];
	var P = one[1];
	myout(Math.floor((A * 3 + P) / 2));
}


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

using namespace std;

typedef long long ll;

#define INF 1e17
#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i=(a); i<(n); i++)

ll N, M, Q;
ll L;
ll d[305][305];
ll e[305][305];

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

    rep(i, 305) rep(j, 305) d[i][j] = (i==j? 0 : INF);
    rep(i, 305) rep(j, 305) e[i][j] = (i==j? 0 : INF);

    rep(_, M) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        d[a][b] = d[b][a] = c;
    }

    rep(k, N) rep(i, N) rep(j, N) {
        d[i][j] = d[j][i] = min(d[i][j], d[i][k] + d[k][j]);
    }

    rep(i, N) rep(j, N) {
        if (i == j) continue;
        if(d[i][j] <= L) e[i][j] = e[j][i] = 1;
    }

    rep(k, N) rep(i, N) rep(j, N) {
        e[i][j] = e[j][i] = min(e[i][j], e[i][k] + e[k][j]);
    }

    cin >> Q;
    rep(_, Q) {
        ll s, t;
        cin >> s >> t;
        s--; t--;
        cout << (e[s][t] < INF? e[s][t]-1 : -1) << endl;
    }
}


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

const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const int MOD=1000000007;

int main(){
	ll x;cin>>x;
	cout<<((x/500)*1000+(x%500)/5*5)<<endl;
}

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

using namespace std;

typedef long long ll;

ll com[70][70];

int main(){
        ll N, A, B;
        cin>>N>>A>>B;
        for(int i=0;i<=66;i++){
                for(int j=0;j<=66;j++){
                        if(j==0||i==j){
                                com[i][j]=1LL;
                        }
                        else{
                                com[i][j]=com[i-1][j-1]+com[i-1][j];
                        }
                }
        }
        vector <ll> v(N);
        for(int i=0;i<N;i++){
                cin>>v[i];
        }
        sort(v.begin(), v.end());
        reverse(v.begin(), v.end());
        ll mn=v[A-1];
        ll sum=0;
        ll cnta=0, cntb=0, cnt=0;
        for(int i=0;i<A;i++){
                sum+=v[i];
        }
        cout<<setprecision(10)<<(double)sum/(double)(A)<<endl;
        bool update=true;
        for(int i=0;i<A;i++){
                if(v[i]!=mn){
                        update=false;
                }
        }
        for(int i=0;i<A;i++){
                if(v[i]==mn){
                        cnta++;
                }
        }
        for(int i=0;i<B;i++){
                if(v[i]==mn){
                        cntb++;
                }
        }
        for(int i=0;i<N;i++){
                if(v[i]==mn){
                        cnt++;
                }
        }
        ll res=0;
        for(int i=cnta;i<=(update?cntb:cnta);i++){
                res+=com[cnt][i];
        }
        cout<<res<<endl;
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int s[n];
    int ans=0;
    for(int i=0;i<n;i++){
      cin>>s[i];  
      ans+=s[i];
    }
    if(ans%10!=0){
     cout<<ans<<endl;
     return 0;
    }
    sort(s,s+n);
    for(int i=0;i<n;i++){
      if(s[i]%10!=0){
        cout<<ans-s[i]<<endl;
        return 0;
      }
    }
    cout<<0<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int a[105];
int main()
{
    int a,b,c,x,y;
    int biao,ea,eb;
    int gmin,ans;
    scanf("%d%d%d%d%d",&a,&b,&c,&x,&y);
    biao = (a+b < 2*c) ? (a+b) : 2*c;
    ea =  (a<2*c) ?  a : 2*c;
    eb =  (b<2*c) ?  b : 2*c;
    x < y ? (ans = x*biao + (y-x)*eb ) :(ans = y*biao + (x-y)*ea );
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256