akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

void fast_input() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int solve(int T, int N) {
    int INF = 1000000000;
    vector<vector<int>> field(1000, vector<int>(1000));
    for (int i = 0; i < 1000; i++) {
        for (int j = 0; j < 1000; j++) {
            field[i][j] = INF;
            if (i == 0 || i == 999 || j == 0 || j == 999) {
                field[i][j] = -1;
            }
        }
    }
    for (int i = 0; i < N; i++) {
        int x, y; cin >> x >> y;
        x += 500;
        y += 500;
        field[x][y] = -1; 
    }
    int startX; cin >> startX;
    int startY; cin >> startY;
    startX += 500;
    startY += 500;
    field[startX][startY] = 0;

    int dx[] = {0, 1, 1, 0, -1, -1};
    int dy[] = {1, 1, 0, -1, -1, 0};
    queue<pair<int, int>> q;
    q.push({startX, startY});
    while (!q.empty()) {
        pair<int, int> crt = q.front();
        q.pop();
        for (int i = 0; i < 6; i++) {
            int nx = crt.first + dx[i];
            int ny = crt.second + dy[i];
            if (field[nx][ny] != -1 && field[crt.first][crt.second] + 1 < field[nx][ny]) {
                field[nx][ny] = field[crt.first][crt.second] + 1;
                q.push({nx, ny});
            }
        }
    }
    
    int ret = 0;
    for (int i = 0; i < 1000; i++) {
        for (int j = 0; j < 1000; j++) {
            if (field[i][j] <= T && 0 <= field[i][j]) ret++;
        }
    }
    return ret;
} 

int main(void) {
    int T, N;
    vector<int> ans;
    while (1) {
        cin >> T >> N;
        if (!T && !N) break;
        ans.push_back(solve(T, N));
    }
    for (auto i : ans) {
        cout << i << endl;
    }
}   


Measured memory_bytes: 6928
/****************************************
  "Temp not a desperate man."
                    -William Shakespeare
 ****************************************/

/*****************************
 PRASANNA_K_ROY (prasanna2425)
 *****************************/

#include <bits/stdc++.h>
using namespace std;

#define __AcHiLlEs ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define __AnAkLuSmOs freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define accio cin
#define pb push_back
#define ff first
#define ss second
#define endl "\n"
#define i_64 long long
#define d_64 long double
#define u_64 unsigned long long

const int mod = (int)1e9 + 7;
const i_64 MAX = 1000001;


