akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>

using namespace std;

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

const int dx[] = {1, 0, -1, 0, 0};
const int dy[] = {0, 1, 0, -1, 0};

const int MOD = (int) 1e9 + 7;
const int Maxn = 110;

// {#, A, C, G, T} = {0, 1, 2, 3, 4}

int dp[Maxn][5][5][5];

int n;

bool isAGC(int l1, int l2, int l3) {
    return l1 == 1 && l2 == 3 && l3 == 2;
}

bool ok(int l1, int l2, int l3, int last) {
    if (isAGC(l1, l2, l3) || isAGC(l2, l3, last)) return false;
    if (isAGC(l2, l1, l3) || isAGC(l1, l3, last)) return false;
    if (isAGC(l1, l3, l2) || isAGC(l3, l2, last)) return false;
    if (isAGC(l1, l2, last) || isAGC(l2, last, l3)) return false;
    return true;
}

int main() {
    /*
    ios::sync_with_stdio(false);
    cin.tie(0);
    */
    cin >> n;
    dp[0][0][0][0] = 1;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 5; ++j) {
            for (int k = 0; k < 5; ++k) {
                for (int l = 0; l < 5; ++l) {
                    for (int m = 1; m < 5; ++m) {
                        if (ok(j, k, l, m)) {
                            (dp[i + 1][k][l][m] += dp[i][j][k][l]) %= MOD;
                        }
                    }
                }
            }
        }
    }

    int ans = 0;
    for (int j = 0; j < 5; ++j) {
        for (int k = 0; k < 5; ++k) {
            for (int l = 0; l < 5; ++l) {
                if (isAGC(j, k, l)) continue;
                (ans += dp[n][j][k][l]) %= MOD;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i+=1)
#define reps(i,a,b) for(int i=a;i>=b;i-=1)
#define vi vector<int>
#define pb push_back
#define pi pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define in(x) int x; cin>>x;
#define inn(x, y) int x, y; cin>>x>>y;
#define mi unordered_map<int,int>
#define mem(x) memset(x, 0, sizeof(x))
#define IOS ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
using namespace std;

int32_t main(void){
	IOS;
	in(k);
	inn(a, b);
	
	if(a <= (b/k)*k) cout<<"OK";
	else cout<<"NG";
}

Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;


void solve(){
  int n; cin >> n;
  if(n > 888) cout << 999;
  else if(n > 777) cout << 888;
  else if(n > 666) cout << 777;
  else if(n > 555) cout << 666;
  else if(n > 444) cout << 555;
  else if(n > 333) cout << 444;
  else if(n > 222) cout << 333;
  else if(n > 111) cout << 222;
  else cout << 111;
  cout << endl;
  return;
}

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


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

int main(){

  int k, s, ans=0;
  cin >> k >> s;

  for(int i=0; i<=k; i++){
    for(int j=0; j<=k; j++){
      int z = s - i - j;
      if(0<=z && z<=k){
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int n, a, b;
  1 <= n <= 20;
  1 <= a <= 50;
  1 <= b <= 50;
  int na;
  
  	
  scanf("%d %d %d", &n, &a, &b);
  na = n * a;
  
  if(na <= b){
    printf("%d", na);
  }else if(b < na){
    printf("%d", b);
  }
  return 0;
}
  
    

Measured memory_bytes: 128
#include <stdio.h>
int main () {
  int m1, m2, d1, d2;
  scanf ("%d %d\n", &m1, &d1);
  scanf ("%d %d", &m2, &d2);

  if(d2 == 1) printf("1\n");
  else printf("0\n");

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int n;
    cin >> n;
    int t[n];
    int sum = 0;
    forn(i, n) cin >> t[i], sum += t[i];
    int m;
    cin >> m;
    forn(i, m) {
        int p, x;
        cin >> p >> x;
        cout << sum - t[p - 1] + x << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
const int N=101;
int n;
int a[2*N];
int main(){
//   #ifndef ONLINE_JUDGE
//      freopen("input.txt","r",stdin);
//      freopen("output.txt","w",stdout);
//   #endif // ONLINE_JUDGE
   ios_base::sync_with_stdio(0);
   cin>>n;
   for(int i=0;i<2*n;++i){
      cin>>a[i];
   }
   sort(a,a+2*n);
   int ans=0;
   for(int i=0;i<2*n;i+=2)
      ans+=a[i];
   cout<<ans;
   return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

var(
	zero = "0"[0]
)

func main() {
	var n, k int
	var s []byte
	fmt.Scan(&n)
	fmt.Scan(&k)
	fmt.Scan(&s)

	var max, currentK int
	l := make([]int, k + 1)
	for i := 0; i < k; i++ {
		l[i] = 0
	}
	var last uint8
	for i := 0; i < len(s); i++ {
		if s[i] == zero {
			if last != s[i] {
				if i - l[0] > max {
					max = i - l[0]
				}
				if currentK == k {
					for j := 0; j < k; j++ {
						l[j] = l[j + 1]
					}
				}
			}
		} else {
			if last != s[i] {
				if i != 0 && currentK < k {
					currentK++
				}
				l[currentK] = i
			}
		}
		last = s[i]
	}

	if len(s) - l[0] > max {
		max = len(s) - l[0]
	}

	fmt.Printf("%d\n", max)
}


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

constexpr int INF = 1e9;

vector<int> bfs(vector<vector<int>> const& g, int s) {
    vector<int> d(g.size(), INF);
    d[s] = 0;
    queue<int> que;
    que.push(s);
    while(!que.empty()) {
        int v = que.front();
        que.pop();
        for(auto to : g[v]) {
            if(d[to] == INF) {
                d[to] = d[v] + 1;
                que.push(to);
            }
        }
    }
    return d;
}

int main() {
    int N, M, s, t;
    cin >> N >> M >> s >> t;
    s--; t--;
    vector<vector<int>> g(N);
    for(int i = 0; i < M; ++i) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    auto sd = bfs(g, s), td = bfs(g, t);
    int const min_d = sd[t];
    vector<int> cnt1(N), cnt2(N);
    for(int i = 0; i < N; ++i) {
        if(sd[i] != INF) {
            cnt1[sd[i]]++;
        }
        if(td[i] != INF) {
            cnt2[td[i]]++;
        }
    }
    long long res = 0;
    for(int i = 0; 0 <= min_d - i - 2; ++i) {
        res += 1LL * cnt1[i] * cnt2[min_d - i - 2];
    }
    cout << res << endl;
}


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

class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());

        int[] arr = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        int n = 0;

        for(int i = 0; i < arr.Length; i++)
        {
            var num = arr[i];
            while(num % 2 == 0)
            {
                num /= 2;
                n++;
            }
        }

        Console.WriteLine(n);
    }
}



static class MathUtil
{
    public static IEnumerable<IEnumerable<int>> GetPermutation(int n)
    {
        if (n == 0)
        {
            yield return Single(0);
            yield break;
        }

        for (int i = 0; i <= n; i++)
        {
            foreach (var x in GetPermutation(n - 1))
            {
                yield return Single(i).Concat(x.Select(itm => itm < i ? itm : itm + 1));
            }
        }
    }

    private static IEnumerable<int> Single(int x)
    {
        yield return x;
    }

    public static IEnumerable<int> EnumeratePrimeNumbers()
    {
        List<int> primes = new List<int>() { 2 };
        yield return 2;

        for (int i = 3; i < int.MaxValue; i++)
        {
            bool isPrime = true;
            int Sqrt = (int)Math.Sqrt(i) + 1;

            foreach (var prime in primes)
            {
                if (prime > Sqrt)
                {
                    break;
                }
                if (i % prime == 0)
                {
                    isPrime = false;
                    break;
                }
            }

            if (isPrime)
            {
                primes.Add(i);
                yield return i;
            }
        }
    }
}



Measured memory_bytes: 14176
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===
# nCrの左項にはn以外も来るバージョン、1!～(n-1)!を保持
def prepare(n, MOD):
    # 1! - n! の計算
    f = 1
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv

    return factorials, invs


def main():
    n, k = ns()
    facts, invs = prepare(n, MOD)

    a = na()
    a.sort()

    ans = 0
    for i, ai in enumerate(a):
        tmp_min = 0
        tmp_max = 0
        if n - i > k - 1:
            min_n = n - i - 1
            min_r = k - 1
            tmp_min = ai * facts[min_n] * invs[min_r] * invs[min_n - min_r] % MOD

        if i + 1 > k - 1:
            max_n = i
            max_r = k - 1
            tmp_max = ai * facts[max_n] * invs[max_r] * invs[max_n - max_r] % MOD

        ans -= tmp_min
        ans += tmp_max
        ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 29540
#include<iostream>
#include<vector>

using namespace std;

int main(){ 
  int H,W; cin >> H >> W;
  vector<vector<int>> A(H,vector<int>(W));
  vector<int> Y1; vector<int> X1; vector<int> Y2; vector<int> X2;
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){ cin >> A[i][j];}}
    int cnt = 0;
    for(int i = 0; i < H; i++){ 
     if( i % 2 == 0){ //0-indexedで偶数番目の行について調べる
       for(int j = 0; j < W; j++){
         if( i == H - 1 && j == W - 1){ continue;}
         if( j != W - 1){ 
          if( A[i][j] % 2 == 0){ continue;}
          else{ A[i][j]--; A[i][j+1]++; cnt++; Y1.push_back(i+1); X1.push_back(j+1);
                                               Y2.push_back(i+1); X2.push_back(j+2);
                            }}
         else{ // j == W - 1の時
           if( A[i][j] % 2 != 0){ A[i][j]--;A[i+1][j]++; cnt++;
                                              Y1.push_back(i+1); X1.push_back(j+1);
                                              Y2.push_back(i+2); X2.push_back(j+1);
                                }}
       }} //偶数行終了
     else{
       for(int j = W- 1; j >= 0; j--){
         if( i == H - 1 && j == 0){ continue;}
         if( j != 0){
           if( A[i][j] % 2 == 0){ continue;}
           else{ A[i][j]--; A[i][j-1]++; cnt++;
                 Y1.push_back(i+1); X1.push_back(j+1);
                 Y2.push_back(i+1); X2.push_back(j);}}
         else{ // j == 0の時
           if( A[i][j] % 2 != 0){ A[i][j]--; A[i+1][j]++; cnt++;
                 Y1.push_back(i+1); X1.push_back(j+1);
                 Y2.push_back(i+2); X2.push_back(j+1);}}
       }}} //奇数行終了
       
      cout << cnt << endl;
    
      if( cnt != 0){
        
      for(int i = 0; i < cnt; i++){
        cout << Y1[i] << " " << X1[i] << " " << Y2[i] << " " << X2[i] << endl;}}
      
     return 0;}
        
      

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

int main() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  int a[501][501] = {}, o[100001] = {};
  for(int i = 0; i < m; i++) {
    int l, r;
    scanf("%d %d", &l, &r);
    a[l][r]++;
  }
  for(int i = 1; i <= n; i++)
    for(int j = 0; j < n; j++) a[i][j + 1] += a[i][j];
  for(int i = 0; i < q; i++) {
    int P, Q;
    scanf("%d %d", &P, &Q);
    for(int j = P; j <= Q; j++) o[i] += a[j][Q] - a[j][P - 1];
  }
  for(int i = 0; i < q; i++) printf("%d\n", o[i]);
}

Measured memory_bytes: 2304
/*input
8 12 2
*/

#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <iomanip>
#include <utility>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define pb                push_back
#define pp                pop_back
#define nl                cout << "\n"
#define MIN(con)          (*min_element(ALL(con)))
#define MAX(con)          (*max_element(ALL(con)))
#define NX(cont)          next_permutation(ALL(cont))
#define PX(cont)          prev_permutation(ALL(cont))
#define prec(n)           cout << fixed << setprecision(n)
#define PI                3.14159265358979323846264338327951
#define all(c)            c.begin(),c.end()
#define rep(i,a,b)        for(ll i=a;i<b;i++)
#define sp                cout << " "
#define mod               1000000007    //9
#define ifalse            ios_base::sync_with_stdio(false),cin.tie(NULL)

using ll = long long;
using ld = long double;
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > T LCM(T a, T b)            { return (a * b) / GCD(a, b); }
template < typename T > string toString(T a)       { return to_string(a); }  // Convert int to string
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}  // Convert string to int

ll add(ll x, ll y) { x += y; if(x >= mod) x -= mod; return x; }
ll sub(ll x, ll y) { x -= y; if(x < 0) x += mod; return x; }
ll mul(ll x, ll y) { return ((x % mod) * (y % mod)) % mod; }

ll powr(ll a, ll b) {
    ll x = 1LL;
    while(b) {
        if(b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}

ll inv(ll a) { return powr(a, mod - 2); }
const int inv2 = (mod + 1) >> 1;
const ll INF =  1e18;
const int inf = 1e9;

bool check(ll n)
{
    if(n == 1) return 0;
    if(n == 2 or n == 3) return 1;
    if(n % 2 == 0 or n % 3 == 0) return 0;
    for(ll i = 5; i * i <= n; i += 6) if(n % i == 0 or n % (i + 2) == 0) return 0;
    return 1;
}

/*********************************************START**************************************************************/

int main()
{
    ifalse;
    int a, b, k;
    cin >> a >> b >> k;

    int d = GCD(a, b);
    vector < int > v;
    for(int i = 1; i * i <= d; i ++) {
        if(d % i == 0) {
            v.pb(i);
            if(d / i != i) {
                v.pb(d / i);
            }
        }
    }
    sort(all(v));
    reverse(all(v));
    cout << v[k - 1];
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(H: int, N: int, A: "List[int]", B: "List[int]"):
    mp = [0] * (H + 1)
    for i in range(1, len(mp)):
        ml = [0 for j in range(N)]
        for j in range(N):
            if i - A[j] < 0:
                ml[j] = mp[0] + B[j]
            else:
                ml[j] = mp[i - A[j]] + B[j]
        mp[i] = min(ml)
    print(mp[-1])   


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    A = [int()] * (N)  # type: "List[int]"
    B = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(H, N, A, B)

if __name__ == '__main__':
    main()


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

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	cin >> n;
	i = 1;
	while(1){
		if(i * i > n){
			cout << (i-1) * (i-1);
			break;
		}
		i++;
	}
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
// using LLL = tuple<ll,ll,ll>;

// void vprn(vector<int> &v){ for(int i=0;i<v.size();i++) cout<<v[i]<<(i<v.size()-1?",\t":"\n"); }
void vprn(vector<ll> &v){for(int i=0;i<v.size();i++) cout<<v[i]<<(i<v.size()-1?",\t":"\n"); }


int main(){
	int N,M; cin>>N>>M;
	vl X(N),Y(N),Z(N);
	rp(i,0,N) cin>>X[i]>>Y[i]>>Z[i];

	// ote(N);
	// ote(M);
	// vprn(X);
	// vprn(Y);
	// vprn(Z);

	ll ans = 0;
	vl S(N);
	rp(bits, 0, 8){
		// ote(bits);//
		rp(i,0,N){
			ll x = bits&1? X[i]: -X[i];
			ll y = bits&2? Y[i]: -Y[i];
			ll z = bits&4? Z[i]: -Z[i];
			S[i] = x + y + z;
		}
		sort(allr(S));
		ll s = 0;
		rp(i,0,M){
			s += S[i];
		}
		ans = max(ans, s);
	}
	ote(ans);
}


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

using namespace std;
#define ll long long
#define ld long double
#define PI 3.141592653L
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll INF = (ll)1e18;
const int N = 2e5 + 5;
const ll MOD = 998244353;

int parent[N];

int gcd(int a, int b) { 
    if (a == 0) 
        return b;  
    return gcd(b%a, a);  
} 
   
int lcm(int a, int b) {  
    return (a*b)/gcd(a,b);  
} 

ll pow(ll x, ll y, ll p) {
    if(y == 0) return 1;
    ll res = 1;
    x %= p;
    if(x == 0) return 0LL;
    while(y > 0) {
        if(y & 1) res = (res*x) % p;
        y >>= 1;
        x = (x*x) % p;
    }
    return res;
}

int find(int x) {
    return x == parent[x] ? x : parent[x] = find(parent[x]);
}

void Union(int x, int y) {
    int xPar = find(x), yPar = find(y);
    if(xPar != yPar) parent[xPar] = yPar;
}

int main()
{
    IOS
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    ll d = abs(a - b);
    ll d2 = t * (v - w);
    if(d2 >= d) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0; 
}



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

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

    long long int v = 0;

    for(long long int i=1; i<=N; i++){
        if(i%3 == 0){
            v = v+0;
        }else if(i%5 == 0){
            v = v+0;
        }else{
            v = v+i;
        }
    }

    cout << v << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
	int W, H, x, y, r;

	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

	if (x - r >= 0 && x + r <= W&&y - r>=0 && y + r <= H) {
		puts("Yes");
	}
	else {
		puts("No");
	}

	return 0;
}

Measured memory_bytes: 584
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int h[100007][3];
long long int dp[3];
long long int dp_next[3];
int main()
{
    int N;
    scanf("%d\n",&N);
    for(int i=0; i<N; i++)
    {
        scanf("%d %d %d\n", &h[i][0], &h[i][1], &h[i][2]);
    }

    for(int i=0;i<3;i++)
    {
        dp_next[i]=h[0][i];
    }

    int day=0;
    while(++day<N)
    {
        for(int i=0;i<3;i++){ dp[i]=dp_next[i]; }
        for(int i=0;i<3;i++)
        {
            long long int res=0;
            for(int k=0;k<3;k++)
            {
                if(i==k){ continue; }
                long long int temp = dp[k]+h[day][i];
                if(res<temp){ res=temp; }
            }
            dp_next[i]=res;
        }
    }

    long long int res=0;
    for(int i=0;i<3;i++)
    {
        if(res<dp_next[i]){ res=dp_next[i]; }
    }

    printf("%lld\n",res);
    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	double x;
	cin >> x;
	x = (x * x * x) / 27;
	printf("%.6f", x);
	return 0;
}


Measured memory_bytes: 3696
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

H1, M1, H2, M2, K = mapint()
if M2>=M1:
    minutes = (H2-H1)*60
    minutes += M2-M1
else:
    minutes = (H2-H1-1)*60
    minutes += M2-M1+60
print(max(0, minutes-K))


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

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

    if(a == 1)
        cout << (b == 2 ? 3 : 2) << "\n";
    else if(b == 1)
        cout << (a == 2 ? 3 : 2) << "\n";
    else cout << 1 << "\n";
    return 0; 
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>n;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  vector<int> p(3);
  int d;
  cin >> p[0] >> p[1] >> p[2] >> d;
  bool ok = false;
  if (abs(p[2]-p[0])<=d) ok = true;
  if (abs(p[2]-p[1])<=d && abs(p[1]-p[0])<=d) ok = true;
  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
# 2019-11-16 10:55:08(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    a, b, c = [int(x) for x in sys.stdin.readline().split()]
    if a - b >= c:
        ans = 0
    else:
        ans = c - (a - b)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//String line = br.readLine();
		Scanner scan = new Scanner(System.in);

	    int a = scan.nextInt();
	    
	    
	        System.out.println(48-a);


	}
}


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

using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back

int main() {
  vector<pair<pair<string,int>,int>> r(110);
  int n;
  cin>>n;
  rep(i,n) {
    cin>>r[i].first.first>>r[i].first.second;
    r[i].first.second*=-1;
    r[i].second=i+1;
  }
  sort(r.begin(),r.begin()+n);
  rep(i,n) cout<<r[i].second<<endl;
}


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

namespace aoj_ALDS1_5_A
{
    class MainClass
    {
		static int numberCount = 0;
		static int[] numberArray = new int[50];
        public static void Main(string[] args)
        {
			numberCount = int.Parse(Console.ReadLine());
			numberArray = Console.ReadLine().Split(' ').Select(number => int.Parse(number)).ToArray();

			int targetCount = int.Parse(Console.ReadLine());
            int[] targetArray = Console.ReadLine().Split(' ').Select(number => int.Parse(number)).ToArray();

			foreach (var targetNumber in targetArray)
			{
				if (SumCheck(0, targetNumber))
				{
					Console.WriteLine("yes");
				}
				else
				{
					Console.WriteLine("no");
				}
			}
        }

        public static bool SumCheck(int currentIndex, int targetNumber)
		{
			if (targetNumber == 0)
			{
				return true;
			}
            if (currentIndex >= numberCount)
			{
				return false;
			}

			bool result = SumCheck(currentIndex + 1, targetNumber) || SumCheck(currentIndex + 1, targetNumber - numberArray[currentIndex]);

			return result;
		}
    }
}



Measured memory_bytes: 18292
a = "$ACGT"
mod = 10**9 + 7
N = int(input())
dp = [[[[0 for l in range(5)] for k in range(5)] for j in range(5)]
      for i in range(N + 1)]

dp[0][0][0][0] = 1
ans = 0
for i in range(N):
    for j in range(5):
        for k in range(5):
            for l in range(5):
                for m in range(1, 5):
                    if (m == 2):
                        if (j == 1) and (k == 3):
                            continue
                        if (j == 1) and (l == 3):
                            continue
                        if (k == 1) and (l == 3):
                            continue
                        if (k == 3) and (l == 1):
                            continue
                    elif (m == 3):
                        if (k == 1) and (l == 2):
                            continue

                    dp[i + 1][k][l][m] += dp[i][j][k][l]
                    dp[i + 1][k][l][m] %= mod

                    if i + 1 == N:
                        ans += dp[i][j][k][l]
                        ans %= mod

print(ans)


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
ll mod=1e9+7;
#define PI acos(-1)
struct edge{int from, to;};
const int MAX=1001001;

int dp[MAX][26]={};
int main(){
    int n;
    cin>>n;
    vector<string> s(n);
    rep(i,n) cin>>s[i];
    ll ans=0;
    map<string, int> mp;
    for(int i=0;i<n;i++){
        sort(s[i].begin(), s[i].end());
        mp[s[i]]++;
    }
    for(auto now:mp){
        ll x=now.second;
        ans+=x*(x-1)/2;
    }
    cout<<ans<<endl;
    return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// DON'T USE THESE MACROS DURING ICPC PRACTICE
#define For(i,n) for (int i=0; i<n; i++)
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define Down(i,n) for (int i=n-1; i>=0; i--)
#define DOWN(i,a,b) for (int i=b; i>=a; i--)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef complex<ld> pt;
typedef vector<pt> pol;
typedef vector<int> vi;

const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1e-10;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

const int K = 1e5+2;
const int N = 100+1;

struct BIT {
	ll f[K];
	BIT() { memset(f, 0, sizeof f); }
	ll query(int x) {
		ll res = 0;
		for ( ; x>0; x-=x&-x) {
			res += f[x];
		}
		return res % MOD;
	}
	ll query(int l, int r) {
		return (query(r) - query(l-1) + MOD) % MOD;
	}
	void insert(int x, ll v) {
		for ( ; x<K; x+=x&-x) {
			f[x] = (f[x]+v) % MOD;
		}
	}
};

BIT bit[N];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(10);

	int n, k;
	cin >> n >> k;

	bit[0].insert(1, 1);
	FOR(i,1,n) {
		int a;
		cin >> a;
		for (int j=1; j<=k+1; j++) {
			ll cur = bit[i-1].query(max(1,j-a), j);
			bit[i].insert(j, cur);
		}
	}
	cout << bit[n].query(k+1, k+1) << nl;

	return 0;
}


Measured memory_bytes: 79232
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <deque>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <complex>
#include <cstring>
#include <iomanip>
#include <bitset>

using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, a, b) for(int i = (a); i > (b); i--)
#define forIt(it, a) for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define forRev(it, a) for(__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define ft(a) __typeof((a).begin())
#define ll long long
#define ld long double
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define bitcount(n) __builtin_popcountll(n)


