akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

#define VECTOR_INITIAL_CAPACITY 1000
#define push 0
#define access 1
#define pop 2

typedef struct {
    int size;
    int capacity;
    int *data;
} Vector;


void vector_double_capacity_if_full(Vector* vector) {
    if (vector->size < vector->capacity) {
        return;
    }
    
    vector->capacity *= 2;
    vector->data = realloc(vector->data, sizeof(int) * vector->capacity);
}

void vector_init(Vector* vector) {
    vector->size = 0;
    vector->capacity = VECTOR_INITIAL_CAPACITY;
    vector->data = malloc(sizeof(int) * vector->capacity);
}

void vector_append(Vector* vector, int value) {
    vector_double_capacity_if_full(vector);
    vector->data[vector->size++] = value;
}

void vector_pop(Vector* vector) {
    if (vector->size == 0) {
        return;
    }
    
    vector->size--;
}

int vector_get(Vector* vector, int index) {
    if (index >= vector->size || index < 0) {
        printf("Invalid index %d for size %d", index, vector->size);
        exit(1);
    }
    return vector->data[index];
}

void vector_set(Vector* vector, int index, int value) {
    if (index >= vector->size || index < 0) {
        printf("Invalid index %d for size %d", index, vector->size);
        exit(1);
    }
    
    while (index >= vector->size) {
        vector_append(vector, 0);
    }
    
    vector->data[index] = value;
}


void vector_free(Vector* vector) {
    free(vector->data);
}

int main(void){
    int n, op, operand;
    scanf("%d", &n);
    
    Vector v;
    vector_init(&v);
    
    for (int i=0; i<n; i++) {
        scanf("%d", &op);
        if (op != pop) {
            scanf("%d", &operand);
        }

        switch (op) {
            case push:
                vector_append(&v, operand);
                break;
            case access:
                printf("%d\n", vector_get(&v, operand));
                break;
            case pop:
                vector_pop(&v);
                break;
        }
    }
    
    vector_free(&v);
    return 0;
}



Measured memory_bytes: 2476
#include<iostream>

using namespace std;

int main() {
    int n = 999999;
    char* p;
    int t = 2;

   

    p = new char[n];
    for(int i = 0; i < n; i++) {
        p[i] = 1;
    }
    p[0] = p[1] = 0;

    for(int i = 2; i < n; i++) {
        if(p[i] == 0)
            continue;
        for(int point = i * 2; point < n; point += i) {
            p[point] = 0;        
        }
    }
    
    while(cin >> n) {
        int c = 0;
        for(int i = 1; i <= n; i++) {
            if(p[i]) {
                c++;
            }
        }
        cout  << c << endl;
    }



    return 0;
}

Measured memory_bytes: 2156
#include <bits/stdc++.h>
#define REP(i,n)   for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(long long i=(a);((a)<(b)?i<=(b):i>=(b));((a)<(b)?++i:--i))
#define ALL(v)     (v).begin(),(v).end()
#define debug(x)   cerr<<#x<<": "<<(x)<<endl
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
constexpr int    INF=1e9;
constexpr double EPS=1e-9;
constexpr int    MOD=1e9+7;
template<class Type>
void line(const Type &a){int cnt=0;for(const auto &elem:a){cerr<<(cnt++?' ':'>');cerr<<elem;}cerr<<endl;}

inline void YESNO(bool ans){cout<<(ans?"YES":"NO")<<endl;}
inline void YesNo(bool ans){cout<<(ans?"Yes":"No")<<endl;}
inline void yesno(bool ans){cout<<(ans?"yes":"no")<<endl;}

int main(){
	int x;
	cin>>x;
	
	bool ans=(x>=30);
	
	YesNo(ans);
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

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

int main() {
  int H, W;
  vector<vector<int>> map, h_light, w_light;
  cin >> H >> W;
  map = vector<vector<int>>(H, vector<int>(W, 0)); // 0=., 1=#
  h_light = w_light = vector<vector<int>>(H, vector<int>(W, 0));
  char tmp;
  rep(i,H) {
    rep(j, W) {
      cin >> tmp;
      if(tmp=='#') map[i][j] = 1;
    }
  }
  
  int tmp2 = 0;
  rep(i, H) {
    int head = 0;
    tmp2 = 0;
    rep(j, W) {
      if(map[i][j]==0 ){
        tmp2++;
      }else { // 障害物を見つけた
        for(int k=head; k<j; k++) {
          w_light[i][k] = tmp2;
        }
        w_light[i][j] = 0; // 障害物
        tmp2 = 0;
        head = j+1;
      }
      
      if(j==W-1){ // 右端
        for(int k=head; k<j+1; k++) {
          w_light[i][k] = tmp2;
        }
        tmp2 = 0;
      }
      
    }
  }
  tmp2 = 0;
  rep(i, W) {
    int head = 0;
    tmp2 = 0;
    rep(j, H) {
      if(map[j][i]==0){
        tmp2++;
      }else { //障害物を見つけた
        for(int k=head; k<j; k++) {
          h_light[k][i] = tmp2;
        }
        h_light[j][i] = 0; // 障害物
        tmp2 = 0;
        head = j+1;
      }
      
      if(j==H-1){ // 下端
        for(int k=head; k<j+1; k++) {
          h_light[k][i] = tmp2;
        }
        tmp2 = 0;
      }
    }
  }
  
  int ans = 0;
  rep(i,H) {
    rep(j,W) {
      int tmp3 = w_light[i][j] + h_light[i][j];
      if(tmp3>ans) {
        ans = tmp3;
        //cout << i << "  " << j << endl;
      }
    }
  }
  
  cout << ans-1 <<endl;
  
  return 0;
}


Measured memory_bytes: 49408
import java.io.*;
import java.util.StringTokenizer;
import java.util.concurrent.atomic.AtomicLong;

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int n = in.nextInt();
        int k = in.nextInt();
        int[] d = in.nextIntArray(k);

        int toPay = n;
        while (true) {
            char[] s = String.valueOf(toPay).toCharArray();
            boolean possible = true;
            for (char c : s) {
                if (contains(d, Integer.parseInt(String.valueOf(c)))) {
                    possible = false;
                    break;
                }
            }
            // possible to pay
            if (possible) {
                break;
            }

            toPay++;
        }
        out.println(toPay);
    }

    private static boolean contains(int[] d, int i) {
        for (int i1 : d) {
            if (i1 == i)
                return true;
        }
        return false;
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 31572
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a + b > c + d) {
    cout << "Left" << endl;
  } else if (a + b == c + d) {
    cout << "Balanced" << endl;
  } else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
