akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i_len=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back
#define mp make_pair

int main()
{
    ll N, M;
    cin >> N >> M;
    vec k(10);
    mat s(10, vec(10, 0));
    vec p(10, -1);
    REP(i,0,M) {
        cin >> k[i];
        REP(j,0,k[i]) cin >> s[i][j];
    }
    REP(i,0,M) cin >> p[i]; 

    ll c, cnt = 0;
    bool f;
    REP(i,0,1<<N) {
        REP(j,0,M) {
            c = 0;
            f = true;
            REP(l,0,k[j]) {
                if(i & (1 << (s[j][l] - 1))) ++c;
            }
            if(c % 2 != p[j]) {
                f = false;
                break;
            }
        }
        if(f) ++cnt;
    }
    PR(cnt);

    return 0;
}

/*



*/

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

int main(){
    iostream::sync_with_stdio(false);

    int X,Y;
    cin >> X >> Y;
    if(X%Y == 0) cout << -1 << endl;
    else cout << X << endl;
    
    return 0;
}

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

using namespace std;

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

      
    vector<pair<string,int>> v;
    int n,k,sum=0;
    cin>>n;
    string s,x;
    int i;
    
    for(i=0;i<n;++i)
       {
           cin>>s>>k;
           sum+=k;
           v.push_back(make_pair(s,k));
       }
       
     cin>>x;
     
     for(i=0;i<v.size();++i)
      {
          if(v[i].first==x)
             {
                 sum-=v[i].second;
                 break;
             }
             
            sum-=v[i].second; 
      }
      
      cout<<sum;
      
         
	return 0;
	
} 

Measured memory_bytes: 3592
#include <iostream>
#include <climits>
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;

// 入力
int n, T;// n種類の料理、時間(T)
int eat_time[3000 + 10];
int value[3000 + 10];
int dp[3000 + 10][3000 + 10];
int dp2[3000 + 10][3000 + 10];

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

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

  // DPループ
  for (int i = 0; i < n; ++i) {
    for (int t = 0; t <= T; ++t) {
      if (t >= eat_time[i]) dp[i+1][t] = max(dp[i][t-eat_time[i]] + value[i], dp[i][t]);
      else dp[i+1][t] = dp[i][t];
    }
  }
  for (int i = n; i >=1; --i) {
    for (int t = 0; t <= T; ++t) {
      dp2[i][t]=dp2[i+1][t];
      if (t >= eat_time[i-1]) dp2[i][t] = max(dp2[i+1][t-eat_time[i-1]] + value[i-1], dp2[i+1][t]);
      else dp2[i][t] = dp2[i+1][t];
    }
  }  
  
  int ans = 0;

  for (int i = 0; i < n; ++i) {
    for (int t = 0; t < T; ++t) {
      ans = max( ans, dp[i][t]+value[i]+dp2[i+2][T-1-t] );
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 70912
#入力受付
option_num = int(input())
temperature, idea_temperature = map(int, input().split(" "))
options_height = map(int, input().split(" "))

#ダミーデータ
palace_temperature = -999
palace_index = 0
for i, height in enumerate(options_height):
    #候補地の温度を求める
    option_temperature = temperature - height * 0.006
    #現在の最も理想的な候補地と比較
    if abs(idea_temperature - palace_temperature) > abs(idea_temperature - option_temperature):
        #よりいい温度ならばその場所の温度とインデックスを保存
        palace_temperature = option_temperature
        palace_index = i + 1

print(palace_index)
        

Measured memory_bytes: 3060
N, Y = map(int, input().split())
for i in range(N+1):
    for j in range(N-i+1):
        k = N-i-j
        if 10000 * i + 5000 * j + 1000 * k == Y:
            print(i, j, k)
            exit()
print('-1 -1 -1')

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+5;
int n,x,y,cnt,a[N],xu[N],jia[N];
signed main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		if(a[i]>0)x=1;
		if(a[i]<0)y=1;
	}
	if(n==1)
	{
		cout<<a[1];
		return 0;
	}
	if(x==0&&y==0)
	{
		cout<<0<<endl;
		for(int i=1;i<n;i++)printf("%d %d\n",0,0);
	}
	if(x==1&&y==0)
	{
		sort(a+1,a+n+1);
		if(n==2)
		{
			cout<<a[2]-a[1]<<endl;
			cout<<a[2]<<" "<<a[1]<<endl;
			return 0;
		}
		xu[++cnt]=a[1];jia[cnt]=a[2];
		int ans=a[1]-a[2];
		for(int i=3;i<n;i++)
		{
			xu[++cnt]=ans;jia[cnt]=a[i];
			ans-=a[i];
		}
		xu[++cnt]=a[n];jia[cnt]=ans;
		ans=a[n]-ans;
		cout<<ans<<endl;
		for(int i=1;i<=cnt;i++)printf("%lld %lld\n",xu[i],jia[i]);
	}
	if(x==0&&y==1)
	{
		sort(a+1,a+n+1);
		int ans=a[n];
		for(int i=n-1;i;i--)
		{
			xu[++cnt]=ans;jia[cnt]=a[i];
			ans-=a[i];
		}
		cout<<ans<<endl;
		for(int i=1;i<=cnt;i++)printf("%lld %lld\n",xu[i],jia[i]);
	}
	if(x==1&&y==1)
	{
		int wz;
		sort(a+1,a+n+1);
		for(int i=2;i<=n;i++)
			if(a[i]>=0&&a[i-1]<0)
			{
				wz=i;
				break;
			}
		int ans=a[1];
		for(int i=wz+1;i<=n;i++)
		{
			xu[++cnt]=ans;jia[cnt]=a[i];
			ans-=a[i];
		}
		xu[++cnt]=a[wz];jia[cnt]=ans;
		ans=a[wz]-ans;
		for(int i=2;i<wz;i++)
		{
			xu[++cnt]=ans;jia[cnt]=a[i];
			ans-=a[i];
		}
		cout<<ans<<endl;
		for(int i=1;i<=cnt;i++)printf("%lld %lld\n",xu[i],jia[i]);
	}
}