typedef complex<ld> cplex;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef pair<ll, ll> pll;

const int N = 400 + 7;
const int M = 30;
const int inf = 1e9 + 7;
const long long linf = (ll) inf * inf + 7;
const double pi = acos(-1);
const double eps = 1e-20;
const bool multipleTest = false;


int f[N][N];

int n, C;
int a[N], b[N];

ll dp[N][N];


void solve() {
    for(int u = 1; u < N; ++u) {
        f[u][0] = u;
        int t = u;
        for(int c = 1; c < N; ++c) {
            f[u][c] = (f[u - 1][c] + t) % inf;
            t = (ll) t * u % inf;
        }
    }
    cin >> n >> C;
    for(int i = 1; i <= n; ++i) scanf("%d", a + i);
    for(int j = 1; j <= n; ++j) scanf("%d", b + j);
    dp[0][0] = 1;
    for(int i = 1; i <= n; ++i) {
        dp[i][0] = dp[i - 1][0] * (f[b[i]][0] - f[a[i] - 1][0] + inf) % inf;
        for(int c = 1; c <= C; ++c) {
            for(int cur = 0; cur <= c; ++cur) {
                dp[i][c] = (dp[i][c] + dp[i - 1][c - cur] * (f[b[i]][cur] - f[a[i] - 1][cur] + inf)) % inf;
            }
        }
    }
    
    cout << dp[n][C];
    
    
    
}

