akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static final int MOD = (int) Math.pow(10, 9) + 7;
    static final boolean TEST = false;

    static void debug(Object... os) {
        if (TEST) {
            StringBuilder sb = new StringBuilder(os.length);
            for (Object o : os)
                sb.append(o);
            System.out.println(sb);
        }
    }

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            do {
                solve(in);
            } while (TEST);
        }
    }

    private static void solve(Scanner in) {
        int N = in.nextInt();
        long[] A = new long[N], B = new long[N];
        for (int i = 0; i < N; i++) {
            A[i] = in.nextInt();
            B[i] = in.nextInt();
        }
        long ans = 0;
        long accum = 0;
        for (int i = N - 1; i > -1; i--) {
            A[i] += accum;
            long delta = 0;
            if (A[i] == 0) {
                delta = 0;
            } else if (A[i] < B[i]) {
                delta = B[i] - A[i];
            } else if (A[i] % B[i] != 0) {
                delta = B[i] - (A[i] % B[i]);
            }
            A[i] += delta;
            accum += delta;
            ans += delta;
        }
//        debug(Arrays.toString(A));
//        debug(Arrays.toString(B));
        System.out.println(ans);
    }
}

Measured memory_bytes: 65984
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
    int n;
    ll T;
    cin >> n >> T;
    vector<ll> t(n);
    for (int i = 0; i < n; ++i) {
        cin >> t[i];
    }

    ll sum = n * T;
    for (int i = 1; i < n; ++i) {
        if (t[i] < t[i - 1] + T) sum -= t[i - 1] + T - t[i];
    }

    cout << sum << endl;
}

Measured memory_bytes: 1792
import java.io.*;
import java.util.StringTokenizer;

public class Main {
  private static PrintWriter out;

