akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const long long INF = 1001001001;
const long long MOD = 1000000007;
const double EPS = 1e-10;

int grid[33][33]={};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int h,w,k;
    cin>>h>>w>>k;
    for(int i=0;i<h;i++){
        string s;
        cin>>s;
        for(int j=0;j<w;j++)grid[i+1][j]=s[j]-'0';
    }
    int ans=0;
    for(int i=1;i<=h;i++){
        for(int j=0;j<w;j++){
            int newGrid[33][33]={};
            for(int l=1;l<=h;l++){
                for(int m=0;m<w;m++){
                    newGrid[l][m]=grid[l][m];
                    if(l==i&&m==j)newGrid[l][m]=0;
                }
            }
            int rmCnt=-1,res=0;
            bool update=true;
            while(update){
                update=false;
                rmCnt++;
                for(int l=1;l<=h;l++){
                    for(int m=0;m<w;m++){
                        if(newGrid[l][m]==0){
                            for(int r=l;r>=1;r--)newGrid[r][m]=newGrid[r-1][m];
                        }
                    }
                }
                for(int l=1;l<=h;l++){
                    for(int m=0,prv=newGrid[l][0],len=0;m<=w;m++){
                        if(prv==newGrid[l][m]){
                            len++;
                        }else{
                            if(prv>0&&len>=k){
                                for(int r=m-len;r<=m-1;r++)newGrid[l][r]=0;
                                res+=len*prv*pow(2,rmCnt);
                                update=true;
                            }
                            prv=newGrid[l][m],len=1;
                        }
                    }
                }
            }
            ans=max(ans,res);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4040
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ll long long
#define mp make_pair
#define pii pair<int,int>
#define mod 1000000007
#define M 1000000
using namespace std;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll k;
    string s,h;
    cin>>k>>s;
    if(s.size()<=k)
    cout<<s<<endl;
    else
    {
        h=s.substr(0,k)+"...";
        cout<<h<<endl;
    }
}

Measured memory_bytes: 3648
//競技プログラミング　テンプレ
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cstdlib> //abs() これは整数のみ

using namespace std;

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

const int max_v = 300;
const int INF = 1000000;



int main() {
	int n, ans=0;
	cin >> n;
	vector <int> A(n);
	//string str;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	map<int ,int> mp;
	REP(i,n){
		mp[A[i]] = 1;
	}

	ans = mp.size();
	//sort(A.begin(), A.end());

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
###############################################################################\
n,k,q=INPUT()
A=[0]*(n+1)
for i in range(q):
    x=int(input())
    A[x]+=1
for i in range(1,n+1):
    if k-q+A[i]>0:
        print("Yes")
    else:
        print("No")
        


Measured memory_bytes: 76560
while True:
    a,op,b = input().split()
    a = int(a)
    b = int(b)
    
    if op == '?':
        break
    elif op == '+':
        print(int(a+b))
    elif op == '-':
        print(int(a-b))
    elif op == '*':
        print(int(a*b))
    elif op == '/':
        print(int(a/b))


Measured memory_bytes: 5596
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c,m[3];
    scanf("%d%d%d",&a,&b,&c);
    m[0]=a+b;
    m[1]=a+c;
    m[2]=b+c;
    sort(m,m+3);
    printf("%d",m[0]);
    return 0;
}


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

int main() {
  string N;
  int ans=0;
  cin >> N;

  for (int i = 0; i < 3; i++) {
    if (N[i]=='R') {
      ans++;
    }
  }
  if (N=="RSR") {
    ans=1;
  }
  cout << ans << endl;
}

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


int maxn = 2e5;
vector<int> t(4 * maxn);
vector<int> add(4 * maxn, -1);

int inf = 1e9;

void push(int v, int l, int r) {
    if (add[v] == -1) return;
    int m = (l + r) / 2;
    add[2 * v + 1] = add[v];
    add[2 * v + 2] = add[v] + m - l;
    add[v] = -1;
}

int get_val(int v) {
    return max(t[v], add[v]);
}

int get(int v, int l, int r, int ll, int rr) {
    if (ll >= r || rr <= l) {
        return inf;
    }
    if (ll <= l && rr >= r) {
        return get_val(v);
    }
    push(v, l, r);
    int m = (l + r) / 2;
    int ans = min(get(2 * v + 1, l, m, ll, rr),
                  get(2 * v + 2, m, r, ll, rr));
    t[v] = min(get_val(2 * v + 1), get_val(2 * v + 2));
    return ans;
}


void upd(int v, int l, int r, int ll, int rr, int val) {
    // cout << l << " " << r << " " << ll << " " << rr << "  " << val << endl;
    if (ll >= r || rr <= l) {
        return;
    }
    if (ll <= l && rr >= r) {
        add[v] = val + l - ll;
        return;
    }
    push(v, l, r);
    int m = (l + r) / 2;
    upd(2 * v + 1, l, m, ll, rr, val),
    upd(2 * v + 2, m, r, ll, rr, val);
    t[v] = min(get_val(2 * v + 1), get_val(2 * v + 2));
    return;
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int h, w; cin >> h >> w;
    vector<int> a(h), b(h);
    for (int i = 0; i < h; i++) cin >> a[i] >> b[i];
    for (int i = 0; i < h; i++) {
        int ans = inf;
        if (a[i] != 1) {
            ans = min(ans, get(0, 0, w, 0, a[i] - 1));
        }
        if (b[i] != w) {
            ans = min(ans, get(0, 0, w, b[i], w));
        }
        int d = inf;
        if (a[i] != 1) d = get(0, 0, w, a[i] - 2, a[i] - 1) + 1;
        upd(0, 0, w, a[i] - 1, b[i], d);
        if (ans < inf) cout << ans + i + 1 << endl;
        else cout << -1 << endl;
    }
    return 0;
}




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

class Program
{
    int N, Q;
    int[] markCount;
    int[] parent;

    void Solve()
    {
        while (true)
        {
            N = read.Int();
            Q = read.Int();
            if (N == 0) break;
            markCount = new int[N + 1];
            parent = new int[N + 1];
            markCount[1] = 1;

            for (int i = 2; i <= N; i++)
            {
                parent[i] = read.Int();
            }
            var isQuery = new bool[Q];
            var index = new int[Q];
            for (int i = 0; i < Q; i++)
            {
                isQuery[i] = read.String() == "Q";
                index[i] = read.Int();
                if (!isQuery[i]) markCount[index[i]]++;
            }
            long ans = 0;
            for (int i = Q - 1; i >= 0; i--)
            {
                if (isQuery[i]) { ans += GetParent(index[i]); }
                else { markCount[index[i]]--; }
            }
            Console.WriteLine(ans);
        }
    }

    int GetParent(int i)
    {
        if (markCount[i] > 0) return i;
        int p = i;
        var list = new List<int>();
        while (markCount[p] == 0)
        {
            list.Add(p);
            p = parent[p];
        }
        list.ForEach(x => parent[x] = p);
        return parent[i] = p;
    }


    static void Main() { new Program().Solve(); }
    static Read read = new Read();
    class Read
    {
        private Queue<string> que = new Queue<string>();
        public string String() { return Dequeue(); }
        public int Int() { return int.Parse(Dequeue()); }
        public long Long() { return long.Parse(Dequeue()); }
        public double Double() { return double.Parse(Dequeue()); }
        public int[] IntArray() { return Array.ConvertAll(Line().Split(), int.Parse); }
        public int[][] IntGrid(int H) { return Enumerable.Range(0, H).Select(i => IntArray()).ToArray(); }
        public string[] StringArray(int N) { return Enumerable.Range(0, N).Select(i => Line()).ToArray(); }
        public string Line() { return Console.ReadLine().Trim(); }
        private string Dequeue()
        {
            if (que.Count == 0) foreach (var s in Line().Split()) que.Enqueue(s);
            return que.Dequeue();
        }
    }
}

Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define INF 1000000007
using namespace std;

int main(){
	long long N,M;
	scanf("%lld%lld", &N, &M);
	multiset<pair<long long,long long> > yokan;
	multiset<pair<long long, long long> >yokan2;
	for(int i=0;i<N;i++){
		long long a,b;
		scanf("%lld%lld", &a, &b);
		yokan.insert(make_pair(a,b));
		yokan2.insert(make_pair(-b, -a));
	}
	long long po = 1;
	long long leftmost = 0;
	long long rightmost = 0;
	multiset<pair<long long,long long> > yokan1 = yokan;
	while(!yokan1.empty()){
		if(yokan1.lower_bound(make_pair(rightmost, INF)) == yokan1.end()){
			po++;
			rightmost = 0;
			leftmost = 0;
		}
		else{
			auto it = yokan1.lower_bound(make_pair(rightmost, INF));
			rightmost = (*it).second;
			if(leftmost == 0)leftmost = (*it).first;
			yokan1.erase(it);
		}
	}
	if(po%2==0){
		printf("%lld\n",M*po-leftmost);
	}
	else{
		po=1;
		leftmost = -M;
		rightmost = -M;
		while(!yokan2.empty()){
			if(yokan2.lower_bound(make_pair(leftmost, INF)) == yokan2.end()){
				po++;
				leftmost = -M;
				rightmost = -M;
			}
			else{
				auto it = yokan2.lower_bound(make_pair(leftmost, INF));
				leftmost = (*it).second;
				if(rightmost == -M)rightmost = (*it).first;
				yokan2.erase(it);
			}
		}
		printf("%lld\n", M*(po-1)-rightmost);
	}
	return 0;
}


Measured memory_bytes: 40696
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a, b, c, x;
    int ans = 0;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> x;
    for (int i = 0; i <= a; i++){
        for (int j = 0; j <= b; j++){
            for (int k = 0; k <= c; k++){
                if (50 * i + 10 * j + 5 * k == x/10)  ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i,n) {
        cin >> p[i]; 
        p[i]++;
    }
    vector<int> s(n+1, 0);
    s[0] = 0;
    rep(i,n) s[i+1] = p[i] + s[i];
    int mx = 0;
    for(int i = 0; i+k <= n; ++i) mx = max(mx, s[i+k]-s[i]);

    double ans = mx;
    ans /= 2;
    printf("%.10f", ans);
    return 0;
}

Measured memory_bytes: 1792
s = input()

a = -1
b = -1

for i in range(len(s) - 1):
  if a != -1:
    break
  if s[i] == s[i + 1]:
    a = i + 1
    b = i + 2

for i in range(len(s) - 2):
  if a != -1:
    break
  if s[i] == s[i + 2]:
    a = i + 1
    b = i + 3

print(a, b)

Measured memory_bytes: 3188
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;

map<ll, ll> prime_factorize(ll n){
    map<ll, ll> res;
    for (ll i = 2; i * i <= n; ++i){
        while(n % i == 0){
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}

int main(){
    ll N;
    cin >> N;
    auto m = prime_factorize(N);

    ll res = 0;
    for (auto i : m){
        ll p = i.first;
        ll q = i.second;

        int n = 1;
        while (n*(n+1)/2 <= q){
            n++;
        }
        res += --n;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
using namespace std;

typedef pair<int, int> P;

bool pc1(const P& firstElof, const P& secondElof)
{//first降順
	return firstElof.first > secondElof.first;
}
bool pc2(const P& firstElof, const P& secondElof)
{//first昇順
	return firstElof.first < secondElof.first;
}
bool pc3(const P& firstElof, const P& secondElof)
{//second降順
	return firstElof.second > secondElof.second;
}
bool pc4(const P& firstElof, const P& secondElof)
{//second昇順
	return firstElof.second < secondElof.second;
}


int main() {
	int n;
	cin >> n;
	vector<int>l(n);
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> l[i];
		sum += l[i];
	}
	int max = *std::max_element(l.begin(), l.end());
	sum -= max;
	if (max < sum) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,D;
  cin>>A;
  cin>>B;
  cin>>C;
  cin>>D;
for(int i=0; true;i++){
   C-=B;
   A-=D;
   if(C<=0){
     cout<<"Yes"<<endl;
   break;
   }
   else if(A<=0){
     cout<<"No"<<endl;
  break;
   }
}
   
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
using namespace std;
const int maxn = 200010;
//定义链表结构体
struct At {
	char c;		//该位置字符
	At* last;   //上一个节点
	At* next;   //下一个节点
}	c[maxn];
//主函数
int main() {
	//使用cin>>string以方便读入
	string s;
	cin >> s;
	//转存到链表中
	int size = s.size();
	//第一个节点和最后一个节点需要单独处理
	c[0] = { s[0],NULL,&c[1] };//第一个节点的前一个节点为空
	for (int i = 1; i < size - 1; i++) {//遍历中间的size-2个节点
		c[i] = { s[i],&c[i - 1],&c[i + 1] };
	}
	c[size - 1] = { s[size - 1],&c[size - 2],NULL };//最后一个节点的后一个节点为空
	//
	int t = maxn;
	At* x = &c[0];
	while (t--) {
		int update = 0;
		for (At* i = x; i->next != NULL; i = i->next) {
			if (i->c == 'S'&&i->next->c == 'T') {
				if (i->last != NULL) {
					x = i->last;
					x->next = i->next->next;
					if (i->next->next != NULL)
						i->next->next->last = x;
				}
				else {
					x = i->next->next;
					if (i->next->next != NULL)
						i->next->next->last = NULL;
				}
				size -= 2;
				update = 1;
				break;
			}
		}
		if (!update || size == 0 || x == NULL)
			break;
	}
	cout << size << endl;
	return 0;
}


Measured memory_bytes: 5876
#!/usr/bin/env python

def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    q = int(input())
    bc_lst = []
    for i in range(q):
        bc_lst.append(list(map(int, input().split())))
    cnt_lst = [0 for _ in range(100001)]
    s = 0

    for a in a_lst:
        cnt_lst[a] += 1
        s += a

    for bc in bc_lst:
        b, c = bc
        b_cnt = cnt_lst[b]
        s += b_cnt * (c - b)
        cnt_lst[b] = 0
        cnt_lst[c] += b_cnt
        print(s)

if __name__ == '__main__':
    main()


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

using namespace std;

main() {
#ifdef HOME
    freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, d, ans = 0;
    cin >> n >> d;
    for (int i = min(n, d + 1); i <= n;) {
        ans++;
        if (i + d >= n) break;
        i = min(n, i + 2 * d + 1);
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <queue>
#include <cctype>
#include <climits>
#include <stack>
#include <map>
#include <cstring>
#include <cassert>
 
using namespace std;

int main(){

    int n,a,b;
    cin>>n>>a>>b;

    if(abs(a-b)==1){
        cout<<"Borys"<<endl;
    }else{
        for(int i=0;;i++){
            if(i%2==0){
                a++;
                if(abs(a-b)==1){
                    cout<<"Alice"<<endl;
                    break;
                }
            }else{
                b--;
                if(abs(a-b)==1){
                    cout<<"Borys"<<endl;
                    break;
                }
            }
        }
    }


	return 0;
}


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

int main()
{
  int a,b,c,d;
  string ans="Yes";
  cin >> a >> b >> c >> d;
  if((c+b-1)/b>(a+d-1)/d)ans="No";
  cout << ans << endl;
      return 0;
}


Measured memory_bytes: 3572
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atCocderCs
{
    class Program
    {

        static void Main(string[] args)
        {
            string[] vals = Console.ReadLine().Split(' ');
            var a = Convert.ToInt32(vals[0]);
            var b = Convert.ToInt32(vals[1]);

            if (a * b % 2 != 0)
                Console.WriteLine("Odd");
            else
                Console.WriteLine("Even");
            
        }

    }
}


Measured memory_bytes: 11220
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define MAX_N 100
#define inf 1e9
typedef long long ll;
struct edge{
    int s;
    int t;
    int d;
};
vector<edge> G;
int dis[MAX_N][MAX_N];
int main(){
    int N,M;
    cin >> N >> M;
    REP(i,N){
        REP(j,N){
            if(i!=j) dis[i][j] = inf;
        }
    }
    REP(i,M){
        int a,b,c;
        cin >> a >> b >> c;
        dis[a-1][b-1] = c;
        dis[b-1][a-1] = c;
        G.push_back((edge){a-1,b-1,c});
    }
    REP(k,N){
        REP(i,N){
            REP(j,N){
                if(dis[i][k] != inf && dis[k][j] != inf && dis[i][j] > dis[i][k] + dis[k][j]){
                    dis[i][j] = dis[i][k] + dis[k][j];
                }
            }
        }
    }
    int ans = M;
    REP(i,G.size()){
        bool flag = false;
        REP(j,N){
            if(dis[j][G[i].s] + G[i].d == dis[j][G[i].t]){
                flag = true;
            }
        }
        if(flag) ans--;
    }
    cout << ans << endl;
    return 0;
}


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

int n;
int A[3030];
ll dp[3030][3030];
int flag[3030][3030];

ll rec(int l, int r) {
    if(flag[l][r]) return dp[l][r];

    flag[l][r] = 1;

    if (l == r) return dp[l][r] = A[l];
    return dp[l][r] = max(A[l] - rec(l + 1, r), A[r] - rec(l, r - 1));
}

int main() {
    cin >> n;
    rep(i, n) cin >> A[i];
    rep(i, 3030) rep(j, 3030) dp[i][j] = -(1LL << 58);
    cout << rec(0, n - 1) << endl;
    return 0;
}


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

typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++) // no semicoron
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>0;i--)
#define FORD(i,a,b) for(ll i=(a);i>(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
//#define PI 3.14159265359

using namespace std;

int main(){
    ll N, K;
    cin >> N >> K;

    ll count = 0; //あり得る数のカウント
    //ll sum = 0; //端数の合計算出
    ll range;
    ll min = 0;        
    ll max = 0;
    min = K * (K-1) / 2;
    max = (2 * N - K + 1) * K / 2;
    FOR(i, K, N+2){
        range = 0;
        min = i * (i-1) / 2;
        max = (2 * N - i + 1) * i / 2;
       
        //FOR(j, 0, i) min += j;
        //cout << min << endl;
        

        //FOR(j, N-i+1, N+1) max += j;
        //cout << max << endl;
        range = max - min + 1;

        count += range;

        //min += i; //わざわざfor文で回さない
        //max += N - i;
    }

    cout << count%1000000007 << endl;

}

Measured memory_bytes: 3624
n, k, q = map(int, input().split())
answer = list(int(input()) for _ in range(q))

score = [0 for _ in range(n+1)]
for i in answer:
  score[i] += 1
  
for i in range(1, n+1):
  if score[i] > q - k:
    print('Yes')
  
  else:
    print('No')

Measured memory_bytes: 8636
#!/usr/bin/env python3
#ABC70 D

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7

n = int(input())
abc = [list(map(int,input().split())) for _ in range(n-1)]
q,k = map(int,input().split())

g = [[] for _ in range(n)]
for a,b,c in abc:
    g[a-1].append((b-1,c))
    g[b-1].append((a-1,c))

que = deque()
que.append(k-1)
dist = [-1]*n
dist[k-1] = 0
while que:
    v = que.popleft()
    for x,c in g[v]:
        if dist[x] == -1:
            dist[x] = dist[v] + c
            que.append(x)

for _ in range(q):
    x,y = map(int,input().split())
    print(dist[x-1] + dist[y-1])


Measured memory_bytes: 92376
import math
n=int(input())
def prime_judge(n):
  if n == 2:
    return True
  if n < 2 or n % 2 == 0:
    return False
  for i in range(3, int(math.sqrt(n)) + 1, 2):
    if n % i == 0:
      return False
  return True

while prime_judge(n)==False:
  n+=1
print(n)

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

template<typename T, typename K> struct P{
    T a;
    K b;
};

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	int x, y, z;
	cin >> x >> y >> z;
	cout << (int)(x-z)/(y+z) << endl;
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                double[] input = Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);

                double ax = input[0], ay = input[1], ar = input[2];
                double bx = input[3], by = input[4], br = input[5];

                double d = Math.Sqrt((bx - ax) * (bx - ax) + (by - ay) * (by - ay));

                if (d > ar + br) sb.AppendLine("0");
                else if (d < ar - br) sb.AppendLine("2");
                else if (d < br - ar) sb.AppendLine("-2");
                else sb.AppendLine("1");
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9156
# https://juppy.hatenablog.com/entry/2019/04/10/ARC061_-_E_%E3%81%99%E3%81%AC%E3%81%91%E5%90%9B%E3%81%AE%E5%9C%B0%E4%B8%8B%E9%89%84%E6%97%85%E8%A1%8C_-_Python_%E7%AB%B6%E6%8A%80%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0_Atcoder
# 参考にさせていただきました。

from collections import deque, defaultdict

chg = 10**6
n, m = map(int, input().split())
edges = defaultdict(set)
# m=0のためにdefaultdictにしておくべき
visited = defaultdict(set)
for i in range(m):
    p, q, c = map(int, input().split())
    edges[p+c*chg].add(q+c*chg)
    edges[q+c*chg].add(p+c*chg)
    edges[p].add(p+c*chg)
    edges[q].add(q+c*chg)
    edges[p+c*chg].add(p)
    edges[q+c*chg].add(q)
    visited[p] = False
    visited[q] = False
    visited[p+c*chg] = False
    visited[q+c*chg] = False

ans = float("inf")
que = deque()
# now, dist
que.append((1, 0))
# 今求めるのはendの距離だけなので、dist配列はいらない
# さらに、距離は0/1なのでheapで辺を管理する必要もなく、0なら最短確定なので先に、1ならその時点での最長なので後ろにすれば良い
while que:
    now, dist = que.popleft()
    if visited[now]:
        continue
    visited[now] = True
    if now == n:
        ans = dist
        break
    for to in edges[now]:
        # 駅→ホーム
        if now < chg and to > chg:
            que.append((to, dist+1))
        else:
            que.appendleft((to, dist))
if ans == float("inf"):
    print(-1)
else:
    print(ans)

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

public class Main {
	
	public static void main(String[] args) throws IOException {	
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		double a[]=new double[n];
		for(int i=0;i<n;i++)
			a[i]=s.nextDouble();
		double dp[][]=new double[n][n];
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++)
				dp[i][j]=-1.0;
		System.out.println(String.format("%.10f", rec(0,0,a,n,dp)));
		
	}

	private static double rec(int i, int h, double[] a, int n, double[][] dp) {
		
		if(i==n) {
			if(h>=(n+1)/2)
				return 1.0;
			else
				return 0.0;
		}
		if(dp[i][h]>-1) return dp[i][h];
		double op1=a[i]*rec(i+1, h+1, a, n, dp);
		double op2=(1-a[i])*rec(i+1, h, a, n, dp);
		
		
		return dp[i][h]=op1+op2;
		
	}
	
}

Measured memory_bytes: 118712
import java.util.Scanner;

public class Main{	
	public static void main(String[] arts){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			String s = sc.next();
			if(s.equals("-")){
				break;
			}
			int m = sc.nextInt();
			String tmp = "";
			for(int i=0;i<m;i++){
				int h=sc.nextInt();
				String a = s.substring(0,h);
				String b = s.substring(h,s.length());
				s = b + a;
			}
			System.out.println(s);
		}

		sc.close();
	}
}


Measured memory_bytes: 26444
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int a, b;
  cin >> a >> b;
  vector<int> t(b+1, 0);
  rep(i, b+1){
    string si = to_string(i);
    string sj = si;
    reverse(sj.begin(), sj.end());
    t.at(i)++;
    rep(j, sj.size()){
      if(sj.at(j) != si.at(j)){
        t.at(i)--;
        break;
      }
    }
    if(i != 0) t.at(i) += t.at(i-1);
  }
  int ans = t.at(b);
  if(a != 0) ans -= t.at(a-1);
  cout << ans << endl;
  return 0;
}

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

int L[2000][2000];
int R[2000][2000];
int U[2000][2000];
int D[2000][2000];

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

  int h, w;
  cin >> h >> w;

  vector<string> s(h);
  rep (i, 0, h)
    cin >> s[i];

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (s[i][j] == '#') {
        L[i][j] = 0;
        U[i][j] = 0;
        continue;
      }

      if (j != 0)
        L[i][j] = L[i][j - 1] + 1;
      else
        L[i][j] = 1;

      if (i != 0)
        U[i][j] = U[i - 1][j] + 1;
      else
        U[i][j] = 1;
    }
  }

  for (int i = h - 1; i >= 0; i--) {
    for (int j = w - 1; j >= 0; j--) {
      if (s[i][j] == '#') {
        R[i][j] = 0;
        D[i][j] = 0;
        continue;
      }

      if (j != w - 1)
        R[i][j] = R[i][j + 1] + 1;
      else
        R[i][j] = 1;

      if (i != h - 1)
        D[i][j] = D[i + 1][j] + 1;
      else
        D[i][j] = 1;
    }
  }

  int res = 0;
  rep (i, 0, h) {
    rep (j, 0, w) {
      res = max(res, L[i][j] + R[i][j] + D[i][j] + U[i][j] - 3);
    }
  }

  cout << res << endl;

	return 0;
}


