akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0; i<n ; ++i)
#define all(v) v.begin() , v.end()
#define sz(v) (int(v.size()))
typedef unsigned long long ul;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef vector<pii> vp;
int OO = 2e9;
const double eps = 1e-9 ;
const int N = 200;
int mx = -1e9 , mn = 1e9 ;
int arr[N] , arr2[N];

struct dsu{
    int *par, *sz;
    dsu(int n) {
        par = new int[n+1];
        sz = new int[n + 1];
        lp(i,n+1){
            par[i] = i ;
            sz[i] = 1;
        }
    }

    int get_root(int a){
        if(par[a] == a)
            return a;
        return get_root(par[a]);
    }

    long long Union(int a, int b){
        int apar = get_root(a), bpar = get_root(b);
        if (apar == bpar)
            return 0;
        int tmp1 = sz[bpar];
        int tmp2 = sz[apar];
        if(sz[bpar] > sz[apar]){
            par[apar] = bpar;
            sz[bpar] += sz[apar];
        }
        else {
            par[bpar] = apar;
            sz[apar] += sz[bpar];            
        }
        return 1LL * tmp1 * tmp2;
    }
};

int main()
{

    int n, m;
    cin >> n >> m;
    vector<pii> edges(m);
    for (int i = 0; i < m; ++i) {
        cin >> edges[i].first >> edges[i].second;
    }

    dsu ds(n);
    vector<long long> ans(m);
    long long cnt = 1LL * n * (n - 1) / 2;
    for (int i = m - 1; i >= 0; --i){
        ans[i] = cnt;
        cnt -= ds.Union(edges[i].first,edges[i].second);
    }

    for (int i = 0; i < m; ++i) {
        cout << ans[i] << '\n';
    }

    return 0;
}


Measured memory_bytes: 3712
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝




*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
string stream1(long long a)
{
   ostringstream st1;
    st1<<a;
    string g=st1.str();
    return g;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f=0,x=0,g,p=0,q=0,y=0,z=0;
double kk=0;
    vector<pair<long long,long long>>v;
    vector<long long>u;
    map<string,long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4,s5,s6;
   cin>>n;
   l(i,1,n+1)
   {
       s1=stream1(i);
   if(s1.size()%2!=0)
   {
       d++;
   }
   }
 cout<<d<<endl;



}






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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



