akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

using namespace std;

int main(){
    int a,b,x,y;
    cin >> a >> b;
    if(a<=b){
        x=a;
        y=b;
    }else{
        x=b;
        y=a;
    }
    for(int i=0;i<y;i++){
        cout << x;
    }
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
from collections import deque
n=int(input())
Deq=deque()
for i in range(n):
    command=input().split( )
    com=int(command[0])
    com1=int(command[1])
    if com==0:
        if com1==1:
            Deq.append(command[2])
        elif com1==0:
            Deq.appendleft(command[2])
    elif com==1:
        q=Deq[com1]
        print(q)
    elif com==2:
        if com1==1:
            Deq.pop()
        elif com1==0:
            Deq.popleft()



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

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

    ll n;
    cin >> n;


    string al = "zabcdefghijklmnopqrstuvwxy";
    string res = "";

    while(n){
        res += al[n%26];
        
        if(n%26!=0)n /= 26;
        else n = n/26 - 1;
    }

    reverse(res.begin(), res.end());

    cout << res << endl;


    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

bool dbgflag = false;

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

  int n, k, r, s, p;
  cin >> n >> k >> r >> s >> p;

  string str;
  cin >> str;
  string rec = "";

  int ans = 0;

  for (int i = 0; i < n; i++) {
    //cout << str[i] << endl;
    if (i < k) {
      ans += ((str[i] == 'r') ? p : ((str[i] == 's' ? r : s)));
      rec += str[i];
    }
    else {
      if (str[i] == rec[i-k]) {
        rec += 'x';
        continue;
      }
      else {
        ans += ((str[i] == 'r') ? p : ((str[i] == 's' ? r : s)));
        rec += str[i];
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <stdio.h>

#define min(n,m) n<m ? n : m

int main(void)
{
    /*input*/
    int A, B, M;
    scanf("%d %d %d", &A, &B, &M);

    int a[A], b[B];
    for(int i=0;i<A;i++){
        scanf("%d", &a[i]);
    }
    for(int i=0;i<B;i++){
        scanf("%d", &b[i]);
    }

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

    /*process*/
    int ans = a[x[0]-1]+b[y[0]-1]-c[0];
    for(int i=1;i<M;i++){
        ans = min(ans, a[x[i]-1]+b[y[i]-1]-c[i]);
    }
    int amin = a[0];
    for(int i=1;i<A;i++){
        amin = min(amin, a[i]);
    }
    int bmin = b[0];
    for(int i=1;i<B;i++){
        bmin = min(bmin, b[i]);
    }

    /*output*/
    printf("%d\n", min(ans, amin+bmin));

    return 0;
}

Measured memory_bytes: 2176
k, x = map(int, input().split())

if k == 1:
    print(str(x))
else:
    a_list = [x]
    for i in range(1, k):
        a_list.append(x+i)
        a_list.append(x-i)

    a_list.sort()

    print(' '.join([str(a) for a in a_list]))

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

int main() {
  string S,T;
  cin >> S >> T;

  int count = 0;
  for (int i=0; i<3; ++i) {
    if (S[i] == T[i]) {
      ++count;
    }
  }

  cout << count << "\n";
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
    #pragma comment(linker, "/stack:200000000")
    #pragma GCC optimize("unroll-loops")
     
    #include <algorithm>
    #include <bitset>
    #include <cassert>
    #include <chrono>
    #include <cmath>
    #include <complex>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <ctime>
    #include <deque>
    #include <functional>
    #include <iomanip>
    #include <iostream>
    #include <iterator>
    #include <limits>
    #include <climits>
    #include <list>
    #include <map>
    #include <numeric>
    #include <queue>
    #include <random>
    #include <ratio>
    #include <set>
    #include <sstream>
    #include <stack>
    #include <string>
    #include <unordered_map>
    #include <unordered_set>
    #include <utility>
    #include <vector>
    using namespace std;
     
    typedef long long ll;
    typedef long double LD;
    #define int ll
    #define double LD
    #define pb push_back
    #define mp make_pair
    #define REP(i,n) for (int i = 0; i < n; i++)
    #define loop(i,n) for (int i = 0; i < n; i++)
    #define FOR(i,a,b) for (int i = a; i < b; i++)
    #define REPD(i,n) for (int i = n-1; i >= 0; i--)
    #define FORD(i,a,b) for (int i = a; i >= b; i--)
    #define remax(a,b) a = max(a,b)
    #define remin(a,b) a = min(a,b)
    #define mem(a, b) memset(a, b, sizeof a)
    #define append push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define print(x) cout << (x) << endl
    #define PRECISION(x) cout << fixed << setprecision(x)
    #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
     
    const double PI=acos(-1);
    const int MOD = 1000000007;
    const int FMOD = 998244353;
    const double eps = 1e-9;
     
    mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
 	
 	
    signed main()
    {
    	int n,k;
    	cin>>n>>k;
    	int cnt=0;
    	while(n)
    	{
    		int q=n/k;
    		int r=n%k;
    		cnt++;
    		n/=k;
		}
		cout<<cnt;
	}

Measured memory_bytes: 256
package main

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

func getScanner(fp io.Reader) *bufio.Scanner {
	sc := bufio.NewScanner(fp)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 500001), 500000)
	return sc
}

func getHugeScanner(fp io.Reader, size int) *bufio.Scanner {
	sc := bufio.NewScanner(fp)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, size), size)
	return sc
}

func getNextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func getNextInt(sc *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(sc))
	return i
}