Measured memory_bytes: 10880
/*
 Copyright (c) 2019 ... All rights reserved.
 ...
*/
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

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

using namespace std;


int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int main(int argc, const char * argv[]) {

    // source code
    int a, b;
    cin >> a >> b;
    int ans = 0;
    if(a >= 13){
        ans = b;
    }else if( a >= 6){
        ans = b / 2;
    }else{
        ans = 0;
    }
    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 256
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> VI;
typedef pair<int,int> PII;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;

int main(){
    int n;
    while(cin>>n){
        if(n==0)break;
        rep(i,n){
            int a,b,c;
            cin>>a>>b>>c;
            if(a==100 ||b==100 || c==100 || ((a+b+c)>=240) || a+b>=180){cout<<"A"<<endl;}
            else if(a+b+c>=210 || ((a+b+c>=150) && (a>=80 || b>=80) )){cout<<"B"<<endl;}
            else{cout<<"C"<<endl;}
            
        }
    }
    return 0;
}

Measured memory_bytes: 1152
// AOJ 2431: House Moving
// 2017.12.30 bal4u@uu

#include <stdio.h>

int n;
long long bit[100002];
char buf[600000], *p;

int in()
{
	int n = 0;
	while (*p >= '0') n = 10*n + (*p++ & 0xf);
	p++;
	return n;
}

void add(int i, long long v)
{
	i++;
    while (i <= n) {
		if (v > bit[i]) bit[i] = v;
		i += i & -i;
	}
}
 
long long sum(int i)
{
    long long s = 0;
 
    while (i > 0) {
		if (bit[i] > s) s = bit[i];
		i -= i & -i;
	}
    return s;
}

int main()
{
	int x, i;

	fgets(p=buf, 10, stdin), n = in();
	fgets(p=buf, sizeof(buf), stdin);
	i = n; while (i--) {
		x = in();
		add(x-1, sum(x-1)+x);
	}

	printf("%lld\n", (((long long)n*(n+1)) >> 1) - sum(n));
	return 0;
}

Measured memory_bytes: 3128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		sc.close();
		System.out.println((n*800)-n/15*200);
	}

}


Measured memory_bytes: 22996
S = input()
N = len(S)

res = True 

for i in range(1, (N - 1)//2):
  if S[i - 1] == S[N - i]:
    if i < (N - 1) / 2:
      if S[i - 1] != S[(N - 1) // 2 - i]:
        res = False 
        break 
  else:
    res = False 
    break 
print("Yes" if res else "No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i,l,r) for(int i = (int)l;i<(int)r;i++)
#define td(v) v.begin(),v.end()
#define sz(v) (int)v.size()
//#define M   1000000007 // 1e9 + 7
#define MAXN 200100
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int exp(int a,int b,int m){
    
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}

int32_t main(){
    fastio;
    int n;
    cin>>n;
   string s;
   cin>>s;
   int r=0;
   for(int i=0;i<=n-3;i++){
   	if(s.substr(i,3)=="ABC")r++;
   }
   cout<<r<<endl;

}

Measured memory_bytes: 256
def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x


def prime_factor(n):
    ret, p = [], 2

    while p*p <= n:
        if n % p != 0:
            p += 1
            continue

        exp_v = 0
        while n%p == 0:
            exp_v += 1
            n //= p
        ret.append( [p, exp_v] )

        p += 1

    if n != 1: ret.append( [n, 1] )

    return ret


a, b = map(int, input().split())
g = gcd(a, b)

print(len(prime_factor(g)) + 1)


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

int cnt[100005];
int a[100005];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    
    int n, m; cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int l, r; cin >> l >> r;
        cnt[l]++;
        cnt[r + 1]--;
    }
    
    int curr = 0;
    for (int i = 1; i <= n; i++) {
        curr += cnt[i];
        a[i] = curr;
    }
    
    int total = 0;
    for (int i = 1; i <= n; i++) {
        if (a[i] == m) total++;
    }
    cout << total << '\n';
    
    return 0;
}


Measured memory_bytes: 1024
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun subseq-to-int (vec start end)
  (declare ((simple-array uint4 (*)) vec))
  (loop with res of-type uint62 = 0
        for i from start below end
        do (setf res (+ (* 10 res) (aref vec i)))
        finally (return res)))