string s;
int a[4];
void solve(){
	cin >> s;
	for(int i = 0; i < 4; i++) a[i] = s[i]-'0';
	
	for(int i = 0; i < (1<<3); i++){
		int cnt = a[0];
		for(int j = 0; j < 3; j++){
			if(i>>j&1) cnt -= a[j+1];
			else cnt += a[j+1];
		}
		if(cnt != 7) continue;
		cout << a[0];
		for(int j = 0; j < 3; j++){
			if(i>>j&1) cout << '-';
			else cout << '+';
			cout << a[j+1];
		}
		cout << "=7" << endl;
		break;
	}
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 256
n = int(input())

dic = {}

for _ in range(n):
    s = input()
    s = ''.join(sorted(s))
    if s in dic:
        dic[s] += 1
    else:
        dic[s] =  1

result = 0
for key in dic:
    result += (dic[key])*(dic[key]-1)/2

print(int(result))


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

int h, w;
int g[100][101];

int main()
{
	cin >> h >> w;
	for (int i = 0; i < h; i++){
		for (int j = 0; j < w; j++){
			char c;
			cin >> c;
			if (c == '.') g[i][j] = 1 << 28;
		}
	}
	for (int i = 0; i < h; i++){
		for (int j = 0; j < w; j++){
			g[i][j + 1] = min(g[i][j + 1], g[i][j] + 1);
			if (g[i][j] == (1 << 28)) g[i][j] = -1;
			if (j) cout << " ";
			cout << g[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		
		int t, n, i;
		int s, f;
		
		while ((t = input.nextInt()) != 0){
			n = input.nextInt();
			for (i = 0; i < n; i++){
				s = input.nextInt();
				f = input.nextInt();
				t -= (f - s);
			}
			if (t > 0){
				System.out.println(t);
			}
			else {
				System.out.println("OK");
			}
		}
	}
}

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

int main()
{
    int count[26] = {}, n;
    int i, j = 0, judge = 0;
    string w;
    
    cin >> w;
    
    n = w.size();
    
    for(i = 0; i < n; i++) {
        count[int(w[i])-97]++;
    }
    
    do {
        if(count[j] % 2 == 1) {
            judge = 1;
        }
        j++;
        
    } while((j < 26) && (judge == 0));
    
    if(judge == 0) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int N,M;
  int A[10001];
  int sum=0;
  scanf("%d %d",&N,&M);
  for(int i=0;i<M;i++){
    scanf("%d",&A[i]);
    sum+=A[i];
  }
  if(sum<=N){
    printf("%d",N-sum);
  }else{
    printf("-1");
  }
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
	ll cost;
};
using Graph = vector<vector<Edge>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 2.0 * asin(1.0);
const ll INF = 1L<<60;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const ll MAX = 10000000;
/****** define constant end ********/
/****** define variable start ******/
ll n;
/******* define variable end *******/
int solve() {
	cin >> n;
	string ans = "";
	while(true){
		if(n == 0){
			break;
		}
		ll a = n % 26;
		if(a == 0){
			a = 26;
			n--;
		}
		ans = abc.substr(a-1, 1) + ans;
		n /= 26;
	}
	cout << ans << endl;
	return 0;
}

int main() {
	//clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


Measured memory_bytes: 3648
### constant

MAX_F = 151200

### main

cubes = []
for k in (0...MAX_F)
  c = k * k * k
  break if c > MAX_F
  cubes << c
end
#p cubes

tetras = []
for k in (0...MAX_F)
  t = k * (k + 1) * (k + 2) / 6
  break if t > MAX_F
  tetras << t
end
#p tetras

loop do
  n = gets.to_i
  break if n == 0

  max_sum = 0
  i = tetras.length - 1

  for c in cubes
    while i >= 0 && c + tetras[i] > n
      i -= 1
    end
    break if i < 0

    sum = c + tetras[i]
    if max_sum < sum
      #p [n, c, tetras[i]]
      max_sum = sum 
    end
  end

  puts max_sum
end

Measured memory_bytes: 6112
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <utility>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int H,W,D,Q;cin>>H>>W>>D;
    map<int,pair<int,int> > m;
    REP(i,H) REP(j,W){
        int t;
        cin >> t;
        m[t] = make_pair(i,j);
    }

    vector<int> memo(H*W,0);
    for(int i=D;i<=H*W;++i){
        memo[i] = memo[i-D] + abs(m[i].first - m[i-D].first) + abs(m[i].second - m[i-D].second);
    }
    cin>>Q;
    int L,R;
    REP(i,Q){
        cin>>L>>R;
        cout << memo[R] - memo[L] << '\n';
    }
    return 0;
}

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

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




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

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

#define forn(i, n) for (int i = 0; i < int(n); i++)
int main(){
    string s;
    cin>>s;
    int j=s.size()-1, k=(j-1)/2, r = (j+3)/2;
    forn(i, (s.size()-1)/2){
        if(!(s[i] ==s[k] && s[j]==s[r] && s[i] ==s[j])){
            cout<<"No\n";
            exit(0);
        }
        j--;
        k--;
        r++;
    }
    cout<<"Yes\n";
}

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

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

using namespace std;

int main(){
    string s;
    cin >>s;
    if(s == "Sunny"){
        cout << "Cloudy" <<endl;
    }else if(s == "Cloudy"){
        cout << "Rainy" <<endl;
    }else {
        cout << "Sunny"<<endl;
    }
}

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

using namespace std;

const int N = 3e3 + 5;
int n;
double dp[N][N];

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

    cin >> n;

    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        double p; cin >> p;
        for (int j = 0; j <= i; ++j) {
            int k = i - j;
            if (j) dp[j][k] += dp[j - 1][k] * p;
            if (k) dp[j][k] += dp[j][k - 1] * (1 - p);
        }
    }

    double ans = 0;
    for (int i = 0; i <= n; ++i) if (n - i < i) ans += dp[i][n - i];
    cout << fixed << setprecision(10) << ans;

    return 0;
}


Measured memory_bytes: 70016
#include <stdio.h>
#include <string.h>

int char2int(char c)
{
	switch(c){
	case 'I': return 1;
	case 'V': return 5;
	case 'X': return 10;
	case 'L': return 50;
	case 'C': return 100;
	case 'D': return 500;
	case 'M': return 1000;
	default: return 0;
	}
}

int main()
{
	char s[50];

	while(scanf("%s", &s)!=EOF){
		int l=strlen(s);
		int n=0, tmp, i;
		for(i=l-1; i>0; i--){
			if((tmp=char2int(s[i])-char2int(s[i-1]))>0){ n+=tmp; i--; }
			else n+=char2int(s[i]);
		}
		if(i==0) n+=char2int(s[i]);
		printf("%d\n", n);
	}

	return 0;
}

Measured memory_bytes: 536
fn inversion(b: &mut [usize]) -> u64 {
    let n = b.len();
    if n <= 1 {
        return 0;
    }
    let m = n / 2;
    let mut ans = inversion(&mut b[..m]) + inversion(&mut b[m..]);
    let mut c = vec![];
    let mut i = 0;
    let mut j = m;
    while i < m && j < n {
        if b[i] <= b[j] {
            c.push(b[i]);
            i += 1;
        } else {
            ans += (m - i) as u64;
            c.push(b[j]);
            j += 1;
        }
    }
    while i < m {
        c.push(b[i]);
        i += 1;
    }
    for (i, c) in c.iter().enumerate() {
        b[i] = *c;
    }
    ans
}

fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let s: Vec<usize> = s.trim().chars().map(|c| c as usize - 'a' as usize).collect();
    let f = 26;
    let mut a = vec![vec![]; f];
    for (i, &k) in s.iter().enumerate() {
        a[k].push(i);
    }
    let mut odd = 0;
    for i in 0..f {
        odd += a[i].len() & 1;
    }
    if odd > 1 {
        println!("-1");
        return;
    }
    let mut ans = 0u64;
    let mut p = vec![0; f];
    let mut b = vec![];
    let mut back = 0;
    for (_, &k) in s.iter().enumerate() {
        p[k] += 1;
        if 2 * p[k] - 1 == a[k].len() {
            ans += back;
            back += 1;
        } else if 2 * p[k] <= a[k].len() {
            ans += back
        } else {
            b.push(a[k][a[k].len() - p[k]]);
            back += 1;
        }
    }
    b.reverse();
    ans += inversion(&mut b);
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 12540
H, W = map(int, input().split())
N = int(input())
A = [int(s) for s in input().split()]
y = x = 0
d = "r"
c = [[0] * W for _ in range(H)]
while 0 <= y < H and 0 <= x < W and c[y][x] == 0:
    A[-1] -= 1
    c[y][x] = len(A)
    if A[-1] == 0:
        A.pop()
    if d == "r":
        if x < W - 1 and c[y][x + 1] == 0:
            x += 1
        else:
            d = "d"
            y += 1
    elif d == "d":
        if y < H - 1 and c[y + 1][x] == 0:
            y += 1
        else:
            d = "l"
            x -= 1
    elif d == "l":
        if 0 < x and c[y][x - 1] == 0:
            x -= 1
        else:
            d = "u"
            y -= 1
    elif d == "u":
        if 0 < y and c[y - 1][x] == 0:
            y -= 1
        else:
            d = "r"
            x += 1
for ci in c:
    print(*ci)


Measured memory_bytes: 3916
#include <iostream>
#include <algorithm>
using namespace std; long long int l[100009]; long long int dp[100009];
int main(){
	int n,k; cin >> n >> k;
	for (int i=0; i<n; i++) cin >> l[i];
	dp[0]=0; dp[1]=abs(l[0]-l[1]);
	for (int i=2; i<n; i++){
		long long int maxn=10000000000;
		for (int j=1; j<min(k+1,i+1); j++){
			maxn=min(maxn,abs(l[i-j]-l[i])+dp[i-j]);
			//cout << dp[i] << " ";
		}
		dp[i]=maxn;
		//cout << endl;
	}
	cout << dp[n-1];
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long x;
	cin>>x;
	for(long long a=-1000;a<1000;a++)
	{
		for(long long b=-1000;b<1000;b++)
		{
			if((a*a*a*a*a)-(b*b*b*b*b)==x){
				cout<<a<<" "<<b<<endl;
				return 0;
			}
		}
	}
}

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

public class Main {

	public static void main(String[] args) throws IOException {
		
		// 入出力高速化 java.io.* とthrows IOExceptionを忘れずに
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int N = Integer.parseInt(br.readLine());
		String[] IN =br.readLine().split(" ") ;
		
		int[]A = new int[3*N];
		for(int i=0; i<N; i++) {
			int a = Integer.parseInt(IN[i]);
			A[i] = a;
			A[i+N] = a-1;
			A[i+2*N] = a+1;
		}
		Arrays.sort(A);

		int X = A[0]; //出現回数カウントの基準値
		int count = 1; //現在の出現回数
		int max = 1; //出現回数の最大値
		int mode = A[0]; //最頻値初期値

		for(int a=1; a<A.length; a++){
			if (X == A[a]){
				// 調査対象が基準となるXと同じ値であるとき
				// 現在の出現回数に1を足す
				count++;
			}else{
				if(count>max){
					// 調査対象が基準となるXと異なる値であるとき、現在の最頻値と出現回数を更新
					mode = X;
					max = count;
				}

				// 調査基準を変更し、出現回数を初期化
				X = A[a];
				count = 1;
			}
		}

		if (count>max){ //3N端の処理
			max = count;
		}
		
		System.out.println(max);	
	}
}

Measured memory_bytes: 45868
n,t = map(int,input().split())
A = list(map(int,input().split()))
m = 10**9+1 
M = -1
ans = 1
for i in range(n):
    x = A[i]
    m = min(x,m)
    p = x-m
    if p > M:
        ans = 1
        M = p
    elif p == M:
        ans += 1
if M <= 0:
    ans = 0
print(ans)

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

template<class T> inline bool UpdateMin(T& a, T b) {
  if (a > b) { a = b; return 1; } return 0;
}

template<class T> inline bool UpdateMax(T& a, T b) {
  if (a < b) { a = b; return 1; } return 0;
}

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

  int h, n;
  cin >> h >> n;
  vector<int> costs(n);
  vector<int> values(n);
  for (int i = 0; i < n; i++) {
    cin >> values[i] >> costs[i];
  }

  vector<int> dp(h + 1, INT_MAX);
  dp[0] = 0;
  for (int x = 0; x < h; x++) {
    if (dp[x] == INT_MAX) continue;
    for (int i = 0; i < n; i++) {
      UpdateMin(dp[min(x + values[i], h)], dp[x] + costs[i]);
    }
  }
  cout << dp[h] << endl;
}