func getNextInt64(sc *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(sc), 10, 64)
	return i
}
func getNextFloat64(sc *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(sc), 64)
	return i
}

func Divisor(x int) []int {
	ret := make([]int, 0)
	for i := 1; i < int(math.Sqrt(float64(x))) + 1; i++ {
		if x % i == 0 {
			ret = append(ret, i)
			if x / i != i {
				ret = append(ret, x / i)
			}
		}
	}
	return ret
}

func Solve(stdin io.Reader, stdout io.Writer) {
	sc := getScanner(stdin)

	n := getNextInt(sc)

	a := make([]int, n + 1)
	b := make(map[int]int)

	for i := 1; i <= n; i++ {
		a[i] = getNextInt(sc)
	}

	m := 0

	for i := n; i > 0; i-- {
		if a[i] == 0 {
			continue
		}
		divs := Divisor(i)
		m++
		b[i]++
		for _, v := range divs {
			a[v] = (a[v] + 1) % 2
		}
	}
	_, _ = fmt.Fprintf(stdout, "%v\n", m)
	for k, v := range b {
		for i := 0; i < v; i++ {
			_, _ = fmt.Fprintf(stdout, "%v ", k)
		}
	}
	_, _ = fmt.Fprintf(stdout, "\n")
}

func main() {
	Solve(os.Stdin, os.Stdout)
	return
}

Measured memory_bytes: 16256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define rep(n) for(int i=0;i<n;i+=1)
#define prarr(a,n) rep(n) cout<<a[i]<<endl printf("%s\n"," " );
#define sc(a) scanf("%d",&a);
#define scl(a) scanf("%lld",&a);
#define scf(a) ascanf("%f",&a);
#define ff first
#define ss second
#define pu push_back
#define inf 1000000001
#define MOD 1000000007 
#define INF 100000000000001
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin>>n>>k;
    double ans=0;
    for(int i=1;i<n+1;i+=1)
    {
    	if(i>k-1) ans+=1.0/n;
    	else
    	{
    		int t = (k-1)/i;
    		float a1=0.5;
    		while(t>1)
    		{
    			a1*=0.5;
    			t/=2;
    		}
    		ans+=(1.0/n)*a1;
    	}
    }
    printf("%.20lf\n",ans );
    // cout<<ans<<endl;
    return 0;

}
    

Measured memory_bytes: 256
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
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 (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    // インタラクティブ問題では除去した方がいいかも
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n, m; cin >> n >> m;
    vector<ll> x(n), y(n), z(n);
    REP(i, n) cin >> x[i] >> y[i] >> z[i];

    ll ans = 0;
    REP(mask, 8) {
        ll xsgn = mask & 1 ? 1 : -1;
        ll ysgn = mask & 2 ? 1 : -1;
        ll zsgn = mask & 4 ? 1 : -1;
        vector<ll> cand(n);
        REP(i, n) {
            cand[i] = x[i] * xsgn + y[i] * ysgn + z[i] * zsgn;
        }
        nth_element(cand.begin(), cand.begin() + (m-1), cand.end(), greater<ll>());
        chmax(ans, accumulate(cand.begin(), cand.begin() + m, 0LL));
    }
    cout << ans << endl;
    
}

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