(defun main ()
  (let* ((s (map '(simple-array uint4 (*)) #'digit-char-p (read-line)))
         (n (length s))
         (res 0))
    (declare (uint62 res))
    (dotimes (l n)
      (loop for r from l to n
            do (incf res
                     (* (subseq-to-int s l r)
                        (if (zerop l)
                            1
                            (expt 2 (- l 1)))
                        (if (= r n)
                            1
                            (expt 2 (- n r 1)))))))
    (println res)))

#-swank(main)


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

int main(){
    int N;
    static int64_t A[200000], S[200001];
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> A[i];
        S[i+1] = S[i] + A[i];
    }
    int64_t ans = 1e18;
    for(int i=0; i<=N; i++){
        int64_t a = S[i], b = S[N] - S[i];
        ans = min(ans, abs(a-b));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
'''A - Maximize the Formula
https://atcoder.jp/contests/abc110/tasks/abc110_a

>>> main([1, 5, 2])
53
>>> main([9, 9, 9])
108
>>> main([6, 6, 7])
82'''


def main(i):
    _i = sorted(i, reverse=True)
    head = str(_i[0]) + str(_i[1])

    print(int(head) + _i[2])


if __name__ == '__main__':
    i = [i for i in map(int, input().split(' '))]
    main(i)


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

int main(void){
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    int min = p[0];
    int c = 0;
    rep(i,n){
        if(p[i]<=min){
            min = p[i];
            c++;
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main {
   public static void main(String[] args) {  
      Scanner sc = new Scanner(System.in);
      
      int D = sc.nextInt();
      
      if(D == 22) {
         System.out.println("Christmas Eve Eve Eve");
      }
      else if(D == 23) {
         System.out.println("Christmas Eve Eve");
      }
      else if(D == 24) {
         System.out.println("Christmas Eve");
      }
      else {
         System.out.println("Christmas");
      }
   }
}

Measured memory_bytes: 21332
#include <cstdio>
#include <iostream>
#include <cmath>

using namespace std;

int main() {
  int N, count = 0;
  int eq = 0;
  
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    int bottom = i % 10;
    int top = i;
    int digit = 1;
    while (top >= 10) {
      top /= 10;
      digit++;
    }
    if (digit == 1) {
      count++;
      eq++;
      continue;
    }
    int middle = (i - (int)(top * pow(10, digit - 1))) / 10;
    if (bottom == 0) {
      continue;
    } else if (top == bottom) {
      count += middle + 2;
      eq++;
    } else if (top > bottom) {
      count += pow(10, digit - 2);
    }
    for (int d = 0; d <= digit - 3; d++) {
      count += pow(10, d);
    }
  }
  printf("%d\n", 2 * count - eq);
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict, Counter

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def prime_factorize(n):
    a = Counter()
    while n % 2 == 0:
        a[2] += 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a[f] += 1
            n //= f
        else:
            f += 2
    if n != 1:
        a[n] += 1
    return a


def main():
    N, *A = map(int, read().split())

    lcm_prime = Counter()
    for i in range(N):
        for p, n in prime_factorize(A[i]).items():
            if lcm_prime[p] < n:
                lcm_prime[p] = n

    l = 1
    for p, n in lcm_prime.items():
        l = l * pow(p, n, MOD) % MOD

    ans = 0
    for a in A:
        ans = (ans + l * pow(a, MOD - 2, MOD)) % MOD

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 74604
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
#define MOD2 (998244353)
#define MOD3 (1000000009)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("in.txt");ofstream coutt("out.txt");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Use __builtin_popcountll for ll;
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), 

signed main(){
    FASTER;
    int ans=0;
    string a,b;cin>>a>>b;
    for(int i=0;i<a.size();i++){
        ans+=(a[i]!=b[i]);
    }
    cout<<ans;
}



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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n == 0){
				break;
			}
			int[][] students = new int[n][n];
			boolean[][] tallest = new boolean[n][n];
			boolean[][] shortest = new boolean[n][n];
			int[][] x = new int[n][n];
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
					students[i][j] = sc.nextInt();
				}
			}
			
			for(int i = 0; i < n; i++){
				int columnMax = -1, maxj = -1;
				for(int j = 0; j < n; j++){
					if(columnMax < students[j][i]){
						columnMax = students[j][i];
                        maxj = j;
                    }
//					columnMax = Math.max(columnMax, students[j][i]);
				}
				for(int j = 0; j < n; j++){
					if(columnMax == students[j][i]){
						tallest[j][i] = true;
						x[j][i] |= 2;
					}
				}
			}
			for(int i = 0; i < n; i++){
				int rowMin = Integer.MAX_VALUE, minj = -1;
				for(int j = 0; j < n; j++){
					if(rowMin > students[i][j]){
						rowMin = students[i][j];
                        minj = j;
                    }
//					rowMin = Math.min(rowMin, students[i][j]);
//					minj = j;
				}
				for(int j = 0; j < n; j++){
					if(rowMin == students[i][minj]){
						shortest[i][minj] = true;
						x[i][minj] |= 1;
					}
				}
			}
			
			Set<Integer> both = new HashSet<Integer>();
            for(int i = 0;i < n;i++){
                for(int j = 0;j < n;j++){
                    if(x[i][j] == 3){
                        both.add(students[i][j]);
                    }
                }
            }
			
            if(both.size() == 1){
            	StringBuilder sb = new StringBuilder();
                for(int v : both){
                    sb.append(v + " ");
                }
                sb.deleteCharAt(sb.length() - 1);
                System.out.println(sb);
            }else{
            	System.out.println(0);
            }