  public static void main(String[] args) {
    Main main = new Main();
    Runtime.getRuntime().addShutdownHook(new Thread(() -> out.close()));
    try {
      main.run(args);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  private void run(String[] arguments) throws Exception {
    MyScanner sc = new MyScanner();
    out = new PrintWriter(new BufferedOutputStream(System.out));


    String line = sc.nextLine();
    String[] letters = line.split(" ");

    int ans = 0;

    for (int i = 0; i < letters.length; i++) {
      if (letters[i].equals("0")){
        ans = i+1;
        break;
      }
    }

    out.println(ans);

    out.close();
  }

  /*          
   * Form: http://codeforces.com/blog/entry/7018
   */
  private class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    MyScanner() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

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


Measured memory_bytes: 33856
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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

  int ans = 0, tmp = 0;
  REP(i,3) {
    if (s[i] == 'R') {
      tmp++;
    } else {
      chmax(ans,tmp);
      tmp = 0;
    }
  }
  chmax(ans,tmp);

  COUT(ans);

  return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

int dp[3005][3005];

int main() {
    int n, t;
    cin >> n >> t;
    vector<P> p(n);
    rep(i,n) cin >> p[i].first >> p[i].second;
    sort(p.begin(), p.end());
    int ans = 0;
    rep(i,n) {
        rep(j,t) {
            chmax(dp[i+1][j], dp[i][j]);
            int nj = j + p[i].first;
            if (nj < t) chmax(dp[i+1][nj], dp[i][j] + p[i].second);
        }
        int now = dp[i][t-1] + p[i].second;
        ans = max(ans, now);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 38800
n = gets.to_i

cnt = 0

for div in 1..([((n-1)**0.5).to_i, 10**6].min)
  if (n-1) % div == 0
    ns = [div, (n-1)/div].uniq
    ns.each{|num| cnt += 1 if num > 1}
  end
end

for div in 1..([(n**0.5).to_i, 10**6].min)
  if n % div == 0
    ns = [div, n/div].uniq
    ns.each do |num|
      if num > 1
        tmp = n
        while tmp % num == 0
          tmp /= num
        end
        cnt += 1 if tmp % num == 1
      end
    end
  end
end

puts cnt

Measured memory_bytes: 3836
n,d = gets.chop.split.map(&:to_i)

points = Array.new(n).map{Array.new()}

for i in 0..n-1 
  points[i] = gets.chop.split.map(&:to_i)
end

count = 0
for i in 0..n-1
  for j in 0..n-1
    if i >= j
      next
    end

    sum = 0.0
    for k in 0..d-1
      sum += (points[j][k] - points[i][k]) * (points[j][k] - points[i][k])
    end

    if (/^[+-]?[0-9]+\.0$/ =~ Math.sqrt(sum).to_s)
        count += 1
    end
  end
end

puts count

Measured memory_bytes: 1788
/*
 *  * main.cpp
 *   *
 *    */

#include<iostream>
#include<fstream>
#include<algorithm>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<cstring>
#include<string>
#include<cassert>
#include<stdlib.h>
#include<time.h>
using namespace std;

char N[1003];
long long res;

void compute(string restr, int level) {
    if (restr.size() > strlen(N)) return;
    if (level == 0) {
        bool isOk = true;
        for (int i = 0; i < restr.size(); ++i)
            if (restr[i] < N[i]) break;
            else if (restr[i] > N[i]) isOk = false;

        if (isOk) res++;

        return;
    }

    compute(restr + "0", level);

    for (int i = 1; i <= 9; ++i) compute(restr + to_string(i), level - 1);
}
int main() {

    int k;
    scanf("%s %d", N, &k);

    int n = strlen(N);

    long long reminder = pow(9, k);

    for (int i = 1; i <= k; ++i) reminder *= (n - i);
    for (int i = 1; i <= k; ++i) reminder /= i;


    for (int i = 1; i <= 9; ++i) {
        string restr = to_string(i);
        compute(restr, k - 1);
    }

    printf("%lld\n", res + reminder);


    return 0;
}


Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] a = new int[n];
		Set<Integer> nsorted = new HashSet<Integer>();
		
		a[0] = sc.nextInt();
		for(int i = 1; i < n; i++) {
			a[i] = sc.nextInt();
			if(a[i - 1] > a[i]) {
				nsorted.add(i - 1);
			}
		}
		
		int q = sc.nextInt();
		int ans = -1;
		if(nsorted.isEmpty()) {
			ans = 0;
		}else {
			for(int i = 1; i <= q; i++) {
				int x = sc.nextInt() - 1;
				int y = sc.nextInt() - 1;
				
				int tmp = a[x];
				a[x] = a[y];
				a[y] = tmp;
				
				if(x - 1 >= 0) {
					if(a[x - 1] > a[x]) {
						nsorted.add(x - 1);
					}else {
						nsorted.remove(x - 1);
					}
				}
				if(x + 1 < n) {
					if(a[x] > a[x + 1]) {
						nsorted.add(x);
					}else {
						nsorted.remove(x);
					}
				}
				
				if(y - 1 >= 0) {
					if(a[y - 1] > a[y]) {
						nsorted.add(y - 1);
					}else {
						nsorted.remove(y - 1);
					}
				}
				if(y + 1 < n) {
					if(a[y] > a[y + 1]) {
						nsorted.add(y);
					}else {
						nsorted.remove(y);
					}
				}
				
				if(nsorted.isEmpty()) {
					ans = i;
					break;
				}
			}
		}
		
		System.out.println(ans);
	}
}


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

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

	int64_t a,b,c,d;
	cin>> a >> b >> c >> d;

	int64_t ans = a*c;

	ans = max(ans, b*d);
	ans = max(ans, b*c);
	ans = max(ans, a*d);

	cout << ans << endl;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

const int MAX_N=1100;

//Ｏ(n*log(logn))≒Ｏ(n)
int prime[MAX_N];         //i番目の素数
bool is_prime[MAX_N+1];    //is_prime[i]がtrueならiは素数

//n以下の素数の個数を返す。
void sieve(int n){
  int p=0;
  for(int t=0;t<=n;t++)is_prime[t]=true;
  is_prime[0]=is_prime[1]=false;
  for(int t=2;t<=n;t++){
    if(is_prime[t]==true){
      prime[p++]=t;
      for(int i=2*t;i<=n;i+=t)is_prime[i]=false;
    }
  }
}

int calc(int t,int n){
  int res=0;
  int temp=t;
  while(n/t!=0){
    res+=floor(n/t);
    t*=temp;
  }
  return res;
}

signed main(){
  int N;cin>>N;

  sieve(N);

  int ans=1;
  for(int t=1;t<=N;t++){
    if(is_prime[t]){
      int temp=calc(t,N)+1;
      ans*=temp;
      ans%=MOD;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

int main()
{ 
    int n, a[100010], b[100010], c[100010];

    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    for (int i = 0; i < n; i++) cin >> c[i];

    sort(a, a + n);
    sort(b, b + n);
    sort(c, c + n);

    long long ans = 0;
    for (int i = 0; i < n; i++) {
        int aa = (lower_bound(a, a + n, b[i]) - a);
        int bb = n - (upper_bound(c, c + n, b[i]) - c);
        // cout << aa << " " << bb << endl;
        ans += 1LL * aa * bb;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9+7

ans = 0
for i in range(60):
    ones = 0
    for j in range(N):
        if ((A[j] >> i) & 1):
            ones += 1
    ans += 2**i * ones * (N - ones) % MOD
    ans %= MOD

print(ans)


Measured memory_bytes: 122968
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================
/*Advanced
vi g[N];
int a[N];
*/
void solve() {
  int i, j, n, m;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	int n;
	char c[222222];
	cin >> n;
	cin >> c;
	int l = 0;
	int ans = 0;
	int r = n - 1;
	while(l < n && r >= 0) {
		while(l < n && c[l] == 'R') l++;
		while(r >= 0 && c[r] == 'W') r--;
		if(l >= r) break;
		else {l++; r--;
			ans++;}
	}
	cout << ans;
    return 0;
}
/*
int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
    u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}
*/


Measured memory_bytes: 3808
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pi pair<int, int>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define deb(x) cout << #x << ":" << x << endl;
/* freopen("input.txt", "r", stdin); */
/* freopen("output.txt", "w", stdout); */
const ll inf = 1e17 + 7, MOD = 1e7 + 9;


int main() {
	fastio();
	int a, b;
	cin >> a >> b;
	cout << a * b << "\n";
	return 0;
}



Measured memory_bytes: 3604
#include <stdio.h>
#include <string.h>
#include <algorithm>

const int kN = 1000000 + 5;
const int MOD = (int)1e9 + 7;
int Inv[kN], Finv[kN], F[kN], n, m, k;
int pascal[kN];

int binom(int a, int b)
{
    if (b < 0 || b > a) return 0;
    return F[a] * 1LL * Finv[b] % MOD * Finv[a - b] % MOD;
}

inline void add(int &a, int b)
{
    a += b;
    if (a >= MOD) a -= MOD;
}

int power(int a, int b, int p)
{
    int ret = 1;
    for ( ; b; b >>= 1, a = a * 1LL * a % MOD)
        if (b & 1)
            ret = ret * 1LL * a % MOD;
    return ret;
}

int main()
{
    Inv[1] = 1;
    for (int i = 2; i < kN; ++ i)
        Inv[i] = (MOD - MOD / i) * 1LL * Inv[MOD % i] % MOD;
    F[0] = Finv[0] = 1;
    for (int i = 1; i < kN; ++ i) {
        F[i] = F[i - 1] * 1LL * i % MOD;
        Finv[i] = Finv[i - 1] * 1LL * Inv[i] % MOD;
    }
    scanf("%d%d%d", &n, &m, &k);
    pascal[0] = 1;
    for (int i = 1; i <= m + k; ++ i) {
        pascal[i] = (pascal[i - 1] << 1) % MOD;
        if (i >= m + 1) add(pascal[i], MOD - binom(i - 1, m));
        if (i >= k + 1) add(pascal[i], MOD - binom(i - 1, k));
    }
    int result = 0;
    int t = n + m + k;
    for (int i = n; i <= t; ++ i) {
        add(result, binom(i - 1, n - 1) * 1LL * power(3, t - i, MOD) % MOD * pascal[i - n] % MOD);
    }
    printf("%d\n", result);
}


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

#include <iostream>
#include <algorithm>

#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <utility>
#include <array>
#include <complex>
#include <valarray>

#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>


using namespace std;
#define int long long

typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod
#define inside(y, x, h, w) (0 <= (y) && (y) < (h) && 0 <= (x) && (x) < (w)) ? true : false


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> lists;
    bool checked[300000 + 1] = {};
    rep2(i, 2, 300000 + 1) {
        if (checked[i]) continue;
        if (i % 7 == 1 || i % 7 == 6) {
            lists.push_back(i);
            int k = 0;
            while (i * (7 * k + 1) <= 300000) {
                checked[i * (7 * k + 1)] = true;
                k++;
            }
            k = 0;
            while (i * (7 * k + 6) <= 300000) {
                checked[i * (7 * k + 6)] = true;
                k++;
            }
        }
    }
    while (true) {
        int n;
        cin >> n;
        if (n == 1) break;
        vector<int> ans;
        for (auto p : lists) {
            if (n % p == 0) {
                ans.push_back(p);
            }
        }
        cout << n << ':';
        rep(i, ans.size()) {
            cout << " " << ans[i];
        }
        cout << endl;
    }
}

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

int main(){
	string s[7];
	s[0]="SUN";
	s[1]="MON";
	s[2]="TUE";
	s[3]="WED";
	s[4]="THU";
	s[5]="FRI";
	s[6]="SAT";
	string str;
	cin>>str;
	for(int i=0;i<7;i++){
		if(s[i]==str){
			cout<<7-i<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	int h[21];
	for(int i=0;i<n;i++){
		cin >> h[i];
	}
	int m = 0;
	int ans = 0;
	for(int i=0;i<n;i++){
		m = max(m, h[i]);
		if(m<=h[i]){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int read () {
	int num = 0;
	char c = ' ';
	bool flag = true;
	for (;c > '9' || c < '0';c = getchar())
		if (c == '-')
			flag = false;
	for (;c >= '0' && c <= '9';num = (num << 1) + (num << 3) + c - 48, c = getchar());
	return flag ? num : -num;
}
const int maxn = 1020;
int h[maxn], n, T, A;
double t[maxn];
int main () {
	n = read (); T = read (); A = read ();
	for (int i = 1;i <= n;i ++) {
		h[i] = read ();
		t[i] = T - 1.0 * h[i] * 0.006;
	}
	int now = 1; double ans = t[1];
	for (int i = 2;i <= n;i ++)
		if (fabs (t[i] - A) <= fabs (ans - A)) {
			now = i;
			ans = t[i];
		}
	printf ("%d\n", now);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;

int a, b, c, x, ans;

int main() {
    scanf("%d%d%d%d", &a, &b, &c, &x);
    for (int i = 0; i <= a; ++i)
        for (int j = 0; j <= b; ++j)
            for (int k = 0; k <= c; ++k) {
                if (i * 500 + j * 100 + k * 50 == x) ans++;
            }
    printf("%d\n", ans);
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int K = Integer.parseInt(sc.next());
		int gcdTotal = 0;
		for(int a=1; a<=K; a++) {
			for(int b=1; b<=K; b++) {
				for(int c=1; c<=K; c++) {
					gcdTotal += getGcd(c,getGcd(a, b));
				}
			}
		}
		System.out.println(gcdTotal);
	}

	private static int getGcd(int a, int b) {
		while(true) {
			int d = b;
			if(a%b == 0)break;
			b = a%b;
			a = d;
		}
		return b;
	}
}

Measured memory_bytes: 27176
#include <iostream>
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long
#define mod 1000000007
int main()
{
     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n,k;
    cin>>n>>k;
    ll arr[n];
    for(int i=0;i<n;i++)
    cin>>arr[i];
    if(k==0)
    {
        cout<<1;
        return 0;
    }
    ll dp[n+1][k+1];
    ll p[n+1][k+1];
    for(int i=0;i<=n;i++)dp[i][0]=p[i][0]=1;
    for(int i=0;i<=k;i++)p[0][i]=1;
    
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=k;j++)
        {  
            if(j>=arr[i-1]+1)
            dp[i][j]=p[i-1][j]-p[i-1][j-arr[i-1]-1]+mod;
            else
            dp[i][j]=(p[i-1][j])%mod;
            dp[i][j]%=mod;
            p[i][j]=(p[i][j-1]+dp[i][j])%mod;
        }
    }
    cout<<dp[n][k]%mod;
}

Measured memory_bytes: 158080
# 指定された距離で何個の木を作成することができるかを計算する
import bisect
import itertools
N = int(input())
D = list(map(int, input().split()))
node_dis = [1] # 距離iのノードの個数をi番目の要素として格納したリスト
flag_none = False

# 頂点１から深さは決まっている.深さni毎に前のni-1のノードから重複を許してc_ni個選んでノードに繋げばよい
if not D[0] == 0:
    print(0)
    flag_none = True

else:
    D.sort()  # 昇順でソート
    for i in range(1,N):
        if i == 1 and bisect.bisect_left(D,1) >= 2:  # 0が２つ以上ある場合
            print(0)
            flag_none = True
            break
        else:
            if i ==1:
                del D[0]
            index = bisect.bisect_left(D,i+1)
            new_num = index 
            node_dis.append(new_num)
            del D[:index]
            if index==0: 
                if not D == []:
                    print(0)
                    flag_none = True
                break
if flag_none == False:
    sum = 1
    for (ind, di) in enumerate(node_dis): 
        if ind > 0:
            sum *= node_dis[ind-1] ** di
    print(sum%998244353)




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

void dfs(vector< vector<int> > &island, int x, int y) {
    island[x][y] = 0;

    for (int dx = -1; dx <= 1; dx++) {
        for (int dy = -1; dy <= 1; dy++) {
            int nx = x + dx;
            int ny = y + dy;
            if (nx >= 0 && nx < island.size() && ny >= 0 && ny < island[0].size() && island[nx][ny] == 1) {
                dfs(island, nx, ny);
            }
        }
    }
}

int main() {
    while (true) {
        int w, h;
        cin >> w >> h;
        if (w == 0 && h == 0) {
            break;
        }

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

        int res = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (island[i][j] == 1) {
                    dfs(island, i, j);
                    res++;
                }
            }
        }

        cout << res << endl;
    }

    return 0;
}


Measured memory_bytes: 3388
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.System.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static void solve() throws Exception {
        long A = scanLong(), B = scanLong(), N = scanLong();
        long ans = (long)(A * N / B);
        if (N < B) {
            out.print(ans);
//            return;
        } else {
//            if ()
            long tmp = B-1;
            ans = (long)(A * tmp / B) - (long)(A * (long)(tmp / B));
            out.print(ans);
        }


//
//        for (long i = 1; i <= N; i++) {
//            long t = (long)(A * i / B) - (long)(A * (long)(i / B));
//            long j = (A * i / B);
//            long k = (A * (long)(i / B));
////            long t = j - k;
//            System.out.println(i+":"+j +":"+k+":"+t);
//            if (ans <= t) {
//                ans = t;
//            } else {
////                break;
//            }
//        }
//        out.print("sita" + ans);
    }

    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

    static long scanLong() throws IOException {
        return parseLong(scanString());
    }

    static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        }
        catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}

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

using namespace std;

const int N=1e5+7;
int cnt[N];

string s;

int main() {
    int n;
    cin>>n;
    memset(cnt,0,sizeof(cnt));
    for(int i=0;i<n;i++) {
        int x; cin>>x;
        cnt[x]++;
    }
    
    int val=cnt[0]+cnt[1];
    for(int i=1;i<=1e5;i++) {
        val=max(val,cnt[i]+cnt[i-1]+cnt[i+1]);
    }
    
    cout<<val<<endl;

    return 0;
}


Measured memory_bytes: 640
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func next() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func main() {
	scanner.Split(bufio.ScanWords)

	x := nextInt()
	a := nextInt()

	if x < a {
		fmt.Println(0)
	} else {
		fmt.Println(10)
	}
}


Measured memory_bytes: 640
n, h = map(int, input().split())
a, b = 0, [0]*n
for i in range(n):
    x, b[i] = map(int, input().split())
    a = max(x, a)
b.sort(reverse=True)

cnt = 0
for i in range(n):
    if b[i]>a:
        h -= b[i]
        cnt += 1
        if h<=0:
            print(cnt)
            exit()
print(cnt+(h+a-1)//a)

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

int main(){
  	string s;
  	int memo = 0;
  	
  	while(1){
  	    cin >> s;
  	    memo = 0;
  	    if(s != "0"){
  	        rep(i,0,s.size()){
  	            memo += (int)s[i] - 48;
  	        }
  	        cout << memo <<endl;
  	    }
  	    else{
  	        break;
  	    }
  	}
    return 0;
}


Measured memory_bytes: 3172
import heapq

n = int(input())
v = list(map(int, input().split()))

heapq.heapify(v)

while v:
  tmp = heapq.heappop(v)
  if v:
    tmp += heapq.heappop(v)
    heapq.heappush(v,tmp/2)
print(tmp)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

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

using namespace std;

int main(){
    int N;
    map<string, int> mp;
    cin >> N;

    rep(i, N) {
        string tmp;
        cin >> tmp;
        auto itr = mp.find(tmp);
        if (itr != mp.end() ) {
            mp[tmp]++;
        } else {
            mp[tmp] = 0;
        }
    }

    cout << mp.size() << endl;

    return 0;
}



Measured memory_bytes: 18776
#include <bits/stdc++.h>
#define ll long long int
#define ulli unsigned long long int 
#define pb push_back
using namespace std;
ll BS(ll s[],ll q,ll n)
{
    ll beg = 0,last = n;
    while(beg<=last)
    {
        ll mid = (beg+last)/2;
        if (s[mid+1]>=q && s[mid]<q)
            return mid+1;
        else if (s[mid]<q)
            beg = mid+1;
        else 
            last = mid-1;
    }
    return 0;
}
bool isprime(ll n) 
{
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
} 
int main()
{  
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   //while(!cin.eof())
   int t; t=1;
   ll mod=1000000007;
   while(t--)
   {
       ll n;
       cin>>n;
       ll a[n],s[n],ans=0;
       
       for(ll i=0;i<n;i++) cin>>a[i];
       s[n-1]=a[n-1];
        for(ll i=n-2;i>=0;i--)
              s[i]=(a[i]+s[i+1] )%mod;
        
        for(ll i=0;i<n-1;i++)
            ans=( ans%mod + (a[i]%mod) * (s[i+1]%mod)%mod)%mod;
       cout<<ans;
   }
   return 0;
}

Measured memory_bytes: 6724
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
signed main(){
    ll a,b;cin>>a>>b;
    if(a>0){
        cout<<"Positive"<<endl;
    }else if(a<=0&&b>=0){
        cout<<"Zero"<<endl;
    }else{
        if((b-a)%2)cout<<"Positive"<<endl;
        else cout<<"Negative"<<endl;
    }
}

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


Measured memory_bytes: 3568
import java.util.*

fun main(args: Array<String>) = FastScanner().run {
    val v = LongArray(4){long()}
    var n = long()
    var sum = 0L
    if (n >= 2) {
        val cost2 = Math.min(v[0] * 8, Math.min(v[1] * 4, Math.min(v[2] * 2, v[3])))
        sum += cost2 * (n / 2)
        n %= 2
    }
    if (n >= 1) {
        val cost1 = Math.min(v[0] * 4, Math.min(v[1] * 2, v[2]))
        sum += cost1 * n
    }
    println(sum)
}


class FastScanner {
    private val printable = 33..126
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0
    fun hasNextByte(): Boolean {
        if (ptr < buflen) {
            return true
        } else {
            ptr = 0
            buflen = System.`in`.read(buffer)
            if (buflen <= 0) {
                return false
            }
        }
        return true
    }
    fun readByte(): Byte {
        return if (hasNextByte()) buffer[ptr++] else return -1
    }
    fun hasNext(): Boolean {
        while (hasNextByte() && buffer[ptr] !in printable) ptr++
        return hasNextByte()
    }
    fun string(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (b in printable) {
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }
    fun long(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
        if (b !in '0'.toByte()..'9'.toByte()) {
            throw NumberFormatException()
        }
        while (true) {
            if (b in '0'.toByte()..'9'.toByte()) {
                n *= 10
                n += b - '0'.toByte()
            } else if (b == (-1).toByte() || b !in printable) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }
    fun int(): Int {
        val nl = long()
        if (nl !in Integer.MIN_VALUE..Integer.MAX_VALUE) throw NumberFormatException()
        return nl.toInt()
    }
    fun double(): Double {
        return string().toDouble()
    }
}

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

int main() {
  int k; string s;
  cin >> s >> k;
  rep(i, s.size()){
    if(i == (int)s.size()-1) s[i] = (char)((s[i]+k-'a')%26 + 'a');
    else if(s[i] != 'a' && k >= 26-s[i]+'a'){
      k -= 26-s[i]+'a';
      s[i] = 'a';
    }
  }
  cout << s << "\n";
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
	int n, m, x;
	cin >> n >> m >> x;
	vector<int> a(m);
	int r = 0, l = 0;
	for (int i = 0; i < m; i++) {
		cin >> a[i];
		if (a[i] > x)r++;
		if (a[i] < x)l++;
	}
	
	cout << min(r, l) << endl;

	return 0;
}

Measured memory_bytes: 256
// Bismillahirrahmanirrahim
// by Batrrr Tolkynbayev
#include <bits/stdc++.h>
// skripi krasava
#define respa return 0
#define all(x) x.begin(), x.end()
#define sz size
#define pb push_back
#define eb emplace_back
#define forn(i, x, n) for(int i = x; i <= n; ++i)
#define forr(i, n, x) for(int i = n; i >= x; --i)

using namespace std;
typedef long long ll;
typedef long double ld;
const int N = 3e5 + 17, M = N << 2, mod = (int)1e9 + 7; 

int tt = 1, n, a[N], up, ct = 1;

void solve () {
	cin >> n;
	forn(i, 1, n) {
		cin >> a[i];
	}
	forn(i, 2, n) {
		if (!up) {
			if (a[i] > a[i - 1]) up = 1;
			else if (a[i] < a[i - 1]) up = -1;
		}
		else if ((a[i] > a[i - 1] && up == -1) || (a[i] < a[i - 1] && up == 1)) {
			up = 0;
			++ct;
		}        
	}
	cout << ct;
}

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	// cin >> tt;
	while (tt--) solve();
	respa;
}

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

using namespace std;

using ll = long long;

constexpr ll MOD = 1000000007;

#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
#else
#define print(...)
#endif

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

    ll a,b,c,k;

    cin >> a >> b >> c >> k;

    ll ans = 0;
    if(k>a){
        ans+=a;
        k-=a;
    }else{
        ans+=k;
        k-=k;
    }
    
    if(k>b){
        k-=b;
    }else{
        k-=k;
    }
    
    if(k>c){
        ans+=c;
        k-=c;
    }else{
        ans-=k;
        k-=k;
    }


    cout << ans << endl;

    return 0;
}

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

using namespace std;

typedef long long LL;

struct cww{cww(){
    ios::sync_with_stdio(false);cin.tie(0);
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

#define fi first
#define se second
#define pb push_back

template <typename T>inline void chmin(T &l,T r){l=min(l,r);}
template <typename T>inline void chmax(T &l,T r){l=max(l,r);}

template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
    
int main(){
    LL S,C;
    cin>>S>>C;
    LL res=min(S,C/2);
    C-=res*2;
    cout<<res+C/4<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(){
        int a,b,c;
        scanf("%d %d %d",&a,&b,&c);
        if(a+b+c >= 22){
                printf("bust\n");
        }
        else{
                printf("win\n");
        }
        return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>	
#define int long long int
#define pb push_back
#define endl "\n"
#define F first
#define S second 
#define mod 1000000007     
using namespace std;

main()
{	
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	string s;
	cin >> s;
	if(s[2] == s[3] and s[4] == s[5])
		cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
N=input()
T = [input() for i in range(N)]
#print T

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


def lcm(a, b):
	return a * b // gcd (a, b)


ans=1
for i in range(len(T)):
	ans=lcm(ans,T[i])
	#print "ans::"+str(ans)

print ans

Measured memory_bytes: 2568
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
from operator import itemgetter
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
N, M = LI()
A = [LI() for _ in range(N)]
m = [[0] * 3 for _ in range(8)]

for c in range(4):
  A.sort(key=lambda x:(((c>>2)&1)*2-1)*x[0]+(((c>>1)&1)*2-1)*(-1)*x[1]+((c&1)*2-1)*x[2])
  for i in range(M):
  	for j in range(3):
  		m[c*2][j] += A[i][j]
  		m[c*2+1][j] += A[N-1-i][j]

print(max([abs(x[0])+abs(x[1])+abs(x[2]) for x in m]))


Measured memory_bytes: 12316
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

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

bool solve(ll A, ll B, ll C, ll D) {
    if (B > A) {
        return false;
    } else if (B > D) {
        return false;
    } else if (C >= B) {
        return true;
    } else {
        ll g = gcd(B, D);
        return B - g + A % g <= C;
    }
}

int main() {
    ll T;
    cin >> T;
    vector<ll> A(T), B(T), C(T), D(T);
    for (ll i = 0; i < T; i++) {
        cin >> A[i] >> B[i] >> C[i] >> D[i];
    }
    for (ll i = 0; i < T; i++) {
        cout << (solve(A[i], B[i], C[i], D[i]) ? "Yes" : "No") << endl;
    }
}

Measured memory_bytes: 256
h,n = map(int,input().split())
dp = [int(1e18)] * (h+1)
dp[0] = 0
for i in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        nj = min(j+a, h)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[h])


Measured memory_bytes: 43740
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

int main() {
    vector<int> vec(5);
    rep(i, 5) {
        cin >> vec[i];
    }
    int k;  cin >> k;

    bool flag = true;
    rep(i, 5) {
        for (int j=i+1; j<5; ++j) {
            if (abs(vec[j] - vec[i]) > k) flag = false;
        }
    }

    if (flag)  print("Yay!");
    else print(":(");
}

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

int n, k;

int main() {
  int n, k;
  long long ans = 0;
  cin >> n >> k;
  for (int i = k + 1; i <= n; i ++) {
    int l, r;
    for (int w = 0; w <= n; w ++) {
      l = max(i * w + k, 1); r = min(i * w + i - 1, n);
      if (l > n) break;
      ans += r - l + 1;
      if (r == n) break;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string ab = Console.ReadLine();

            if (int.Parse(ab.Split(' ')[0]) <= int.Parse(ab.Split(' ')[1]))
            {
                Console.WriteLine("unsafe");
            }
            else
            {
                Console.WriteLine("safe");
            }
        }
    }
}


Measured memory_bytes: 27536
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define cont continue
#define rep(i, n) for(int i = 0 ; i < (n) ; i++)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 987654321;

int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> f;

  rep(i, n) {
    int x;
    cin >> x;
    f.pb(x);
  }
  sort(all(f));

  int ans = 0;
  for(int i = 0 ; i < k ; i++) {
    ans += f[i];
  }
  cout << ans << endl;
} 


Measured memory_bytes: 3612
import sys
 
 
A = int(sys.stdin.readline().strip())
B = int(sys.stdin.readline().strip())
C = int(sys.stdin.readline().strip())
D = int(sys.stdin.readline().strip())
E = int(sys.stdin.readline().strip())



l = [A,B,C,D,E]

sur = []
i = 0
while(i<len(l)):
    if(l[i]%10==0):
        sur.append(0)
    else:
        sur.append(10 - l[i]%10)
    i += 1
    

j=0
t=0
while(j<len(l)):
    if(j!=sur.index(max(sur))):
        if(l[j]%10==0):
            t += l[j]
        else:
            t += int(l[j]/10)*10 + 10
    else:
        t += l[j]
    j += 1

print(t)

Measured memory_bytes: 3064
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(unsigned x){
  int s=0;
  char f[10];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(unsigned long long x){
  int s=0;
  char f[21];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(double x){
  printf("%.15f",x);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
inline void wt_L(string &x){
  int i=0;
  for(i=0;x[i]!='\0';i++){
    putchar_unlocked(x[i]);
  }
}
template<class T, class U> inline T GCD_L(T a, U b){
  T r;
  while(b){
    r=a;
    a=b;
    b=r%a;
  }
  return a;
}
template<class T, class U> inline T LCM_L(T a, U b){
  return a/GCD_L(a,b)*b;
}
int main(){
  long long A;
  long long B;
  rd(A);
  rd(B);
  wt_L(LCM_L(A, B));
  wt_L('\n');
  return 0;
}
// cLay varsion 20200119-1

// --- original code ---
// {
//   ll A, B;
//   rd(A,B);
//   wt(lcm(A,B));
// }

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include<algorithm>
#include<math.h>

using namespace std;
int main()
{
	string N;
	cin >> N;
	if (N[2] == '7' || N[1] == '7' || N[0] == '7')cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 3548
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())

print(a[k-1])

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

struct RollingHash{
    static const int B1=1007,B2=2009;
    static const int mod1=1000000007,mod2=1000000009;
    vector<long long> hash1,hash2,po1,po2;
    RollingHash(const vector<long long> &vs){init(vs);}
    RollingHash(const string &S){
        vector<long long> vs;
        for (char c:S) vs.emplace_back(c);
        init(vs);
    }
    void init(vector<long long> vs){
        int n=vs.size();
        hash1.assign(n+1,0);
        hash2.assign(n+1,0);
        po1.assign(n+1,1);
        po2.assign(n+1,1);
        for (int i=0;i<n;++i){
            hash1[i+1]=(hash1[i]*B1+vs[i])%mod1;
            hash2[i+1]=(hash2[i]*B2+vs[i])%mod2;
            po1[i+1]=po1[i]*B1%mod1;
            po2[i+1]=po2[i]*B2%mod2;
        }
    }
    inline pair<long long,long long> get(int l,int r) const {
        long long res1=hash1[r]+mod1-hash1[l]*po1[r-l]%mod1
                ,res2=hash2[r]+mod2-hash2[l]*po2[r-l]%mod2;
        return {res1>=mod1?res1-mod1:res1,res2>=mod2?res2-mod2:res2};
    }
    inline int lcp(int a,int b) const {
        int len=min((int)hash1.size()-a,(int)hash1.size()-b);
        int lb=0,ub=len;
        while(ub-lb>1){
            int mid=(lb+ub)>>1;
            (get(a,a+mid)==get(b,b+mid)?lb:ub)=mid;
        }
        return lb;
    }
};

void ABC141_E(){
    int N; string S; cin >> N >> S;

    RollingHash rh(S);

    int ans=0;
    for (int i=0;i<N;++i){
        for (int j=i+1;j<N;++j){
            ans=max(ans,min(rh.lcp(i,j),j-i));
        }
    }

    cout << ans << '\n';
}

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

Measured memory_bytes: 3780
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
using i64 = long long int;

int main() {
    i64 n;
    cin >> n;
    vector<i64> s(n);
    i64 ans = 0, mi = 1000;
    for(int i = 0; i < n; ++i) {
        cin >> s[i];
        ans += s[i];
        if (s[i] % 10 != 0) {
            mi = min(mi, s[i]);
        }
    }
    if (ans % 10 == 0) {
        if(mi == 1000) cout << 0 << endl;
        else cout << ans - mi << endl;
    }
    else {
        cout << ans << endl;
    }
}

Measured memory_bytes: 256