akhauriyash/Code-Regression huggingface dataset:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from copy import copy 
def main():
    S = readline().decode().rstrip()
    P = int(1e9)+7
    DP = [0 for _ in range(13)]
    DP[0] = 1
    mul = 0
    for k in reversed(S):
        nxDP = [0 for _ in range(13)]
        if k == '?':
            for j in range(10):
                r = (j*pow(10, mul, 13))%13
                for i in range(13):
                    nxDP[(r+i)%13] += DP[i] 
                    nxDP[(r+i)%13] %= P  
        else:
            r = ((ord(k)-ord('0'))*pow(10, mul, 13))%13
            for i in range(13):
                nxDP[(r+i)%13] += DP[i] 
                nxDP[(r+i)%13] %= P
        mul += 1
        DP = copy(nxDP)
    print(DP[5])
if __name__ == '__main__':
    main()

Measured memory_bytes: 44396
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
#define mod 1000000007
#define all(x) (x).begin(),(x).end()
 
#define REP(i, n) for(int i = 0; i < (n); i++)
#define NREP(i, n) for(int i = 1; i <= (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.size()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>());
#define VSORT(v) sort(v.begin(),v.end());
#define VGSORT(v) sort(v.begin(),v.end(),greater<int>());
#define REV(a) reverse(begin(a),end(a));

int nums(int n){
	return to_string(n).length();
}
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	cout << fixed << setprecision(7);
////////////////////////////////////////////
	string s,t,u;
	cin >> s >> t;
	int a,b;
	cin >> a >> b >> u;
	if(u==s){
		a--;
	}else{
		b--;
	}
	cout << a << ' ' << b << endl;
///////////////////////////////////////////
}


Measured memory_bytes: 256
from bisect import bisect
import sys
readline = sys.stdin.readline
write = sys.stdout.write

def construct(N, S, base, MOD):
    L = 26
    root = [0, 0, N-1, [None]*L]
    nds = [root]
    for i, s in enumerate(S):
        node = root
        for c in s:
            h, a, b, nt = node
            if nt[c] is None:
                h1 = (h * base + c+1) % MOD
                nt[c] = nd = [h1, i, i, [None]*L]
                nds.append(nd)
            else:
                nd = nt[c]
                nd[1] = min(i, nd[1])
                nd[2] = max(i, nd[2])
            node = nt[c]
    H = {}
    for h, a, b, _ in nds:
        H[h] = (a, b)
    return H

def solve():
    N, Q = map(int, readline().split())

    MOD = 10**18 + 3; base = 41
    ca = ord('a')
    f = lambda x: ord(x) - ca
    A = [list(map(f, readline().strip())) for i in range(N)]
    A.sort()
    ha = construct(N, A, base, MOD)
    B = [(s[::-1], i) for i, s in enumerate(A)]
    B.sort(key = lambda x: x[0])
    C = [0]*N
    for i, (b, j) in enumerate(B):
        C[j] = i
    B = [b for b, j in B]
    hb = construct(N, B, base, MOD)

    N0 = 2**(N-1).bit_length()
    data = [None]*(2*N0)
    for i in range(N):
        data[N0-1+i] = [C[i]]
    for i in range(N, N0):
        data[N0-1+i] = [-1]
    for i in range(N0-2, -1, -1):
        p = data[2*i+1]; q = data[2*i+2]
        pl = len(p); ql = len(q)
        res = [0]*(pl + ql)
        a = b = 0
        while a < pl and b < ql:
            if p[a] < q[b]:
                res[a+b] = p[a]
                a += 1
            else:
                res[a+b] = q[b]
                b += 1
        while a < pl:
            res[a+b] = p[a]
            a += 1
        while b < ql:
            res[a+b] = q[b]
            b += 1
        data[i] = res

    def query(l, r, a, b):
        L = l + N0; R = r + N0
        s = 0
        while L < R:
            if R & 1:
                R -= 1
                s += bisect(data[R-1], b-1) - bisect(data[R-1], a-1)
            if L & 1:
                s += bisect(data[L-1], b-1) - bisect(data[L-1], a-1)
                L += 1
            L >>= 1; R >>= 1
        return s
    for i in range(Q):
        p, s = readline().strip().split()
        h1 = h2 = 0
        for c in map(f, p):
            h1 = (h1 * base + c+1) % MOD
        for c in map(f, s[::-1]):
            h2 = (h2 * base + c+1) % MOD
        if h1 not in ha or h2 not in hb:
            write("0\n")
            continue
        p0, p1 = ha[h1]
        q0, q1 = hb[h2]
        write("%d\n" % query(p0, p1+1, q0, q1+1))
solve()


Measured memory_bytes: 1114844
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextDouble()) {
            double a = sc.nextDouble();
            double b = sc.nextDouble();
            double c = sc.nextDouble();
            double d = sc.nextDouble();
            double e = sc.nextDouble();
            double f = sc.nextDouble();

            double x = (c * e - b * f) / (a * e - b * d);
            double y = (c * d - a * f) / (b * d - a * e);

            if (x == 0) {
                x = 0;
            }
            if (y == 0) {
                y = 0;
            }
            System.out.printf("%.3f %.3f\n", x, y);
        }
    }
}