int main()
{
    int N, L;
    cin >> N >> L;
    vector<string> vs(N);
    for (int i = 0; i < N; i++)
        cin >> vs[i];

    sort(vs.begin(), vs.end());
    string s;
    for (int i = 0; i < N; i++)
        s += vs[i];
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 256
n, m, q = gets.split.map(&:to_i)
list = Array.new(q){gets.split.map(&:to_i)}
puts [*1..m].repeated_combination(n).map{|a|
	list.sum{|li|
		if a[li[1] - 1] - a[li[0] - 1] == li[2]
			li[3]
		else
			0
		end
	}
}.max

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


int main()
{
    long long int a,b,c,k;
    cin>>a>>b>>c>>k;
    long long int sum=0;
    if(k<a)
        sum+=k;
    else
    {
       sum+=a;
       k=k-a;
       if(k>=b)
       {
            k=k-b;
            if(k<=c)
            {
                sum=sum-k;
            }
       }     

    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3512
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    v = [[] for i in range(n)]
    for i in range(n-1):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
        v[b].append(a)
    q = [0]
    q2 = []
    g = [0]*n
    bfs = [1]*n
    bfs[0] = 0
    d = [0]*n
    while q:
        x = q.pop()
        for y in v[x]:
            if bfs[y]:
                bfs[y] = 0
                d[x] += 1
                q.append(y)
                q2.append((x,y))
    while q2:
        x,y = q2.pop()
        g[x] ^= g[y]+1
    ans = g[0]
    if ans:
        print("Alice")
    else:
        print("Bob")
    return

#Solve
if __name__ == "__main__":
    solve()


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

int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  
  int pos = -3, count = 0;
  while ((pos = s.find("ABC", pos+3)) != string::npos) ++count;
  
  cout << count << endl;
}

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

template <typename T>
T calc_gcd(T x, T y)
{
    if (x < y)
    {
        swap(x, y);
    }
    T remain = x % y;
    while (remain != 0)
    {
        x = y;
        y = remain;
        remain = x % y;
    }
    return y;
}
template <typename T>
T calc_lcm(T x, T y)
{
    if (x < y)
    {
        swap(x, y);
    }
    T ret = x / calc_gcd(x, y);
    return ret * y;
}

int main()
{
    long long A, B;
    cin >> A >> B;

    cout << calc_lcm(A, B) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=500005,M=27;
int f[N][M],p[N][M],n,Q,l,r;
char s[N];

int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	REP(k,27){
		f[n+1][k]=f[n+2][k]=n+1;
		p[n+1][k]=p[n+2][k]=n+1;
	}
	per(i,n,1){
		int c=s[i]-'a';
		f[i][c]=i;
		rep(k,c+1,26) f[i][k]=f[f[i][k-1]+1][k-1];
		REP(k,c) f[i][k]=f[f[i][26]+1][k];
		p[i][0]=f[i][26];
		rep(k,1,20) p[i][k]=p[p[i][k-1]+1][k-1];
	}
	read(Q);
	while(Q--){
		read(l),read(r);
		int x=l;
		per(k,20,0) if(p[x][k]<=r) x=p[x][k]+1;
		puts(x==r+1?"Yes":"No");
	}
	return 0;
}


Measured memory_bytes: 106752
#include <stdio.h>
#define N 100

int main(void){
  
  int i,j,n,a[N],ch=0,sw;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  
  for(i=0;i<n;i++){
    for(j=n-1;j>=i+1;j--){
      if(a[j]<a[j-1]){
	sw=a[j];
	a[j]=a[j-1];
	a[j-1]=sw;
	ch++;
      }
    }
  }

  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i!=n-1){
      printf(" ");
    }
  }
  printf("\n");
  printf("%d\n",ch);
  
  return 0;
}

Measured memory_bytes: 604
import sys

sys.setrecursionlimit(10 ** 7)
debug = True

debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def matdprint(mat):
    if debug == True:
        for i in range(len(mat)):
            for j in range(len(mat[i])):
                print(mat[i][j], end=', ')
            print()

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()

INF = 10 ** 18
MOD = 10 ** 9 + 7
def conv(s):
    cnt = 0
    for n in s:
        cnt += 2**n
    return cnt

def main():

    N, M = LI()

    a_list = []
    b_list = []
    c_list = []
    for i in range(M):
        a, b = LI()
        a_list.append(a)
        # b_list.append(b)
        c_list.append(LI())

    dp = [[0 for j in range(2**N)]for i in range(M)]

    def conv(c):
        key = 0
        for i in c:
            key += 2**(i-1)
        return key

    def update(i, j, a):
        if dp[i][j] == 0:
            dp[i][j] = a
        else:
            dp[i][j] = min(dp[i][j], a)

    for i in range(M):
        c = c_list[i]
        a = a_list[i]
        key = conv(c)
        dprint('i', i, 'a', a, 'key', key)

        # 無に自分を入れるパターン
        if dp[i - 1][key] != 0:
            dp[i][key] = min(dp[i - 1][key], a)
        else:
            dp[i][key] = a


        for j in range(2**N):
            org_key = j
            or_key = j | key

            # 直前パターンに自分を足す場合
            # if dp[i-1][org_key] == 0:
            #     # 直前orgがなければ足せない
            #     # dprint('org_key', org_key, 'or_key', or_key, 'pass')
            # else:
            if dp[i - 1][org_key] != 0:

                # 直前がある場合、直前orgに足したのを入れる
                update(i, or_key, dp[i-1][org_key] + a)

                # dprint('org_key', org_key, 'or_key', or_key, dp[i][or_key])

            # 直前パターンをすべて引き継がせる
            if dp[i-1][j] != 0:
                update(i, j, dp[i-1][j])

        # matdprint(dp)

    # matdprint(dp)
    ans = dp[M-1][(2**N)-1]
    if ans == 0:
        print(-1)
    else:
        print(ans)

main()

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