/*			boolean noAns = true;
			StringBuilder sb = new StringBuilder();
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
					if(shortest[i][j] && tallest[i][j]){
						sb.append(students[i][j] + " ");
						noAns = false;
					}
				}
			}
			
			if(noAns){
				System.out.println(0);
			}else{
				sb.deleteCharAt(sb.length() - 1);
				System.out.print(sb);
			}
*/		}
		
	}
}

Measured memory_bytes: 19520
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,x;
  cin>>n>>x;
  
  int l[n],sum = 0, cnt=1;
  for(int i=0; i<n; i++)
  {
    cin>>l[i];
    sum = sum + l[i];
    if(sum <= x)
    {
      cnt++;
    }
  }
  cout<<cnt<<endl;
  return 0;
}
  

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
char ma[1001][1001];
int main(){
  int n;
  while(cin >> n,n){

    int d[1001][1001] = {{0}};

    for(int i = 0 ; i < n ; i++){
      for(int j = 0 ; j < n ; j++){
	cin >> ma[j][i];
      }
    }

    for(int i = 0 ; i < n ; i++ ){
      if(ma[i][0] != '*')d[i][0] = 1;
      else d[i][0] = 0;
      if(ma[0][i] != '*')d[0][i] = 1;
      else d[0][i] = 0;
    }
    int MSquare = 0;
    for(int i = 1 ; i < n ; i++ ){
      for(int j = 1 ; j < n ; j++ ){
	if(ma[i][j] == '*'){
	  d[i][j] = 0;
	}else{
	  d[i][j] = min(d[i-1][j-1],min(d[i-1][j],d[i][j-1])) + 1;
	  MSquare = max(MSquare,d[i][j]);
	}
      }
    }

    cout << MSquare << endl;

  }
  return 0;
}

Measured memory_bytes: 6060
#include<iostream>
#include<algorithm>
#include<functional>
#define MAX 1000