/*
	1042:Yes, I have a number
*/
#include	<iostream>
#include	<string>

using namespace std;

int main(void) {
	while(1) {
		string str;
		
		getline(cin, str, '\n');
		if( str == "END OF INPUT" ) { break; }
		
		int c = 0;
		for(int i = 0; i < (int)str.length(); i++) {
			if(str[i] == ' ') {
				cout << c;
				c = 0;
			} else {
				c++;
			}
		}
		cout << c << endl;
	}
	return 0;
}

Measured memory_bytes: 1184
x =  input().split()
x = list(map(int, x))

if x[0] > x[1]:
    x = [x[1], x[0], x[2]]

if x[1] > x[2]:
    x = [x[0], x[2], x[1]]

if x[0] > x[1]:
    x = [x[1], x[0], x[2]]

print(x[0], x[1], x[2])



Measured memory_bytes: 5600
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
	int n;
	cin >> n;

	vector<ll> v(n);
	rep(i, n) cin >> v[i];

	vector<ll> sum(2*n + 1);
	rep(i, n) {
		sum[i+1] += sum[i] + v[i];
	}

	rep(i, n) {
		sum[n+i+1] += sum[n + i] + v[i];
	}

	ll ans = 0;
	int s = 0, t = 0,cnt = 0;
	bool flag = true, first = true;

	while(true) {
		if(flag) t++;
		else s++;

		if(s + n >= sum.size()) break;

		ll d = sum[t] - sum[s];
		int id = lower_bound(sum.begin(), sum.end(), sum[t]  + (sum[t] - sum[s])) - sum.begin();

		if(s + n > id && d < sum[s+n] - sum[id]) {
			ans = max(ans, d);
			flag = true;
		} else {
			flag = false;
		}

		// cout << s << " " << t << " v:" << sum[s] << "," << sum[t] << " diff:" << sum[t] - sum[s] << endl;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3380
H, W, K = map(int, input().split())
c = [input() for _ in range(H)]
ans = 0
for case in range(2**(H+W)):
    black = 0
    for i in range(H):
        for j in range(W):
            if (case >> i) & 1 and (case >> j + H) & 1 and c[i][j] == "#":
                black += 1
    if black == K:
        ans += 1
print(ans)

Measured memory_bytes: 9128
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<double> x;
    vector<string> u;
    for(int i=0; i<N; i++)
    {
    	double a;
    	string s;
    	cin >> a >> s;
    	x.push_back(a);
    	u.push_back(s);
    }

    double Y = 0.0;
    for(int i=0; i<N; i++)
    {
    	if(u[i]=="JPY") 
    		Y += x[i];
    	else 
    		Y += x[i] * 380000.0;
    }

    cout << Y << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	long long x,k;
	long long l,s;
	scanf("%lld %lld",&x,&k);
	l=0; s=0;
	if(x<0){
		x=x*-1;
	}
	l=x-((x/k)*k);
	s=(x-((x/k+1)*k))*-1;
	if(s<l){
		printf("%lld\n",s);
	}
	else{
		printf("%lld\n",l);
	}
	return 0;
}

Measured memory_bytes: 1700
#include <cstdio>
#include <cmath>
int n;
double x[1005], y[1005], X, Y, d, e;
double dist(double a, double b) {
    return a*a + b*b;
}
int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lf%lf", &x[i], &y[i]);
        X += x[i]; Y += y[i];
    }
    X /= n; Y /= n;
    double P = 0.1;
    for (int i = 0; i < 30000; i++) {
        int f = 0;
        d = dist(X - x[0], Y - y[0]);
        for (int j = 1; j < n; j++) {
            e = dist(X - x[j], Y - y[j]);
            if (d < e) { d = e; f = j; }
        }
        X += (x[f] - X)*P;
        Y += (y[f] - Y)*P;
        P *= 0.999;
    }
    printf("%.10lf", sqrt(d));
}