Measured memory_bytes: 20552
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
int N,M;
int a[60],L[60];
bool used[110];
map<int,int> m;
vector<int> v;
int main()
{
	memset(used,false,sizeof(used));
	cin >> N >> M;
	rep(i,M)cin >> a[i] >> L[i];
	rep(i,M)
	{
		for(int j=a[i];j<a[i]+L[i];j++)
		{
			used[j%N]=true;
		}
	}
	int cnt=0;
	rep(i,N)
	{
		if(used[i])cnt++;
		else
		{
			if(cnt)v.pb(cnt);
			cnt = 0;
		}
	}
	if(cnt)v.pb(cnt);
	if(used[0]&&used[N-1]&&v.size()>1)
	{
		int p = v.back();
		v[0]+=p;
		v.pop_back();
	}
	sort(all(v));
	rep(i,v.size())m[v[i]]++;
	v.erase(unique(all(v)),v.end());
	int h = v.size();
	for(int i=h-1;i>=0;i--)cout << v[i] << ' ' << m[v[i]] << endl;
	return 0;
}


Measured memory_bytes: 1220
#include <iostream>

using namespace std;

int main() {
    int N, Q;
    scanf("%d %d", &N, &Q);
    char S[N];
    scanf("%s", S);
    int l[Q], r[Q];
    for (int i=0; i<Q; i++) scanf("%d %d", &l[i], &r[i]);

    int AC[N];
    int cnt = 0;
    bool flag = false;
    for (int i=0; i<N; i++) {
        if (S[i] == 'A') {
            flag = true;
        } else if (S[i] == 'C' && flag == true) {
            flag = false;
            cnt++;
        } else {
            flag = false;
        }
        AC[i] = cnt;
    }
    for (int i=0; i<Q; i++)
        printf("%d\n", AC[r[i]-1] - AC[l[i]-1]);

    return 0;
}


Measured memory_bytes: 2048
H, W = map(int, input().split())
S = [input() for i in range(H)]
dd = [(0, -1), (-1, 0), (0, 1), (1, 0)]
for i in range(H):
    for j in range(W):
        if S[i][j] == '.':
            continue
        for dx, dy in dd:
            nx = j + dx; ny = i + dy
            if 0 <= nx < W and 0 <= ny < H:
                if S[ny][nx] == '#':
                    break
        else:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    //(sx,sy)にいて上下左右に距離1動くことができる
    int up = ty - sy;
    int right = tx - sx;
    string ans;
    REP(i, up) { ans += "U"; }
    REP(i, right) { ans += "R"; }
    REP(i, up) { ans += "D"; }
    REP(i, right) { ans += 'L'; }
    ans += 'D';
    REP(i, right + 1) { ans += "R"; }
    REP(i, up + 1) { ans += "U"; }
    ans += "L";
    ans += "U";
    REP(i, right + 1) { ans += "L"; }
    REP(i, up + 1) { ans += "D"; }
    ans += 'R';
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>

using namespace std;