bool primeCheck(i_64 n) {
    if (n == 2 || n == 3 || n == 5) return true;
    if (n % 2 == 0 || n % 3 == 0) return false; 
  
    for (i_64 i = 5; i * i <= n; i += 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
           return false; 
    return true; 
}

i_64 power(i_64 x, i_64 y) { 
    if (y == 0) 
        return 1; 
    i_64 p = power(x, y / 2) % mod; 
    p = (p * p) % mod; 
    if (!(y & 1)) 
        return p;
    return (p * x) % mod; 
} 

i_64 Imod(i_64 a) { 
    i_64 res = (power(a, mod - 2)) % mod;
    return res;
}

i_64 nCr(i_64 n, i_64 r) { 
    vector<i_64> v(r + 1);
    i_64 c(1);
    v[0] = c;
    for(i_64 j = 1; j <= r; j++){
        i_64 l = Imod(j);
        v[j] = (((c * (n - j + 1)) % mod )* l) % mod;
        c = v[j];
    }
    return v[r]; 
}

int solve() {
    int n, m;
    cin >> n >> m;
    cout << nCr(n, 2) + nCr(m, 2) << endl;
	return 0;
}

int main() {
    /*auto start=std::chrono::steady_clock::now();
    #ifndef ONLINE_JUDGE
        __AnAkLuSmOs
    #endif*/

    __AcHiLlEs
    
    int t(1);
    //accio >> t;
    while (t--) {
        solve();
    }
    
    /*auto end = std::chrono::steady_clock::now();
        double elapsed=double (std::chrono::duration_cast < std::chrono::nanoseconds> (end-start).count());
    std::cout << endl << "Terminated\n"<< elapsed/1e9;*/
    return 0;
}

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

int main() {
	int b;
	cin >> b;
	vector<int> a(b);
	for (int i = 0; i < b; ++i) {
		cin >> a[i];
	}
	cout << a[b-1];
	for (int y = b-2; y >=0; --y) {
		cout << " " << a[y];
	}
	cout << endl;
}

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

typedef long long ll;
typedef pair<int, int> P;

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976

int main()
{
    ll a,b,n; cin >> a >> b >> n;
    ll ans = 0;
    if(b <= n+1){
        cout << floor(a*(b-1)/b) - a * floor((b-1)/b);
    }else{
        cout << floor(a*(n)/b) - a * floor((n)/b);
    }
}

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

int main() {
  int N,W;

  cin >> N >> W;

  vector<int> w(N), v(N);
  vector<vector<long long> > dp(N+1,vector<long long>(W+1,0));

  for(int i=0;i<N;i++) {
    cin >> w[i];
    cin >> v[i];
  }



  for(int i=0;i<N;i++) {
    for(int j=0;j<=W;j++) {
      if(j-w[i]>=0) {
        dp[i+1][j] = max(dp[i][j],dp[i][j-w[i]]+v[i]);
      }
      else {
        dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
      }
    }
  }

  // for(int i=0;i<=N;i++) {
  //   for(int j=0;j<=W;j++) {
  //     cout << dp[i][j] << " ";
  //   }
  //   cout << endl;
  // }

  cout << dp[N][W] << endl;

  return 0;
}


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

int main(void)
{
    char s[7];
    cin >> s;
    if ((s[2] == s[3]) && (s[4] == s[5]))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3620
package main

import (
	"fmt"
)

const MOD = 1000000007

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	idx, value int
	a, b       int
	index      int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

func FactoredPrimeNumber(num int) map[int]int {
	m := map[int]int{}
	return factor(m, num, 2)
}

func factor(result map[int]int, num, pnum int) map[int]int {
	if pnum*pnum > num {
		if num != 1 {
			result[num] += 1
		}
		return result
	}

	if num%pnum == 0 {
		num /= pnum
		result[pnum]++
	} else {
		pnum++
	}
	return factor(result, num, pnum)
}

func GCD(a, b int) int {
	if b == 0 {
		return a
	}
	return GCD(b, a%b)
}

func LCM(a, b int) int {
	return a * b / GCD(a, b)
}

type P struct {
	l, r int
}

func main() {
	var N, M int
	fmt.Scanf("%d %d\n", &N, &M)
	H := make([]int, N)
	for i := 0; i < N; i++ {
		var h int
		fmt.Scan(&h)
		H[i] = h
	}
	m := map[int][]int{}
	for i := 0; i < M; i++ {
		var a, b int
		fmt.Scanf("%d %d\n", &a, &b)
		m[a] = append(m[a], b)
		m[b] = append(m[b], a)
	}
	cnt := 0
	for idx, h := range H {
		ds := m[idx+1]
		ok := true
		for _, di := range ds {
			d := H[di-1]
			if h <= d {
				ok = false
				break
			}
		}
		if ok {
			cnt++
		}
	}
	fmt.Println(cnt)

}

func Reverse(runes []rune) []rune {
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return runes
}


Measured memory_bytes: 18764
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<set>
#include<ctime>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
inline void write(int a){
	if(a>=10)write(a/10);
	putchar('0'+a%10);
}
inline void writeln(int a){
	write(a); puts("");
}
inline int	read()//不管是正负数，都可以 
{
	int x = 0; char ch = getchar(); bool positive = 1;
	for (; !isdigit(ch); ch = getchar())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = getchar())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
int l,r,quex[1000000],quey[1000000],que[1000000],ans=10000000,n,m,k,S1[4]={0,0,1,-1},S2[4]={1,-1,0,0},s1,s2;
bool vis[1000][1000];
char ch[1000][1000];
int main(){
	n=read(); m=read(); k=read();
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++)scanf("\n%c",&ch[i][j]);
		for(int j=1;j<=m;j++)if(ch[i][j]=='S'){
			s1=i; s2=j;
		}
	}
	quex[l=r=1]=s1; quey[1]=s2;
	while(l<=r){int x=quex[l],y=quey[l]; int zs=que[l++];// cout<<x<<" "<<y<<endl;
	if(x==1||x==n||y==1||y==m){
		ans=min(ans,1); break;
	}
	ans=min(ans,1+min((x-2)/k+1,min((y-2)/k+1,min((n-x-1)/k+1,(m-y-1)/k+1))));
	if(zs<k)for(int i=0;i<4;i++)if(!vis[x+S1[i]][y+S2[i]]&&ch[x+S1[i]][y+S2[i]]!='#'){
		quex[++r]=x+S1[i];quey[r]=y+S2[i]; que[r]=zs+1; vis[x+S1[i]][y+S2[i]]=true;
	}
	}
	writeln(ans);
}

Measured memory_bytes: 9728
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s, t;cin>>s>>t;
	int n = s.size(), m = t.size();
	int dp[n+1][m+1], path[n+1][m+1];
	memset(dp, 0, sizeof(dp));
	memset(path, 0, sizeof(path));
	for(int i = 1; i<=n; ++i){
		for(int j = 1; j<=m; ++j){
			if(s[i-1]==t[j-1]) dp[i][j] = 1 + dp[i-1][j-1], path[i][j] = 3;
			else if(dp[i-1][j] >= dp[i][j-1]){
				dp[i][j] = dp[i-1][j];
				path[i][j] = 1;
			} else{
				dp[i][j] = dp[i][j-1];
				path[i][j] = 2;
			}
			//cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
		}
	}
	string ans = "";
	int i = n, j = m;
	while(i && j){
		if(s[i-1]==t[j-1]){
			ans += s[i-1];
			--i;--j;
		} else if(dp[i-1][j] > dp[i][j-1]){
			--i;
		} else{
			--j;
		}
	}
	reverse(ans.begin(), ans.end());
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 70656
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = br.readLine().split(" ");
		long a = Integer.parseInt(str[0]);
		long b = Integer.parseInt(str[1]);
		Double ad = new Double(a);
		Double bd = new Double(b);
		System.out.println(a / b + " " + a % b + " " + String.format("%.5f", ad / bd));
	}
}

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