Measured memory_bytes: 256
program fivedishes
  implicit none

integer::a(5),i,count=0,m=644

do i=1,5
   read*,a(i)
   if(mod(a(i),10)==0)then
      count=count+a(i)
   else
      count=count+(a(i)/10+1)*10
   end if
end do

do i=1,5
   if(mod(a(i),10)/=0)then
      if(count-(a(i)/10+1)*10+a(i)<m)then
         m=count-(a(i)/10+1)*10+a(i)
      end if
      else
         if(count<m)then
            m=count
         end if
   end if
end do

 print*,m

end program fivedishes

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
using namespace std;
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

int main(){
    long long N,M; cin >> N >> M;
    long long a,b;
    //int dp[100010]; fill(dp,dp+100010,MM);
    long long ans = 0;
    vector<pair<long long,long long>> p;
    for(int i = 0; i < N; i++){
        cin >> a >> b;
        p.push_back({a,b});
    }
    long long mx = 0,cnt = 0;

    sort(p.begin(),p.end());

    priority_queue<long long> pq;
    int pn = 0;
    for(int i = M-1; i >= 0; i--){
        int day = M-i;
        while(pn <= N && p[pn].first <= day){
            pq.push(p[pn++].second);
        }
        if (!pq.empty()){
            ans += pq.top();
            pq.pop();
        }
    }
    cout << ans << endl;



}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define help freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);

int main()
{
    string s, t;
    cin >> s >> t;
    int ans = -1;
    for (int i = 0; i + t.size() - 1 < s.size(); i++)
    {
        int cnt = 0;
        for (int j = 0; j < t.size(); j++)
        {
            if (t[j] == s[i + j])
                cnt++;
        }
        ans = max(cnt, ans);
    }

    cout << t.size() - ans << endl;

    return 0;
}


Measured memory_bytes: 3616
def bbb(x, y):
    return (x * y) // aaa(x, y)


def aaa(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return aaa(y, x % y)


a, b, c, d = map(int, input().split())
bc = b // c
bd = b // d
ac = (a-1) // c
ad = (a-1) // d
aw = (a-1) // bbb(c, d)
bw = b // bbb(c, d)
print((b - a + 1) - (bc - ac) - (bd - ad) + (bw - aw))


Measured memory_bytes: 3064
a =700
b,c,d = map(str, input().strip())
number1 = str(b)
number2 = str(c)
number3 = str(d)
if number1 == 'o':
    a = a + 100
elif number1 == 'x':
    a
if number2 == 'o':
    a = a + 100
elif number2 == 'x':
    a
if number3 == 'o':
    a = a + 100
elif number3 == 'x':
    a
print(a)

Measured memory_bytes: 3060
use std::io::BufRead;

fn main() {
    let stdin = std::io::stdin();
    let n = stdin.lock().gets().parse::<usize>().unwrap();
    let map = stdin.lock().lines().take(n).map(|x| x.unwrap().into_bytes())
        .collect::<Vec<_>>();
    let mut starts = Vec::new();
    for x in 0..n {
        starts.push((x, 0));
    }
    for y in 1..n {
        starts.push((0, y));
    }
    let mut ans = 0u64;
    for (mut sx, mut sy) in starts {
        let mut symcount = Vec::new();
        while sx < 2 * n - 1 && sy < 2 * n - 1 {
            let mut count = 0;
            let mut endi = std::cmp::min(n, 2 * n - 1 - sx);
            endi = std::cmp::min(endi, 2 * n - 1 - sy);
            for i in 1..endi {
                if map[sy % n][(sx + i) % n] != map[(sy + i) % n][sx % n] {
                    break;
                }
                count += 1;
            }
            symcount.push(count);
            sx += 1;
            sy += 1;
        }
        'notsym: for i in 0..(symcount.len() - n + 1) {
            for j in 0..(n - 1) {
                if symcount[i + j] < n - j - 1 {
                    continue 'notsym;
                }
            }
            ans += 1;
        }
    }
    println!("{}", ans);
}

trait Gets { fn gets(&mut self) -> String; }
impl<T: std::io::BufRead> Gets for T {
    fn gets(&mut self) -> String { self.lines().next().unwrap().unwrap() } }


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

int a[3][100005];
int n;
int dp[3][100005];


int f(int i, int n, int last) {
    if(dp[last][i] != -1) return dp[last][i];
    if(i == n) return 0;
    
    int x = INT_MIN;
    for(int j = 0; j < 3; j++) {
        if(j != last) x = max(x, a[j][i] + f(i+1, n, j));
    }
    
    return dp[last][i] = x;
}


int main() {
	// your code goes here
	cin >> n;
	for(int i = 0; i < n; i ++) {
	    cin >> a[0][i] >> a[1][i] >> a[2][i];
	}
	memset(dp, -1, sizeof dp);
	
	cout << max(f(0, n, 0), max(f(0, n, 1), f(0, n, 2)));
	
	return 0;
}


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