int main(){
    string a,b,c;
    cin >> a >> b >> c;
    vector<int> x(3,0);
    int s = 0;
    while(1){

        //配列の大きさを越した場合はその人が勝利となる。
        if(x[0] > a.length()){
            cout << 'A' << endl;
            return 0;
        }else if(x[1] > b.length()){
            cout << 'B' << endl;
            return 0;
        }else if(x[2] > c.length()){
            cout << 'C' << endl;
            return 0;
        }

        //'a'を基準として、その数値となったら動作を行うようにする。
        if(s == 0){
            s = a[x[0]]- 'a';
            x[0]++;
        }else if(s == 1){
            s = b[x[1]] - 'a';
            x[1]++;
        }else{
            s = c[x[2]] - 'a';
            x[2]++;
        }

    }

    
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include<queue>
#include<utility>
#include<cstdio>
#include<cstring>
#include<new>
#include<float.h>
#include<ctype.h>
#include<cfloat>
#include<cmath>
#include<cctype>
#include<errno.h>
#include<cerrno>
#include<memory>
#include<memory.h>
#include<assert.h>
#include<cassert>
#include<deque>
#include<sstream>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qui queue<int>
#define vit vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define prq priority_queue
#define pii pair<int,int>
#define mp make_pair
#define sz size()
#define em empty()
#define ct continue
#define ms multiset
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define ppf pop_front()
using namespace std;
int main()
{
	ll a,b;
	cin>>a>>b;
	if(a*2>=b)cout<<b/2<<endl;
	else cout<<a+(b-a*2)/4<<endl;
	return 0;
}


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

using namespace std;
int main(void)
{
    string S;
    cin>>S;
    if(S=="SUN")
    {
        printf("7");
    }
    else if (S=="MON")
    {
        printf("6");
    }
    else if (S=="TUE")
    {
        printf("5");
    }
    else if (S=="WED")
    {
        printf("4");
    }
    else if (S=="THU")
    {
        printf("3");
    }
    else if (S=="FRI")
    {
        printf("2");
    }
    else if (S=="SAT")
    {
        printf("1");
    }
    
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,tim;
	cin>>n>>tim;
	long long mi = 1234567891011;
	for(int i=0;i<n;i++)
	{
		long long a,b;
		cin>>a>>b;
		if(b<=tim)
		{
			mi = min(mi,a);	
		}
	}
	if(mi ==1234567891011)
	{
		cout<<"TLE\n";
		return 0;
	}
	cout<<mi<<endl;
 } 

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {

	int n, x, sum=0;
	scanf("%d", &n);
	x = n;

	while (x) {
		sum += x % 10;
		x /= 10;
	}

	if (n % sum == 0) {
		printf("Yes");
	}

	else {
		printf("No");
	}

	return 0;
}

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

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

  if (str[0] == 'Y' && str[1] == 'A' && str[2] == 'K' && str[3] == 'I') {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 256
INF = float('inf')

def solve():
    lp = [-INF] * n
    lp[0] = 0

    for i in range(n):
        for a, b, c in es:
            if lp[a] != -INF and lp[b] < lp[a] + c:
                lp[b] = lp[a] + c
                if i == n - 1 and b == n - 1:
                    return 'inf'
    return lp[n - 1]


if __name__ == '__main__':
    n, m = map(int, input().split())
    es = []

    for i in range(m):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        es.append((a, b, c))

    print(solve())



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

using namespace std;

int main(){
	int n;
	cin >>n;
	vector<long long> a(n), b(n);

	for(int i = 0; i < n; ++i)
		cin >>a[i] >>b[i];
	
	long long sum = 0;
	for(int i = n - 1; i >= 0; --i){
		long long val = a[i] + sum;
		long long nxtmul = (val + b[i] - 1) / b[i] * b[i];
		sum += nxtmul - val;
	}
	cout <<sum <<'\n';
	return 0;
}


Measured memory_bytes: 4844
#include<stdio.h>

#define MAX 2000000

int select(int S[],int n,int max){
  int ans=0;
  int temp;
  for(int i = 0;i<n;i++){
    for(int j = i+1;j<n;j++){
      temp = S[i]+S[j];
      if(temp <= max && ans <= temp){
	ans = temp;
      }
    }
  }

  return ans;
}

int main(){

  int n;
  int a;
  int m;
  int k =0;
  int ans[100000];
  int S[MAX];

  while(1){
    scanf("%d",&n);
    scanf("%d",&m);
    if(n==0 && m == 0){
      break;
    }
    for(int i = 0;i<n;i++){
      scanf("%d",&a);
      S[i] = a;
    }

    ans[k] = select(S,n,m);
    k++;
  }


  for(int i = 0;i<k;i++){
    if(ans[i]==0){
      printf("NONE\n");
    }else{
      printf("%d\n",ans[i]);
    }
  }
  return 0;
}
  
  



Measured memory_bytes: 2596
#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
	int num[3]={0},num1=0,num2=0,num3=0;
	
	for( int i=0;i<3;i++ ){
		scanf("%d",&num[i]);
	}

	sort( num,num+3 );

	for( int i=0;i<3;i++ ){
		if( i != 2 ){
			printf("%d ",num[i]);
		}
		else{
			printf("%d\n",num[i]);
		}
	}

	return 0;
}

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

int main(){

  int a,b,c,x;
  cin >> a >> b >> c >> x;
  int ans = 0;
  for(int i=0;i<=a;i++){
    for(int j=0;j<=b;j++){
      for(int k=0;k<=c;k++){
        if(x == 500*i+100*j+50*k)ans++;
      }
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import numpy as np
import sys

n = int(input())

a = list(map(int, input().split()))

a_sum = sum(a)
# x[i]はi番目のダムに溜まった水の半分
x = []

x_0 = int(a_sum/2)

for i in range(int((n-1)/2)):
    x_0 -= a[2*i+1]

x.append(x_0)
x_tmp = x_0

for i in range(n-1):
    x_tmp = a[i] - x_tmp
    x.append(x_tmp)

x = list(map(lambda y: y*2, x))

print(*x, sep=' ')


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

using namespace std;

typedef long long ll;
ll wn[100005];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n,m;
	cin>>n>>m;
	vector<ll> cr(n+1,-1);
	for(int i=0;i<m;i++)
	{
		ll x;
		cin>>x;
		string str;
		cin>>str;
		if(str=="AC")
		{
			cr[x]=1;
		}
		else
		{
			if(cr[x]!=1)
			{
				wn[x]+=1;
			}
		}
	}
	ll ans=0,pen=0;
	for(int i=0;i<n+1;i++)
	{
		if(cr[i]==1){
			pen+=wn[i];
			ans+=1;
		}
		
	}
	cout<<ans<<" "<<pen<<endl;
	return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
	int n,k;
	cin >> n >> k;
	VL h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	VL dp(n,INT32_MAX);
	dp[0] = 0;
	for (int i = 1; i < n; i++) {
		for (int j = 1; j < min(i+1,k+1); j++) {
			dp[i] = min(dp[i],dp[i-j] + abs(h[i] - h[i-j]));
		}
	}
	cout << dp[n-1] << endl;
	return 0;

}


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

int main(){
  int N,K,Q;
  cin >> N >> K >> Q;
  vector<int> A(N);
  for(int i=0;i<Q;i++){
    int B;
    cin >> B;
    A.at(B-1)++;
  }
  for(int i=0;i<N;i++){
    if(K-Q+A.at(i)<=0){
      cout << "No" << endl;
    }
    else{
      cout << "Yes" << endl;
    }
  }
}
      
  

Measured memory_bytes: 3780
#include <stdio.h>

int main(void) {
	int a,b,c;
	
	scanf("%d %d %d",&a, &b, &c);
	
	if(a < b){
		if(b < c){
			printf("Yes\n");
		}else{
			printf("No\n");
		}
	}else{
		printf("No\n");
	}
	return 0;
}



Measured memory_bytes: 2040
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>

// Construct [k, 0, 1, ..., k - 1, k + 1, ..., 2 ^ m, k, 2 ^ m, ..., k + 1, k - 1, ..., 2, 1, 0]

int m, k;

int main()
{
    std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
    std::cin >> m >> k;
	if (k == 0)
	{
		for (int i = 0; i < (1 << m); ++i)
			std::cout << i << " " << i << " ";
		return 0;
	}
	int s = 0;
	for (int i = 0; i < (1 << m); ++i)
		if (i != k)
			s ^= i;
	if (s != k)
		return (std::cout << -1 << std::endl), 0;
	std::cout << k << " ";
	for (int i = 0; i < (1 << m); ++i)
		if (i != k)
			std::cout << i << " ";
	std::cout << k << " ";
	for (int i = (1 << m) - 1; ~i; --i)
		if (i != k)
			std::cout << i << " ";
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll  long long int
#define mod 1000000007
#define modd 998244353
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main()
{
    fast; 
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0; i<n ;i++)
    cin>>a[i];
    ll ans =1000;
    for(ll i=0; i<n-1 ;i++)
    {
        ll stocks = ans/a[i];
        if(a[i] < a[i+1])
        {
            ans+=abs(a[i+1]-a[i])*stocks;
        }
    }
    cout<<ans<<"\n";
    
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  int N; cin >> N;
  map<string, int> res{};
  for (int i = 0; i < N; ++i) {
    string s; cin >> s;
    ++res[s];
  }
  int M; cin >> M;
  for (int i = 0; i < M; ++i) {
    string s; cin >> s;
    --res[s];
  }

  auto ans = boost::max_element(
    res,
    [](auto s, auto t){
      return s.second < t.second;
    });

  cout << std::max(ans->second, 0) << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());

		long[] value = new long[n];

		for (int i = 0; i < n; i++) {
			value[i] = Long.parseLong(sc.next());
		}

		boolean minuscount = false;
		long max = 0;

		for (int i = 0; i < n; i++) {
			if (value[i] < 0) minuscount = !minuscount;
		}

		for (int i = 0; i < n; i++) {
			max += Math.abs(value[i]);
		}

		if (minuscount) {
			long min = Math.abs(value[0]);

			for (int i = 0; i < n; i++) {
				if (min > Math.abs(value[i])) {
					min = Math.abs(value[i]);
				}
			}

			max -= min * 2L;
		}

		System.out.println(max);


		sc.close();
	}

}


Measured memory_bytes: 48936
def tapdance(s):
    odd = ["R","U","D"]
    even = ["L","U","D"]

    o = s[::2]
    e = s[1::2]

    for i in o:
        if i not in odd:
            return print("No")
    for i in e:
        if i not in even:
            return print("No")
    return print("Yes")

s = input()
tapdance(s) 

Measured memory_bytes: 3064
#include<stdio.h>
int main(){
	int m,f,r;
	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1 && f==-1 && r==-1)	break;
		if(m==-1 || f==-1)	printf("F\n");
		else{
			if(m+f<30)	printf("F\n");
			else if(m+f<50){
				if(r>=50)	printf("C\n");	
				else		printf("D\n");
			}else if(m+f<65)	printf("C\n");
			else if(m+f<80)		printf("B\n");
			else if(m+f>=80)	printf("A\n");
		}	
	}
	return 0;

}


