akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){

	int S, h, m, s;

	cin >> S;

	h = S / (60 * 60);
	m = (S - (60 * 60) * h) / 60;
	s = S % 60;

	cout << h << ':' << m << ':' << s << endl;

	return 0;

}



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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

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

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define MP make_pair
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define fst first
#define snd second

#define INF 1000000

inline int t(int x) { return x*(x+1)*(x+2)/6; }

int dp[1000010];

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

  Vi one, two, odd;
  for (int i = 1; t(i) <= 1000000; i++) {
    one.push_back(t(i));
    if (t(i)%2) odd.push_back(t(i));
  }

  for (int a : one) {
    for (int b : one) {
      two.push_back(a+b);
    }
  }
  sort(ALL(two));

  dp[0] = 0;
  REP(i, 1000000) {
    dp[i+1] = INF;
    for (int a : odd) {
      if (i+1-a < 0) break;
      dp[i+1] = min(dp[i+1-a]+1, dp[i+1]);
    }
  }  

  while (1) {
    int n;
    cin >> n;
    if (n == 0) break;

    if (n == *lower_bound(ALL(one), n)) {
      cout << 1;
    } else if (n == *lower_bound(ALL(two), n)) {
      cout << 2;
    } else {
      bool flag = false;
      for (int a : one) {
	if (n - a == *lower_bound(ALL(two), n - a)) {
	  flag = true;
	  break;
	}
      }
      if (flag) {
	cout << 3;
      } else {
	for (int a : two) {
	  if (n - a == *lower_bound(ALL(two), n - a)) {
	    flag = true;
	    break;
	  }
	}
	cout << (flag ? 4 : 5);
      }
    }

    cout << ' ' << dp[n] << endl;

  }    
  return 0;
}

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

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

    int n, k;
    cin >> n >> k;

    if((n+1) / 2 < k) puts("NO");
    else puts("YES");

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807
ll ans = 0;
vector< int > z_algorithm(const string &s) {
  vector< int > prefix(s.size());
  for(int i = 1, j = 0; i < s.size(); i++) {
    if(i + prefix[i - j] < j + prefix[j]) {
      prefix[i] = prefix[i - j];
    } else {
      int k = max(0, j + prefix[j] - i);
      while(i + k < s.size() && s[k] == s[i + k]) ++k;
      prefix[i] = k;
      j = i;
    }
  }
  prefix[0] = (int) s.size();
  return prefix;
}

int main()
{
string s;
cin >> s;
string t;
cin >> t;

string ss=s;
ll num=0,num2=0;
while(ss.size()<t.size()){
  ss=ss+ss;
}
ss=ss+ss;
ss=ss+s;
{vector< int > v=z_algorithm(t+'|'+ss);
ll n=v.size();
ll m=t.size();
vector <bool> vis(n, false);
  int ans = 0;
  for (int i = m; i < n; i++) {
    if (vis[i]) continue;
    vis[i] = true;
    if (v[i] >= m) {
      ll cnt = 1;
      int j = i;
      while (j + m < n and v[j + m] >= m) {
        j += m;
        vis[j] = true;
        cnt++;
      }
      num = max(num, cnt);
    }
}
}
//cout << ss <<" " <<num <<endl;

ss+=ss;
{vector< int > v=z_algorithm(t+'|'+ss);
ll n=v.size();
ll m=t.size();
vector <bool> vis(n, false);
  int ans = 0;
  for (int i = m; i < n; i++) {
    if (vis[i]) continue;
    vis[i] = true;
    if (v[i] >= m) {
      ll cnt = 1;
      int j = i;
      while (j + m < n and v[j + m] >= m) {
        j += m;
        vis[j] = true;
        cnt++;
      }
      num2 = max(num2, cnt);
    }
}
}

//cout << ss <<" " <<num2 <<endl;

if(num==num2)cout << num << endl;
else cout << -1 << endl;

return 0;
}


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

using namespace std;

int main() {
     int k=0,i,n;
     char s[101];
     cin.getline(s,101);
     n=strlen(s);
     for(i=0;i<=n/2-1;i++){
         if(s[i]!=s[n-i-1]){
             k++;
         }
     }
     cout<<k;
    
    return 0;
}