using namespace std;

const int maxn = 1e5 + 10;
int v[maxn];
int cnt[maxn];
int n;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i ++) cin >> v[i];
	int a = 0, b = 0, f1 = 0, s1 = 0;
	memset(cnt, 0, sizeof cnt);
	for (int i = 0; i < n; i += 2) {
		cnt[v[i]] ++;
		if (cnt[v[i]] > f1) {
			if (b != a) {
				b = a;
				s1 = f1;
			}
			a = v[i];
			f1 = cnt[v[i]];
		}
		else if (cnt[v[i]] > s1) {
			b = v[i];
			s1 = cnt[v[i]];
		}
	}
	if (a == b) b = a + 1;
	int c = 0, d = 0, f2 = 0, s2 = 0;
	memset(cnt, 0, sizeof cnt);
	for (int i = 1; i < n; i += 2) {
		cnt[v[i]] ++;
		if (cnt[v[i]] > f2) {
			if (c != d) {
				d = c;
				s2 = f2;
			}
			c = v[i];
			f2 = cnt[v[i]];
		}
		else if (cnt[v[i]] > s2) {
			d = v[i];
			s2 = cnt[v[i]];
		}
	}
	if (c == d) d = c + 1;
	if (a != c) {
		int res = 0;
		for (int i = 0; i < n; i ++) {
			if (i % 2 == 0 && v[i] != a) res ++;
			else if (i % 2 != 0 && v[i] != c) res ++;
		}
		cout << res << endl;
	}
	else {
		int res1 = 0, res2 = 0;
		for (int i = 0; i < n; i ++) {
			if (i % 2 == 0 && v[i] != a) res1 ++;
			else if (i % 2 != 0 && v[i] != d) res1 ++;
		}
		for (int i = 0; i < n; i ++) {
			if (i % 2 == 0 && v[i] != b) res2 ++;
			else if (i % 2 != 0 && v[i] != c) res2 ++;
		}
		cout << min(res1, res2) << endl;
	}
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x ,n) for(int i = x; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    int a,n,m,c,t;
    cin >> n >> m >> c;
    vector<int>b;
    b.reserve(m);
    rep(i,m){
        cin >> t;
        b.push_back(t);
    }
    int ans=0;
    int sum=0;
    rep(i,n){
        bool ok = false;
        sum = 0;
        rep(j,m){
            cin >> a;
            sum+=a*b[j];
            // cout << a << "*" << b[j] << "  " << sum << endl;
            if(j==m-1 and sum>-c)ok = true;
        }
        if(ok)ans++;
    }
    cout << ans;
	return 0;
}

Measured memory_bytes: 3584
import java.io.PrintWriter;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.nextInt();
		int K = sc.nextInt();
		char[] S = sc.next().toCharArray();

		boolean[] a = new boolean[N];
		for(int i=0; i<N; i++)
			a[i] = S[i]=='A';
		boolean flip = false;
		int idx = 0;
		
		int T = Math.min(2*N, K);
		for(int i=0; i<T; i++) {
			if(a[idx]^flip) {
				a[idx] = false^flip;
			} else {
				flip ^= true;
				a[idx] = true^flip;
				idx = (idx+1)%N;
			}
		}
		if(T<K && N%2==1)
			a[idx] ^= (K-T)%2==1;
		
		for(int i=0; i<N; i++)
			pw.print(a[(i+idx)%N] ^ flip ? 'A' : 'B');
		pw.println();
		
		
		sc.close();
		pw.close();
	}
}


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

const int MAXH = 55;
const int MAXW = 55;
const string D = ">v<^";
const int di[] = {0,1,0,-1};
const int dj[] = {1,0,-1,0};

int H, W;
char G[MAXH][MAXW];
int si, sj, sd;
bool vis[MAXH][MAXW][4];

int main() {
  while(cin >> H >> W) {
    fill(G[0], G[MAXH], '#');
    for(int i = 2; i < H+2; ++i) {
      for(int j = 2; j < W+2; ++j) {
        cin >> G[i][j];
        int k = D.find(G[i][j]);
        if(k != string::npos) {
          si = i; sj = j; sd = k;
        }
      }
    }
    H += 4; W += 4;
    memset(vis, 0, sizeof(vis));
    vis[si][sj][sd] = true;
    for(int pi = si, pj = sj, d = sd; G[pi][pj] != 'G'; ) {
      for(int k = 0; k < 4; ++k) {
        int nd = (d - k + 5) % 4;
        int ni = pi + di[nd];
        int nj = pj + dj[nd];
        if(G[ni][nj] == '#') continue;
        pi = ni; pj = nj; d = nd;
        break;
      }
      if(vis[pi][pj][d]) break;
      vis[pi][pj][d] = true;
    }
    int res = 0;
    bool goal = false;
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
        bool add = 0;
        for(int k = 0; k < 4; ++k) add |= vis[i][j][k];
        res += add;
        if(G[i][j] == 'G') goal = add;
      }
    }
    if(!goal) res = -1;
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1228
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_letters as letters,
    ascii_lowercase as lcletters,
    ascii_uppercase as ucletters,
    digits
)