int N,M,K;
int main(){
	cin >> N >> M >> K;
	for(int i=0;i<=N;i++){
		for(int j=0;j<=M;j++){
			if(M*i+N*j-2*i*j==K){
				printf("Yes\n");
				return 0;
			}
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define F(x,e) for(x=0;x<e;x++)
int main(){
  int i,j,k,n,m,l,*a,*b;
  long *c;
  scanf("%d%d%d",&n,&m,&l);
  a=(int*)calloc(n*m,sizeof(int));
  b=(int*)calloc(m*l,sizeof(int));
  c=(long*)calloc(n*l,sizeof(long));
  F(i,n)F(j,m)scanf(" %d",&a[i*m+j]);
  F(i,m)F(j,l)scanf(" %d",&b[i*l+j]);
  F(i,n)F(j,l){F(k,m)c[i*l+j]+=a[i*m+k]*b[k*l+j];printf("%ld%c",c[i*l+j],j==l-1?'\n':' ');}
  return 0;
}

Measured memory_bytes: 768
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#define N 51
using namespace std;
typedef long long ll;
const int Mod = 1e9 + 7;

struct Matrix {
    int n;
    ll a[N][N];

    Matrix(int _n = 0, int _a = 0) {
        memset(a, 0, sizeof a);
        n = _n;
        for (int i = 0; i < n; ++i)
            a[i][i] = _a;
    }

    Matrix operator * (const Matrix& b) {
        Matrix res = Matrix(n, 0);
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j) if (a[i][j])
                for (int k = 0; k < n; ++k)
                    (res.a[i][k] += 1LL * a[i][j] * b.a[j][k] % Mod) %= Mod;
        return res;
    }

    Matrix operator ^ (ll p) {
        Matrix res = Matrix(n, 1), x = *this;
        while (p) {
            if (p & 1) res = res * x;
            x = x * x;
            p >>= 1;
        }
        return res;
    }
};

int n;
ll K;

int main() {
#ifdef whyqx
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif
    cin >> n >> K;
    Matrix bs = Matrix(n, 0), res;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            scanf("%lld", &bs.a[i][j]);
    res = bs ^ K;
    ll ans = 0;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            (ans += res.a[i][j]) %= Mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include "iostream"

using namespace std;

static const int MAX = 100000;
static const int SENTINEL = 200000000;

struct Card {
	char suit;
	int value;
};

Card L[MAX / 2 + 2], R[MAX / 2 + 2];


void marge( Card s[500000], int head, int mid, int tail) {

	Card x[500000];
	int m = mid;
	
	for (int i = head; i < tail; i++) {
		x[i] = s[i];
	}
	
	for (int i = head; i < tail; i++) {
		if (mid == tail) {
			s[i] = x[head];
			head++;
		}
		else if (head == m) {
			s[i] = x[mid];
			mid++;
		}
		else if (x[head].value <= x[mid].value) {
			s[i] = x[head];
			head++;
		}
		else {
			s[i] = x[mid];
			mid++;
		}
	}

}

//head 0???????????????
//tail ?????????????´???????????¬?????????????n = 10?????????tail = 10

void msort(Card s[500000], int head, int tail) {

	if (tail - head <= 1) return;

	int mid = head + (tail - head) / 2;

	msort(s, head, mid);
	msort(s, mid, tail);

	marge(s, head, mid, tail);
}


int partition( Card A[], int n, int p, int r ) {
	int i, j;
	Card t, x;

	x = A[r];
	i = p - 1;

	for (j = p; j < r; j++) {
		if (A[j].value <= x.value) {
			i++;
			t = A[i]; A[i] = A[j]; A[j] = t;
		}
	}
	t = A[i + 1]; A[i + 1] = A[r]; A[r] = t;

	return i + 1;
}

void quickSort( Card A[], int n, int p, int r ) {
	int q;
	if (p >= r) return;
	q = partition(A, n, p, r);
	/*
	cout << endl;
	for (int i = p; i <= r; i++) {
		cout << A[i].suit << " " << A[i].value << endl;
	}
	cout << endl;
	*/
	quickSort(A, n, p, q - 1);
	quickSort(A, n, q + 1, r);

}


int main() {

	int n, i, v;
	Card A[MAX], B[MAX];

	char S[10];
	bool stable = true;

	cin >> n;

	for (i = 0; i < n; i++) {
		cin >> S;
		cin >> v;

		A[i].suit = B[i].suit = S[0];
		A[i].value = B[i].value = v;
	}

	msort(A, 0, n);
	quickSort( B, n, 0, n-1 );

	for (int i = 0; i < n; i++) {
		if (A[i].suit != B[i].suit) {
			stable = false;
			break;
		}
	}
	if (stable) cout << "Stable" << endl;
	else cout << "Not stable" << endl;

	for (int i = 0; i < n; i++) {
		cout << B[i].suit << " " << B[i].value << endl;
	}

	return 0;
}

Measured memory_bytes: 3516
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  int m=0,mi=0;
  for (int i=0; i< n;i++){
    cin >> v[i];
    if (v[i] > m){
      m=v[i];
      mi=i;
    }
  }
  int sum=0;
  for (int j=0;j < n;j++){
    if (j==mi) {
      sum+=v[j]/2;
      continue;
    }
    sum+=v[j];
  }
  cout << sum << endl;
  return 0;
}
  


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

        private static int iN = 5;
        private static int iK = 3;

    static void Main(string[] args)
    {
            // 入力
            string sS = Console.ReadLine().Trim();
            int iNN = int.Parse(sS);
            List<string> lstS = new List<string>();
            for (int i = 0; i < iNN; i++) { lstS.Add(Console.ReadLine().Trim().Substring(0, 1)); }   // 先頭1文字のみでよい
            // debug入力
            //int iNN = 100000;
            //List<string> lstS = new List<string>();
            //Random rD = new Random(1000);
            //for (int i = 0; i < iNN; i++)
            //{
            //    char rN = (char)('A' + rD.Next(25));
            //    lstS.Add(new String(new char[] { rN }));
            //}

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            Decimal dOut = 0;
            //lstS.Sort();
            List<int> lstC = new List<int>();
            lstC.Add(lstS.Count(x => x == "M"));
            lstC.Add(lstS.Count(x => x == "A"));
            lstC.Add(lstS.Count(x => x == "R"));
            lstC.Add(lstS.Count(x => x == "C"));
            lstC.Add(lstS.Count(x => x == "H"));
            if (lstC.Count > 2)             // 3種類以上ないとダメ
            {
                // 前準備
                iN = lstC.Count;
                List<List<int>> lstCmp = new List<List<int>>();     // 全組合せ
                List<int> lstTmp = new List<int>();                 // テンポラリ
                GetCom(lstCmp, lstTmp);                             // 全組合せ取得
                for (int i = 0; i < lstCmp.Count; i++)
                {
                    dOut += (Decimal)lstC[lstCmp[i][0]] * (Decimal)lstC[lstCmp[i][1]] * (Decimal)lstC[lstCmp[i][2]];
                }
            }

            // 出力
            Console.WriteLine("{0}", dOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

        // 組合せ取得
        private static void GetCom(List<List<int>> lstCmp, List<int> lstTmp)
        {
            for (int j = 0; j < iN; j++)
            {
                int iKn = 1;
                List<int> lstTm2 = new List<int>();
                lstTm2.AddRange(lstTmp);
                lstTm2.Add(j);
                GetCo2(lstCmp, lstTm2, j, iKn);
            }
        }

        // 組合せ取得その２
        private static void GetCo2(List<List<int>> lstCmp, List<int> lstTmp, int i, int iKn)
        {
            if (iKn == iK) { lstCmp.Add(lstTmp); return; }
            for (int j = i + 1; j < iN; j++)
            {
                List<int> lstTm2 = new List<int>();
                lstTm2.AddRange(lstTmp);
                lstTm2.Add(j);
                GetCo2(lstCmp, lstTm2, j, iKn + 1);
            }
        }

}


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

#define MAXN 200005
int n,x;
struct aa
{
	int a,b;
}a[MAXN];

bool cmp(aa a,aa b) {
	return a.b < b.b;
}

int main()
{
	cin >> n;
	for(int i = 1; i <= n; i ++)
		cin >> a[i].a >> a[i].b;
	sort(a+1,a+n+1,cmp);
	x = 0x3f3f3f3f;
	for(int i = n; i >= 1; i --)
	{
		x = min(a[i].b-a[i].a,x-a[i].a);
	//	cout<<i<<" "<<a[i].b<<" "<<a[i].a<<"\n";
		if(x < 0) {
			cout<<"No"; 
			return 0;
		}
	}
	cout<<"Yes";
	return 0;
 } 
 /*
5
2 4
1 8
1 9
4 9
3 12
 */

Measured memory_bytes: 1792
//by rng_59
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <memory.h>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;

#define REP(i,n) for(int (i)=0; i<(int)(n); i++)

int main(void) {
	int N;
	cin >> N;
	cout << (N+1) / 2 << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
#define dump(x) cout << #x << " = " << x << "\n";
#define SELECTOR(_1, _2, _3, SELECT, ...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__, _rep1, _rep0)(__VA_ARGS__)
#define _rep0(i, n) for (ll i = 0; i < n; ++i)
#define _rep1(i, k, n) for (ll i = k; i < n; ++i)
template <typename T> void vecout(const T &v) {
  for(auto it=v.begin();it!=v.end();++it,cout<<(it!=v.end()?" ":"\n")) {
    cout << *it;
  }
}

void solve(){
  // main coding
  ll n,k; cin>>n>>k;
  vector<ll> A(n);
  rep(i,n) cin>>A[i];
  vector<bool> dp(k+1,false);
  rep(i,k) {
    if(dp.at(i)) continue;
    rep(j,n) if(i+A[j]<=k) dp.at(i+A[j])=true;
  }
  cout<<(dp.at(k)?"First":"Second")<<"\n";
}

int main(){
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  solve();
  return 0;
}


Measured memory_bytes: 256
n, w = gets.chomp.split.map(&:to_i)
items = []
n.times{items << gets.chomp.split.map(&:to_i)}

maxes = Array.new(w + 1, 0)
items.each{|v, w| maxes[w] = v if maxes[w] < v}
#p maxes
#puts
1.upto(w){|i|
    max = 0
    1.upto(i / 2){|j|
        val = maxes[j] + maxes[i - j]
        max = val if max < val
    }
    maxes[i] = [max, maxes[i]].max
#p maxes
}
puts maxes.last

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

int main(){
	string w;
	cin >> w;
	int cnt[26]={};
	for(int i=0;i<w.length();i++){
		cnt[w[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		// cout << (char)(i+'a') << ": " << cnt[i] << endl;
		if(cnt[i]%2 != 0){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String[] sl = s.split("[\\s]+");
    int n = Integer.parseInt(sl[0]);
    int m = Integer.parseInt(sl[1]);
    int x = Integer.parseInt(sl[2]);
    HashSet<Integer> hs = new HashSet<>();
    s = r.readLine();
    sl = s.split("[\\s]+");
    for(int i = 0; i < m; i++)
    {
      hs.add(Integer.parseInt(sl[i]));
    }
    //System.out.println(hs);

    int a = 0;
    for(int i = 0; i <= x; i++)
    {
      if(hs.contains(i))
      {
        a++;
      }
    }

    int b = 0;
    for(int i = x; i <= n; i++)
    {
      if(hs.contains(i))
      {
        b++;
      }
    }


    System.out.println(Math.min(a, b));

  }

}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
#define int long long
#define pb push_back
#define x first
#define ld long double
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) a.begin(),a.end()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int cur = 0;
    for (int i = 1; ; i++) {
        cur += i;
        if (cur >= n) {
            cout << i << '\n';
            rr;
        }
    }
}


Measured memory_bytes: 256
A, B, C, D, E, F = map(int, input().split())
maxDensity = 0
ans_water = A * 100
ans_sugar = 0

for i in range(F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        water = (i * A + j * B) * 100
        rest = F - water
        if water > F:
            continue
        for k in range(rest // C + 1):
            for l in range(rest // D + 1):
                sugar = k * C + l * D
                if water + sugar > F:
                    continue
                if sugar * 100 > water * E:
                    continue
                if sugar + water == 0:
                    density = 0
                else:
                    density = sugar / (sugar + water)
                if maxDensity < density:
                    ans_water = water
                    ans_sugar = sugar
                    maxDensity = density


print(ans_water + ans_sugar, ans_sugar)


Measured memory_bytes: 3064
# ARC058D - いろはちゃんとマス目 / Iroha and a Grid (ABC042D)
def get_fact(lim):
    # compute a toble of factorials (1-idx)
    fact = [1] * (lim + 1)
    x = 1
    for i in range(1, lim + 1):
        x = (x * i) % MOD
        fact[i] = x
    return fact

def get_inv(lim):
    # compute a toble of inverse factorials (1-idx)
    inv = [1] * (lim + 1)
    inv[lim] = pow(fact[lim], MOD - 2, MOD)
    x = inv[lim]
    for i in range(lim - 1, 0, -1):
        x = (x * (i + 1)) % MOD
        inv[i] = x
    return inv

def comb(n: int, r: int) -> int:
    # compute nCr (n! / r!(n - r)!)
    return fact[n] * inv[n - r] * inv[r]


def main():
    global MOD, fact, inv
    H, W, A, B = tuple(map(int, input().split()))
    MOD = 10 ** 9 + 7
    fact = get_fact(H + W)
    inv = get_inv(H + W)
    ans = 0
    for i in range(B, W):
        ans += comb(i + H - A - 1, i) * comb(W - i - 1 + A - 1, A - 1)
    print(ans % MOD)


if __name__ == "__main__":
    main()

Measured memory_bytes: 18804
N=parse(Int,readline())
S=map(x->parse(Int,x),split(readline()))
ans=0
for i=1:N-1
	now=0
	L=1
	R=N
	while R>i+1&&((R-1)%i!=0||L<R)
		ans=max(ans,now+=S[L]+S[R])
		L+=i
		R-=i
	end
end
println(ans)


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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

constexpr int mod = 1e9 + 7;
constexpr int32_t inf = 1001001001;
constexpr int64_t infll = 1001001001001001001ll;
constexpr int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const string YES = "YES", NO = "NO", Yes = "Yes", No = "No", yes = "yes", no = "no";

// clang-format off
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }

template <typename T> void sort(vector<T> &v) { sort(all(v)); }
template <typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int a = in(), b = in(), k = in();

  int cnt = 0;
  for (int i = 100; cnt < k; --i) {
    if ((a % i == 0) && (b % i == 0)) {
      cnt++;
      cerr << i << endl;
    }
    if (cnt == k) cout << i << endl;
  }
}


Measured memory_bytes: 256
=begin
loop do
    h, w = gets.chomp.split.map(&:to_i)
        if h ==0 && w ==0
            break
        elsif h.odd?
            (w / 2).times do
                print "."
                print "#"
            end
            print "."
        elsif h.even?
            (w / 2).times do
                print "#"
                print "."
            end
        end
        puts ""
=end
def line(w, x, y)
    l = ""
    w.times do |i|
        if i.even?
            l += x
        else
            l +=y
        end
    end
    puts l
end

loop do
    h, w = gets.chomp.split.map(&:to_i)
    if h == 0 && w == 0
        break
    end
    h.times do |i|
        if i.even?
            line(w, "#", ".")
        else
            line(w, ".", "#")
        end
    end
    puts ""
end

Measured memory_bytes: 10168
def f(myC, s, chrs, lst, k):
    if len(lst) == k:
        print(lst[k - 1])
        exit()
    else:
        for c in chrs:
            buf = myC + c
            if buf in s:
                lst += [buf]
                ##print(lst)
                f(buf, s, chrs, lst, k)

if __name__ == '__main__':
    s = input()
    k = int(input())

    chrs = sorted(list(set(s)))
    lst = f('', s, chrs, list(), k)

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

int main(){
    double n,s[10];
    
    while(cin >> n){
        double ans = 0.0;
        s[0] = n;
        
        for(int i = 1 ; i < 10 ;i++){
            if((i+1)%2==0) s[i] = 2.0*s[i-1];
            else s[i] = s[i-1] / 3.0;
        }
        
        for(int i = 0 ; i < 10 ; i++) ans += s[i];
        printf("%.8f\n" ,ans);
    }

    return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
typedef pair<ll,ll> ipair;
#define F first
#define S second
 
/*
//functions from gfg
 
long long int power(long long int x,long long int y,long long  int p)
{
    long long int res = 1;     // Initialize result
 
    x = x % p;  // Update x if it is more than or 
                // equal to p
 
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            {//d=(long double)x/p;
            res = (res*x) % p;
            }
 
        // y must be even now
        y = y>>1; // y = y/2
        x=(x*x)%p;
        
    }
    return res%p;
}
 
long long int gcd(long long int a,long long int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
 
long long int binomialCoeff(long long int n, ll k) 
{ 
    ll res = 1; 
  
    // Since C(n, k) = C(n, n-k) 
    if (k > n - k) 
        k = n - k; 
  
    // Calculate value of [n*(n-1)*---*(n-k+1)] / [k*(k-1)*---*1] 
    for (ll i = 0; i < k; ++i) 
    { 
        res *= (n - i); 
        res /= (i + 1); 
    } 
  
    return res; 
} 
 

void sieve(int n, vector<ll> &primes) 
{ 
    vector<int> prime(n,1);
    ll p;
    for ( p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == 1) 
        { 
            
            for (int i=p*p; i<=n; i += p) 
                prime[i] = 0; 
        } 
    } 
  
    for(p=2;p<=n;p++)
    {
        if(prime[p])
        primes.pb(p);
    }
   
} 


void dfs(vector<ll> adj[] ,ll src,vector<ll> &vis)
{
    vis[src]=1;
    for(ll i=0;i<adj[src].size();i++)
    {
        if(vis[adj[src][i]]==0)
        dfs(adj,adj[src][i],vis)
    }
}
 
*/

int main() {
	ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);
    
    
	ll n,i,j,p,k,m,ans=0;
    cin>>n;
    vector<pair<pair<ll,ll>,ll> > a(2*n),b(n);
    for(i=0;i<2*n;i++)
    {
        cin>>a[i].F.F>>a[i].F.S;
        if(i>=n)
        a[i].S = 1;
        else a[i].S = 0;
    }
    sort(a.begin(),a.end());
    // for(i=0;i<2*n;i++)
    // {
    //     cout<<a[i].F.F<<" "<<a[i].F.S<<" "<<a[i].S<<endl;
    // }
    set<ll> s;
    ans=0;
    for(i=0;i<2*n;i++)
    {
        if(a[i].S == 0)
        s.insert(a[i].F.S);
        else
        {
            auto it = s.lower_bound(a[i].F.S);
            if(it!=s.begin())
            {
                it--;
                s.erase(it);
                ans++;
            }
        }
    }
    cout<<ans<<endl;
    
    
    
    
    
    // for(i=0;i<n;i++)
    // {
    //     cout<<a[i]<<" ";
    // }
    // cout<<endl;
    
	return 0;
}

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

#define p 1000000007

int  main()
{
    int i,n;
    cin >> n;
    
    int h[n];
    for(i=0;i<n;i++)
        cin >> h[i];
        
    int dp[n+1];
    
    dp[0] = 0;
    dp[1] = abs(h[1]-h[0]);
    
    for(i=2;i<n;i++)
    {
        dp[i] = min(dp[i-2]+abs(h[i-2]-h[i]), dp[i-1]+abs(h[i-1]-h[i]));   
    }
    
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(x>=r){
		if(W>=x+r){
			if(H>=y+r){
				if(y>=r){
					printf("Yes\n");
				}else printf("No\n");
			}else printf("No\n");
		}else printf("No\n");
	}else printf("No\n");
	return 0;
}

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

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  int sum = a + b + c;
  int maxi = max(a, max(b, c));
  if (sum % 2 == (maxi * 3) % 2)
  {
    cout << ((maxi * 3) - sum) / 2 << endl;
  }
  else
  {
    cout << (((maxi + 1) * 3) - sum) / 2 << endl;
  }
}

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

int main() {
    string S;
    cin >> S;
    int N = S.length() + 1;
    vector<ll> a(N, 0);

    for (int i = 0; i < N - 1; i++) {
        if (S[i] == '<') {
            a[i + 1] = a[i] + 1;
            continue;
        }

        int n = i;
        while (n + 1 < N - 1 && S[n + 1] == '>') {
            n++;
        }
        int cnt = n - i + 1;
        if (a[i] - cnt < 0) {
            a[i] += cnt - a[i];
        }

        a[n + 1] = 0;
        for (int j = n; j > i; j--) {
            a[j] = a[j + 1] + 1;
        }
        i = n;
    }

    // for (int v : a) {
    //     cout << v << " ";
    // }
    // cout << endl;
    cout << accumulate(a.begin(), a.end(), 0ll) << endl;
}


Measured memory_bytes: 4740
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	int v[55], c[55];
	for (i = 0; i < n; i++)
		scanf("%d", &v[i]);
	for (i = 0; i < n; i++)
		scanf("%d", &c[i]);
	int ans = 0;
	for (i = 0; i < n; i++)
		if (v[i] - c[i] > 0)
			ans += v[i] - c[i];
	printf("%d", ans);
	return 0;
}

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

using namespace std;

template <typename T=int>
struct Fenwick {
    int n;
    vector<T> v;
    
    Fenwick(int size = 100005) : n(size), v(n+1, 0) {}
    inline void add(int p, T val) {
        for (; p <= n; p += (p&-p)) { v[p] += val; }
    }
    inline T query(int p) {
        T tmp = 0;
        for (; p > 0; p -= (p&-p)) { tmp += v[p]; }
        return tmp;
    }
    inline T query(int l, int r) {
        return query(r) - query(l-1);
    }
};
// when range [l, r), has property notP~P, want first P.
// when return r, means not found.
template <typename T>
T bs_first(T l, T r, function<bool (T)> f) {
    assert(l < r);
    T mid;
    while (l != r) {
        mid = l + (r-l)/2;
        if (f(mid)) {
            r = mid;
        }else {
            l = mid + 1;
        }
    }
    return r;
}
void solve() {
    int n; cin >> n;
    vector<int> a(n+1);
    vector<int> pos(n+1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        pos[a[i]] = i;
    }
    Fenwick<int> f(n);
    long long res = 0;
    for (int i = n; i >= 1; i--) {
        int k = pos[i];
        int lef = f.query(k);
        int l1=0, l0=0;
        if (lef > 0) l0 = bs_first<int>(1, k, [&](int x){return f.query(x)>=lef;});
        if (lef > 1) l1 = bs_first<int>(1, k, [&](int x){return f.query(x)>=lef-1;});
        int r0=n+1, r1=n+1;
        int rig = f.query(k, n);
        if (rig > 0) r0 = bs_first<int>(k,n+1, [&](int x){return f.query(k, x)>=1;});
        if (rig > 1) r1 = bs_first<int>(k,n+1, [&](int x){return f.query(k, x)>=2;});
        res += 1ll*(l0-l1)*(r0-k)*i;
        res += 1ll*(r1-r0)*(k-l0)*i;
        f.add(k, 1);
    }
    cout << res;
}

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


Measured memory_bytes: 1408
#include<iostream>
#include<cmath>

using namespace std;

int main(){
    int n;
    long long a[100000];
    long long b[100000];
    cin>>n;
    for(int i = 0; i < n; i++){
        cin>>a[i];
    }
    a[n] = a[0];
    long long s = a[0];
    for(int i = 1; i < n; i++){
        s = a[i] - s;
    }
    b[0] = s;
    cout<<b[0]<<endl;
    for(int i = 1; i < n; i++){
        b[i] = 2 * a[i-1] - b[i-1];
        cout<<b[i]<<endl;
    }
}

Measured memory_bytes: 2816
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#define int long long
#define mod 1000000007
using namespace std;

vector<int>b;
int c[200001];
signed main() {
	int a; cin >> a;
	for (int i = 0; i < a; i++) {
		int t; cin >> t;
		if (b.size() == 0 || *b.rbegin() != t) {
			b.push_back(t);
		}
	}
	a = b.size();
	int ans = 1;
	for (int i = 0; i < a; i++) {
		int k = ans;
		if(i+1==a||b[i]!=b[i+1])ans += c[b[i]];
		c[b[i]] += k;
		ans %= mod;
	}
	cout << ans << endl;
}

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

int main(){


  double r , w, c, r2,sum;

  while(1){  
    cin >> r >> w >> c >> r2;	 
    if(r == 0 &&  w == 0 && c == 0 && r2 == 0) break;


    int cnt = 0;
    for(int i=0;cnt<1;i++){
      sum = (r + r2 * i) / w;
      if(c <= sum){cout << i << endl;
	cnt ++;}

    }

  }
}


Measured memory_bytes: 3132
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cstdlib>

typedef long long ll;

using namespace std;

int main() {
  int N;
  cin >> N;
  ll A[N], B[N];
  for (int i = 0; i <= N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> B[i];
  }
  ll s = 0;
  for (int i = 0; i < N; i++) {
    s += min(A[i], B[i]);
    B[i] -= min(A[i], B[i]);
    A[i] -= min(A[i], B[i]);
    s += min(A[i + 1], B[i]);
    A[i+1] -= min(A[i + 1], B[i]);
  }
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 1792
pub struct Poper<'a> {
	iter: std::str::SplitWhitespace<'a>,
}

impl<'a> Poper<'a> {
	pub fn new(iter: std::str::SplitWhitespace) -> Poper {
		Poper { iter: iter }
	}
	pub fn read<T: std::str::FromStr>(&mut self) -> T
	where
		<T as std::str::FromStr>::Err: std::fmt::Debug,
	{
		self.iter.next().unwrap().parse().unwrap()
	}
}

// const MOD: u64 = 1_000_000_007;

fn main() {
	let input = {
		use std::io::Read;
		let mut s = String::new();
		std::io::stdin().read_to_string(&mut s).unwrap();
		s
	};
	let mut iter = Poper::new(input.split_whitespace());

	let b: i64 = iter.read();
	let x: i64 = iter.read();

let t: String = (x - b + 1..x + b)
  .into_iter()
  .map(|n|n.to_string()).collect::<Vec<String>>().join(" ");

println!("{}", t);


}


Measured memory_bytes: 4352
H,W=map(int,input().split())
N=int(input())
A=list(map(int,input().split()))
C=[[0 for w in range(W)] for h in range(H)]

i=1
for h in range(H):
    for w in (range(W) if h%2==0 else range(W-1,-1,-1)):
        #print(h,w)
        C[h][w]=i
        A[i-1]-=1
        if not A[i-1]:
            i+=1
for c in C:
    c=list(map(str,c))
    print(" ".join(c))


Measured memory_bytes: 40304
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String [] str = new String[n];
        int count = 0;
        int A = 0;
        int B = 0;
        int BA = 0;
        for (int i = 0; i < n; ++i) {
            str[i] = scanner.next();
        }
        for (int i = 0; i < n; ++i) {
            String current = str[i];
            for (int j = 0; j < current.length() - 2; ++j) {
                if (current.charAt(j) == 'A' && current.charAt(j + 1) == 'B') {
                    ++count;
                }
            }
            if (current.charAt(0) == 'B' && current.charAt(current.length() - 1) == 'A') {
                ++BA;
            } else if (current.charAt(0) == 'B') {
                ++B;
            } else if (current.charAt(current.length() - 1) == 'A') {
                ++A;
            }
        }
        if (BA >= 2) {
            count += BA - 1;
            if (A > 0) {
                ++count;
            }
            if (B > 0) {
                ++count;
            }
        } else {
            if (BA > 0) {
                if (A > 0) {
                    ++count;
                }
                if (B > 0) {
                    ++count;
                }
            } else {
                if (A > 0 && B > 0) {
                    ++count;
                }
            }
        }
        if (A - 1 > 0 && B - 1 > 0) {
            count += Math.min(A, B) - 1;
        }

        System.out.println(count);

    }
}


Measured memory_bytes: 31908
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define UP(i,a,b) for(int i=(a); i<=(b); ++i)
#define DOWN(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) UP(i,0,(n)-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //NOTE: <a> must be sorted in advance

lng power(lng b, int n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n in O(log(n)) time

const int MOD = 1000000007; //10^9+7
const double PI = 3.1415926535897932384626;

/*********** variables ************/
int T;
lng A, B, C, D;
/**********************************/

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

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

    REP(query, T) {
        cin >> A >> B >> C >> D;
        if(A < B || D < B) {
            cout << "No" << endl;
            continue;
        }
        if(C >= B) {
            cout << "Yes" << endl;
            continue;
        }
        lng g = gcd(D, B);
        A %= B;
        lng k = (B - A) / g;
        if((B-A)%g == 0) k--;
        if(A + k*g > C) {
            cout << "No" << endl;
        }
        else {
            cout << "Yes" << endl;
        }
    }
}


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


int main(){

  int N,a=0;
  string s;
  
  cin >>N;
  
  for(int i=0;i<N;i++)
  {
  cin >>s;
    if (s=="Y"){
      a=1;
    }
  }
  
  if (a==1){
  cout <<"Four" <<endl;
  }
  else{
  cout <<"Three" <<endl;
  }

}

Measured memory_bytes: 256
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")

// #pragma GCC optimize("O3")
// #pragma GCC target("avx2")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

bool judge(int a, int b, int c) {
  if (a == b || b == c || c == a) return false;
  if (a + b <= c) return false;
  if (b + c <= a) return false;
  if (a + c <= b) return false;
  // cout << a << ' ' << b << ' ' << c << endl;
  return true;
}

void solve() {
  int N;
  cin >> N;
  vector<int> L(N);
  cin >> L;
  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 (judge(L[i], L[j], L[k])) { ans++; }
      }
    }
  }
  cout << ans << endl;
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