Measured memory_bytes: 256
//ABC093B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	long long int a, b, k;
	cin >> a >> b >> k;
	if(b-a >= 2*k){
		for(int i=0;i<k;i++){
			cout << a+i << endl;
		}
		for(int j=0;j<k;j++){
			cout << b-k+j+1 << endl;
		}
	}else{
		for(int l=a;l<=b;l++){
			cout << l << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import re
import sys
from collections import *
from functools import lru_cache
from heapq import *
from itertools import *
from statistics import *
from string import (ascii_lowercase as lcletters,
                    ascii_uppercase as ucletters,
                    ascii_letters as letters,
                    digits)

hexdigits='01234567890ABCDEFabcdef'

inf=float('inf')

sys.setrecursionlimit(2**31-1)

rfs=lambda:rl().split()
ri=lambda:int(rl())
ris=lambda:list(map(int,rfs()))
rl=lambda:next(sys.stdin)
rrs=lambda:list(map(str.strip,sys.stdin))
rs=lambda:rl().strip()
rt=lambda:sys.stdin.read()
rg=lambda:list(map(list,rrs()))

def n4(i,j):
    return [
                (i-1,j),
        (i,j+1),        (i,j-1),
                (i+1,j),
    ]

def n8(i,j):
    return [
        (i-1,j-1),(i-1,j),(i-1,j+1),
        (  i,j-1),        (  i,j+1),
        (i+1,j-1),(i+1,j),(i+1,j+1),
    ]

inb=lambda i,j,m,n:0<=i<m and 0<=j<n

###########################################

N=ri()
H=ris()

ok=True
for i in range(N-2,-1,-1):
    x,y=H[i],H[i+1]
    if x-1>y:
        ok=False
        break
    elif x-1==y:
        H[i]-=1

if ok:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 22124
import math
from functools import reduce
from collections import deque

N = int(input())
A = list(map(int, input().split()))


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


max_A = max(A)

if max_A == 1:
    print('pairwise coprime')
    exit()
# エラトステネスの篩により素数を高速で求める
# そのかんにある数値がふるい落とされたその素数をメモしておく

D = [0] * (max_A + 1)
is_prime = [True] * (max_A + 1)
is_prime[0] = False
is_prime[1] = False
prime = deque()
for i in range(2, int(max_A ** 0.5) + 1):
    if not is_prime[i]:
        continue
    for j in range(i * 2, max_A + 1, i):
        is_prime[j] = False
        D[j] = i

for i in range(len(is_prime)):
    if is_prime[i]:
        D[i] = i

pairwise = True
check = [0] * (max_A + 1)
new_A = A[:]
for i in range(N):
    min_prime = D[new_A[i]]
    while True:
        if D[min_prime] == 0:
            break

        check[D[min_prime]] += 1
        while new_A[i] % min_prime == 0:
            new_A[i] //= min_prime

        min_prime = new_A[i]

        # print(check)


# print(D)
# print(check)

if max(check) > 1:
    pairwise = False
# print(check)
if pairwise:
    print('pairwise coprime')
else:
    if gcd_list(A) == 1:
        print('setwise coprime')
    else:
        print('not coprime')


Measured memory_bytes: 213200
package main

import (
	"fmt"
)

func main() {
	var X string
	var Y string
	fmt.Scan(&X)
	fmt.Scan(&Y)

	var x int
	var y int

	if X == "A" {
		x = 10
	}
	if X == "B" {
		x = 11
	}
	if X == "C" {
		x = 12
	}
	if X == "D" {
		x = 13
	}
	if X == "E" {
		x = 14
	}
	if X == "F" {
		x = 15
	}
	if Y == "A" {
		y = 10
	}
	if Y == "B" {
		y = 11
	}
	if Y == "C" {
		y = 12
	}
	if Y == "D" {
		y = 13
	}
	if Y == "E" {
		y = 14
	}
	if Y == "F" {
		y = 15
	}
	if x < y {
		fmt.Println("<")
	}
	if x > y {
		fmt.Println(">")
	}
	if x == y {
		fmt.Println("=")
	}
}


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

using namespace std;

#define N 4200
#define INF 0x3f3f3f3f

int n,x,y,tot,head[N],f[N],g[N],h[N],ans;
char s[N];
struct edge{int v,nxt;}e[N];

void add(int x,int y){e[++tot].v=y; e[tot].nxt=head[x]; head[x]=tot;}

void dfs(int u,int fa){
	h[u]=s[u]-'0'; g[u]=0; f[u]=0;
	int t=0;
	for (int i=head[u],v;i;i=e[i].nxt)
		if ((v=e[i].v)!=fa){
			dfs(v,u);
			h[u]+=h[v];
			g[u]+=g[v]+h[v];
			if (g[v]+h[v]>f[t]+h[t]) t=v;
		}
	if (f[t]+h[t]>g[u]-g[t]-h[t]) f[u]=f[t]+h[t]-(g[u]-g[t]-h[t]);
	else f[u]=g[u]%2;
}

int main(){
	scanf("%d",&n);
	scanf("%s",s+1);
	for (int i=1;i<n;++i){
		scanf("%d%d",&x,&y);
		add(x,y); add(y,x);
	}
	ans=INF;
	for (int i=1;i<=n;++i){
		dfs(i,0);
		if (f[i]==0) ans=min(ans,g[i]/2);
	}
	if (ans<INF) printf("%d\n",ans);
	else puts("-1");
	
	return 0;
}
			

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>

using namespace std;

pair<int, int> a[111111];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i].second >> a[i].first;
    sort(a, a + n);
    cout << a[0].second + a[0].first << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#define int long long
using namespace std;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int k,m,n;
signed main(){
	n=read();
	int w1=0,w2=0;
	if(n%2==1 || n==0){puts("0");return 0;}
	n/=10;
	int ans=n;
	for(register int i=5;i<=n;i*=5){
		ans+=n/i;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
def examA():
    a, b, c, d = LI()
    ans = "No"
    if abs(a-c)<=d:
        ans = "Yes"
    if abs(a-b)<=d and abs(b-c)<=d:
        ans = "Yes"
    print(ans)


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Measured memory_bytes: 3444
#include <stdio.h>

int main(){
    int matrix[3][3];
    char x;
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            scanf("%d", &matrix[i][j]);
        }
    }
    int n;
    scanf("%d",&n);
    int input[n];
    for(int k=0;k<n;k++){
        scanf("%d", &input[k]);
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(input[k] == matrix[i][j]){
                    matrix[i][j] = x;
                }
            }
        }
    }
    // 0,0  0,1  0,2
    // 1,0  1,1  1,2
    // 2,0  2,1  2,2
    int ctr[8] = {0};
    int last=2;
    for(int i=0;i<3;i++){
        if(matrix[i][0]==x){
            ++ctr[0];// kolom 1
        }
        if(matrix[i][2]==x){
            ++ctr[1];//kolom 3
        }
        if(matrix[0][i]==x){
            ++ctr[2];//baris 1
        }
        if(matrix[2][i]==x){
            ++ctr[3];
        }
        if(matrix[i][i]==x){
            ++ctr[4];
        } 
        if(matrix[i][last--]==x){
            ++ctr[5];
        }
        if(matrix[1][i]==x){
            ++ctr[6];
        }
        if(matrix[i][1]==x){
            ++ctr[7];
        }
    }
    int flag = 0;
    for(int i=0;i<8;i++){
        if(ctr[i]==3){
            flag = 1;
        }
    }
    printf("%s\n", (flag == 1) ? "Yes" : "No");

    return 0;
}