int main(void){
    int n,k,a=1000000000;
    int h[100000];
    cin>>n>>k;
    for(int i = 0; i <n; i++)
    {
        cin>>h[i];
    }
    sort(h,h+n);
       
    for(int i = 0; i <= n-k; i++)
    {
        if(h[i+k-1]-h[i]<a){
            a=h[i+k-1]-h[i];
        }
    }
    cout<<a<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using P = pair<int, int>;
using LL = long long;

#define ALL(a) (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN_LL(v) LL v;cin>>v;
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl
#define MOD 1000000007
#define INF 1000000

int N;
vector<int> edge;
int pos(int x, int y) {
  return N * x + y;
}

void warshallFloyd(vector<int>& d) {
  REP(i, N) {
    REP(j, N) {
      if (i == j)
        d[pos(i, i)] = 0;
      else
        d[pos(i,j)] = edge[pos(i,j)];
    }
  }

  REP(k, N) {
    REP(i, N) {
      REP(j, N) {
        if (d[pos(i,j)] > d[pos(i,k)] + d[pos(k,j)])
          d[pos(i,j)] = d[pos(i,k)] + d[pos(k,j)];
      }
    }
  }
}
int main() {
  cin >> N;
  IN(M);

  vector<int> d(N*N);
  edge.resize(N*N);
  fill(ALL(edge), INF);
  vector<int> A, B;
  REP(i, M) {
    IN(a); IN(b); IN(c);
    edge[pos(a-1, b-1)] = edge[pos(b-1, a-1)] = c;
    A.push_back(a-1);
    B.push_back(b-1);
  }
  warshallFloyd(d);
  vector<bool> included(N*N, false);
  REP(s, N) {
    REP(t, N) {
      if (s == t)
        continue;

      REP(i, M) {
        if (d[pos(s,t)] == d[pos(s,A[i])] + edge[pos(A[i],B[i])]+ d[pos(B[i],t)]) {
          included[pos(A[i],B[i])] = true;
        }
      }
    }
  }
  int ans = 0;

  REP(i, N) {
    FOR(j, i+1, N) {
      if (edge[pos(i, j)]<INF && d[pos(i,j)] != edge[pos(i,j)])
        ++ans;
    }
  }

  OUT(ans);

  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <functional>
#include <stdio.h>
#include <array>
#include <algorithm>
#include <string>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <queue>
#include<iomanip>
#include<bitset>
#include<stack>
#include<set>
#include<limits>
#include <complex>
#include<cstdlib>
using namespace std;

bool isso(long long int a) {
	if (a == 1||a==0)return false;
	for (long long int i = 2; i*i <= a; ++i) {
		if ((a%i)) {
		}
		else {
			return false;
		}
	}
	return true;
}



long long int powint(long long int a, long long int b) {
	assert(b >= 0);
	if (b == 0)return 1;
	if (b == 1)return a;
	long long int ans = 1;
	long long int aa = powint(a, b / 2);
	ans *= aa*aa;
	if (b % 2)ans *= a;
	return ans;
}


int main() {
	
	while (1) {
		vector<int>reads;
		vector<int>writes;
		int N; cin >> N;
		if (!N)break;
		for (int i = 0; i < N; ++i) {
			int a, b; cin >> a >> b;
			reads.push_back(a);
			writes.push_back(b);
		}
		int ans;
		const int readsum = accumulate(reads.begin(), reads.end(), 0);
		int readtime;
		const auto maxid = (max_element(reads.begin(), reads.end()))-reads.begin();
		if (reads[maxid] * 2 > readsum) {
			readtime = reads[maxid] * 2;
			const int resttime = readtime - readsum;//余った時間で感想文書く//maxの以外

			bool dp[1001];
			memset(dp, false, sizeof(dp));
			dp[0] = true;
			for (int j = N - 1; j >= 0; --j) {
			for (int i = resttime-1; i >=0; --i) {
				if (dp[i]) {

						if (j != maxid) {
							if (i + writes[j] <= resttime) {
								dp[i + writes[j]] = true;
							}
						}
					}
				}
			}
			int maxtime;
			for (int i = resttime; i >= 0; --i) {
				if (dp[i]) {
					maxtime = i;
					break;
				}
			}
			ans = readtime + accumulate(writes.begin(), writes.end(), 0) - maxtime;

		}
		else {
			readtime = readsum;

			ans = readtime + accumulate(writes.begin(), writes.end(), 0);

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

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

void Main() {
  int h, w;
  cin >> h >> w;
  int g[h][w], l[h][w], r[h][w], u[h][w], d[h][w];

  memset(g, 0, sizeof(g));
  memset(l, 0, sizeof(l));
  memset(r, 0, sizeof(r));
  memset(u, 0, sizeof(u));
  memset(d, 0, sizeof(d));

  for (int i = 0; i < h; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < w; j++) {
      if (s[j] == '#') g[i][j] = 1;
      else g[i][j] = 0;
    }
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (g[i][j]) {
        l[i][j] = 0;
        u[i][j] = 0;
      } else {
        if (j == 0) l[i][j] = 1;
        else l[i][j] = l[i][j - 1] + 1;
        if (i == 0) u[i][j] = 1;
        else u[i][j] = u[i - 1][j] + 1;
      }
    }
  }

  for (int i = h - 1; i >= 0; i--) {
    for (int j = w - 1; j >= 0; j--) {
      if (g[i][j]) {
        r[i][j] = 0;
        d[i][j] = 0;
      } else {
        if (j == w - 1) r[i][j] = 1;
        else r[i][j] = r[i][j + 1] + 1;
        if (i == h - 1) d[i][j] = 1;
        else d[i][j] = d[i + 1][j] + 1;
      }
    }
  }

  int ans = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      ans = max(ans, l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3);
    }
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 78464
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 1100000;
const int K = 20;
const int B = 300;
int a[N];
int solve(int x){
    if (x == 0) return 0;
    if (x == 1) return 1;
    return 1 + solve(x / 2) * 2;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int h;
    cin >> h;
    cout << solve(h);
}


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

#define pb push_back
#define ff first
#define ss second

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

ll ans, cnt, k;
string s;

ll C(int n, int r) {
	if (r > n) return 0;
	ll res = 1;
	for (int i = 1; i <= r; i++)
		res *= (n - i + 1), res /= i;
	return res;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> s >> k;
	for (int i = 0; i < s.size() && cnt <= k; i++) {
		for (int j = 0; j < s[i] - '0' && cnt <= k; j++) {
			if (j == 1)
				cnt++;
			ll tmp = C((int)s.size() - i - 1, k - cnt);
			for (int p = 1; p <= k - cnt; p++)
				tmp *= 9;
			ans += tmp;
		}
		if (s[i] == '1')
			cnt++;
		if (cnt == k) {
			ans++;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)

using namespace std;

int main() {
  int h,w;
  cin>>h>>w;
  vector<string> b(h);
  using P = pair<int, int>;
  P s,g;
  REP(i,h) {
    cin>>b[i];
    REP(j,w) {
      if (b[i][j] == 's') {
        s = {i, j};
      } if (b[i][j] == 'g') {
        g = {i, j};
      }
    }
  }
  string prog;
  cin>>prog;
  int l = prog.size();
  vector<int> match(l);
  stack<int> beg;
  REP(i,l) {
    switch(prog[i]) {
      case '[':
      case '{':
        beg.push(i);
        break;
      case ']':
      case '}':
        match[i] = beg.top();
        match[beg.top()] = i;
        beg.pop();
        break;
      default:;
    }
  }
  using S = tuple<P, int, int>;
  set<S> his;
  P pos = s;
  int dir = 0;
  int ip = 0;
  int di[4] = {-1,0,1,0};
  int dj[4] = {0,1,0,-1};
  string dirc = "NESW";
  int cnt = 0;
  while (!his.count(S(pos, dir, ip))) {
    //cerr << pos.first << ' ' << pos.second << ' ' << dir << ' ' << ip << endl;
    if (pos == g) break;
    if (ip >= prog.size()) break;
    his.emplace(pos, dir, ip);
    switch (prog[ip]) {
      case '{':
      case '[': {
        bool inv = prog[ip+1] == '~';
        int condip = inv ? ip+2 : ip+1;
        bool res;
        switch (prog[condip]) {
          case 'N':
          case 'E':
          case 'S':
          case 'W':
            res = prog[condip] == dirc[dir];
            break;
          case 'C': {
            int i,j;
            tie(i, j) = pos;
            int ni = i+di[dir];
            int nj = j+dj[dir];
            res = b[ni][nj] == '#';
          } break;
          case 'T':
            res = true;
            break;
          default:;
        }
        if (inv) res = !res;
        if (res) {
          ip = condip+1;
        } else {
          ip = match[ip]+1;
        }
      } break;
      case ']':
        ++ip;
        break;
      case '}':
        ip = match[ip];
        break;
      case '^': {
        int i,j;
        tie(i, j) = pos;
        int ni = i+di[dir];
        int nj = j+dj[dir];
        if (b[ni][nj] != '#') {
          pos = P(ni, nj);
        }
        ++ip;
        ++cnt;
      } break;
      case 'v': {
        int i,j;
        tie(i, j) = pos;
        int ni = i+di[(dir+2)%4];
        int nj = j+dj[(dir+2)%4];
        if (b[ni][nj] != '#') {
          pos = P(ni, nj);
        }
        ++ip;
        ++cnt;
      } break;
      case '>':
        ++dir;
        dir %= 4;
        ++ip;
        ++cnt;
        break;
      case '<':
        dir += 3;
        dir %= 4;
        ++ip;
        ++cnt;
        break;
      default:
        cerr << "error" << endl;
    }
  }
  if (pos == g) {
    cout << cnt << endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}

Measured memory_bytes: 79108
#include <iostream>
using namespace std;
int main() {
    int N,cnt=0;
    cin >> N;
    int A[N],B[N-1];
    for (int i=0; i<N-1; i++) {
        cin >> B[i];
        A[i+1] = B[i];
    }
    A[0] = A[1];
    for (int i=0; i<N-1; i++) {
        if (A[i] > A[i+1]) A[i] = A[i+1];
    }
    for (int i=0; i<N; i++) cnt += A[i];
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;

class Program
{
	static void Main(string[] args)
	{
		long N = long.Parse(Console.ReadLine());
		List<string> S = new List<string>();
		
		for(long l = 0;l < N; l++)
		{
			S.Add(Console.ReadLine());
		}
		S = S.Distinct().ToList();
		Console.WriteLine(S.Count);
	}
}

//string s = Console.ReadLine();
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];
//int N = int.Parse(Console.ReadLine());
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());
//Boolean ok = false;

//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.ReadKey();

//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];


Measured memory_bytes: 49776
import java.util.Scanner;

public class Main {

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();

        System.out.println((H-h) * (W-w));

    }


}


Measured memory_bytes: 23252
dp[2][2][1<<16];*s=dp[0][0],*t=dp[0][1];w;c;f;p=2e4;i;x,y;
main(a)
{
	s[p]=dp[1][0][p]=1;
	do{
		a=getchar();
		if(a-70){
			for(i=0;i<'~~';i++)t[i]=0;
			for(i=1e4;i<3e4;i++)t[i+c]|=s[i],f&&(t[i-c]|=s[i]);
			w=w?y=f%2,s=dp[0][f%2],t=dp[0][-~f%2],0:(x=-~f%2,s=dp[1][f%2],t=dp[1][++f%2],1);
			c=0;
		}
		else c++;
	}while(a-10);
	scanf("%d%d",&a,&c);
	puts(dp[0][x][p+a]&&dp[1][y][p+c]?"Yes":"No");
}

Measured memory_bytes: 768
N = int(input())
Min = 1
Max = 26
Count = 0
Flag = True
while Flag:
    Count += 1
    if Min<=N<=Max:
        Disp = ['']*Count
        Flag = False
        Num = N-Min
        for T in range(1,Count+1):
            Disp[-T] = chr(97+Num%26)
            Num = Num//26
    else:
        Min = Max+1
        Max += pow(26,Count+1)
print(''.join(Disp))

Measured memory_bytes: 9188
n, k = map(int, input().split())
kouho = set(range(1, n + 1))
#print(kouho)
for kashi in range(1, k + 1):
  a = input()
  lst = map(int, input().split())
  for b in lst:
    kouho.discard(b)
print(len(kouho))

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

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

using namespace std;

int main(){
  int n,a,b;cin>>n>>a>>b;
  int p1=0,p2=0,p3=0;
  rep(i,n){
    int t;cin>>t;
    if(t<=a)p1++;
    else if(t<=b)p2++;
    else p3++;
  }

  cout<<min({p1, p2, p3});

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        while(true){
        
            int a = sc.nextInt();
            String op = sc.next();
            int b = sc.nextInt();
            if(!op.equals("?")){
                switch(op){
                    case "+": System.out.println(a + b);break;
                    case "-": System.out.println(a - b);break;
                    case "*": System.out.println(a * b);break;
                    case "/": System.out.println(a / b);break;
                }
            }else break;
        }
    }
}


Measured memory_bytes: 26128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;
long long GCD(long long a, long long b);
vector<long long> divisor(long long n);

int main(){
  long long a, b;
  cin >> a >> b;
  long long tmp;

  vector<long long> list;
  if(a % 2 == 0 && b % 2 == 0){
    list.push_back(2);
  }

  vector<long long> divisor_a = divisor(a);

  for (long i = 0; i < divisor_a.size(); i++)
  {
    if(b % divisor_a[i] == 0){
      bool flag = false;
      // すでにある数と互いに素であれば追加
      for (long long j = 0; j < list.size(); j++)
      {
        if(GCD(list[j],divisor_a[i]) != 1){
          flag = true;
          break;
        }
      }
      if(!flag){
        list.push_back(divisor_a[i]);
      }
    }

  }
    cout << list.size() << endl;
}

long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

vector<long long> divisor(long long n) {
  vector<long long> ret;
  for(long long i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return ret;
}

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

using namespace std;

const int N = 2e5 + 3;

int n, a[N];
long long pf[N], dp[N];

int main() {
    cin >> n;

    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        pf[i] = pf[max(0, i - 2)] + a[i];
    }

    for (int i = 2; i <= n; i++) {
        if (i % 2 == 0) {
            dp[i] = max(dp[i - 2] + a[i], pf[i - 1]);
        } else {
            dp[i] = max(dp[i - 2] + a[i], dp[i - 1]);
        }
    }

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


Measured memory_bytes: 7528
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	1000000007

ll gcd(ll a, ll b) {
	if (a < b)
		swap(a, b);
	while (ll r = a % b)
		a = b, b = r;
	return b;
}

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

	ll modinv(ll a)
	{
		ll b = max, u = 1, v = 0;
		while (b)
		{
			ll t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= max;
		if (u < 0)
			u += max;
		return u;
	}

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

//	for priority queue
//	priority_queue<ipair, vector<ipair>, greater<ipair>>
using ipair = pair<int, pair<int, int>>;
bool operator>(const ipair a, const ipair b) { return a.first > b.first; };
bool operator<(const ipair a, const ipair b) { return a.first < b.first; };

int main()
{
	int n;
	cin >> n;
	vector<int> a(n + 1);
	for (int i = 0; i <= n; i++)
		cin >> a[i];
	if (n == 0)
	{
		if (a[0] == 1)
			printf("1");
		else
			printf("-1");
		return 0;
	}
	if (a[0] >= 1)
	{
		printf("-1");
		return 0;
	}

	vector<ll> b(n + 2, 0);
	for (int i = n; i >= 0; i--)
		b[i] = b[i + 1] + a[i];
	if (b[0] == 0)
	{
		//	あり得ないけど
		printf("-1");
		return 0;
	}
	
	ll bef = 1;
	ll r = 1;
	for (int i = 1; i <= n; i++)
	{
		ll mn = bef * 2;
		if (mn < a[i]/* || b[i] < bef*/)
		{
			printf("-1");
			return 0;
		}

		/*if (i == n)
			mn = a[i];
		else */
		if (mn > b[i])
			mn = b[i];
		r += mn;
		bef = mn - a[i];
	}

	printf("%lld", r);
	return 0;
}


Measured memory_bytes: 3876
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

const string key = "abcdefghijklmnopqrstuvwxyz";
map<int, int> m;

string convert(long long num, long long base)
{
	string result = "";
	while (num > 0)
	{
		int remainder = num % base;

		if (!remainder) 
		{
			result += key[25];
			num--;
			if (num == 26) break;
		}
		else result += key[remainder - 1];

		num -= remainder;
		num /= base;
	}
	string reverse(result.rbegin(), result.rend());
	return reverse;
}


int main()
{

	long long n;
	cin >> n;
	string s = convert(n, 26);

	cout << s << endl;
}

Measured memory_bytes: 3616
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
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; }

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  int ans = 0;
  rep(i, N) {
    cin >> A.at(i);
  }
  rep(j, N) {
    cin >> B.at(j);
  }
  rep(k, N) {
    if (A.at(k) > B.at(k)) {
      ans += A.at(k) - B.at(k);
    }
  }
  cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner; 
class Main{
    static public void main(String[] av){
	Scanner sc = new Scanner(System.in);
	int S = sc.nextInt();
	while(0>S || S>=86400) System.out.println("imput agian.");
	int h = 0;
	int m = 0;
	int m2 = 0;
	int s = 0;
	if(S/60>0){ m = S/60; s = S%60;}
	if(m/60>0){ h = m/60; m = m%60;}
	System.out.println(h+":"+m+":"+s);
    }
}


Measured memory_bytes: 26380
n = gets.chomp.to_i
t,a=gets.chomp.split(" ").map { |e| e.to_i }
h = gets.chomp.split(" ").map { |e| e.to_i }

def abs(n)
  return n if n >= 0
  return -n
end

min = 10000000
ans = 0


for i in 0..n-1 do
  if abs(t - h[i]*0.006 - a) < min
    ans = i
    min = abs(t - h[i]*0.006 - a)
  end
end

puts ans+1


Measured memory_bytes: 1788
// Contest: AtCoder Beginner Contest 159 (https://atcoder.jp/contests/abc159)
// Problem: D: Banned K (https://atcoder.jp/contests/abc159/tasks/abc159_d)


// region {{{ boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <chrono>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cplusplus >= 201703L
#   define all(a)      begin(a),end(a)
#   define sz(x)       ((int)size(x))
#else
#   define all(a)      (a).begin(),(a).end()
#   define sz(x)       ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;

#if __cplusplus >= 201703L
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9 + 5;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18 + 5;
MAYBE_UNUSED static mt19937 rng((u32)chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
//endregion }}}

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

    int n; cin >> n;
    vi a(n);
    map<int, int> c;
    rep(i, n) {
        cin >> a[i];
        c[a[i]]++;
    }

    ll cnt = 0;
    for (auto& p : c)
        cnt += (ll)p.second * (p.second - 1) / 2;

    rep(i, n)
        cout << (cnt - c[a[i]] + 1) << '\n';

    return 0;
}

Measured memory_bytes: 8320
#include<bits/stdc++.h>
using namespace std;
int n,m;
bool f[100000],f1[100000];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
		f[i]=1;
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		memset(f1,0,sizeof(f1));
		while(x--)
		{
			int x1;
			scanf("%d",&x1);
			f1[x1]=1;
		}
		for(int j=1;j<=m;j++)
			f[j]=min(f[j],f1[j]);
	}
	int ans=0;
	for(int i=1;i<=m;i++)
		ans+=f[i];
	printf("%d",ans);
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<P,int>
#define vpp vector<PP>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int main(){
    int n,m,k;
    cin>>n>>m>>k;
    // if(n==1||m==1){
    //     cout<<"Yes"<<endl;
    //     return 0;
    // }
    REP(i,n+1){
        REP(j,m+1){
            if(n*j+m*i-i*j*2==k){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

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

#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define ST(n) sort(n.begin(),n.end())

using namespace std;
typedef long long ll;

int main(){
	int N;
	cin >> N;
	int A;
	int maxA=0;
	int sum=0;
	REP(i,N){
		cin >> A;
		sum+=A;
		maxA=max(maxA,A);
	}
	sum-=maxA;
	if(maxA<sum)
			cout << "Yes" << endl;
		else 
			cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  vector<int> ini(N);
  vector<int> fin(N);
  priority_queue<PII> pque;
  rep(i,N)cin >> ini[i];
  rep(i,N) cin >> fin[i];
  rep(i,N){
    int ni = (i+1)%N, pi = (i-1+N)%N;
    if(fin[i] > fin[ni] + fin[pi] && fin[i] != ini[i])pque.push(PII(fin[i],i));
  }

  bool issat = true;
  ll count = 0;
  while(!pque.empty()){
    int val = pque.top().first;
    int i = pque.top().second;
    pque.pop();
    int ni = (i+1)%N,pi = (i-1+N)%N;
    int nni = (ni+1)%N,ppi = (pi-1+N)%N;
    int tag = fin[ni] + fin[pi];
    int nval = max(tag,ini[i]);
    int n = (fin[i] - nval + tag - 1)/tag;
    fin[i] -= tag*n;
    count += n;
    if(fin[i]<ini[i]) issat = false;
    else{
      if(fin[ni] > fin[i] + fin[nni] && fin[ni] != ini[ni])pque.push(PII(fin[ni],ni));
      if(fin[pi] > fin[i] + fin[ppi] && fin[pi] != ini[pi])pque.push(PII(fin[pi],pi));
    }
    if(!issat)break;
  }
  rep(i,N)if(fin[i] != ini[i])issat = false;
  if(issat)cout << count << endl;
  else cout << -1 << endl;
  return 0;
}


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

//get digit(return int)
int get_digit(int num){
    int digit = 0;
    while(num > 0){
        num = num/10;
        digit++;
    }
    return digit;
}

int main(){
    int a, b;
    int answer[200];
    int size = 0;

    while(cin >> a >> b){
        if(size > 200){
            break;
        }
        answer[size] = get_digit(a + b);
        size++;
    }
    for(int i = 0;i < size;i++){
        cout << answer[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 2984
#include <bits/stdc++.h>
using namespace std;
int main(){
   int n;
   cin >> n;
   vector<int> v(n-1);
   for(int i=0;i<n-1;i++)cin >> v[i];
   long sum = v[0] + v[n-2];
   for(int i=1;i<n-1;i++){
       sum += min(v[i-1],v[i]);
   }
   cout << sum << endl;
}


Measured memory_bytes: 3580
#ifndef VS
#include<bits/stdc++.h>
#endif

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}
}star;
#define DEBUG if(0)
#endif

#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}

class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};



int main() {
	int N, M;
	cin>>N>>M;
	cout<<N-M-1<<endl;
	return 0;
}



Measured memory_bytes: 3220
import math
import fractions
A,B = map(int,input().split())

maxn=fractions.gcd(A,B)
list=[]
def isPrime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    if n==3:
        return True
    m = math.floor(math.sqrt(n)) + 1
    for p in range(3, m,2):
        if n % p == 0:
            return False
    return True
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

yaku=make_divisors(maxn)
for i in range(len(yaku)):
    if isPrime(yaku[i]):
        list.append(yaku[i])

print(len(list))


Measured memory_bytes: 5304
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
const int INF = 1e9 + 100;
const lli INF64 = (1LL << 61) + 100;
const lli MOD = 1000*1000*1000+7;
lli bpow(lli a, lli b) {
	if(b == 0) return 1;
	if(b == 1) return a % MOD;
	lli r = bpow(a, b >> 1);
	r = (r * r) % MOD;
	return (r * (((b&1)?a:1) % MOD)) % MOD;
}
lli multInverse(lli a) {
	return bpow(a, MOD - 2);
}
lli modMult(lli a, lli b) {
	return (a * b) % MOD;
}
lli modSub(lli a, lli b) {
	a += MOD;
	lli r = a - b;
	if(r >= MOD) return r - MOD;
	return r;
}
lli modAdd(lli a, lli b) {
	lli r = a + b;
	if(r >= MOD) return r - MOD;
	return r;
}
signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	cout << (((n + 1) * n) / 2) << "\n";
	return 0;
}

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

int n;
string s;


int main()
{

	cin >> n >> s;


	int x = 0;

	int l = 0;
	int r = 0;
	for(int i = 0;i < n;i++)
	{
		if(s[i] == '(')
		{
			l++;
		}
		else
		{
			r++;
		}
		x = min(x , l - r);
	}

	string ans = s;

	for(int i = 0;i < -x;i++)
	{
		ans = "(" + ans;
	}

	for(int i = 0;i < l - r - x;i++)
	{
		ans = ans + ")";
	}

	cout << ans << endl;


	

	return 0;
}


Measured memory_bytes: 256
(defn coins [a b c x]
  (count
    (for [i (range 0 (inc a)) j (range 0 (inc b)) k (range 0 (inc c))
          :let [res (+ (* 500 i) (* 100 j) (* 50 k))]
          :when (= res x)]
     res)))

(println (coins (Long/parseLong (read-line))
                (Long/parseLong (read-line))
                (Long/parseLong (read-line))
                (Long/parseLong (read-line))))

Measured memory_bytes: 71440