xdigits='01234567890ABCDEFabcdef'
inf=float('inf')
bigi=2**31-1

cache=lru_cache(None)

sys.setrecursionlimit(bigi)

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()))
rig=lambda:[[*map(int,x.split())] for x in rls()]

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

def nbs8(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,Q=ris()
S=rs()
a=[0]*(N+1)
for i in range(1,N):
    if S[i-1]=='A' and S[i]=='C':
        a[i+1]+=1
    a[i+1]+=a[i]
for _ in range(Q):
    l,r=ris()
    print(a[r]-a[l])


Measured memory_bytes: 14904
#include <stdio.h>
#include <stdlib.h>
#define N_MAX 100
#define M_MAX 1000

typedef struct hbar { int h, p, q; } hbar;

int comp_hbars(const void* a, const void* b) { return (*(hbar*)b).h - (*(hbar*)a).h; }

int main(void)
{
    int i, m, a;
    hbar hbars[M_MAX];

    while(scanf("%*d %d %d", &m, &a), m + a)
    {
        for(i = 0; i < m; i++)
            scanf("%d %d %d", &hbars[i].h, &hbars[i].p, &hbars[i].q);

        qsort(hbars, m, sizeof(hbar), comp_hbars);

        for(i = 0; i < m; i++)
            if(hbars[i].p == a) a = hbars[i].q;
            else if(hbars[i].q == a) a = hbars[i].p;

		printf("%d\n", a);
    }

    return 0;
}

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

int main(void){
	int n;
	int debt=100000;
	cin >> n;
	for(int i=0;i<n;i++){
		debt *= 1.05;
		if( ( debt % 1000 ) != 0 ){
			debt -= ( debt % 1000 );
			debt += 1000;
		}
	}
	cout << debt << endl;
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 1000000000000000005
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
int main(){
	int n;
	while(~getI(n)){
		VgetII(d,x);
		int arr[n],ans=n;
		F(i,0,n) getI(arr[i]);
		FE(i,2,d) F(j,0,n) if((i-1)%arr[j]==0) ans++;
		printf("%d\n",ans+x);
	}
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int i, n, m, counter = 0;
		try (Scanner sc = new Scanner(System.in)) {
			n = sc.nextInt();
			int[] a = new int[n];
			for(i = 0; i < n; i++) {
				a[i] = sc.nextInt();
			}
			m = sc.nextInt();
			int[] b = new int[m];
			for(i = 0; i < m; i++) {
				b[i] = sc.nextInt();
			}
			if(m > n) {
				counter = 1;
			}
			for(i = 0; i < Math.min(m, n); i++) {
				if(b[i] > a[i]) {
					counter = 1;
					break;
				}else if(b[i] < a[i]) {
					counter = 0;
					break;
				}
			}
		}
		System.out.println(counter);
	}
}



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

int main()
{
	double L;

	cin >> L;
	double V= (L / 3) * (L / 3) * (L / 3);
	string S="";
	/*int digit = floor(log10(V))+1;
	for (size_t i = 0; i < 10; i++)
	{
		S+=(V%(int)pow(10,digit))/
	}*/
	cout <<setprecision(8)<< (L / 3) * (L / 3) * (L / 3);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define mll map<ll,ll>
#define sll set<ll>
#define fo(i,n) for(i=0;i<n;i++)
#define MOD 1000000007
using namespace std;

int main()
{
    ios::sync_with_stdio(false);


    ll n,i,j,k,t,a[200001];

    cin>>n;
    ll sum1=0,sum2=0;
    fo(i,n)
    {
        cin>>a[i];
        sum1+=a[i];
    }
    ll ma=1000000000000;
    fo(i,n-1)
    {
        sum2+=a[i];
        ma=min(ma,abs(sum1-sum2-sum2));
    }
    cout<<ma;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int n; cin >> n;
    vector<int> v(n); cin >> v;
    map<int, map<int, int> > m;
    REP(i, n) {
        m[v[i]][i%2]++;
    }
    sort(ALL(v));
    ll ans = 0;
    REP(i, n) {
        if (m[v[i]][i%2]) {
            --m[v[i]][i%2];
        }
        else {
            --m[v[i]][(i+1)%2];
            ++ans;
        }
    }
    assert(ans % 2 == 0);
    ans /= 2;
    cout << ans << endl;
}


Measured memory_bytes: 19456
#include <bits/stdc++.h>
using namespace std;
const int maxN = 85;
const int OFF_SET = 80 * 2 * 80;

int n, m;
int a[maxN][maxN], b[maxN][maxN];
bitset<2 * maxN * 2 * maxN> memo[maxN][maxN];

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

    cin >> n >> m;

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

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            cin >> b[i][j];

    memo[1][1][OFF_SET + (a[1][1] - b[1][1])] = true;
    memo[1][1][OFF_SET - (a[1][1] - b[1][1])] = true;

    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if(i == 1 && j == 1)
                continue;

            int diff = abs(a[i][j] - b[i][j]);
            if(j - 1 >= 1) {
                memo[i][j] |= (memo[i][j - 1] << diff);
                memo[i][j] |= (memo[i][j - 1] >> diff);
            }
            if(i - 1 >= 1) {
                memo[i][j] |= (memo[i - 1][j] << diff);
                memo[i][j] |= (memo[i - 1][j] >> diff);
            }
        }
    }

    int ans = 2e9;
    for(int i = -80 * 2 * 80; i <= 80 * 2 * 80; i++)
        if(memo[n][m][i + OFF_SET]) {
            ans = min(ans, abs(i));
            //cerr << i << '\n';
        }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 26628