int main() {
//#ifndef ONLINE_JUDGE
//    freopen("in.txt", "r", stdin);
//    auto t1 = clock();
//#endif

    
    int Test = 1;
    if (multipleTest) {
        cin >> Test;
    }
    
    for(int i = 0; i < Test; ++i) {
        solve();
    }
    
//#ifndef ONLINE_JUDGE
//    printf("\n%.9lf\n", (0.0 + clock() - t1) / CLOCKS_PER_SEC);
//#endif
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    int n; cin >> n;

    ll ans = 0;

    for (int i = 1; i <= n; ++i) {
        if (i % 3 == 0 && i % 5 == 0) continue;

        if (i % 3 == 0) continue;
        if (i % 5 == 0) continue;

        ans += i;
    }

    cout << ans << endl;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;
#define debug(x) cerr << #x << ": " << (x) << "\n";

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

// AOJ DPL_2_A
// TSP

const int MAX_N = 15;
const int INF = 1e9+7;
vvi dist(MAX_N, vi(MAX_N, INF));
vvi dp(1 << MAX_N, vi (MAX_N, INF));

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

  int V, E;
  cin >> V >> E;
  int s, t, d;
  rep(i, 0, E) {
    cin >> s >> t >> d;
    dist[s][t] = d;
  }

  // どの点から初めても同じ
  dp[(1 << V) - 1][0] = 0;

  for (int S = (1 << V) - 2; S >= 0; S--) {
    rep(v, 0, V) {
      rep(u, 0, V) {
        if (!((S >> u) & 1)) { // まだ訪れてない点
          dp[S][v] = min(dp[S][v], dp[S | 1 << u][u] + dist[v][u]);
        }
      }
    }
  }


  if (dp[0][0] == INF) {
    cout << -1 << endl;
  } else {
    cout << dp[0][0] << endl;
  }

  return 0;
};