int main(){
	int n,m,p[MAX];
	while(1){
		int f=0,m1=0;
		std::cin>>n>>m;
		if(n==0&&m==0)
			break;
		for(int i=0;i<n;++i){
			std::cin>>p[i];
		    m1+=p[i];
		}
		std::sort(p,p+n,std::greater<int>());
		int c=n%m;
		for(int i=0;i<n-c;++i){
			if((i+1)%m==0)
				f+=p[i];
		}
		std::cout<<m1-f<<std::endl;
	}
	return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
    int n,d;
    scanf("%d %d",&n,&d);
    vector<vector<int>> X(n, vector<int>(d,0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            scanf("%d",&X[i][j]);
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int norm = 0;
            for (int k = 0; k < d; k++) {
                int tmp = abs(X[i][k]- X[j][k]);
                norm += tmp * tmp;
            }
            bool ok = false;
            for (int l = 1; l * l <= norm; l++) {
                if (l * l == norm) {
                    ok = true;
                    break;
                }
            }
            if (ok) ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp(a, b) make_pair(a, b)
#define pb(t) push_back(t)
#define ft first
#define sc second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;


ll dp[3333][3333]={};

int main(void) {
    ll a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    ll i, j;
    
    dp[0][0]=1;
    for(i=0; i<3030; i++) {
        for(j=0; j<3030; j++) {
            if(dp[i][j]) {
                if(i+100*a<3030) dp[i+100*a][j]=1;
                if(i+100*b<3030) dp[i+100*b][j]=1;
                if(j+c<3030) dp[i][j+c]=1;
                if(j+d<3030) dp[i][j+d]=1;
            }
        }
    }
    
    ll water=0, sugar=0;
    for(i=0; i<3030; i++) {
        for(j=0; j<3030; j++) {
            if(!dp[i][j]) continue;
            if(i*e<j*100) continue;
            if(i+j>f) continue;
            
            if(sugar*(i+j)<=(water+sugar)*j) {
                water=i;
                sugar=j;
            }
        }
    }
    
    cout << water+sugar << " " << sugar << endl;
    
}



Measured memory_bytes: 61696
N, M, Q = gets.split.map(&:to_i)
LR = M.times.map { gets.split.map(&:to_i) }
PQ = Q.times.map { gets.split.map(&:to_i) }

N_MAX = 500

lr2 = Array.new(N_MAX + 1) { Array.new(N_MAX + 1, 0) }
LR.each do |lr|
  lr2[lr[0]][lr[1]] += 1
end

1.upto(N_MAX) do |l|
  1.upto(N_MAX) do |r|
    lr2[l][r] += lr2[l-1][r] + lr2[l][r-1] - lr2[l-1][r-1]
  end
end

PQ.each do |pq|
  pq_max = [pq[0], pq[1]].max
  pq_min = [pq[0], pq[1]].min
  puts lr2[pq_max][pq_max] - lr2[pq_max][pq_min-1] - lr2[pq_min-1][pq_max] + lr2[pq_min-1][pq_min-1]
end

Measured memory_bytes: 32124
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


int main(){
    ll x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<ll> p(a);
    vector<ll> q(b);
    vector<ll> r(c);
    rep(i, a) cin >> p[i];
    rep(i, b) cin >> q[i];
    rep(i, c) cin >> r[i];
    sort(p.begin(), p.end(), greater<ll>());
    sort(q.begin(), q.end(), greater<ll>());
    sort(r.begin(), r.end(), greater<ll>());

    vector<ll> sump(a+1);
    vector<ll> sumq(b+1);
    vector<ll> sumr(c+1);
    rep(i, a) sump[i+1] = sump[i] + p[i];
    rep(i, b) sumq[i+1] = sumq[i] + q[i];
    rep(i, c) sumr[i+1] = sumr[i] + r[i];

    ll ans = sump[x] + sumq[y];
    ll np = x;
    ll nq = y;
    for (ll i=1; i<=min(x+y, c); i++) {
        ll now;
        if (np!=0 && nq==0) {
            now = sump[np-1] + sumq[nq] + sumr[i];
            np--;
        }
        else if (nq!=0 && np==0) {
            now = sump[np] + sumq[nq-1] + sumr[i];
            nq--;
        }
        else if (p[np-1]<q[nq-1]) {
            now = sump[np-1] + sumq[nq] + sumr[i];
            np--;
        }
        else {
            now = sump[np] + sumq[nq-1] + sumr[i];
            nq--;
        }
        ans = max(ans, now);
    }
    
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
D = int(input())
C = list(map(int, input().split()))
S = []
for i in range(D):
    a = list(map(int, input().split()))
    S.append(a)
last_d = [0] * 26  # それぞれのタイプでのd - last(d,i)
threshould = 100  # Ci*(last_d) / sqrt(Ci) がこれを超えたら対処する
for i in range(D):
    idx = 1
    tmp_max = 0
    for j in range(26):
        # もし閾値を超えるやつがあればそれをすぐに使う
        if C[j] * (i + 1 - last_d[j]) / ((C[j] + 0.1) ** 0.5) >= threshould:
            idx = j
            break
        if tmp_max <= S[i][j]:
            tmp_max = S[i][j]
            idx = j

            # print("a", idx)
    print(idx + 1)
    last_d[idx] = i + 1  # i+1日目に最後に使われた



Measured memory_bytes: 9588
#define MAX 101010
#include<iostream>
using namespace std;


int main()
{
    int N;
    int t[MAX],x[MAX],y[MAX];
    int dt,dist;

    scanf("%d",&N);
    t[0]=x[0]=y[0];
    for(int i=0;i<N;i++)
    {
        scanf("%d %d %d",&t[i+1],&x[i+1],&y[i+1]);
    }

    bool can=true;
    for(int i=0;i<N;i++)
    {
        dt=t[i+1]-t[i];
        dist=abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
        if(dt<dist)can=false;
        if(dist%2 != dt%2) can=false;
    }

    if(can) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(V) V.begin(), V.end()
#define PB push_back
using namespace std;
typedef long long ll;

int main() {
    string s,t;
    cin>> s >> t;
    int cnt = 0;
    rep(i,s.size()) if(s[i] != t[i]) cnt++;
    cout << cnt << endl;
}

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

typedef long long int llint;

int main()
{
  string str;
  cin>> str;

  if(str[0] != str[1] && str[0] != str[2] && str[1] != str[2]) {
    cout<< "Yes" <<endl;
  } else {
    cout<< "No" <<endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
int n;
int main(){
	scanf("%d",&n);
	string s,t;cin>>s>>t;
	if(s==t)puts("0"),exit(0);
	reverse(s.begin(),s.end()),reverse(t.begin(),t.end());
	int k=0;
	queue<int>q;
	int ans=0;
	for(int i=0,j;i<n;i=j+1){
		for(j=i;j+1<n&&t[j+1]==t[j];++j);
		k=max(k,j);
		while(k<n&&t[i]!=s[k])++k;
		if(k==n)puts("-1"),exit(0);
		while(!q.empty()){
			int k1=q.front();
			if(k1+(int)q.size()<=j)q.pop();
			else break;
		}
		if(j<k)q.push(k);
		ans=max(ans,(int)q.size());
	}
	printf("%d\n",ans+1);
	return 0;
}

Measured memory_bytes: 9720
'use strict';
(function(input){
  input=input.trim().split(/\n/);
  input.shift();
  input=input.map(str=>str.split(/\s+/).map(x=>x-0));
  let m=0,M=Infinity;
  input.forEach(function(LR){
    if(LR[0]>m)m=LR[0];
    if(M>LR[1])M=LR[1];
  })
  console.log(Math.max(M-m+1,0));
})(require('fs').readFileSync('/dev/stdin','utf8'));


Measured memory_bytes: 49208
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Map;
import java.util.TreeMap;

public class Main {
  public static void main(String[] args) throws Exception {
    int max = 0;
    final Map<String, int[]> map = new TreeMap<>();

    try (final BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
      for (int n = Integer.parseInt(br.readLine()); n > 0; n--) {
        final String s = br.readLine();
        final int[] c = map.get(s);
        if (c == null) {
          map.put(s, new int[] { 1 });
          if (max == 0) {
            max = 1;
          }
        } else {
          if (++c[0] > max) {
            max = c[0];
          };
        }
      }
    }
    try (final PrintWriter pw = new PrintWriter(System.out)) {
      for (Map.Entry<String, int[]> e : map.entrySet()) {
        if (e.getValue()[0] == max) {
          pw.println(e.getKey());
        }
      }
      pw.flush();
    }
  }
}


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

class Main {
    static Scanner scanner = new Scanner();
    static long inf = 0x7fffffffffL;

    public static void main(String[]$) throws IOException {
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        long p = scanner.nextInt();
        Edge[] edges = new Edge[m];
        for (int i = 0; i < m; i++) {
            int a = scanner.nextInt() - 1;
            int b = scanner.nextInt() - 1;
            long c = scanner.nextLong();
            edges[i] = new Edge(a, b, p - c);
        }
        long[] d = new long[n];
        Arrays.fill(d, inf);
        d[0] = 0;
        Set<Integer> loop = new HashSet<>();
        long dist = -1;

        for (int i = 1; i <= 2 * n; i++) {
            for (int j = 0; j < m; j++) {
                if (d[edges[j].to] > d[edges[j].from] + edges[j].cost) {
                    d[edges[j].to] = d[edges[j].from] + edges[j].cost;
                    if (i == n) {
                        dist = d[n - 1];
                    }
                    if (i == 2 * n) {
                        if (dist != d[n - 1]) {
                            System.out.println(-1);
                            return;
                        }
                    }
                }
            }
        }

        System.out.println(Math.max(0, -d[n - 1]));
    }

    static class Edge implements Comparable<Edge> {
        int from;
        int to;
        long cost;

        Edge(int from, int to, long cost) {
            this.from = from;
            this.to = to;
            this.cost = cost;
        }

        @Override
        public int compareTo(Edge o) {
            return Long.compare(this.cost, o.cost);
        }

        @Override
        public String toString() {
            return String.format("[%s, %s, %s]", from, to, cost);
        }
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 32768);
        StringTokenizer tokenizer;

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

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

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

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

Measured memory_bytes: 26452
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll unsigned long long
#define md 1000000007
#define pb push_back
#define ff first
#define ss second
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(i,start,end) for(ll i=start;i<end;i++) 
using namespace std;
using namespace __gnu_pbds;
typedef priority_queue<int, vector<int>, greater<int> > min_pq;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> OST;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }


int main(){
    fio();
    ll n,a,b;
    cin>>n>>a>>b;
    ll rem = n%(a+b);
    ll ans = a * (n/(a+b)) + min(rem,a);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
s = list(map(int, input().split()))
for k in range(N):
    if k>0:
        print(" ",sep='',end='')
    print(s[k],sep='',end='')
print()



def insertionSort(A,N):
    for i in range(1,N):
        v = A[i]
        j = i-1
        while j>=0 and A[j] > v:
            A[j+1] = A[j]
            j=j-1

        A[j+1]=v

        
        for k in range(N):
            if k>0:
                print(" ",sep='',end='')
            print(A[k],sep='',end='')

        print()

insertionSort(s,N)




Measured memory_bytes: 6320
// Contest: AtCoder Beginner Contest 154 (https://atcoder.jp/contests/abc154)
// Problem: B: I miss you... (https://atcoder.jp/contests/abc154/tasks/abc154_b)


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

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

using namespace std;

#if __cpp_lib_nonmember_container_access >= 201411
#   define sz(x) ((int)size(x))
#else
#   define sz(x) ((int)(x).size())
#endif

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

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

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

#if __has_cpp_attribute(maybe_unused) >= 201603
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18;
//endregion }}}

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

    string s; cin >> s;
    trav(c, s)
        c = 'x';
    cout << s << '\n';

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define IOS cin.tie(0); ios::sync_with_stdio(false)
const int INF = 1e9;
using namespace std;

signed main() {
    string S; cin >> S;
    bool can = false;
    if(S=="KIHBR") can = true;
    if(S=="AKIHBR") can = true;
    if(S=="KIHABR") can = true;
    if(S=="KIHBAR") can = true;
    if(S=="KIHBRA") can = true;
    if(S=="AKIHBRA") can = true;
    if(S=="AKIHABR") can = true;
    if(S=="AKIHBAR") can = true;
    if(S=="KIHABAR") can = true;
    if(S=="KIHABRA") can = true;
    if(S=="KIHBARA") can = true;
    if(S=="AKIHBARA") can = true;
    if(S=="AKIHABRA") can = true;
    if(S=="AKIHABAR") can = true;
    if(S=="KIHABAEA") can = true;
    if(S=="AKIHABARA") can = true;
    if(can) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
n = int(input())
array = list(map(int, input().split()))
ans = 10000
for i in range(n):
    b = array[:i]
    s1 = sum(b)
    s2 = sum(array)-s1
    ab = abs(s2 - s1)
    if ab<ans:
        ans = ab

print(ans)

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

string s;
int main() {
    cin >> s;
    int n = s.length();
    string ans = s[0] + to_string(n - 2) + s[n - 1];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3684
#include <iostream>
#include <iomanip>
#include <cassert>

#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <limits>
#include <queue>
#include <unordered_map>
#include <list>
#include <set>
#include <numeric>
using namespace std;

using ll = long long;

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

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

	vector<int> withdraw;
	for (int i = 6; i <= N; i *= 6)
	{
		withdraw.push_back(i);
	}
	for (int i = 9; i <= N; i *= 9)
	{
		withdraw.push_back(i);
	}

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

	vector<int> dp(N+1, 0);
	rep_init(i, 1, N+1)
	{
		dp[i] = dp[i-1] + 1;
		for (auto e : withdraw)
		{
			if (e > i) break;
			dp[i] = min(dp[i], dp[i-e] + 1);
		}
	}

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

Measured memory_bytes: 3704
#include <bits/stdc++.h>
 
#define ll long long
#define pb push_back
#define f first
//#define s second
//#define mp make_pair
#define gg return 0;
#define pii pair < int, int>
 
using namespace std;
 
const int maxn = 132675;
const int INF = (int)1e9;
 
ll a,b[maxn],c,d,cnt,e[(int)2e3 + 1][(int)2e3 + 1],cost[maxn],tout[maxn],mn = INF,mx = -INF,l,r;
 
ll x[maxn],y[maxn],x2[maxn],y2[maxn];
 
bool u[maxn], m;
 
vector <int> v;
 /*
void forn( int s, int f, int inter){
	for(int i = s; i <= f; i += inter){
		b[i] = i;
	}
}
*/ 
ll ans;
 
ll pref;
 
//vector <int> g[maxn],d[maxn];
 
ll lvlc,lvl[maxn];
/*
void dfs(int v){
	lvlc++;
	lvl[v] = lvlc;
	d[lvl[v]].pb(v);
	u[v] = 1;
	for(int i = 0; i < g[v].size(); ++i){
		int to = g[v][i];
		if(!u[to]){
			dfs(to);
		}
	}
	lvlc--;
}*/

map <int, int> col; 
 
char ch;

string s; 

int main()
{
	cin >> s;
	for(int i = 0; i < (1 << (int)(s.size() - 1)); ++i){
		for(int j = 0; j < (int)(s.size() - 1); ++j){
			if((i >> j) & 1){
				v.push_back(j + 1);
				//cou	t << 1;
			}
		}
		v.push_back((int)s.size());
		sort(v.begin(),v.end());
		ll sum = 0;
		for(int j = 0; j < (int)v.size(); ++j){
			ll res = 0;
			if(j == 0){
				for(int k = 0; k < v[j]; ++k){
					res *= 10;
					res += (int)(s[k] - '0');
				}
			}
			else{
				for(int k = v[j - 1]; k < v[j]; ++k){
					res *= 10;
					res += (int)(s[k] - 48);
				}
			}
			//cout << res << " ";
			sum += res;
		}
		//cout << "\n";
		ans += sum;
		v.clear();
	}
	cout << ans;
	gg
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int a = Integer.parseInt(br.readLine());
			int b = Integer.parseInt(br.readLine());
			int h = Integer.parseInt(br.readLine());
			int S = (a + b) * h / 2;
			System.out.println(S);
		} catch (Exception e) {
			System.err.println("Error:" + e.getMessage());
		}
	}
}


Measured memory_bytes: 7892
q=int(input())
query=[input() for _ in range(q)]
from bisect import bisect_left
ary=[-float('inf')]
for qq in query:
  if qq[0]=='1':
    _,a,_=map(int,qq.split())
    ary.append(a)
ary.sort()
ary.append(float('inf'))

class BIT:
  def __init__(self, n):
    self.n = n
    self.data = [0]*(n+1)
    self.el = [0]*(n+1)
  def sum(self, i):
    s = 0
    while i > 0:
      s += self.data[i]
      i -= i & -i
    return s
  def add(self, i, x):
    # assert i > 0
    self.el[i] += x
    while i <= self.n:
      self.data[i] += x
      i += i & -i
  def get(self, i, j=None):
    if j is None:
        return self.el[i]
    return self.sum(j) - self.sum(i)

ml,mr=0,len(ary)+1
mv=0
bit=BIT(len(ary)+1)
for qq in query:
  if qq[0]=='2':
    print(ary[ml],mv)
  else:
    _,a,b=map(int,qq.split())
    a=bisect_left(ary,a)
    bit.add(1,-1)
    bit.add(a+1,2)
    if ml<=a<mr:
      mv+=b
      ml,mr=a,a+1
    else:
      l,r=1,len(ary)+2
      # はじめて0以上になる場所を二分探索→ここがml
      while r-l>1:
        x=(r+l)//2
        if bit.sum(x)>=0:
          l,r=l,x
        else:
          l,r=x,r
      # はじめて1以上になる場所を二分探索→ここがmr
      mv+=b
      mv+=min(abs(ary[l]-ary[ml]),abs(ary[l]-ary[mr]))+abs(ary[l]-ary[a])
      ml=l
      l,r=1,len(ary)+2
      while r-l>1:
        x=(r+l)//2
        if bit.sum(x)>0:
          l,r=l,x
        else:
          l,r=x,r
      mr=l


Measured memory_bytes: 109456
N = int(input())


def DFS(N, S):
    if len(S) == N:
        print(S)
    else:
        if S:
            next_max_chr = ord(max(S)) + 1
        else:
            next_max_chr = ord("a")
        for i in range(0, next_max_chr - ord("a") + 1):
            DFS(N, S + chr(ord("a") + i))


DFS(N, "")

Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
template<class T>
ostream &operator<<(ostream &os, const vector <T> &v) {
    os << "[";
    for (int i=0; i<(((int)(v).size())); ++i) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}
template<class T, class U>
ostream &operator<<(ostream &os, const pair <T, U> &p) {
    return os << "(" << p.first << " " << p.second << ")";
}
template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;
/*
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    // ifstream in("in.txt");
    // cin.rdbuf(in.rdbuf());

    return 0;
}
*/
/**
 * @brief
 * 最小共通祖先（ダブリング）
 * 構築O(VlogV), クエリO(logV)
 *
 * LCA(G, root)で構築（無向木Gを、rootを根として向きづけしたときのLCAを構築）
 * query(u, v)で取得
 *
 * @author ゆきのん？
 * @date 2019/12
 */
struct LCA {
    /**
    * @brief コンストラクタ. O(nlog n)
    * @param[in] G 無向木.
    * @param[in] root 指定した根.
    */
    LCA(const vector<vector<int>>& G, int root = 0) :
            n(G.size()), log2_n(log2(n)), depth(n),
            par(log2_n+1, vector<int>(n,-1)) {
        dfs(G, root, -1, 0);
        for (int k = 0; k < log2_n; ++k) {
            for (int v = 0; v < n; ++v) {
                if (par[k][v] != -1) {
                    par[k+1][v] = par[k][par[k][v]];
                }
            }
        }
    }
    /**
    * @brief lca を取得する. O(log n);
    * @param[in] u, v: lca を求めたい2頂点.
    * @return u, v のlca.
    */
    int query(int u, int v) {
        if (depth[u] > depth[v]) swap(u, v);
        for (int k = 0; k <= log2_n; ++k) {
            if ((depth[v] - depth[u]) >> k & 1) {
                v = par[k][v];
            }
        }
        if (u == v) return u;
        for (int k = log2_n; k >= 0; --k) {
            if (par[k][u] != par[k][v]) {
                u = par[k][u];
                v = par[k][v];
            }
        }
        return par[0][u];
    }
private:
    int n, log2_n;
    vector<int> depth;
    vector<vector<int>> par;
    void dfs(const vector<vector<int>>& G, int v, int p, int d) {
        depth[v] = d;
        par[0][v] = p;
        for (auto to : G[v]) {
            if (to != p) dfs(G, to, v, d+1);
        }
    }
};
int main() {
    int N, Q;
    cin >> N;
    vector<vector<int>> g(N);
    for(int i = 0; i < N; i++) {
        int k; cin >> k;
        while (k--) {
            int c; cin >> c;
            g[i].push_back(c);
        }
    }
    LCA lca(g);
    cin >> Q;
    while (Q--) {
        int x, y; cin >> x >> y;
        printf("%d\n", lca.query(x, y));
    }
}


Measured memory_bytes: 18600
local n = io.read("*n")
local t = {}
for i = 1, n do t[i] = 0 end
if(n % 2 == 0) then
  for i = 1, n do
    local a = io.read("*n")
    if(i % 2 == 0) then
      t[1 + (n - i) / 2] = a
    else
      t[(n + i + 1) / 2] = a
    end
  end
else
  for i = 1, n do
    local a = io.read("*n")
    if(i % 2 == 0) then
      t[(n+ i + 1) / 2] = a
    else
      t[1 + (n - i) / 2] = a
    end
  end
end
print(table.concat(t, " "))


Measured memory_bytes: 15656
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>
#include <map>
#include <set>
#include <stack>
#include <deque>

#define INF 1000000000;
#define MOD 1000000007;
#define LIMIT 1000000000000000000;
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
typedef pair<int, int> P;

template<typename T>
T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return (a * b) / gcd(a, b);
}

int main()
{
    int N; cin >> N;
    vector<ll> A(N), B(N);
    for (int i = 0; i < N; i++) {
        ll a, b; cin >> a >> b;
        A[i] = a; B[i] = b;
    }

    ll ans = 0;
    for (int i = N - 1; i >= 0; i--) {
        ll mod_val = (A[i] + ans) % B[i];
        if (mod_val != 0) {
            ans += B[i] - mod_val;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
int main()
{
    long int n;
    scanf("%ld", &n);
    long long int count = 0;
    for(; n > 0; n--)
    {
    	if(n % 3 && n % 5)
    		count += n;
    }
    printf("%lld", count);
    return 0;
}

Measured memory_bytes: 1728
Module Module1

    Sub Main()
        'let'
        Dim N As Long = Console.ReadLine()
        Dim tmp() As String = Console.ReadLine().Split()
        Dim a(N - 1) As Long

        For i As Long = 0 To N - 1
            a(i) = tmp(i)
        Next

        Array.Sort(a)

        ''var'
        Dim ans As Long = 0

        For i As Long = N - 1 To 0 Step -1
            ans += New Long() {-1, 1}(i Mod 2) * a(i)
        Next

        Console.WriteLine(Math.Abs(ans))

    End Sub

End Module

Measured memory_bytes: 11220