<?php
list($n, $k, $q)= explode(" ", trim(fgets(STDIN)));
$comp_array = array_fill(0, $n, $q);
for($i=0; $i<$q; $i++){
	$win = trim(fgets(STDIN));
	$comp_array[$win-1] -= 1;
}
for($j=0; $j<$n; $j++){
	echo ($k > $comp_array[$j] ? "Yes" : "No") . "\n";
}

Measured memory_bytes: 9080
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n ; cin >> n ;
	vll a(n) ;
	for(auto &i:a) cin >> i ;
	reverse(all(a)) ;
	vll color(1,1000000000000000) ;
	for(int i=0;i<n;i++){
		if(a.at(i)>=color.at(color.size()-1)) color.emplace_back(a.at(i)) ;
		else *upper_bound(color.begin(),color.end(),a.at(i)) = a.at(i) ;
	}
	cout << color.size() << endl ;
}


Measured memory_bytes: 2168
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n, q;
        cin >> n >> q;
        if(n == 0)
            return 0;

        vector<int> num(101);
        for(int i=0; i<n; ++i){
            int m;
            cin >> m;
            for(int j=0; j<m; ++j){
                int a;
                cin >> a;
                ++ num[a];
            }
        }

        int ret = 0;
        for(int i=1; i<=100; ++i){
            if(num[i] >= q && num[i] > num[ret])
                ret = i;
        }
        cout << ret << endl;
    }
}

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


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

    vi dp(N);
    rep(i, N-1) {
        int mi = INT_MAX;
        if(i>0) {
            mi = min(mi, dp[i-1] + abs(h[i+1]-h[i-1]));
        }
        mi = min(mi, dp[i] + abs(h[i+1]-h[i]));
        
        dp[i+1] = mi;
    }
    cout << dp[N-1] << '\n';
}

Measured memory_bytes: 1024
//  ROAD TO GREEN
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>



#define ll long long
#define uint unsigned int
#define ull unsigned ll
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define fr(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)


using namespace std;
const ll MAXN = 1e9+2;
const ll SIZE = 1e5+2;
int a[SIZE];
int bins[SIZE];
unordered_map<string,int> m;



int main(){
    int n; cin >> n;
    fr(i,1,n){
        string s; cin >> s;
        sort(s.begin(),s.end());
        m[s]++;
    }
    ll sum = 0;
    for(auto i = m.begin(); i != m.end(); i++){
        ll x = i->se;
        sum += (x-1)*x/2;
    }
    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 10660
#!/usr/bin/env python3
# input
import sys
import bisect

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cum_a = [0] * (1 + n)
cum_b = [0] * (1 + m)
for i in range(1, n + 1):
    cum_a[i] = cum_a[i - 1] + a[i - 1]
for i in range(1, m + 1):
    cum_b[i] = cum_b[i - 1] + b[i - 1]
# cum_a で k 以下のものを全探索する
ans = 0  # INF
for i in range(n + 1):
    if cum_a[i] > k:
        break  # owari
    ans = max(ans, -1 + i + bisect.bisect_right(cum_b, k - cum_a[i]))
if ans != n + m + 1:
    print(ans)
else:
    print(0)


Measured memory_bytes: 47432
import java.util.*;

class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]){
        int N=sc.nextInt();
        boolean f[]=new boolean[8];
        int p=0,c=0;
        Arrays.fill(f, true);
        for(int i=0;i<N;i++){
            int a=sc.nextInt()/400;
            if(a>7){
                p++;
            }
            else if(f[a]){
                c++;
                f[a]=false;
            }
        }
        int m=c+p;
        if(c==0) c++;
        System.out.println(c+" "+m);
    }
}

Measured memory_bytes: 38664
st=input()
c="0"
j="0"
u="0"
for i in st:
    if i=="d" and u=="0" and c=="0":
        u="d"
        j="1"
    elif i=="r" and u=="d":
        u="r1"
    elif i=="e" and u=="r1":
        u="e1"
    elif i=="a" and u=="e1":
        u="a1"
    elif i=="m" and u=="a1":
        u="0"
        
    elif i=="e" and u=="0" and c=="0":
        u="e2"
        if j !="1":
            c="1"
    elif i=="r" and u=="e2":
        u="0"
        j="2"
    elif i=="a" and u=="0" and j=="2":
        u="a2"
    elif i=="s" and u=="a2":
        u="s"
    elif i=="e" and u=="s":
        u="0"
        c="0"
        j="3"
    elif i=="r" and u=="0" and j=="3":
        j="0"
    else:
        print("NO")
        exit(0)