Measured memory_bytes: 6164
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>

using namespace std;

int main()
{
    int64_t A, B, C, X, Y;
    std::cin >> A >> B >> C >> X >> Y;

    int64_t p, q, r;
    p = X*A + Y*B;

    if (X > Y) {
        q = Y * C*2 + (X-Y)*A;
        r = X * C*2;
    }
    else {
        q = X * C*2 + (Y-X)*B;
        r = Y * C*2;
    }

    auto s = std::min(std::min(p,q), r);
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class c{
  public static void Main(){
    String[] str = Console.ReadLine().Split(' ');
    String s1 = str[0];
    String s2 = str[1];
    String s3 = "";
    int n = s2.Length;
    for(int i=0; i<s2.Length; i++){
      if(s2[i] == '.'){
        n = i;
      }
      else{
        s3 += s2[i];
      }
    }
    long a = long.Parse(s1);
    long b = long.Parse(s3);
    long res = a*b;
    String ans = res.ToString();
    int dec = s2.Length - 1 - n;
    if(ans.Length <= dec){
      Console.WriteLine(0);
    }
    else{
      for(int i=dec; i<ans.Length; i++){
        Console.Write(ans[i-dec]);
      }
      Console.WriteLine();
    }
  }
}


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

using namespace std;
#define PI              3.1415926536

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod 1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define REP(i,n) for(i=0;i<n;i++)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());