Measured memory_bytes: 1636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int N = sc.nextInt();
		int a = 0, b = 0, c = 1;

		for (int i = 1; i <= N; i++) {
			int k = i;
			while (k % 2 == 0) {
				k = k / 2;
				a++;
			}
			if (b < a) {
				b = a;
				c = i;
			}
			a = 0;
		}
		System.out.print(c);
		sc.close();
	}
}


Measured memory_bytes: 23636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Main().run();
	}
	private void run() throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		int[] a = new int[n];
		StringTokenizer st = new StringTokenizer(reader.readLine());
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(st.nextToken());
		}
		int q = Integer.parseInt(reader.readLine());
		st = new StringTokenizer(reader.readLine());
		for (int i = 0; i < q; i++) {
			if (subsetSum(Integer.parseInt(st.nextToken()), a)) {
				System.out.println("yes");
			} else {
				System.out.println("no");
			}
		}
		reader.close();
	}

	private boolean subsetSum(int s, int[] a) {
		int n = a.length;
		int[][] dp = new int[n+1][s+1];
		for (int i = 0; i < n; i++) {
			int v = a[i];
			for (int j = 0; j <= s; j++) {
				if (v == j) {
					dp[i+1][j] = dp[i+1][j] + 1;
				} else if (v > j) {
					dp[i+1][j] = dp[i][j];
				} else {
					if (dp[i][j-v] > 0) {
						dp[i+1][j] = dp[i][j-v] + 1;
					} else {
						dp[i+1][j] = dp[i][j];
					}
				}
			}
		}
		return dp[n][s] > 0;
	}
}


Measured memory_bytes: 41820
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 10;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions 

#endif


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

    int N; cin >> N;
    vs S(N); REP(i, N) cin >> S[i];

    REP(i,N) {
        sort(S[i].begin(), S[i].end());
    }

    map<string, ll> mp;
    REP(i, N) {
        mp[S[i]]++;
    }

    ll ans = 0;
    for(auto p : mp) {
        if (p.second > 1) {
            ans += p.second * (p.second - 1) / 2;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 16640
#include <bits/stdc++.h>
// BE READY FOR THE NEXT :)
using namespace std ;
int main()
{

  int n ;
  int a=0 ;
  cin >> n ;
 for(int i=1;i<=9;i++)
 {
     for (int j=1;j<=9;j++)
     {
         if(i*j==n){a=1 ;}
     }
 }
 if(a==1){cout<<"Yes" ;}
 else {cout<<"No" ;}

	return 0 ;
}


Measured memory_bytes: 256
n,a,b,c,d=map(int,input().split())
s=list(input())

ans='Yes'
if d>c:
    check=0
    for i in range(a,d):
        if s[i]=='.':
            check=0
        else:
            check+=1
            if check==2:
                ans='No'
else:
    check=0
    for i in range(a,c):
        if s[i]=='.':
            check=0
        else:
            check+=1
            if check==2:
                ans='No'
    check=0
    for i in range(b-2,d+1):
        if s[i]=='.':
            check+=1
            if check==3:
                break
        else:
            check=0
    if check!=3:
        ans='No'
print(ans)


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

#define $(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector
#define beg begin
#define dbg(x) cerr << #x << " = " << x << endl;

template<class T> ostream& operator<<(ostream &str, vector<T> &a) {
    for (auto &i : a) {
        str << i << " ";
    }
    return str;
}

template<class T> istream& operator>>(istream &str, vector<T> &a) {
    for (auto &i : a) {
        str >> i;
    }
    return str;
}

template<class T> ostream& operator<<(ostream &str, pair<T, T> &a) {
    str << a.first << " " << a.second;
    return str;
}

template<class T> istream& operator>>(istream &str, pair<T, T> &a) {
    str >> a.first >> a.second;
    return str;
}

void solve(); signed main() {
#ifdef LOCAL
    freopen("C:\\Users\\artma\\CLionProjects\\problems\\input.txt", "r", stdin);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);
    solve();
    return 0;
}

const int MOD = 1e9 + 7, MAXN = 1e6 + 10, INF = 1e18 + 10, BASE = 37;

void solve() {
    int n, d;
    cin >> n >> d;
    d = d * d;
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        int dist = x * x + y * y;
        if (dist <= d) {
            cnt++;
        }
    }

    cout << cnt << endl;
}