Measured memory_bytes: 256
n=int(input())
c,s,f=[0]*(n-1),[0]*(n-1),[0]*(n-1)
for i in range(n-1):
  c[i],s[i],f[i]=map(int,input().split())
arr=[0]*n
for i in range(n-1):
  for j in range(i,n-1):
    l=s[j]
    if arr[i]>l:
      while arr[i]>l:
        l+=f[j]
    arr[i]=l
    arr[i]+=c[j]
  print(arr[i])
print(0)

Measured memory_bytes: 42812
n = int(input())
count = 0
lenn = len(str(int(n)))
if lenn == 1:
    count += n
else:
    for i in range(1,lenn+1):
        if i == 1:
            count += 9
        elif i == lenn:
            if i % 2 == 0:
                pass #count += n - (10**(i-1)) -1
            else:
                count += n - (10**(i - 1)) + 1
        elif i % 2 == 0:
            pass
        else:
            count += ((10**i) - 1) - (10**(i-1)) + 1
        
print(count)


Measured memory_bytes: 38384
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

res = 0
for i in range(N):
    c = min(A[i], B[i])
    res += c
    B[i] -= c

    if B[i] > 0:
        c = min(A[i + 1], B[i])
        A[i + 1] -= c
        res += c

print(res)


Measured memory_bytes: 18624
#include<stdio.h>