if u=="0"and c=="0":
    print("YES")
else:
    print("NO")

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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	int ref = 753;
	int ans = 1001001001;
	for (int ii = 0; ii < s.size() - 2; ++ii){
		int num = ((s[ii] - '0') * 100) + ((s[ii+1] - '0') * 10) + (s[ii+2] - '0');
		ans = min(ans, abs(ref - num));
	}


	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int a[3],s=0,i;
    for(i=0;i<3;i++)
        scanf("%d",&a[i]);
    for(i=0;i<3;i++)
        s+=a[i];
    if(s>=22)
        printf("bust\n");
    else 
        printf("win\n");
    return 0;
}

Measured memory_bytes: 1644
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

struct Graph {
    struct Edge { int from; int to; lint cost; };
    struct Node {
        Node() : par(-1), done(false), dist(INF) {}
        int index;
        int par;
        bool done;
        lint dist;
        vector<Edge> edge;
        lint h;
    };

    int n;
    vector<Node> nodes;
    vector<Edge> edges;
    const static lint INF = 1e18;

    Graph(int n) : n(n) {
        nodes.resize(n);
        for(int i=0; i<n; i++)  nodes[i].index = i;
    }

    void add_edge(int from, int to, lint cost) {
        nodes[from].edge.push_back(Edge{from, to, cost});
        edges.push_back(Edge{from, to, cost});
    }

    bool check(int idx) {
        bool good = true;
        for(auto [from, to, cost] : nodes[idx].edge) {
            good &= (nodes[to].h < nodes[idx].h);
        }
        return good;
    }
};