Measured memory_bytes: 3656
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

a,b,c=get_i
if a+b==c or b+c==a or c+a==b
    puts "Yes"
else
    puts "No"
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define For(n) for(int i = 0; i < n; i++)
#define FOR(i, r, k) for(int i = r; i < k; i ++)
#define pb push_back
#define X first
#define Y second
#define mp make_pair
const ll maxn = 5e8 + 2;;
const ll mod = 1e9 + 7;
const ll inf = 1e18 + 500;
bool isp[maxn + 100];

int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    
    ll ans = 0;
    while(true)
    {
        if(a & 1 || b & 1 || c & 1)
        {
            break;
        }
        ll aa = a;
        ll bb = b;
        ll cc = c;
        a = (bb + cc) / 2;
        b = (aa + cc) / 2;
        c = (bb + aa) / 2;
        ans ++;
        if(ans > 1e7)
        {
            ans = -1;
            break;
        }
    }
    cout << ans;
    return 0;
}


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

int main()
{
    /* ------- 宣言と入力 ------- */
    int N;
    cin >> N;

    unordered_set<string> keihin;

    for (int i = 0; i < N; i++)
    {
        string input;
        cin >> input;
        keihin.emplace(input);
    }

    /* ------- 計算 ------- */
    cout << keihin.size() << endl;
    return 0;
}


Measured memory_bytes: 17692
package main

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

func main() {
	sc := NewScanner()
	N, D := sc.NextInt(), sc.NextInt()
	D = D * D
	cnt := 0
	for i := 0; i < N; i++ {
		X, Y := sc.NextInt(), sc.NextInt()
		if X*X+Y*Y <= D {
			cnt++
		}
	}
	fmt.Println(cnt)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 5896