//演習　カエルはまっすぐ帰る

int main() {
    int d, l; //距離、大ジャンプ
    
    //入力
    //printf("距離、大ジャンプ = ");
    scanf("%d %d", &d, &l);
    
    //出力
    printf("%d\n", d/l + d%l);
    
    return 0;
}



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

int main(){
    int x; //所持金
    cin >> x;

    int ans = 0; //嬉しさ

    while(x >= 5){
        if(x >= 500){
            ans += 1000;
            x -= 500;
        }else{
            ans += 5;
            x -= 5;
        }
    }

    cout << ans << endl;
}

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

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }


#define int long long
const int INF = 1001001001;

signed main(){

    int n;cin >> n;
    vector<int> h(n);
    for(int i = 0, i_len = (int)n; i < i_len; ++i) cin >> h[i];

    vector<int> dp(n+1, INF);

    dp[0] = 0;
    dp[1] = (int)abs(h[0] - h[1]);
    /*
    dp[2] = (int)abs(h[1] - h[2]);
    dp[2] = (int)abs(h[0] - h[2]);
    amin(dp[2], dp[1] + (int)abs(h[1] - h[2]));
    amin(dp[2], dp[0] + (int)abs(h[0] - h[2]));

    amin(dp[i], dp[i-1] + (int)abs(h[i-1] - h[i]));
    amin(dp[i], dp[i-2] + (int)abs(h[i-2] - h[i]));
    */

    for(int i = 2; i < n; ++i){
        amin(dp[i], dp[i-1] + (int)abs(h[i-1] - h[i]));
        amin(dp[i], dp[i-2] + (int)abs(h[i-2] - h[i]));        
    } 


cout << dp[n-1] << endl;
    return 0;
}

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

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    ll mn, mx;
    mn = a*(n-1) + b;
    mx = b*(n-1) + a;
    if(n == 1 && a == b) cout << 1 << endl;
    else if(a > b || n == 1) cout << 0 << endl;
    else cout << mx - mn + 1 << endl;
    return 0;
}


Measured memory_bytes: 3556
use std::io::*;
use std::str::FromStr;
use std::cmp;
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main(){
    let a: u32=read();
    let b: u32=read();
    let c: u32=read();
    if(c>b/a){
        println!("{}",b/a);
    }else{
        println!("{}",c);
    }
    
}

Measured memory_bytes: 2096
/*+lmake
 * STD = c++14
 * DEFINE += MDEBUG
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
#ifdef DEBUG
     #define debug(args...)            {dbg,args; cerr<<endl;}
#else
    #define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

void solve(long long A, long long B, long long C){
	LL a[3]={A,B,C};
	sort(a,a+3);
	int x=a[2]-a[0],y=a[2]-a[1];
	if ((x-y)%2==0) {
		cout<<(x+y)/2<<endl;
	} else {
		cout<<(x+y)/2+2<<endl;
	}
}

int main(){	
	long long A;
	long long C;
	long long B;
	scanf("%lld",&A);
	scanf("%lld",&B);
	scanf("%lld",&C);
	solve(A, B, C);
	return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;
int x,nr,nr1,i,n;
int main()
{
    cin>>n;
    nr1=0;
    for(i=1;i<=n;i++)
    {
        cin>>x;
        if(x==i) nr1++;
        else
        {
            nr+=(nr1+1)/2;
            nr1=0;
        }
    }
    nr+=(nr1+1)/2;
    cout<<nr;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL K, X;
	in >> K >> X;
	out << (500 * K >= X ? "Yes" : "No") << std::endl;
}


Measured memory_bytes: 764
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'

void solve(){
  ll n, a, b;
  cin >> n >> a >> b;
  if (a > b) swap(a, b);
  ll d = b - a;
  if (d % 2ll){
    cout << min(a - 1ll, n - b) + 1 + d / 2ll;
  } else {
    cout << d / 2ll;
  }
}

int main() {
  ios::sync_with_stdio(false); 
  cin.tie(0); cout.tie(0);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 

1
1000000000000000000


*/

Measured memory_bytes: 3620
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int cnt=0;
        int c1=0,c2=0,c3=0;
        int ans = 0;
        for(int i=0; i<n; i++){
            char[] s = sc.next().toCharArray();
            for(int j=0; j< s.length-1; j++){
                if(s[j]=='A' && s[j+1]=='B') cnt++;
            }
            if(s[0] == 'B' && s[s.length-1]=='A') c1++;
            else if(s[0]=='B') c2++;
            else if(s[s.length-1]=='A') c3++;
        }
        if(c1 != 0){
            if(c2+c3 > 0){
                ans = Math.min(c2,c3) + c1;
            }else{
                ans = c1 - 1;
            }
        }else{
            ans = Math.min(c2,c3);
        }
        System.out.println(ans + cnt);
    }
}