Measured memory_bytes: 3648
n, x, m = map(int, input().split())
ans = 0
prev_set = set()
prev_list = list()
ans_hist = list()
r = x

for i in range(n):
    if i == 0:
        pass
    else:
        r = (r * r) % m
    
    if r == 0:
        break
    
    if r in prev_set:
        index = prev_list.index(r)
        period = i - index
        count = (n - index) // period
        rest = (n - index) % period

        ans = sum(prev_list[:index])
        ans += sum(prev_list[index:i]) * count
        # ans += (ans - ans_hist[index - 1]) * (count - 1)

        ans += sum(prev_list[index:index+rest])
        # ans += (ans_hist[index + rest - 1] - ans_hist[index - 1])
        break
    else:
        ans += r
        prev_set.add(r)
        prev_list.append(r)
        ans_hist.append(ans)
print(ans)


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n, h;
    cin >> n >> h;
    vint a(n), b(n);
    int ma = 0;
    rep(i, n)
    {
        cin >> a[i] >> b[i];
        ma = max(a[i], ma);
    }

    sort(ALL(b), greater<int>());

    int dm = 0;
    int ans = INF;
    rep(i, n)
    {
        int th = i + 1;
        dm += b[i];

        int use = max(0, dup(h - dm, ma));

        ans = min(ans, th + use);
    }
    cout << ans << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#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 out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll mod=1e9+7;
ll v[3000][3000];
void ncr(ll n){
    for(int i=0;i<n+1;i++){
        for(int j=0;j<=i;j++){
            if(j==0||j==i){
                v[i][j]=1;
            }
            else{
                v[i][j]=(v[i-1][j-1]+v[i-1][j])%mod;
            }
        }
    }
}

ll N,K;

int main(){
    cin>>N>>K;
    ncr(2500);
    rep(i,K){
        out((v[K-1][i]*v[N-K+1][i+1])%mod);
    }

}


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

int main(){
  int h,w;
  cin >> h >> w;
  int a[h][w];
  for(int i=0;i<h;i++) for(int j=0;j<w;j++) cin >> a[i][j];
  int ans=0;
  int sum=h*w;
  int y[sum],x[sum],yy[sum],xx[sum];
  for(int i=0;i<h;i++){
    for(int j=0;j<w-1;j++){
      if(a[i][j]%2==1){
        y[ans]=i,x[ans]=j,yy[ans]=i,xx[ans]=j+1;
        a[i][j]--; a[i][j+1]++;
        ans++;
      }
    }
  }
  for(int i=0;i<h-1;i++){
    if(a[i][w-1]%2==1){
      y[ans]=i,x[ans]=w-1,yy[ans]=i+1,xx[ans]=w-1;
      a[i][w-1]--; a[i+1][w-1]++;
      ans++;
    }
  }
  cout << ans << endl;
  for(int i=0;i<ans;i++){
    cout << y[i]+1 << ' ' << x[i]+1 << ' ' << yy[i]+1 << ' ' << xx[i]+1 << endl;
  }
}

Measured memory_bytes: 6144
package main

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

// const abcd = "abcdefghijklnmopqrstuvwxyz"
// const ABCD = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

// var dy = [...]int{1, 1, 0, -1, -1, -1, 0, 1}
// var dx = [...]int{0, 1, 1, 1, 0, -1, -1, -1}

// var dx = [...]int{0, 1, 0, -1}
// var dy = [...]int{1, 0, -1, 0}

// var inf int = 1e9
// var mod = 1000000007

// ---------------------------------------------------------
func main() {
	log.SetFlags(log.Lshortfile)
	next := newScanner()
	n := next.Int()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = next.Int()
	}
	var cnt [3]int
	for i := 0; i < n; i++ {
		log.Println(a[i], a[i]%2, a[i]/2)
		if a[i]%2 != 0 {
			a[i] = 1
			cnt[0]++
		} else if a[i]%4 != 0 {
			a[i] = 2
			cnt[1]++
		} else {
			a[i] = 4
			cnt[2]++
		}
	}
	log.Println(cnt)
	ans := ""
	if cnt[1] == 0 {
		if cnt[0] <= cnt[2]+1 {
			ans = "Yes"
		} else {
			ans = "No"
		}
	} else {
		// cnt[0]++
		if cnt[0] <= cnt[2] {
			ans = "Yes"
		} else {
			ans = "No"
		}
	}

	fmt.Println(ans)
}

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

// Pair is liked C++ pair
type Pair struct {
	a, b int
}

// Pairs is sorted by []Pair struct
type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a < p[j].a {
		return true
	} else if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return false
}

// -------------------------------
func in(c, a, z int) bool {
	return c >= a && c < z
}

func btoi(b bool) int {
	if b {
		return 1
	}
	return 0
}

func itob(a int) bool {
	if a == 0 {
		return false
	}
	return true
}

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}