void c_p_c()
{
#ifndef  ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

void solve()
{
	double n;
	cin >> n;

	if (n > 0 && n < 4)
		cout << "N\n";
	else
	{
		double ans = n * n - 4 * n;
		double res = sqrt(ans);

		double a = (n + res) / 2;
		double b = (n - res) / 2;

		cout << "Y" << " ";
		cout << setprecision(11);
		cout << a << " " << b << endl;
	}
}

int vis[2000005];
int n, m;
vi graph[2000005];
int res = 0;
void dfs(int i)
{
	vis[i] = 1;
	res++;
	for (auto &it : graph[i])
	{
		if (!vis[it])
			dfs(it);
	}
}
int32_t main()
{
	

	cin >> n >> m;

	int i;

	for (i = 1; i <= m; i++)
	{
		int x, y;
		cin >> x >> y;
		graph[x].pb(y);
		graph[y].pb(x);
	}
	int ans = 0;
	for (i = 1; i <= n; i++)
	{
		if (!vis[i])
		{
			res = 0;
			dfs(i);
			ans = max(ans, res);
		}
	}
	cout << ans;

}

Measured memory_bytes: 64416
s = gets.chomp
numx = [0]
notx = ''
pt = 0
s.chars do |c|
    if c == 'x'
        numx[pt] += 1
    else
        notx << c
        pt += 1
        numx[pt] = 0
    end
end
if notx != notx.reverse
    puts -1
else
    ans = 0
    l = numx.length
    (l/2).times do |i|
        ans += (numx[i] - numx[l-1-i]).abs
    end
end
puts ans

Measured memory_bytes: 3068
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>

std::vector<intmax_t> divisor(intmax_t x) {
  std::vector<intmax_t> res;
  for (intmax_t i = 1; i*i <= x; ++i)
    if (x % i == 0) {
      res.push_back(i);
      if (i*i < x) res.push_back(x/i);
    }
  return res;
}

int main() {
  intmax_t x;
  scanf("%jd", &x);

  auto f = [](intmax_t a, intmax_t b) {
    return a*a*a*a + a*a*a*b + a*a*b*b + a*b*b*b + b*b*b*b;
  };

  std::map<intmax_t, std::pair<intmax_t, intmax_t>> ab;
  for (intmax_t a = -300; a <= 300; ++a)
    for (intmax_t b = -300; b <= 300; ++b)
      ab[f(a, b)] = std::make_pair(a, b);

  for (auto d: divisor(x)) {
    auto it = ab.find(d);
    if (it == ab.end()) continue;
    auto [a, b] = it->second;
    if ((a-b) * it->first == x) return !printf("%jd %jd\n", a, b);
  }
}


Measured memory_bytes: 8948
using System;

namespace abc163_c
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] str = Console.ReadLine().Split(' ');
            int[] a = new int[n+1];
            for(int i = 0; i <= n; ++i)
            {
                a[i] = 0;
            }
            int[] y = new int[n];
            y[0] = 0;
            for (int i = 1; i < n; ++i)
            {

                y[i] = int.Parse(str[i-1]);
                a[y[i]]++;
            }
            for(int i = 1; i <= n; ++i)
            {
                Console.WriteLine(a[i]);
            }
        }
    }
}