Measured memory_bytes: 29540
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e5) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n, p[4], t[4], ans = IINF;
    cin >> n;
    for(int i=0;i<4;i++) cin >> p[i];
    for(int i=0;i<4;i++) cin >> t[i];
    for(int i=0;i<=100;i++){
        for(int j=0;j<=100;j++){
            for(int k=0;k<=100;k++){
                int sum = t[0]*i + t[1]*j + t[2]* k;
                int l = max(0, n-sum)/t[3] + (max(0, n-sum)%t[3] > 0);
                ans = min(ans, p[0]*i + p[1]*j + p[2]*k + p[3]*l);
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3096
# include<stdio.h>
int main()
{
	int a,b,c,d,m,n;
	while(~scanf("%d%d%d%d",&a,&b,&c,&d))
	{
		if (a>=d||b<=c)
		{
			printf("0\n");
		}
		else
	 {
		m=a;
		if (m<c)
		{
			m=c;
		}
		n=b;
		if (n>d)
		{
			n=d;
		}
		printf("%d\n",n-m);
	 }
	}
	return 0;
 } 

Measured memory_bytes: 128
#include<iostream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

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

    int A[n][m];
    int B[m][l];
    ll C[n][l];

    rep(i,n) {
        rep(j,l) C[i][j] = 0;
    }

    rep(i, n) {
        rep(j,m) cin >> A[i][j];
    }

    rep(i, m) {
        rep(j, l) cin >> B[i][j];
    }

    rep(i, n) {
        rep(j, l) {
            rep(k, m) {
                C[i][j] += A[i][k] * B[k][j];
            }
        }
    }
    rep(i,n) {
        rep(j,l) {
            if (j) cout << " ";
            cout << C[i][j];
        } cout << endl;
    }
}


Measured memory_bytes: 3232
/*

  "With age, comes wisdom. With travel, comes understanding.
   Remember that happiness is a way of travel – not a destination"

*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int            long long int
#define ld             long double
#define F              first
#define S              second
#define pb             push_back
#define si             set <int>
#define vi             vector <int>
#define pii            pair <int, int>
#define vpi            vector <pii>
#define vpp            vector <pair<int, pii>>
#define mii            map <int, int>
#define mpi            map <pii, int>
#define spi            set <pii>
#define endl           "\n"
#define sz(x)          ((int) x.size())
#define all(p)         p.begin(), p.end()
#define que_max        priority_queue <int>
#define que_min        priority_queue <int, vi, greater<int>>
#define bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)       for(auto x : a) cout << x << " "; cout << endl
#define print1(a)      for(auto x : a) cout << x.F << " " << x.S << endl
#define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << endl

inline int power(int a, int b)
{
     int x = 1;
     while (b)
     {
          if (b & 1) x *= a;
          a *= a;
          b >>= 1;
     }
     return x;
}

typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> Set;

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 200005;
int a[N], n, m, k;

void solve()
{
     int i, j;
     string s; cin >> n >> s;

     for (auto x : s)
     {
          int z = x - 'A';
          z += n;
          z %= 26;
          char c = 'A' + z;
          cout << c;
     }

}

int32_t main()
{
     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);


     cout << setprecision(9) << fixed;
     clock_t z = clock();
     solve();
     cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);

     return 0;
}

Measured memory_bytes: 256
import math
import bisect
n=int(input())
a=list(map(int,input().split()))
a.sort()

x=a[0];ctn=1;l=[];l2=[]
for i in range(1,n):
  if x==a[i]:
    ctn+=1
  else:
    l.append([x,ctn])
    l2.append(x)
    x=a[i]
    ctn=1
l.append([x,ctn])
l2.append(x)

b=[2**i for i in range(1,50)]

ct=0
for i in range(len(l2)-1,-1,-1):
  x=math.floor(math.log2(l2[i]))
  x=b[x]-l2[i]
  y=bisect.bisect_left(l2,x)
  if l2[y]==x:
    if l2[y]!=l2[i]:
      m=min(l[i][1],l[y][1])
    else:
      m=l[i][1]//2
    l[i][1]-=m
    l[y][1]-=m
    ct+=m
print(ct)

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

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

    int G[26][26];
    int exist[26];
    int vis[26];

    int n;
    while(cin >>n,n)
    {
        memset(G,0,sizeof(G));
        memset(exist,0,sizeof(exist));
        memset(vis,0,sizeof(vis));

        int in[26]={0}, out[26]={0};
        rep(i,n)
        {
            string s;
            cin >>s;

            int S=s.size();
            int a=s[0]-'a', b=s[S-1]-'a';
            ++out[a];
            ++in[b];
            G[a][b]=1;
            exist[a]=exist[b]=1;
        }

        rep(i,26)
        {
            if(exist[i])
            {
                queue<int> que;
                que.push(i);
                vis[i]=1;
                while(!que.empty())
                {
                    int now=que.front(); que.pop();
                    rep(j,26)
                    {
                        if(G[now][j]==0) continue;
                        if(!vis[j])
                        {
                            vis[j]=1;
                            que.push(j);
                        }
                    }
                }
                break;
            }
        }

        bool connected=true;
        rep(i,26)
        {
            if(exist[i] && !vis[i]) connected=false;
        }

        bool valid=false;
        if(connected)
        {
            valid=true;
            rep(i,26) if(in[i]!=out[i]) valid=false;
        }

        string ans="NG";
        if(valid) ans="OK";
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;

int main(){
  int a,b,c,k;
  cin >>  a >> b >> c >> k;
  int max_num =  max(a, max(b, c));
  if(max_num == a)cout << (a * pow(2, k)) + b + c << endl;
  else if(max_num == b)cout << (b * pow(2, k)) + a + c << endl;
  else if(max_num == c)cout << (c * pow(2, k)) + b + a << endl;
  
}

Measured memory_bytes: 256
using System;

class ABC079C
{
	static public void Main(string[] args)
	{
		string ABCD = Console.ReadLine();
		int A = int.Parse(ABCD.Substring(0, 1));
		int B = int.Parse(ABCD.Substring(1, 1));
		int C = int.Parse(ABCD.Substring(2, 1));
		int D = int.Parse(ABCD.Substring(3, 1));

		for(int op1 = 0; op1<=1; op1++)
		{
			for(int op2=0; op2<=1; op2++)
			{
				for(int op3=0; op3<=1; op3++)
				{
					int s = A;
					if(op1 == 0)
						s += B;
					else
						s -= B;

					if(op2 == 0)
						s += C;
					else
						s -= C;

					if(op3 == 0)
						s += D;
					else
						s -= D;

					if(s == 7)
					{
						string pm1 = (op1 == 0) ? "+" : "-";
						string pm2 = (op2 == 0) ? "+" : "-";
						string pm3 = (op3 == 0) ? "+" : "-";
						Console.WriteLine("{0}{1}{2}{3}{4}{5}{6}=7", A, pm1, B, pm2, C, pm3, D);
						return;
					}
				}
			}
		}
	}
}


Measured memory_bytes: 13268
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<vector>

using namespace std;

int main(){
    int n,a, min=1001, max=-1;
    cin>>n;
    for(int i=1; i<=n; i++){
        cin>>a;
        if(min>a)min=a;
        if(max<a)max=a;
    }
    cout<<(max-min)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n,m=0;
	while(cin>>n){	
	for(int i=0;i<=9;i++){
		for(int j=0;j<=9;j++){
			for(int k=0;k<=9;k++){
				for(int l=0;l<=9;l++){
					if(i+j+k+l==n) m++;
					}
				}
			}
		}
	cout<<m<<endl;
	m=0;
	}
}

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

int main(){
	int n,k;
	cin >> n >> k;
	if(n % k == 0)cout << 0 << endl;
	else cout << 1 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int data[10];
	int a;
	int i;
	a=0;

	for(i=0;i<10;i++){	
	
		scanf("%d",&data[i]);
		a+=data[i];
	}
	
	printf("%d\n",a);
	
	return 0;
}

Measured memory_bytes: 1028
#include<stdio.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<bitset>
#include<map>
#include<vector>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<queue>
#include<deque>
#include<stack>
using namespace std;

string s;
char now;
int ans;

int main(){
	cin>>s;
	now=s[0];
	for(int i=0;i<s.size();i++) if(s[i]!=now){
		now=s[i];
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
using System;
using System.Linq;


class Program
{
    static void Main(string[] args)
    {
        string[] s = Console.ReadLine().Split(' ');
        //int N = int.Parse(Console.ReadLine());
        int A = int.Parse(s[0]);
        int P = int.Parse(s[1]);
        P += A * 3;
        int ApplePie = P / 2;
        Console.WriteLine(ApplePie);
    }
}


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

// templates -------------------------------------

#define ULL unsigned long long
#define LL long long
#define LLD long long double
#define REP(i, n) for(LL i = 0; i < n; i++)
#define INV_REP(i, n) for(LL i = n; 0 <= i; i--)

LL combination(LL n, LL m)
{
  LL nume = 1;
  REP(i, m) nume *= (n-i);
  LL demo = 1;
  for(int i = 1; i <= m; i++) demo *= i;
  return nume / demo;
}

template<class T>
class UnionFind
{
private:
  vector<T> par;
  vector<T> rank;
  vector<T> size;

public:
  UnionFind(T N) :
    par(N, T()), rank(N, T()), size(N, T())
  {
    REP(i, N)
    {
      par[i] = i;
      rank[i] = 0;
      size[i] = 1;
    }
  }

  inline T root(T x)
  {
    return par[x] == x ? x : par[x] = root(par[x]);
  }

  inline bool same(T x, T y)
  {
    return root(x) == root(y);
  }

  inline T getSize(T x)
  {
    return size[root(x)];
  }

  void unite(T x, T y)
  {
    T r1 = root(x);
    T r2 = root(y);
    if(r1 == r2) return;

    if(rank[r1] < rank[r2]) swap(r1, r2);
    if(rank[r1] == rank[r2]) rank[r1]++;
    par[r2] = r1;
    size[r1] += size[r2];
  }
};

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

LL n, m;
vector<LL> l, r;

void input()
{
  cin >> n >> m;
  l.resize(m);
  r.resize(m);
  for(int i = 0; i < m; i++)
  {
    cin >> l[i] >> r[i];
  }
}

void solve()
{
  sort(l.begin(), l.end(), [](LL a, LL b){return a > b;});
  sort(r.begin(), r.end());
  cout << max(r[0] - l[0] + 1, 0LL);
}

int main()
{
  input();
  solve();
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

ll to_ll(string s);

int main(){
    string s;
    cin >> s;
    ll sum = 0;
    for(int i = 0; i < (1 << (s.size() - 1)); i++){
        int pos = 0;
        for(int j = 0; j < s.size() - 1; j++){
            if(((i >> j) & 1) == 0)
                continue;
            sum += to_ll(s.substr(pos, j + 1 - pos));
            pos = j + 1;
        }
        sum += to_ll(s.substr(pos, s.size() - pos));
    }
    cout << sum << endl;
    return 0;
}

ll to_ll(string s){
    ll ans = 0;
    for(string::iterator i = s.begin(); i != s.end(); i++){
        ans = 10 * ans + (*i - '0');
    }
    return ans;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

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

S = [0] * (N+1)
for i in range(1, N+1):
    S[i] = S[i-1] + A[i-1]

# 正の数限定の累積和
O = [0] * (N+1)
for i in range(1, N+1):
    x = max(0, A[i-1])
    O[i] = O[i-1] + x

#print(S)

# 区間を白/黒、区間の外を白/黒で比較
ans = 0
for i in range(N-K+1):
    l = i
    r = i+K-1

    # 区間
    sum_in = S[r+1] - S[l]

    # 左区間
    if i == 0:
        sum_left = 0
    else:
        sum_left = O[l]-O[0]

    # 右区間
    if r+1 < N:
        sum_right = O[N]-O[r+1]
    else:
        sum_right = 0

    # 全部黒
    tmp = 0
    tmp = max(tmp, sum_in+sum_left+sum_right)

    # 区間だけ黒
    tmp = max(tmp, sum_in)

    # 区間だけ白
    tmp = max(tmp, sum_left+sum_right)

    ans = max(ans, tmp)

#    print(tmp, sum_in, sum_left, sum_right, l, r)


print(ans)

Measured memory_bytes: 16492
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long ans = 0;
		for(int a = 2; a < n-1; a++) {
			int b = 1;
			while(a*b<n&&b<a) {
				ans++;
				b++;
			}
		}
		
		ans*=2;
		for(int a = 1; a <= n-1; a++) {
			if(a*a<n)ans++;
			else break;
		}
		if(n!=2) System.out.println(ans+2);
		else System.out.println(1);
	}
}

Measured memory_bytes: 36472
#include <bits/stdc++.h>
#define ll long long
#define rep(i, a, b) for (int i = a; i <= b; ++i)
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
long double L;
int main() {
	io(); cin >> L;
	L /= 3.0;
	cout << fixed << setprecision(12) << (L * L * L);
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;
const int MAX_N = 200000;
long long a[MAX_N], b[MAX_N];
long long n;
pair<long long, long long>  itv[MAX_N];
bool solve(){
    for(int i=0 ; i<n ; i++){
        itv[i].first = b[i];
        itv[i].second = a[i];
    }
    sort(itv, itv + n);
    long long count = 0;
    long long ft = 0;
    for(int i=0 ; i<n ; i++){
        if(ft <= itv[i].first-itv[i].second){
            count++;
            ft = ft + itv[i].second;
        }
    }
    if(count == n)  return true;
    else return false;
}
int main(){
    cin >> n;
    for(int i=0 ; i<n ; i++)    cin >> a[i] >> b[i];
    if(solve()) cout << "Yes" << endl;
    else    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include<math.h>
#include <algorithm>
#include<string>
using namespace std;

int main() {
        int N;
        int C[510],S[510],F[510];
        long long int Ans[510];

        cin >> N;
        for(int i=0; i<N-1; i++) {
                cin >> C[i] >> S[i] >> F[i];
                Ans[i]=0;
        }
        Ans[N-1]=0;

        for(int i=0; i<N-1; i++){
                long long int Time=S[i]+C[i];
                for(int j=i+1; j<N-1; j++){
                        if(Time < S[j]) Time=S[j];
                        else if(Time%F[j]!=0) Time=(Time/F[j]+1)*F[j];
                        Time+=C[j];
                }
                Ans[i]=Time;
        }

        for(int i=0; i<N; i++) cout << Ans[i] << endl;;
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=1000010;
const ll mod=1e9+7;

int main(){  
  int n,t;
  cin >> n >> t;
  vector<int> a(n);
  rep(i,n){ cin>>a[i]; }
  priority_queue<int> sell;
  vector<int> profit(n,0);
  
  for(int i=n-2; i>=0; i--){
    sell.push(a[i+1]);
    profit[i] = sell.top()-a[i];
  }
  sort(profit.begin(),profit.end());
  int maxi=profit[n-1];
  int ans = profit.end() - lower_bound(profit.begin(),profit.end(),maxi);
  cout << ans << endl;
  return 0;
}

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

typedef long long LL;
#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define FOR(it,c) for(auto&& it=begin(c);it!=end(c);it++)
#define ROF(it,c) for(auto&& it=rbegin(c);it!=rend(c);it++)
#define PB push_back
#define INT(n) int n;scanf("%d",&n)
#define VI(v,n) vector<int> v(n);REP(i,n){scanf("%d",&v[i]);}
#define MSET(arr,val)  memset(arr,val,sizeof(arr))

template<typename T>
class bit {
public:
  T e;
  function<T(T, T)> f;
  unsigned int n;
  vector<T> v;
  bit(T _e, function<T(T, T)> _f, unsigned int _n) {
    e = _e;
    f = _f;
    n = _n;
    vector<T> _v((1 << n) - 1, e); v.swap(_v);
  }
  void update(unsigned int i, T x){
    assert(0 < i);
    while (i + 1 < 1u << n){
      v[i] = v[i] + x;
      i += i & -i;
    }
  }
  T query(unsigned int i) {
    assert(0 < i);
    T rtn = e;
    while (0 < i){
      rtn = f(rtn, v[i]);
      i -= i & -i;
    }
    return rtn;
  }
};

int main(){
  INT(n); INT(k); VI(as, n);
  vector<LL> va = {0}, vb;
  LL s = 0, ans = 0;
  FOR(it, as){
    s += (*it - k);
    va.PB(s);
    vb.PB(s);
  }
  sort(vb.begin(), vb.end());
  bit<int> bit(0, [](int x, int y){return x + y;}, 18);
  FOR(it, va){
    int i = lower_bound(vb.begin(), vb.end(), *it) - vb.begin() + 1;
    ans += bit.query(i);
    bit.update(i, 1);
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 6376
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

int main()
{
    int n, count = 0;
    std::cin >> n;
    std::string str;
    for (int i = 1; i <= n; i++)
    {
        str = std::to_string(i);
        if ((str.length() % 2) != 0) { count++; }
    }
    std::cout << count << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
if(s=="Sunny")
{
    cout<<"Cloudy"<<endl;
}
else if(s=="Cloudy")
{
    cout<<"Rainy"<<endl;
}
else{
    cout<<"Sunny"<<endl;
}
    return 0;
}

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

using namespace std;

#define MAX 30

int main(){

	int h,w,n;
	string fiel[MAX];
	string cfiel[MAX];
	bool ok=false;
	bool co;

	cin>>h>>w>>n;
	for(int i=0;i<h;i++){
		cin>>fiel[i];
		cfiel[i]=fiel[i];
	}

	for(int cw=0;cw<w;cw++){
		for(int ch=0;ch<h;ch++){
			if(cw==w-1) continue;
			for(int i=0;i<w;i++){
				for(int j=0;j<h;j++){
					cfiel[j][i]=fiel[j][i];
				}	
			}
			swap(cfiel[ch][cw],cfiel[ch][cw+1]);
				
			while(1){
				while(1){
					bool lf=false;
					for(int i=0;i<w;i++){
						for(int j=h-1;j>0;j--){
							if(cfiel[j][i]=='.'){
								if(cfiel[j-1][i]!='.'){
									lf=true;
									cfiel[j][i]=cfiel[j-1][i];
									cfiel[j-1][i]='.';
								}
							}
						}
					}
					if(!lf) break;
				}
				bool dfiel[MAX][MAX];
				for(int i=0;i<w;i++){
					for(int j=0;j<h;j++){
						dfiel[j][i]=false;
					}
				}
				bool df=false;
				for(int i=0;i<h;i++){
					for(int j=0;j<=w-n;j++){
						if(cfiel[i][j]=='.') continue;
						bool del=true;
						for(int k=1;k<n;k++){
							if(cfiel[i][j]!=cfiel[i][j+k]) del=false;
						}
						if(del){
							for(int k=0;k<n;k++){
								dfiel[i][j+k]=true;
							}
						}
					}
				}
				for(int i=0;i<w;i++){
					for(int j=0;j<=h-n;j++){
						if(cfiel[j][i]=='.') continue;
						bool del=true;
						for(int k=1;k<n;k++){
							if(cfiel[j][i]!=cfiel[j+k][i]) del=false;
						}
						if(del){
							for(int k=0;k<n;k++){
								dfiel[j+k][i]=true;
							}
						}
					}
				}
				for(int i=0;i<w;i++){
					for(int j=0;j<h;j++){
						if(dfiel[j][i]==true){
							cfiel[j][i]='.';
							dfiel[j][i]=false;
							df=true;
						}
					}
				}
					
				if(!df) break;
			}
			co=true;
			/*cout<<endl;*/
			for(int i=0;i<h;i++){
				for(int j=0;j<w;j++){
					if(cfiel[i][j]!='.') co=false;
					/*cout<<cfiel[i][j];*/
				}
				/*cout<<endl;*/
			}
			if(co) ok=true;
		}
	}

	if(ok) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;

	return 0;
}