func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}

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

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// ---------- buffered scanner -----------------------------------------
type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 10000)
	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) Line() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) Int() int {
	v, _ := strconv.Atoi(s.next())
	return v
}
func (s *scanner) Int64() int64 {
	v, _ := strconv.ParseInt(s.next(), 10, 64)
	return v
}
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: 6528
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

ll gcd(ll a, ll b){ return b==0?a:gcd(b,a%b);}

ll add(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a+b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll mul(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a*b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

ll a, b, x;

ll f(ll L, ll m){
	if(L < 0) return 0LL;
	return L / m + 1;
}

int main(){
	rll3(a,b,x);
	ll ans = f(b,x) - f(a-1,x);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll m=n,sum=0;
    while(m)sum+=m%10,m/=10;
    if(n%sum==0)cout << "Yes" <<endl;
    else cout << "No" <<endl;
    return 0;
}


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

N = int(input())
B = list(map(int, input().split()))
A = []

B.append(float('inf'))
A.append(B[0])

for i in range(1, N):
    A.append( min(B[i-1], B[i]) )

print(sum(A))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  ll N = 0;
  cin >> N;
  vector<ll>A(N);
  rep(i,N){
    cin >> A[i];
  }
  vector<ll>s(N-1);
  rep(i,N-1){
    if(A[i] >= A[i+1]){
      s[i] = 1;
    }
    else{
      s[i] = 0;
    }
  }
  ll count = 0;
  ll ans = 0;
  rep(i,N-1){
    if(s[i]){
      count++;
      ans = max(ans,count);
    }
    else{
      ans = max(ans,count);
      count = 0;
    }
  }
  cout << ans;
}
    

Measured memory_bytes: 4828
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
import string

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")


# S = sys.stdin.readline().rstrip()
# if len(S) == len(set(list(S))):
#     print('yes')
# else:
#     print('no')


N, M = list(map(int, sys.stdin.readline().split()))
A, B = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(M)]))

for i in range(1, N+1):
    print(A.count(i) + B.count(i))


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

int main(){
  ll A, B, K, A_, B_;
  cin >> A >> B >> K;
  A_ = max(A-K, (ll)0);
  K = max(K-A, (ll)0);
  B_ = max(B-K, (ll)0);
  cout << A_ << ' ' << B_ << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using static System.Console;

namespace MergeSort
{
    internal class Program
    {
        private static int m_count = 0;
        public static void Main(string[] args)
        {
            var n = int.Parse(ReadLine());
            var seq = ReadLine().Split(' ').Select(int.Parse).ToArray();

            MergeSort(seq, 0, n);
            var result = string.Join(" ", seq);
            WriteLine(result);
            WriteLine(m_count);
        }

        private static void Merge(int[] array, int left, int mid, int right)
        {
            var n1 = mid - left;
            var n2 = right - mid;
            var l_arr = new int[n1 + 1];
            var r_arr = new int[n2 + 1];
            for (var i = 0; i < n1; i++)
            {
                l_arr[i] = array[left + i];
            }

            for (var i = 0; i < n2; i++)
            {
                r_arr[i] = array[mid + i];
            }

            l_arr[n1] = int.MaxValue;
            r_arr[n2] = int.MaxValue;
            int j,k,l;
            for (j = 0, k = 0, l = left; l < right; l++)
            {
                m_count++;
                if (l_arr[j] <= r_arr[k])
                {
                    array[l] = l_arr[j];
                    j++;
                }
                else
                {
                    array[l] = r_arr[k];
                    k++;
                }
            }

        }

        private static void MergeSort(int[] seq, int left, int right)
        {
            if (left + 1 < right)
            {
                var mid = (left + right) / 2;
                MergeSort(seq, left, mid);
                MergeSort(seq, mid, right);
                Merge(seq, left, mid, right);

            }

        }
    }
}


Measured memory_bytes: 84724
#include<bits/stdc++.h>
using namespace std;
#define N 200005
#define inf 0x7fffffff
#define ll long long
int n,mn[N<<2],add[N<<2],b[N],a[N];
ll ans=0;
inline void pushup(int x){mn[x]=min(mn[x<<1],mn[x<<1|1]);}
inline void pushdown(int x){
	mn[x<<1]+=add[x];mn[x<<1|1]+=add[x];
	add[x<<1]+=add[x];add[x<<1|1]+=add[x];
	add[x]=0;
}
void build(int v,int l,int r){
	if(l==r){mn[v]=b[l];return;}
	int mid=l+r>>1;
	build(v<<1,l,mid);build(v<<1|1,mid+1,r);
	pushup(v);
}
void ins(int v,int l,int r,int x,int y){
	if(x>y) return;
	if(x<=l&&r<=y){add[v]++;mn[v]++;return;}
    int mid=l+r>>1;pushdown(v);
	if(x<=mid) ins(v<<1,l,mid,x,y);
	if(mid<y) ins(v<<1|1,mid+1,r,x,y);
	pushup(v);
} 
int query(int v,int l,int r,int x,int y){
	if(x<=l && r<=y) return mn[v];
	int mid=l+r>>1,s=inf;pushdown(v);
	if(x<=mid) s=min(s,query(v<<1,l,mid,x,y));
	if(mid<y) s=min(s,query(v<<1|1,mid+1,r,x,y));
	return s;
}
signed main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),b[i]=a[i];
	sort(b+1,b+n+1);
    int nn=unique(b+1,b+n+1)-b-1;
	build(1,1,nn);
	for(int i=1;i<=n;i++){
		int p=lower_bound(b+1,b+nn+1,a[i])-b;
		ans+=query(1,1,nn,p,nn)-a[i];
		ins(1,1,nn,1,p-1);
	}
    printf("%lld\n",ans);
	return 0;
}

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