Measured memory_bytes: 42800
#include <algorithm>
#include <cstdio>
#include <vector>

const int N = 200000;
const int INF = 1000000000;

int n, m, b[N], mi[N + 1 << 1];
std::vector<int> r[N];

int get_id(int l, int r)
{
    return l + r | l != r;
}

void update(int l, int r, int k, int v)
{
    if (l <= k && k <= r) {
        int id = get_id(l, r);
        mi[id] = std::min(mi[id], v);
        if (l < r) {
            int m = l + r >> 1;
            update(l, m, k, v);
            update(m + 1, r, k, v);
        }
    }
}

int query(int l, int r, int a, int b)
{
    if (b < l || r < a) {
        return INF;
    }
    if (a <= l && r <= b) {
        return mi[get_id(l, r)];
    }
    int m = l + r >> 1;
    return std::min(query(l, m, a, b), query(m + 1, r, a, b));
}

int main()
{
#ifdef LOCAL_JUDGE
    freopen("D.in", "r", stdin);
#endif
    scanf("%d", &n);
    int zeros = 0;
    for (int i = 0; i < n; ++ i) {
        scanf("%d", b + i);
        zeros += !b[i];
    }
    scanf("%d", &m);
    for (int _ = 0; _ < m; ++ _) {
        int a, b;
        scanf("%d%d", &a, &b);
        r[a - 1].push_back(b);
    }
    for (int i = 0; i < n + 1 << 1; ++ i) {
        mi[i] = INF;
    }
    update(0, n, 0, zeros);
    for (int i = 0; i < n; ++ i) {
        for (int j : r[i]) {
            update(0, n, j, query(0, n, i, j));
        }
        update(0, n, i + 1, query(0, n, i, i) + (b[i] ? 1 : -1));
    }
    printf("%d\n", query(0, n, n, n));
}