Measured memory_bytes: 67072
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        A: i64,
        B: i64,
        X: i64,
    }
    if A==0{
        println!("{}",B/X - A/X + 1);
    }else{
        println!("{}", B/X - (A-1)/X);
    }
}

Measured memory_bytes: 4352
mod = 998244353
N = int(input())
D = list(map(int, input().split()))
if D[0] != 0:
    print(0)
    exit()
D.sort()
before_cnt = 1
tmp = 1
cnt = 0
ans = 1
#print(D)
for i in range(1, len(D)):
    #print(ans)
    if (tmp == D[i]):
        cnt += 1
    else:
        if tmp + 1 != D[i]:
            #print("tmp = " + str(tmp))
            print(0)
            exit()
        ans *= before_cnt ** cnt
        tmp = D[i]
        before_cnt = cnt
        cnt = 1

ans *= before_cnt ** cnt
print(ans % mod)



Measured memory_bytes: 14396
h,w=map(int,input().split())
s=[list(input()) for i in range(h)]
dp=[[0]*w for i in range(h)]
dp[0][0]=1
for i in range(h):
    for j in range(w):
        if i+1<h and s[i+1][j]=='.':dp[i+1][j]+=dp[i][j]
        if j+1<w and s[i][j+1]=='.':dp[i][j+1]+=dp[i][j]