int main() {
    lint n, m;
    cin >> n >> m;

    Graph g(n);
    for(int i=0; i<n; i++) cin >> g.nodes[i].h;

    for(int i=0; i<m; i++) {
        lint a, b;
        cin >> a >> b;
        a--, b--;
        g.add_edge(a, b, 1);
        g.add_edge(b, a, 1);
    }

    lint ans = 0;
    for(int i=0; i<n; i++) {
        ans += g.check(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 17008
N = int(input())
hs = list(map(int, input().split()))
def sub(l, r, b):
  if l == r:
    return 0
  i = min(range(l, r), key=lambda i: hs[i])
  h = hs[i]
  return h-b+sub(l, i, h)+sub(i+1, r, h)
r = sub(0, N, 0)
print(r)


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

using namespace std;
typedef long long ll;
typedef long double ld;

typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<ld> vld;
typedef map<ll,ll> mpll;
typedef set<ll> setll;
typedef multiset<ll> msetll;

#define F first
#define S second
#define pb push_back
#define mp make_pair



const ll mod = 1e9 + 7;


ll n;
vvll graph;
ll memo[100001][2];
vector<bool> vis;
vector<ll> par;

void dfs(int x){
	if(vis[x])
		return;
	vis[x]=true;
	for(auto xx : graph[x]){
		if(!vis[xx]){
			par[xx]=x;
			dfs(xx);
		}
	}
}


ll func(ll x,int c){ 
	if(graph[x].size()==1 && graph[x][0]==par[x])
	{
		if(c==0)
			return 2;
		else
			return 1;
	}
	if(memo[x][c]!=-1)
		return memo[x][c];
	//int col=0;
	ll num1=1;
	int ccc=0;
	for(int i=0;i<(ll)graph[x].size();i++)
	{
		ccc++;
		if(graph[x][i]!=par[x])
		num1*=func(graph[x][i],0);
		num1=(num1)%mod;
	}
	if(ccc==0)
		num1=0;
	ll num2=1;
	ccc=0;
	if(c!=1)
	{for(int i=0;i<(ll)graph[x].size();i++)
	{
		ccc++;
		if(graph[x][i]!=par[x])
		num2*=func(graph[x][i],1);
		num2=(num2)%mod;
	}
	}
	if(ccc==0)
		num2=0;
	return memo[x][c]=(num1+num2)%mod;
}


int main()
{

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	#ifdef DEBUG_
		freopen("input.txt","r",stdin);
	#endif
	cout.setf(ios::fixed), cout.precision(20);


	cin >> n;
	graph.resize(n);
	vis.resize(n);
	par.resize(n);
	par[0]=-1;
	for(int i=0;i<n;i++){
		vis[i]=false;
	}
	ll a,b;
	for(int i=0;i<n-1;i++)
	{
		cin >> a >> b;
		a--;
		b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	for(int i=0;i<100001;i++)
	{
		memo[i][0]=-1;
		memo[i][1]=-1;
	}
	dfs(0);
	for(int i=0;i<n;i++){
		vis[i]=false;
	}
	ll xx;
	if(n>1)
		xx = func(0,0);
	else
	{
		xx=2;
	}
	
	cout<<xx<<"\n";
	
	return 0;
}

Measured memory_bytes: 14976
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();
            var t = Console.ReadLine();
            var curS = n - 1;
            var curT = n - 1;
            
            var count = 0;
            while (curT >= 0) {
                if (s[curS] == t[curT]) {
                    curS--;
                    curT--; 
                }
                else
                {
                    curT--;
                    curS = n -1;
                }
            }
            
            Console.WriteLine(2 * n - (n - curS - 1));
        }
    }
}


Measured memory_bytes: 13140
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def main():
    N, K = map(int, input().split())
    MOD = 10 ** 9 + 7
    for i in range(1,K+1):
        if N - K + 1 < i:
            print(0)
            continue
        blue = cmb(K-1,i-1)
        red = cmb(N-K+1,N-K-i+1)
        ans = blue * red
        ans %= MOD
        print(ans)
        


if __name__ == "__main__":
    main()

Measured memory_bytes: 45788
#include <bits/stdc++.h>
#ifdef DEMETRIO
#define deb(...) fprintf(stderr,__VA_ARGS__)
#define deb1(x) cerr << #x << " = " << x << endl
#else
#define deb(...) 0
#define deb1(x) 0
#endif
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define SZ(x) ((int)x.size())
using namespace std;
typedef long long ll;

int main(){
	int n;int n0=0,n1=0;bool asd=false;
	scanf("%d",&n);
	fore(i,0,n){
		int x;
		scanf("%d",&x);
		if(x%4==0)n0++;
		else if(x%2==0){
			if(!asd)n1++;
			asd=true;
		}
		else n1++;
	}
	puts(n0+1>=n1?"Yes":"No");
	return 0;
}

Measured memory_bytes: 384
def num(i,k):
    n=1
    while True:
        if i*2*(2**(n-1))>=k:
            return n
            break
        n+=1

n,k=map(int, input().split())
c=0
i=1
for i in range(1,n+1):
    if i>=k:
        c+=1
    elif i*2<k:
        c+=(1/2)**num(i,k)
    else:
        c+=(1/2)
print((1/n)*c)


Measured memory_bytes: 9392
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		final int INF = 9999999;

		Scanner scan = new Scanner(System.in);
		String str1 = scan.nextLine();

		String[] stringArray = str1.split(" ");

		int chestCount = Integer.parseInt(stringArray[0]);
		int keyCount = Integer.parseInt(stringArray[1]);

		List<int[]> keyList = new ArrayList<>();

		for (int i = 0; i < keyCount; i++) {

			// 0:開けれる宝箱 1:値段
			int[] key = new int[2];

			String strTemp1 = scan.nextLine();
			String[] stringTemp1Array = strTemp1.split(" ");

			key[1] = Integer.parseInt(stringTemp1Array[0]);

			String strTemp2 = scan.nextLine();
			String[] stringTemp2Array = strTemp2.split(" ");

			int openNumberBitInt = 0;

			for (String openNumberStr : stringTemp2Array) {

				int openNumberInt = Integer.parseInt(openNumberStr);

				openNumberBitInt = openNumberBitInt | 1 << openNumberInt - 1;
			}

			key[0] = openNumberBitInt;

			keyList.add(key);
		}

		int allChestOpenStatusCount = (int) Math.pow(2, chestCount);

		// 全ての宝箱を開けられるか確認
		int openStatus = 0;

		for (int[] key : keyList) {

			openStatus = openStatus | key[0];
		}

		if (openStatus != allChestOpenStatusCount - 1) {

			System.out.println("-1");
			return;
		}

		Map<Integer, Integer> chestOpenStatusMap = new HashMap<>();

		for (int i = 0; i < allChestOpenStatusCount; i++) {

			chestOpenStatusMap.put(i, INF);
		}

		chestOpenStatusMap.put(0, 0);

		for (int i = 0; i < allChestOpenStatusCount; i++) {

			for (int[] key : keyList) {

				int newChestOpenStatus = i | key[0];
				int newPrice = chestOpenStatusMap.get(i) + key[1];

				if (chestOpenStatusMap.get(newChestOpenStatus) > newPrice) {

					chestOpenStatusMap.put(newChestOpenStatus, newPrice);
				}
			}
		}

		int answer = chestOpenStatusMap.get(allChestOpenStatusCount - 1);

		System.out.println(answer);
	}
}


Measured memory_bytes: 60192
from sys import stdin

k, s = map(int, stdin.readline().split())

result = 0


def get_variants(target, maximum):
    result = 0
    for x in range(maximum, -1, -1):
        y = target - x
        if 0 <= y <= maximum:
            result += 1
    return result

for z in range(k+1):
    variants = get_variants(s - z, k)
    result += variants

print(result)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dp[1010][1010];
ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };

//long longしか使わない
//素数は1より大きい
int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll>p(n);
	rep(i, n) {
		cin >> p[i];
	}
	sort(p.begin(), p.end());
	ll ans = 0;
	rep(i, k) {
		ans += p[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3636
using System;
using System.Linq;
using System.Collections.Generic;

class MyClass
{
    public static void Main(string[] args)
    {
        var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var A = input[0];
        var B = input[1];
        var C = input[2];
        int q, r = 0;
        q = Math.DivRem(C, 7 * A + B, out r);
        Console.WriteLine(7 * q + Math.Min(Math.Ceiling((double)r / A), 7));
    }
}


Measured memory_bytes: 20496
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int A,B,C,X,Y;
	cin >> A >> B >> C >> X >> Y;

	if(A + B < 2 * C){
		println(A*X+B*Y);
		return 0;
	}

	int more_cnt,more_price,common_cnt;

	common_cnt = min(X,Y);
	more_cnt = max(X,Y)-common_cnt;
	more_price = (X > Y) ? A : B;

	if(more_price > C * 2){
		println(C * 2 * max(X,Y));
	}else{
		println(C * 2 * common_cnt + more_cnt * more_price)
	}

	return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,c;
	cin>>a>>b>>c;
	long long m=a-b;
	if(m>=c)
	{
		cout<<0<<endl;
	}else
	{
		cout<<c-m<<endl;
	}
}

Measured memory_bytes: 256
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
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;
}
const int dx[8] = { -1,0,1,-1,1,-1,0,1 };
const int dy[8] = { 1,1,1,0,0,-1,-1,-1 };


//LOVE NyantakoGG	https://www.youtube.com/channel/UC6XdFs8T6Ei54O0FYl3PVVA


using namespace std;



int main() {
	int W, a, b;
	cin >> W >> a >> b;
	if (a <= b && b <= a + W) {
		cout << 0 << endl;
		return 0;
	}
	if (a <= b + W && b + W <= a + W) {
		cout << 0 << endl;
		return 0;
	}
	if (b + W < a) {
		cout << a - (b + W) << endl;
		return 0;
	}
	if (a + W < b) {
		cout << b - (a + W) << endl;
		return 0;
	}
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    b--;
    int ans = 0;
    while(b > 0) {
        ans++;
        b -= (a-1);
    }
    cout << ans << endl;
    return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  while(cin >> n&&n){
    vary(int,v,n,0);
    vary(int,v2,n,0);
    rep(i,n){
      cin >> v[i];
    }
    int ans = 0;
    while(1){
      map<int,int> m;
      v2 = v;
      rep(i,n){
        m[v[i]]++;
      }
      rep(i,n){
        v[i] = m[v[i]];
      }
      if(v == v2){
        cout << ans << endl;
        rep(i,n-1){
          cout << v2[i] << " ";
        }
        cout << v[n-1]<< endl;
        break;
      }
      ++ans;
    }
  }
  return 0;
}

Measured memory_bytes: 3080
import collections

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

def combinations_count_two(n):
    if n < 2:
        return 0
    else:
        return (n * (n - 1)) // 2

counter = collections.Counter(A)

for val in counter.values():
    all_comb += combinations_count_two(val)

for i in A:
    ans = all_comb - combinations_count_two(counter[i]) + combinations_count_two(counter[i] - 1)
    print(ans)


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

string solve(int a, int b, int c, int d, int e, int k){
    return (min({a-b,a-c,a-d,a-e,b-c,b-d,b-e,c-d,c-e,d-e}) * (-1)) > k ? ":(" : "Yay!";
    //multipliquei por -1 pro número sempre retornar positivo se min for negativo
}
int main(){
    int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;
    cout<<solve(a,b,c,d,e,k)<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
	string s;
	cin >> s;
	int ans = INF;
	REP(i,26){
		int cnt = 0;
		string t = s;
		REP(j,s.length()){
			REP(k,t.length() - 1){
				if(t[k] != t[k + 1]) goto no;
			}
			break;
			no:;
			REP(k,t.length() - 1){
				if(t[k] == 'a' + i || t[k + 1] == 'a' + i) t[k] = 'a' + i;
			}
			t.pop_back();
			cnt++;
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int cards[4][13] = {0};
    int n, num, i, j;
    char mark;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%s %d", &mark, &num);
        
        if (mark == 'S') {
            cards[0][num - 1] = 1;
        }
        else if (mark == 'H') {
            cards[1][num - 1] = 1;
        }
        else if (mark == 'C') {
            cards[2][num - 1] = 1;
        }
        else if (mark == 'D') {
            cards[3][num - 1] = 1;
        }
    }
    
    for (i = 0; i < 4; i++)
    {
        for (j = 0; j < 13; j++) {
            if (cards[i][j] == 0){
                
                if (i == 0) {
                    printf("S %d\n", j + 1);
                }
                else if (i == 1) {
                    printf("H %d\n", j + 1);
                }
                else if (i == 2) {
                    printf("C %d\n", j + 1);
                }
                else if (i == 3) {
                    printf("D %d\n", j + 1);
                }
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <math.h>
#include <sstream>
#include <deque>
#include <string>
#include <cctype>
#include <cstring>
#include <cstdio>
const int M = 1e9 + 7;
#define ll long long int
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
using namespace std;

//insta  -------  __ansh7
//MSDIAN




int main()
{
    fastio

    ll a,b;
    cin>>a>>b;

    cout<<a*b<<"\n";


    return 0;
}

Measured memory_bytes: 3652