Measured memory_bytes: 11264
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    string s;
    cin >> s;
    string t = "CODEFESTIVAL2016";
    int ans;
    for(int i=0;i<16;i++){
        if(s.at(i) != t.at(i)) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A)
mod = 10**9+7

# conbModに使うfactとfactinvを求める
def factorialMod(n, p):
    fact = [1, 1]
    factinv = [1, 1]
    inv = [0, 1]
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)
    return fact, factinv

# 二項係数を素数で割った余り
def combMod(n, r, fact, factinv, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

ans = 0
fact, factinv = factorialMod(N, mod)
for i in range(N):
    num = combMod(i, K-1, fact, factinv, mod) % mod
    ans += num * A[i] % mod
    ans -= num * A[N-i-1] % mod
    ans %= mod

print(ans)

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

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<int64_t> s(N);
	for (auto& e: s) scanf("%lld", &e);
	int64_t max{};
	for (int delta{1}; delta < N - 2; delta++)
	{
		int64_t sum{};
		if ((N - 1) % delta)
		{
			for (int i{1}; delta < N - 1 - i * delta; i++)
			{
				sum += s[i * delta] + s[N - 1 - i * delta];
				max = std::max(max, sum);
			}
		}
		else
		{
			for (int i{1}; i * delta < N - 1 - i * delta; i++)
			{
				sum += s[i * delta] + s[N - 1 - i * delta];
				max = std::max(max, sum);
			}
		}
	}
	printf("%lld\n", max);

	return 0;
}

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