Measured memory_bytes: 1812
S = input()
S = list(input())
S_len = len(S)
ans = 0
i = 0
for _ in range(S_len):
  if S[0] == 'R':
    ans += S[1:].count('B') * S[1:].count('G')
    for j in range(int(len(S)/2+1)):
      try:
        if S[j+1] != S[j*2+2] and S[j*2+2] !='R' and S[j+1] !='R':
          ans-=1
      except:
        pass
  if S[0] == 'B':
    ans += S[1:].count('R') * S[1:].count('G')
    for j in range(int(len(S)/2+1)):
      try:
        if S[j+1] != S[j*2+2] and S[j*2+2] !='B' and S[j+1] !='B':
          ans-=1
      except:
        pass
  if S[0] == 'G':
    ans += S[1:].count('B') * S[1:].count('R')
    for j in range(int(len(S)/2+1)):
      try:
        if S[j+1] != S[j*2+2] and S[j*2+2] !='G' and S[j+1] !='G':
          ans-=1
      except:
        pass
  S  = S[1:]
print(ans)

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<string, vector<string>, greater<string> > PQ_ASK;

#include <iostream>
#include <vector>

using namespace std;


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

    vector<vector<int>> costs(c, vector<int>(c));
    rep(i, c) rep(j, c) cin >> costs[i][j];

    vector<vector<int>> grid(n, vector<int>(n));
    rep(i, n) rep(j, n) cin >> grid[i][j];
    rep(i, n) rep(j, n) grid[i][j]--;

    vector<vector<int>> use(c, vector<int>(3));

    rep(i, n) {
        rep(j, n) {
            int p = (i + j) % 3;
            int ci = grid[i][j];
            use[ci][p]++;
        }
    }

    auto check = [&](int d, int e, int f) {
        ll ans = 0;
        for (int i = 0; i < c; i++) {
            ll now = use[i][0] * costs[i][d];
            ans += now;
        }
        for (int i = 0; i < c; i++) {
            ll now = use[i][1] * costs[i][e];
            ans += now;
        }
        for (int i = 0; i < c; i++) {
            ll now = use[i][2] * costs[i][f];
            ans += now;
        }
        return ans;
    };

    ll ans = INF;

    for (int d = 0; d < c; d++) {
        for (int e = 0; e < c; e++) {
            for (int f = 0; f < c; f++) {
                if (d == e) continue;
                if (e == f) continue;
                if (f == d) continue;
                ll now = check(d, e, f);
                cmin(ans, now);
            }
        }
    }

    cout << ans << endl;
}