int n;

void solve()
{
	vector<int> res(n);
	for(int i = 0; i < n; i++){
		int sum = 0, in;
		for(int j = 0; j < 5; j++){
			cin >> in;
			sum += in;
		}
		res[i] = sum;
	}
	sort(res.begin(), res.end());

	cout << res.back() << ' ' << res.front() << endl;
}

int main(void)
{
	while(cin >> n, n)
		solve();
	return 0;
}

Measured memory_bytes: 1216
import java.util.*

fun main() {
  val sc = Scanner(System.`in`)
  val a = sc.nextLong()
  val b = sc.nextLong()
  val c = sc.nextLong()
  val k = sc.nextLong()
  
  if (k <= a) {
    println(k)
    return
  }
  if (k <= a + b) {
    println(a)
    return
  }
  if (k <= a + b + c) {
    println(a - (k - a - b))
    return
  }
  println(a - c)
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define int long long
#define endl "\n"
const int mod=998244353;

int32_t main()
{
    IOS;
    
    int n;
    cin>>n;
    
    int ans=n/500;
    ans*=1000;
    n%=500;
    ans+=(5*(n/5));
    cout<<ans;
    return 0;
}

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

class Program
{
    private static int N;

    public static void Main()
    {
        N = int.Parse(Console.ReadLine());
        int M = (int)((-1 + Math.Sqrt(1 + 8 * N)) / 2);
        if (M * (M + 1) / 2 < N)
            M++;
        int dis = M * (M + 1) / 2 - N;
        for (int i = 1; i <= M; i++)
        {
            if (i == dis)
                continue;
            Console.WriteLine(i);
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
long long dp[110][100100];//do[i][j]=i番目のものまでで重さjのときの価値の最大値

int main(void){
	long long N,W;
	cin >> N >> W;
	long long w[N],v[N];
	for(int i=0;i<N;i++)cin >> w[i] >> v[i];
	for(int i=0;i<N;i++){
		for(int j=0;j<=W;j++){
			//i番目の商品を選んだ場合          
			if(j-w[i]>=0){
				dp[i+1][j]=max(dp[i+1][j],dp[i][j-w[i]]+v[i]);
			}
			dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
			
		}
	}
	cout << dp[N][W] << endl;
}

Measured memory_bytes: 79360
#include<iostream>

int main(){
	int n;
	char s[101];
	bool e = false;
	std::cin >> n;
	for (int lp = 0; lp < n; lp++) {
		std::cin >> s[lp];
	}
	for (int lp = 0; lp < n; lp++) {
		if (s[lp] == 'Y') {
			std::cout << "Four" << std::endl;
			e = true;
			break;
		}
	}
	if (e == false) {
		std::cout << "Three" << std::endl;
	}
return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    N=ii()
    rs = []
    for _ in range(N):
        x, l = mis()
        rs.append((x-l, x+l))
    rs.sort(key=lambda t: t[1])
    ans = 0
    right = rs[0][0] - 1
    for r in rs:
        if right <= r[0]:
            ans += 1
            right = r[1]
    print(ans)

main()


Measured memory_bytes: 20320
import math
X = int(input())
max = 0
for n1 in range(1, int(math.sqrt(X)) + 1):
	for n2 in range(2, 10):
		v = pow(n1, n2)
		if v > X:
			break
		if v <= X and v > max:
			max = v
print(max)

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

template <typename T, int B = 3>
class persistent_array {
public:
	static const int mask = (1 << B) - 1;
	struct node {
		T val;
		node* ch[1 << B];
		node() {
			for (int i = 0; i < (1 << B); i++) ch[i] = nullptr;
		}
		node(T v) : val(v) {}
		node(node* t) { memcpy(ch, t->ch, sizeof(node*) << B); }
	};
private:
	const int h, n;
	const T id;
	node *root;
	int get_h(int n) {
		int cnt = 0, tmp = 1;
		while (tmp < n) tmp <<= B, cnt++;
		return cnt;
	}
	node* fix(node *t, int p, T val, int x) {
		if (x < 0) return new node(val);
		t = t ? new node(t) : new node();
		int to = (p >> x) & mask;
		t->ch[to] = fix(t->ch[to], p, val, x - B);
		return t;
	}
	node* dfs(int p, int d, const vector<T>& v) {
		if ((int)v.size() <= (p << d)) return nullptr;
		if (d == 0) return new node(v[p]);
		node* t = new node;
		for (int i = 0; i < (1 << B); i++) {
			t->ch[i] = dfs((p << B) | i, d - B, v);
		}
		return t;
	}
	node* init(const vector<T>& v) {
		return dfs(0, h * B, v);
	}
public:
	persistent_array(int n_, T id_ = 0)
		: h(get_h(n_)), n(1 << (h * B)), id(id_), root(nullptr) {}
	persistent_array(const vector<T>& v, T id_ = 0)
		: h(get_h(v.size)), n(1 << (h * B)), id(id_), root(init(v)) {}
	T set(int p, T val) {
		root = fix(root, p, val, B * (h - 1));
		return val;
	}
	T operator[](int p) const {
		node* t = root;
		for (int i = (h - 1) * B; i >= 0; i -= B) {
			if (!t) return id;
			t = t->ch[(p >> i) & mask];
		}
		return t ? t->val : id;
	}
	void trip_version(node* t) {
		root = t;
	}
	node* get_version() const {
		return root;
	}
};

class persistent_union_find {
public:
	using pa = persistent_array<int>;
	using node = typename pa::node;
private:
	pa par;
	int find(int a) {
		return par[a] < 0 ? a : par.set(a, find(par[a]));
	}
public:
	persistent_union_find(int n) : par(n, -1) {}
	bool same(int a, int b) {
		return find(a) == find(b);
	}
	void unite(int a, int b) {
		a = find(a);
		b = find(b);
		if (a == b) return;
		if (par[a] > par[b]) swap(a, b);
		par.set(a, par[a] + par[b]);
		par.set(b, a);
	}
	int size(int a) {
		return -par[find(a)];
	}
	void trip_version(node* t) {
		par.trip_version(t);
	}
	node* get_version() {
		return par.get_version();
	}
};

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, q;
	cin >> n >> q;
	persistent_union_find uf(n);
	while (q--) {
		int com, x, y;
		cin >> com >> x >> y;
		if (com == 0) {
			uf.unite(x, y);
		}
		else {
			printf("%d\n", uf.same(x, y));
		}
	}
	return 0;
}



Measured memory_bytes: 98428
#include <iostream>

int main()
{
    int N, M, C;
    int B[21];
    int A[21][21];
    std::cin >> N >> M >> C;
    for (int j = 1; j <= M; j++) {
        std::cin >> B[j];
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= M; j++) {
            std::cin >> A[i][j];
        }
    }
    int ans = 0;
    for (int i = 1; i <= N; i++) {
        int sum = 0;
        for (int j = 1; j <= M; j++) {
            sum += A[i][j] * B[j];
        }
        if (sum + C > 0) {
            ans++;
        }
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
def prime_factor(n):
    ass = []
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass


n = int(input())
n_prime = {}
for i in range(1, n+1):
    for item in prime_factor(i):
        if item not in n_prime.keys():
            n_prime[item] = 0
        n_prime[item] += 1
#print(n_prime)
count_74 = 0
count_24 = 0
count_14 = 0
count_4 = 0
count_2 = 0
for prime, count in n_prime.items():
    if count >= 74:
        count_74 += 1
    if count >= 24:
        count_24 += 1
    if count >= 14:
        count_14 += 1
    if count >= 4:
        count_4 += 1
    if count >= 2:
        count_2 += 1
ans75 = count_74
ans25 = count_24*(count_2 - 1)
ans15 = count_14*(count_4 - 1)
ans5 = count_4*(count_4 - 1)*(count_2 - 2)//2
print(ans75 + ans25 + ans15 + ans5)


Measured memory_bytes: 38896
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n, a, b;
    cin >> n >> a >> b;

    if(a%2 == b%2) {
        out((b-a)/2);
    }
    else {
        if(a-1 <= n-b) {
            out(a + (b-a-1)/2 );
        }
        else {
            ll x = n-b+1;
            out(x + (n - (a+x))/2);
        }
    }
    
    re0;
}

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

int a[2010][2010] = {0};
int b[2010][2010] = {0};

int main() {
  int h, w, z;
  cin >> h >> w;
  vector<vector<char> > c(h, vector<char>(w));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> c[i][j];
    }
  }

  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      if (c[i - 1][j - 1] == '.') {
        a[i][j] = a[i][j - 1] + 1;
      }
    }
  }

  /*
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      cout << a[i][j];
    }
    cout << endl;
  }
  */

  for (int i = 1; i <= h; i++) {
    for (int j = w; j >= 1; j--) {
      int tmp;
      tmp = a[i][j];
      if (tmp != 0) {
        for (int k = j; k >= 0; k--){
          //cout << "i:" << i << "j:" << j << "k:" << k << endl;
          if (a[i][k] == 0) {
            j = k;
            //cout << "i:" << i << "j:" << j << endl;
            break;
          }
          else {
            a[i][k] = tmp;
          }
        }
      }
    }
  }

  /*
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      cout << a[i][j];
    }
    cout << endl;
  }
  */

  for (int i = 1; i <= w; i++) {
    for (int j = 1; j <= h; j++) {
      if (c[j - 1][i - 1] == '.') {
        b[j][i] = b[j - 1][i] + 1;
      }
    }
  }

  for (int i = 1; i <= w; i++) {
    for (int j = h; j >= 1; j--) {
      int tmp;
      tmp = b[j][i];
      if (tmp != 0) {
        for (int k = j; k >= 0; k--){
          if (b[k][i] == 0) {
            j = k;
            break;
          }
          else {
            b[k][i] = tmp;
          }
        }
      }
    }
  }

  int ans = -1;
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      int tmp = 0;
      if (c[i - 1][j - 1] == '.') {
        tmp += a[i][j] + b[i][j] - 1;
      }
      if (tmp > ans) {
        ans = tmp;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    int sum = 0;
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
        sum += A.at(i);
    }
    bool able = true;
    sort(A.begin(), A.end(), greater<int>());
    for(int i = 0; i < M; i++){
        if(sum % 4*M == 0){
            if(A.at(i) < sum / (4 * M)){
                able = false;
                break;
            }else{
                able = true;
            }
        }else{
            if(A.at(i) <= sum / (4 * M)){
                able = false;
                break;
            }else{
                able = true;
            }
        }
    }
    if(able == true)cout << "Yes" << endl;
    if(able == false) cout << "No" << endl;
    return 0;
}

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