const int mod = 1e9 + 7;
const int N   = 1e5 + 5;

signed main(){
    int n;
    cin >> n;
    int ans = 0;
    int t = 0;
    for(int i=1; i<=n; i++){
        int x;
        scanf("%d",&x);
        if(x == i) t++;
        else{
            ans += (t+1)/2;
            t = 0;
        }
    }
    
    cout << ans + (t+1)/2;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  priority_queue<int> pq;
  for ( int i = 0; i < n; i++ ) {
    int a;
    cin >> a;
    pq.push(a);
  }

  while ( m-- > 0 ) {
    int tmp = pq.top();
    tmp /= 2;
    pq.pop();
    pq.push(tmp);
  }

  long long ans = 0;
  while ( !pq.empty() ) {
    ans += pq.top();
    pq.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3924
#include <iostream>
#include <string>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

int main()
{
  string s;
  bool cnt[255];
  cin >> s;
  fill(cnt, cnt + 255, false);
  for (int i = 0; i < s.length(); i++) {
    cnt[s[i]] = true;
  }
  for (char i = 'a'; i <= 'z'; i++) {
    if (!cnt[i]) {
      cout << i << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 512
#include <math.h>

#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;

int main() {
  int A, B;
  cin >> A >> B;
  int m = A+B;
  m = max(m, A-B);
  m = max(m, A*B);

cout << m << endl;
  return 0;
}

Measured memory_bytes: 256
n, x = gets.split.map(&:to_i)
boxes = gets.split.map(&:to_i)
ans = 0
(0...n - 1).each do |a|
  b = a + 1
  surpassed = (boxes[a] + boxes[b]) - x
  if surpassed > 0
    ans += surpassed
    b_deduction = [surpassed, boxes[b]].min
    boxes[b] -= b_deduction
    surpassed -= b_deduction
    boxes[a] -= surpassed
  end
end
puts ans


Measured memory_bytes: 20848
#include<stdio.h>
#include<stdlib.h>
int main(){
  int *a,n,i,j,sum=0,b;
  scanf("%d",&n);
  a=malloc(4*n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
    for(j=n-1;j>i;j--){
      if(a[j]<a[j-1]){
	sum++;
	b=a[j];
	a[j]=a[j-1];
	a[j-1]=b;
      }
    }
  }
  for(i=0;i<n;i++){
    if(i==n-1)printf("%d\n",a[i]);
    else printf("%d ",a[i]);
  }
  printf("%d\n",sum);
  return 0;
}



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

typedef long long int int64;
using ld = long double;
ld point[3003];
int n,l;
int main()
{
	scanf("%d%d",&n,&l);
	for(int i = 0;i < n;++i) {
		int t;
		scanf("%d",&t);
		point[i] = (ld)t / (ld)l;
	}
	std::sort(point,point+n);
	ld ansx = 0, ansy = 0;
	for(int i = 0;i < n;++i) {
		for(int j = i+1;j < n;++j) {
			double pa = (point[i]+point[j])/2., pb = (point[i]+point[j]+1)/2.;
			int ca = j-i-1, cb = n-ca-2;
			ansx += cos(2*M_PI*pa)*cb;ansy += sin(2*M_PI*pa)*cb;
			ansx += cos(2*M_PI*pb)*ca;ansy += sin(2*M_PI*pb)*ca;
		}
	}
	ansx /= (int64)n*(n-1)*(n-2)/6;
	ansy /= (int64)n*(n-1)*(n-2)/6;
	printf("%.18Lf %.18Lf\n", ansx, ansy);
}


Measured memory_bytes: 512
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author AnandOza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AACOrWA solver = new AACOrWA();
        solver.solve(1, in, out);
        out.close();
    }

    static class AACOrWA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), m = in.nextInt();

            out.println(n == m ? "Yes" : "No");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 23380
#include<iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>

#define LOCAL  1
#define UPLOAD 2

using namespace std;

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int N;

    cin >> N;

    vector<long> A(N);

    long min = 1000000000;
    long secondmin = 1000000000;
    for(int i=0;i<N;i++){
        cin >> A[i];
        if(A[i] < min){
            min = A[i];
        }
        else if(A[i] < secondmin){
            secondmin = A[i];
        }
    }

    for(long j=secondmin;j>=0;j--){
        int count = 0;
        bool OK = true;
        for(int i=0;i<N;i++){
            if(A[i]%j != 0){
                count++;
            }
            if(count >= 2){
                OK = false;
                break;
            }
        }
        if(OK){
            cout << j << endl;    
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N; cin >> N;
  map<string, int> mp;
  ll ans = 0;
  rep(i, N){
    string s; cin >> s;
    sort(s.begin(), s.end());
    ans += mp[s];
    mp[s]++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 11136