Measured memory_bytes: 1280
'use strict'
const main = (input: string) => {
    const std: string[] = input.trim().split('\n');
    const n: number = Number(std.shift());
    const b: number[] = std[0].split(' ').map(Number);
    let r = b[0] + b[n-2];
    for (let i = 0; i < n -2; i++) {
        r += Math.min(b[i], b[i+1]);
    }
    console.log(r);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  


Measured memory_bytes: 7372
/*
	*	Created By: 'Present_Sir'
	*	Created On: Sunday 02 August 2020 05:45:57 PM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define int long long
using namespace std;


void solve(){
    int n;
    cin>>n;
    int ans = 7;
    for(int i=0; i<1e6+5; ++i){
        if(ans%n == 0){
            cout<<i+1<<endl;
            return;
        }
        ans *= 10;
        ans += 7;
        ans %= n;
    }
    cout<<"-1"<<endl;
}

int32_t main(){
    IOS;
    //int t; cin>>t; while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3588
N = input()
i_N = int(N)
s_N = str(N)

lis = [[] for i in range(9)]
for i in range(9):
  lis[i] = [[] for i in range(9)]

for i in range(1,i_N+1):
  row = int(str(i)[0])-1
  column = int(str(i)[-1])-1
  if not row == -1 and not column == -1: 
    lis[row][column].append(1)

times = 0
for i in range(9):
  for j in range(9):
    if i != j:
      times += len(lis[i][j]) * len(lis[j][i])
    else:
      times += len(lis[i][i]) **2
print(times)

Measured memory_bytes: 4980
#include <string>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

#define FOR(i,S,E) for(int i=S; i<E; i++)
#define ri(x) scanf("%d", &x)
#define rii(x,y) scanf("%d%d", &x, &y)
int N, Y;

int main() {
	rii(N, Y);
	int A = Y/1000, B=0, C=0;
	do {
		int auxB = B/5;
		C = 0;
		do {
			int auxC = C/2;
			//printf("%d %d %d\n", auxC, auxB, A);
			if (A*1000 + auxB*5000 + auxC*10000 && A+auxB+auxC==N) {
				printf("%d %d %d\n", auxC, auxB, A);
				return 0;
			}
			auxB -= 2;
			C += 2;
		} while(auxB >= 0);
		A -= 5;
		B += 5;

	} while(A >= 0);
	printf("-1 -1 -1\n");
}

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

using namespace std;

typedef long long ll;
typedef vector<int> pi;
typedef pair<int,int> vi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(vi c, vi d){
	return c.S < d.S;
}

int main() {
	ll N;
	cin >> N;
	ll num1 = sqrt(N);
	while(N%num1 != 0) --num1;
	
	cout << num1-1+N/num1 - 1;


}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = n - 1; 0 < i; i--) cout << a[i] << " ";
	cout << a[0] << endl;
}


Measured memory_bytes: 3116
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

//Main
var sc = bufio.NewScanner(os.Stdin)

var H1, M1, H2, M2, K int

func main() {
	sc.Split(bufio.ScanWords)
	H1, M1, H2, M2, K := nextInt(), nextInt(), nextInt(), nextInt(), nextInt()

	fmt.Println(60*H2 + M2 - K - 60*H1 - M1)
}


Measured memory_bytes: 1756
#include <bits/stdc++.h>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <string>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define f first
#define s second
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define eb emplace_back
#define in insert
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define FOR(i, n, x) for(int i = x; i < n; i++)
#define OUT(a, e) FOR(i, e, 0) cout << a[i] << ' '
#define OUTV(a) for(auto i : a) cout << i << ' ';
#define maxim(a, n, mx) FOR(i, n, x)mx = max(mx, a[i]);
using namespace std;
const int N = 1e5 + 5;
vector<int> a;
vector<pii> now;
int fact(int x)
{
    int nans = 1;
    FOR(i, x + 1, 1)nans *= i;
    return nans;
}
ld get_ln(int n)
{
    ld nans = 0;
    FOR(i, n, 1)
    {
        nans += sqrt(pow(now[a[i]].f - now[a[i - 1]].f, 2) + pow(now[a[i]].s - now[a[i - 1]].s, 2));
    }
    return nans;
}
int main() {
    fast;
    int n; cin >> n;
    FOR(i, n, 0)
    {
        int x, y; cin >> x >> y;
        now.pb({x, y});
    }
    int up = fact(n);
    ld ans = 0;
    FOR(i, n, 0)a.pb(i);
    while(up--)
    {
        ans += get_ln(n);
        next_permutation(all(a));
       // OUTV(a);
    }
    ans = (ans / fact(n));
    cout << setprecision(6) << fixed << ans;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define alla(a,n) a, a + n
#define prtarr(n,len) {for(int i=0;i<len;i++) cout<<n[i]<<" ";}

using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<string> vs;
using namespace std;

int n;
vll lists;
int main() {
    //freopen("input.txt", "r", stdin) ;
    //freopen("output.txt", "w", stdout) ;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL) ;
    cin>>n;
    vll dp(n,0);
    ll sum=0;
    for(int i=0;i<n;i++){
        ll sub;
        cin>>sub;
        sum+=sub;
        lists.pb(sub);
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        if(i==0) dp[i]=sum;
        else dp[i]=(dp[i-1]-lists[i-1]);
    }
    for(int i=0;i<n-1;i++){
        ans+=((dp[i+1]%MOD)*lists[i])%MOD;
    }
    cout<<ans%MOD;
    return 0;
}




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

int main()
{
  vector<vector<int>> a(3,vector<int>(3));
  vector<vector<bool>> ok(3,vector<bool>(3,false));
  int i,j,k;
  for(i=0;i<3;i++)for(j=0;j<3;j++)cin>>a[i][j];
  int n;cin>>n;
  vector<int> b(n);
  for(i=0;i<n;i++)cin>>b[i];
  for(i=0;i<n;i++)
  {
    for(j=0;j<3;j++)
    {
      for(k=0;k<3;k++)
      {
        if(a[j][k]==b[i])ok[j][k]=true;
      }
    }
  }
  bool bin=false;
  for(i=0;i<3;i++)
  {
    if(ok[i][0]&&ok[i][1]&&ok[i][2])bin=true;
    if(ok[0][i]&&ok[1][i]&&ok[2][i])bin=true;
  }
  if(ok[0][0]&&ok[1][1]&&ok[2][2])bin=true;
  if(ok[2][0]&&ok[1][1]&&ok[0][2])bin=true;
  if(bin)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

int main() {
  int n, d, x; cin >> n >> d >> x;

  int ans = 0;
  rep(i, n) {
    int tmp;
    cin >> tmp;
    ans += ((d-1)/tmp)+1;
  }

  p(ans+x);
}

Measured memory_bytes: 256
using System;

namespace v0_0008
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;
            while (!string.IsNullOrEmpty(line = Console.ReadLine()))
            {
                int n = int.Parse(line);
                int count = 0;
                for (int a = 0; a < 10; a++)
                {
                    for (int b = 0; b < 10; b++)
                    {
                        for (int c = 0; c < 10; c++)
                        {
                            if (((n - (a + b + c)) >= 0) && ((n - (a + b + c)) < 10)) { count++; }
                        }
                    }
                }
                Console.WriteLine(count);
            }
        }
    }
}

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

struct result{
	int i, j, k, r;
};

int main(){
	int a,b,c;
	while( cin >> a >> b >> c , a || b || c ){
		int p[301];
		result R[1001];
		for(int i=0 ; i < a+b+c ; i++ ){
			p[i] = 2;
		}
		
		int N, n;
		cin >> N;
		for(int n=0 ; n < N ; n++ ){
			int i, j, k, r;
			cin >> i >> j >> k >> r;
			R[n].i = i;
			R[n].j = j;
			R[n].k = k;
			R[n].r = r;
			if( r == 1 ){
				p[i-1] = 1;
				p[j-1] = 1;
				p[k-1] = 1;
			}else{
				if( p[i-1] == 1 && p[j-1] == 1 ){
					p[k-1] = 0;
				}else if( p[j-1] == 1 && p[k-1] == 1 ){
					p[i-1] = 0;
				}else if( p[k-1] == 1 && p[i-1] == 1 ){
					p[j-1] = 0;
				}
			}
		}
		for(int n=0 ; n < N ; n++ ){
			int i, j, k, r;
			i = R[n].i;
			j = R[n].j;
			k = R[n].k;
			r = R[n].r;
			if( r == 1 ){
				p[i-1] = 1;
				p[j-1] = 1;
				p[k-1] = 1;
			}else{
				if( p[i-1] == 1 && p[j-1] == 1 ){
					p[k-1] = 0;
				}else if( p[j-1] == 1 && p[k-1] == 1 ){
					p[i-1] = 0;
				}else if( p[k-1] == 1 && p[i-1] == 1 ){
					p[j-1] = 0;
				}
			}
		}
		for(int i=0 ; i < a+b+c ; i++ ){
			cout << p[i] << endl;
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
    int main(){
       int N,M;cin>>N>>M;
       double a[N];
       int sum=0;
       for(int i=0;i<N;i++){
           cin>>a[i];
           sum+=a[i];
       }

       double j=1.0*sum/(4*M);
        int res=0;
       for(int i=0;i<N;i++){
           if(a[i]>=j)res++;
       }
       
       if(res>=M)cout<<"Yes"<<endl;
       else cout<<"No"<<endl;
    }










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

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::pair;

using std::vector;
using std::sort;

int main(){
    long x,y;
    cin >> x >> y;
    y/=x;
    int ans=0;
    while(y>0){
        ans++;
        y/=2;
    }

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



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<vector<pair<int, int> > > vvp;
typedef vector<pair<int, int> > vp;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<vector<ll> > vvl;
typedef vector<ll> vl;
typedef vector<vector<bool> > vvb;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define yn(f) (f?"yes":"no")
#define YN(f) (f?"YES":"NO")
#define Yn(f) (f?"Yes":"No")
#define mod (1e9+7)
#define inf (1e9+7)
#define nil -1
struct rect {
	int height, pos;
};
int gcd(int x,int y) {
	return x % y == 0 ? y : gcd(y,x%y);
}
int main() {
	int x, y;
	cin >> x >> y;
	cout << gcd(x,y) << endl;
}



Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
int a[100001][3];
int dp[100001][3];
int n; 
int rec(int idx, int prev)
{
	if(idx==n){return 0;}
	if(prev==-1)
	{
		int x=rec(idx+1,0)+a[idx][0];
		 int y=rec(idx+1,1)+a[idx][1];
		 int z=rec(idx+1,2)+a[idx][2];
		 return dp[idx][prev+1]=max({x,y,z});
	}
		
	if(dp[idx][prev]!=0)
	{
		return dp[idx][prev];
	}
	if(prev==0)
	{
		 int x=rec(idx+1,1)+a[idx][1];
		 int y=rec(idx+1,2)+a[idx][2];
		 return dp[idx][prev]=max(x,y);
	}
	if(prev==1)
	{
		int x=rec(idx+1,0)+a[idx][0];
		 int y=rec(idx+1,2)+a[idx][2];
		 return dp[idx][prev]=max(x,y);
	}
	if(prev==2)
	{
		int x=rec(idx+1,0)+a[idx][0];
		 int y=rec(idx+1,1)+a[idx][1];
		 return dp[idx][prev]=max(x,y);
	}
	
	
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{for(int j=0;j<3;j++)
	{
		cin>>a[i][j];
	}
	}
	cout<<rec(0,-1);
}
	

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, h1, count=0, ans=0;
  cin >> n >> h1;
  for(int i=1;i<n;i++){
  	int h2;
  	cin >> h2;
  	if(h1>=h2) count++;
  	else{
  		if(ans<count) ans = count;
  		count = 0;
  	}
  	h1 = h2;
  }
  if(ans<count) ans = count;
  cout << ans << endl;
}

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

using namespace std;

int main(){
    long long  x;
    cin >>x;
    for(long a=-1000;;a++){
      for(long b=0;b>=-1000;b--){
        long long c = (a*a*a*a*a)-(b*b*b*b*b);
          if(x == c){
           cout<<a<<" "<<b<<endl;
           return 0;
          }
      }     
    }
}

Measured memory_bytes: 3196