#ifdef ONLINE_JUDGE
#define freopen \
  if (0) freopen
#define cerr \
  if (0) cerr
#endif

#define fi first
#define se second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)

#define sqr(a) ((a)*1ll * (a))
#define sz(a) (int)a.size()
#define len(a) (int)a.length()
#define all(a) a.begin(), a.end()
#define nl '\n'

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pi;

const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

ll n, s;

ll sum(ll b) {
  ll k = n;
  ll ans = 0;
  while (k > 0) {
    ans += k % b;
    k /= b;
  }
  return ans;
}

void solve() {
  cin >> n >> s;

  for (ll b = 2; b <= sqrt(n); b++) {
    if (sum(b) == s) {
      cout << b;
      return;
    }
  }

  ll ans = -1;
  for (ll p = 1; p <= sqrt(n - s); p++) {
    if ((n - s) % p != 0) continue;

    ll b1 = p + 1;
    if (b1 > 1 && sum(b1) == s) {
      ans = ans == -1 ? b1 : min(ans, b1);
    }

    ll b2 = (n - s) / p + 1;
    if (b2 > 1 && sum(b2) == s) {
      ans = ans == -1 ? b2 : min(ans, b2);
    }
  }
  if (ans != -1) {
    cout << ans;
    return;
  }

  if (sum(n + 1) == s) {
    cout << n + 1;
    return;
  }

  cout << -1;
}

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

  freopen(".in", "r", stdin);

  solve();

  return 0;
}