print(dp[-1][-1]%(10**9+7))

Measured memory_bytes: 165264
#include<iostream>
#include<cstdio>
#include<functional>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<map>
#include<ctime>
using namespace std;
typedef long long ll;
typedef long double ld;
const int maxn = 1e5+7;
const int inf = 1e5;
const int modn = 1e9+7;
const ld eps = 1e-8;
const long double PI = acos(-1.0);
void qRead(ll &x){x = 0;char a;for(a = getchar();a <'0' || a > '9';a = getchar());for(;a >= '0' && a <= '9';a = getchar())x = x*10 + a-'0';}
void qRead(int &x){x = 0;char a;for(a = getchar();a <'0' || a > '9';a = getchar());for(;a >= '0' && a <= '9';a = getchar())x = x*10 + a-'0';}
ll qpow(ll a,ll b,ll mo = modn){
//    printf("%lld\n",mo);
    ll res = 1;
    while(b){
        if(b & 1)res = (res*a) % mo;
        a = (a*a) % mo;
        b >>= 1;
    }
    return res;
}
ld qpow(ld a,ll b){
    ld res = 1;
    while(b){
        if(b & 1)res *= a;
        a = a*a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b){
    if(!b)return a;
    return gcd(b,a%b);
}
//ll vis[maxn],prime[maxn],cnt,smallP[maxn];
//void getPrime(int n){
//    cnt = 0;
//    for(int i = 1;i <= n;i++)vis[i] = 0;
//    for(ll i = 2;i <= n;i++){
//        if(!vis[i]){
//            prime[++cnt] = i;
//            smallP[i] = i;
//        }
//        for(int j = 1;j <= cnt && i*prime[j] <= n;j++){
//            vis[prime[j]*i] = 1;
//            smallP[prime[j]*i] = prime[j];
//            if((i % prime[j]) == 0)break;
//        }
//    }
//}
//ll cnm[maxn][maxn];
//void getCnm(){
//    cnm[0][0] = 1;
//    for(int i = 1;i < maxn;i++){
//        for(int j = 0;j <= i;j++){
//            cnm[i][j] = cnm[i-1][j];
//            if(j)cnm[i][j] += cnm[i-1][j-1];
//            cnm[i][j] %= (modn-1);
//        }
//    }
//}
//ll f[maxn],invF[maxn];
//void getF(){
//    f[0] = invF[0] = 1;
//    for(int i = 1;i < maxn;i++)f[i] = f[i-1]*i % modn;
//    invF[maxn-1] = qpow(f[maxn-1],modn-2);
//    for(int i = maxn-2;i >= 1;i--)invF[i] = invF[i+1]*(i+1) % modn;
//}
int v[maxn];
int cnt[maxn];
int main(){
    int n;
    scanf("%d",&n);
    int first = 0,second = 0;
    for(int i = 1;i <= n;i++)scanf("%d",&v[i]);
    for(int i = 1;i <= n;i += 2){
        cnt[v[i]]++;
        if(cnt[v[i]] > cnt[first]){
            second = first;
            first = v[i];
        }
        else if(cnt[v[i]] > cnt[second] && v[i] != first){
            second = v[i];
        }
    }
    int ans1 = n/2-cnt[first],ans2 = n/2-cnt[second];
    int oldF = first,oldS = second;
    first = second = 0;
    for(int i = 1;i < maxn;i++)cnt[i] = 0;
    for(int i = 2;i <= n;i += 2){
        cnt[v[i]]++;
        if(cnt[v[i]] > cnt[first]){
            second = first;
            first = v[i];
        }
        else if(cnt[v[i]] > cnt[second] && v[i] != first){
            second = v[i];
        }
    }
    if(first != oldF)printf("%d\n",ans1 + n/2-cnt[first]);
    else printf("%d\n",min(ans1+n/2-cnt[second],ans2+n/2-cnt[first]));
}


Measured memory_bytes: 1152
#include <stdio.h>
int main(){
	int A, B;
	int max;
	scanf("%d %d",&A,&B);
	int C, D, E;
	C = A+B;
	D = A-B;
	E = A*B;
	if(C>=D & D>=E)
		max = C;
	else if(C>=E & E>=D)
		max = C;
	else if(D>=C & C>=E)
		max = D;
	else if(D>=E & E>=C)
		max = D;
	else
		max = E;
	
	printf("%d",max);
	return 0;
}

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf

#define sf(n) scanf("%d",&n)
#define sff(n1,n2) scanf("%d %d",&n1,&n2)
#define sfff(n1,n2,n3) scanf("%d %d %d",&n1,&n2,&n3)
#define sl(n) scanf("%lld",&n)
#define sll(n1,n2) scanf("%lld %lld",&n1,&n2)
#define slll(n1,n2,n3) scanf("%lld %lld %lld",&n1,&n2,&n3)

#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define sz(x) x.size()

#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))

#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >

#define nl puts("");
#define line puts("-------");
#define dbb(x) cout<<#x<<" : "<<x<<"\n";

void __print(int x) {cerr << x;} void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;} void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;} void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';} void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V> void __print(const pair<T, V> &x)
{cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T> void __print(const queue<T> &x)
{queue<T>temp=x;cerr<<"\n-----\n";while(!temp.empty())
{cerr << temp.front() << endl;temp.pop();}cerr<<"-----\n";}
template<typename T> void __print(const stack<T> &x)
{stack<T>temp=x;cerr<<"\n-----\n";while(!temp.empty())
{cerr << temp.top() << endl;temp.pop();}cerr<<"-----\n";}
template<typename T> void __print(const T &x)
{int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V> void _print(T t, V... v)
{__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
    #define db(x...) cerr << "[" << #x << "] = [", _print(x)
#endif
using ll = long long;
const int N = 100005;
const int MOD = 1000000007;

int main()
{
    #ifndef ONLINE_JUDGE
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt","w",stdout);
    #endif
    ll i,n,sum=0,ans=0,k,now=0;
    sl(n);
    vector<ll>vec;
    rep0(i,n)
    {
        sl(k);
        vec.pb(k);
        sum+=k;
    }
    rep0(i,n)
    {
        sum-=vec[i];
        ans+=((vec[i]%MOD)*(sum%MOD))%MOD;
        ans%=MOD;
    }
    pf("%lld",ans%MOD);
}


Measured memory_bytes: 5388
#include <stdio.h>
#include <stdbool.h>

int main(){
	bool a[1000000];
	a[0]=a[1]=0;
	int i,j;
	for(i=2;i<1000000;i++){
		a[i]=1;
	}
	for(i=2;i<500000;i++){
		if(a[i]){
			j=2;
			while(i*j<1000000){
				a[i*j]=0;
				j++;
			}
		}
		//printf("%d %d\n",i,a[i]);
	}
	int n;
	while(scanf("%d",&n)!=EOF){
		int k=0;
		for(i=0;i<=n;i++){
			k+=a[i];
		}
		printf("%d\n",k);
	}
	return 0;
}

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

int main() {
	long long N, K, ans = 0;
	cin >> N >> K;
	if (K == 0) ans = N * N;
	else {
		for (int i = K + 1; i <= N; i++) {
			if (N % i < K) {
				ans += (i - K) * (N / i);
			}
			else {
				ans += (i - K) * (N / i) + (N % i - K + 1);
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){ 
  int N, M;
  cin >> N >> M;
  vector<int> H(N), Ma(N);
  for(int i = 0; i < N; i++){ 
    cin >> H.at(i);  
  } 
  for(int i = 0; i < N; i++) { 
    Ma.at(i) = 0; 
  } 
  for(int i = 0; i < M; i++){ 
    int a, b; 
    cin >> a >> b; 
     Ma.at(a - 1) = max(Ma.at(a - 1), H.at(b - 1)); 
     Ma.at(b - 1) = max(Ma.at(b - 1), H.at(a - 1)); 
  } 
  int ans = 0; 
  for(int i = 0; i < N; i++){ 
    if (H.at(i) > Ma.at(i)) {
      ans++;
    }
  }  
  cout << ans << endl;
}
  

Measured memory_bytes: 4036
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dl double long
#define rep(i, m, n) for(ll i = (ll)(m); i < (ll)(n); ++i)
#define rrep(i, m, n) for(ll i = (ll)(m); i < (ll)(n); --i)
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;

const int INF = 2000000000;

void marge(int a[], int left, int mid, int right, ll *count){
    int n1 = mid - left;
    int n2 = right - mid;
    vector<int> l,r;
    rep(i, 0, n1) l.push_back(a[left+i]);
    rep(i, 0, n2) r.push_back(a[mid+i]);
    l.push_back(INF);
    r.push_back(INF);
    int i = 0, j = 0;
    rep(k, left, right){
        if(l[i] <= r[j]) a[k] = l[i++];
        else {
            a[k] = r[j++];
            *count += (n1-i);
        }
    }
    return;
}

void margesort(int a[], int left, int right, ll *count){
    if(left + 1 < right){
        int mid = (left + right) / 2;
        margesort(a, left, mid, count);
        margesort(a, mid, right, count);
        marge(a, left, mid, right, count);
    }
    return;
}

int main(void){
    int n, s[200000];
    ll count = 0;
    cin >> n;
    rep(i, 0, n) cin >> s[i];
    margesort(s, 0, n, &count);
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 4708
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}

ll gcd(ll(a), ll(b)) {
	ll k = a;
	ll l = b;
	ll j = 0;
	while (l != 0) {
		j = k % l;
		k = l;
		l = j;
	}
	return k;
}



int main() {
	ll N;
	cin >> N;
	
	vector<ll> vec(N);
	for (int i = 0; i < N; i++) {
		cin >> vec.at(i);
	}
	ll an=vec.at(0);
	for (int i = 1; i < N; i++) {
		an=gcd(an, vec.at(i));
	}
	cout << an << endl;;

	
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] c = new int[n];
        int[] s = new int[n];
        int[] f = new int[n];

        for (int i = 0; i < n - 1; i++){
            c[i] = scanner.nextInt();
            s[i] = scanner.nextInt();
            f[i] = scanner.nextInt();
        }
        c[n - 1] = 0; s[n - 1] = 0; f[n - 1] = 1;
        for (int i = 0; i < n; i++) {
            int t = 0;
            for (int j = i; j < n; j++) {
                if (t <= s[j]) t += (s[j] - t) + c[j];
                else t += (f[j] - (t - s[j]) % f[j]) % f[j] + c[j];
            }
            System.out.println(t);
        }

    }
}


Measured memory_bytes: 25880
'use strict'
const main = (sdi) => {
  const line = sdi.split("\n");
  let a = new Array(line.length);
  for(const i in line){
    a[i] = line[i].split(" ").map( str => parseInt(str, 10) );
  }
  let c = 0;
  for(let i=2; i<a.length; i++){
    let r = 0;
    for(let j=0; j<a[0][1]; j++){
      r = r + a[i][j]*a[1][j];
    }
    r = r + a[0][2];
    if(r>0){
      c++;
    }
  }
  console.log(c);
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));

Measured memory_bytes: 7500
#include<bits/stdc++.h>
#define ll 	 long long
#define pb push_back
#define mp make_pair
using namespace std;

#define mmm    ios_base::sync_with_stdio(false);cin.tie(NULL);

const int MOD = 1e9 + 7;
int dp[1000][1000];
string s[1000];

int main()
{

mmm;

int n,m; cin>>n>>m;


for(int i=0; i<n; i++) 
cin>>s[i]; 

//for(int i=0; i<n; i++) 
//cout<<s[i]<<" "; 

dp[0][0]=1;

for(int i=0; i<n; i++)
{
	for(int j=0; j<m; j++)
	{
		if(i) dp[i][j] += dp[i-1][j];
		if(j) dp[i][j] += dp[i][j-1];
		dp[i][j]%=MOD ;
		
		if(s[i][j]=='#') dp[i][j]=0;
	}
}

cout<<dp[n-1][m-1]<<endl;

     return 0;
}

Measured memory_bytes: 8588
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String S = scan.next();
        String T = scan.next();

        char[] arrayS = S.toCharArray();
        char[] arrayT = T.toCharArray();

        int answer = 0;
        for (int i = 0; i < 3; i++) {
            if(arrayS[i] == arrayT[i])
                answer++;
        }

        os.println(answer);
    }
}

Measured memory_bytes: 23124
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,k;
	cin>>n>>k;
	LL c=0;
	FORQ(b,k+1,n){
		if(b==-1){
			c+=n;
		}else{
			int t=b-k;
			int f=n/b;
			c+=f*1LL*t;
			if(n%b>=k)c+=n%b-k+1;
			if(k==0)c--;
			//cout<<" "<<t<<" "<<f<<" "<<n%b-k+1<<endl;
		}
		//cout<<b<<" "<<c<<endl;
	}
	cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-9;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		// if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int p[110000];
int q[110000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%d",p+i);
	}
	for(int i=0;i<b;i++){
		int s,t;scanf("%d%d",&s,&t);s--;t--;
		q[s]=max(q[s],p[t]);
		q[t]=max(q[t],p[s]);
	}
	int ret=0;
	for(int i=0;i<a;i++){
		if(p[i]>q[i])ret++;
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 2508
#include <algorithm>

#include <bitset>

#include <complex>

#include <deque>

#include <exception>

#include <fstream>

#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>



#if __cplusplus >= 201103L

#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>

#endif
using namespace std;



int main()
{
	int n;
	cin >> n;
	int ans=0;
	for (int i = 0;i < n;i++) {
		int l, r;
		cin >> l >> r;
		ans += r - l + 1;
}
	cout << ans << endl;
}

Measured memory_bytes: 256