Measured memory_bytes: 1212
#include <algorithm>
#include <iostream>
 
using namespace std;
 
int main () {
    int r,c;
    int tec=0;
    cin>>r>>c;
    int ave[r][c];
     
    for(int s=0;s<r; s++)
    {
        for(int t=0; t<c; t++)
        {
            cin>>ave[s][t];
        }
    }
        for(int s=0;s<r; s++)
        {
            int num=0;
            for(int t=0; t<c; t++)
            {
                cout<<ave[s][t]<<" ";
                num+=ave[s][t];
            }
            cout<<num;
            cout<<endl;
        }
    for(int m=0; m<c; m++)
    {int st=0;
        for(int w=0;w<r; w++)
        {
            st += ave[w][m];
            tec+=ave[w][m];
        }
        cout<<st<<" ";
    }
    cout<<tec<<endl;
     
    return 0;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5+10; 
int N, M, ans[MAXN], D[MAXN];
vector<int> adj[MAXN];

void bfs(int v){
     queue<int> q;
     q.push(v);
     for(int i = 1; i < N; i++) D[i] = INT_MAX;
     while(!q.empty()){
          v = q.front();
          q.pop();
          for(auto x : adj[v]){
               if(D[x] == INT_MAX){
                    D[x] = D[v] + 1;
                    q.push(x);
               }
          }
     }
}

main(){
     ios_base::sync_with_stdio(false);
     cin.tie(nullptr);
     cin >> N >> M;
     while(M--){
          int u, v; cin >> u >> v;
          u--, v--;
          adj[u].push_back(v);
          adj[v].push_back(u);
     }
     bfs(0);
     for(int i = 1; i < N; i++){
          int Min = INT_MAX;
          for(auto x : adj[i]){
               if(Min > D[x]){
                    Min = D[x];
                    ans[i] = x;
               }
          }
          if(Min == INT_MAX){
               cout << "No";
               exit(0);
          }
     }
     cout << "Yes\n";
     for(int i = 1; i < N; i++) cout << ans[i]+1 << "\n";
}

Measured memory_bytes: 10852
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();
		boolean flag = true;
		if (S.length() + 1 != T.length()) {
			flag = false;
		}

		for (int i = 0; i < S.length(); i++) {
			if (S.charAt(i) != T.charAt(i)) {
				flag = false;
			}

		}
		System.out.println(flag ? "Yes" : "No");
	}
}


Measured memory_bytes: 35708