Measured memory_bytes: 3688
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
using namespace std;

int main() {
	string str;
	int size, i;
	int C = 0, F = 0;
	cin >> str;
	size = str.size();
	for (i = 0; i < size; i++) {
		if (str[i] == 'C') {
			C = 1;
		}
		if (C == 1 && str[i] == 'F') {
			F = 1;
		}
	}
	if (C == 1 && F == 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

int n;
char s[111][111];

int f(vector<int> u, vector<int> b){
    int h = 0;
    while(u.size()){
        int k = max_element(begin(b), end(b)) - begin(b);
        if(h + b[k] < 0) return -1;
        h += u[k];
        u.erase(u.begin() + k);
        b.erase(b.begin() + k);
    }
    return h;
}

string solve(){
    vector<int> up[2], bottom[2];
    for(int i = 0; i < n; ++i){
        int h = 0, b = 0;
        for(char *p = s[i]; *p; ++p){
            *p == '(' ? ++h : --h;
            b = min(b, h);
        }
        if(h >= 0){
            up[0].push_back(h);
            bottom[0].push_back(b);
        } else {
            up[1].push_back(-h);
            bottom[1].push_back(b-h);
        }
    }
    int a = f(up[0],bottom[0]), b = f(up[1],bottom[1]);
    return a == b && a != -1 ? "Yes" : "No";
}

int main(){
    while(cin >> n){
        for(int i = 0; i < n; ++i) cin >> s[i];
        cout << solve() << endl;
    }
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
typedef long long int LL;
using namespace std;
#define INF (1LL << 60)
#define ALL(x) (x).begin(),(x).end()
#define FOR(i,k,n) for(int i=(k);(i)<(n);(i)++)
#define REP(i,n) for(int i = 0;(i)<(n);(i)++)
#define REPR(i,n) for(int i = n; i >= 0; i--)
#define F first
#define S second
#define MOD (1e9 + 7)

int main() {
	int x, y;
	cin >> x >> y;
	cout << x + y / 2 << endl;

}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		
		int n = sc.nextInt();
		
		
		int ans = 1000 - n;
		
		ans = ans + 110;
		
		System.out.println(ans);
	}
}


Measured memory_bytes: 22608
from collections import defaultdict
N, M = map(int,input().split())
d = defaultdict(int)
for _ in range(M):
    a, b = map(int,input().split())
    if a == 1:
        d[b] += 1
    if b == N:
        d[a] += 1
if 2 in d.values():
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 27336
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

H,W = map(int,readline().split())
A = np.frombuffer(read(),'S1').reshape(H,-1)[:,:W]

red = np.full((H,W),'.','U1')
blue = np.full((H,W),'.','U1')

red[0] = '#'
red[:-1,::2] = '#'
blue[-1] = '#'
blue[1:,1::2] = '#'

both = (A == b'#')
red[both] = '#'
blue[both] = '#'

def output_grid(A):
    print('\n'.join(''.join(row) for row in A))

output_grid(red)
print()
output_grid(blue)

Measured memory_bytes: 16160