akhauriyash/Code-Regression huggingface dataset:
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  ll d,n=26;
  cin >> d;
  vector<ll> c(n),contest(d);
  vector<vector<ll>> s(d,vector<ll>(n));
  for(int i=0;i<n;i++){
    cin >> c[i];
  }
  for(int i=0;i<d;i++){
    for(int j=0;j<n;j++){
      cin >> s[i][j];
    }
  }
  for(int i=0;i<d;i++){
    ll b_score = -1e9,b_c=0;
    for(int j=0;j<n;j++){
      ll tmp = s[i][j];
      for(int k=0;k<n;k++){
        if(j==k) continue;
        ll last = 0;
        for(int l=i-1;l>=0;l--){
          if(contest[l]==k){
            last = l;
            break;
          }
        }
        tmp -= c[k]*(i-last);
      }
      if(tmp>b_score){
        b_score = tmp;
        b_c = j;
      }
    }
    contest[i] = b_c;
  }
  for(int i=0;i<d;i++){
    cout << contest[i]+1 << endl;
  }
}


Measured memory_bytes: 3748
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

s = INT()
N = 1000000

aN = [0] * (N+1)
aN[0] = s
c = Counter()
c[aN[0]] += 1
for i in range(1, N+1):
    n = aN[i-1]
    if n % 2 == 0:
        aN[i] = n // 2
    else:
        aN[i] = 3*n + 1
    if c[aN[i]] == 0:
        c[aN[i]] += 1
    else:
        print(i+1)
        exit()


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

using namespace std;
#define int long long
int MOD = 1000000007;

signed main(){
    string A,B;
    cin >> A >> B;
    
    if(A.length()>B.length()){
        cout << "GREATER" << endl;
        return 0;
    }else if(A.length()<B.length()){
        cout << "LESS" << endl;
        return 0;
    }else{
        for(int i=0;i<A.length();i++){
            if(A[i]>B[i]){
                cout << "GREATER" << endl;
                return 0;
            }else if(A[i]<B[i]){
                cout << "LESS" << endl;
                return 0;
            }
        }
    }
    cout << "EQUAL" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define min(a,b) ((a)>(b)?(b):(a))

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main()
{
    int n;
    scanf("%d", &n);
    int a[n];
    int i;
    for(i=0;i<n;i++){
        scanf("%d", &a[i]);
        a[i] -= i+1;
    }
    
    qsort(a, n, sizeof(int), compare_int);
    
    long x = 0, y = 0, z = 0;

    for(i=0;i<n;i++){
        x += abs(a[i]-a[(n/2)-1]);
        y += abs(a[i]-a[n/2]);
        z += abs(a[i]-a[(n/2)+1]);
    }
    
    printf("%ld", min(min(x,y),z));

    return 0;
}

Measured memory_bytes: 1788
N=int(input())
S=input()
R=0
G=0
B=0
for i in range(N):
    s=S[i]
    if s=="R":
        R+=1
    elif s=="G":
        G+=1
    else:
        B+=1
ans=R*G*B
for i in range(N-2):
    for j in range(i+1, N-1):
        if 0<=j+j-i<N:
            si=S[i]
            sj=S[j]
            sk=S[2*j-i]
            if si!=sj and sj!=sk and sk!=si:
                ans-=1
print(ans)

Measured memory_bytes: 68540
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	if(a + b == 15){
		cout << "+" << endl;
	}else if(a * b == 15){
		cout << "*" << endl;
	}else{
		cout << "x" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int Stack=0;
    string x;cin>>x;
    int sz=x.size();int ans=sz;
    for(int i=0;i<sz;i++){
        if(x[i]=='S')Stack++;
        else{
            if(Stack>0){
                Stack--;
                ans-=2;
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3724
import itertools

n = int(input())
keep = []
p = tuple((map(int, input().split())))
q = tuple((map(int, input().split())))
for i in range(1, n + 1):
    keep.append(i)
all = list(itertools.permutations(keep))
for j in range(len(all)):
    if all[j] == p:
        ans1 = j
    if all[j] == q:
        ans2 = j
print(abs(ans1 - ans2))

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

int main() {
  ll n,count=0;
  cin>>n;
  for(ll a=1;a<sqrt(n)+2;a++){
    for(ll b=a;b<n;b++){
        if(a*b<n&a!=b){
          count+=2;
        }
      else if(a*b<n&a==b){
        count++;
        }
      }
    }
  cout<<count<<endl;
}

Measured memory_bytes: 3620
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

int Root( int x );
void Unite( int x, int y );

int root[SIZE];

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

    int n, m;
    cin >> n >> m;

    for( int i = 1; i <= n; ++i ) root[i] = i;

    for( int i = 0; i < m; ++i ) {
        int x, y, z;
        cin >> x >> y >> z;
        Unite( x, y );

    }

    set< int > st;
    for( int i = 1; i <= n; ++i ) {
        st.insert( Root( root[i] ) );

    }
    cout << st.size() << endl;
    return 0;
}

int Root( int x ) {
    if( x == root[x] ) {
        return x;

    }
    return root[x] = Root( root[x] );

}

void Unite( int x, int y ) {
    x = Root( x );
    y = Root( y );

    if( x > y ) {
        root[x] = y;

    } else {
        root[y] = x;

    }
    return;

}


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

std::string ReplaceString
(
      std::string String1   // 置き換え対象
    , std::string String2   // 検索対象
    , std::string String3   // 置き換える内容
)
{
    std::string::size_type  Pos( String1.find( String2 ) );
 
    while( Pos != std::string::npos )
    {
        String1.replace( Pos, String2.length(), String3 );
        Pos = String1.find( String2, Pos + String3.length() );
    }
 
    return String1;
}

int main() {
    string s, ans;
    cin >> s;

    ans = ReplaceString(s, "?", "D") ;  

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

Measured memory_bytes: 3924
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.util.stream.Stream;
import java.util.Scanner;

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

    static class BSomeSums {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = Integer.parseInt(in.next());
            int a = Integer.parseInt(in.next());
            int b = Integer.parseInt(in.next());

            int ans = 0;
            for (int i = 1; i <= n; i++) {
                int sum = Arrays.stream(String.valueOf(i).split("")).mapToInt(Integer::parseInt).sum();
                if (sum >= a && sum <= b) {
                    ans += i;
                }
            }
            out.println(ans);
        }

    }
}



Measured memory_bytes: 39776
n,m = map(int,input().split())
 
c = []
for i in range(m):
    c.append(list(map(int,input().split())))
 

ans = -1
if n == 1 and m == 0:
    ans = 0
elif m == 0 and n != 1:
    ans = pow(10,n-1)
elif n == 1:
    tmp = 0
    for i in range(m):
        if c[i][1] == c[0][1]:
            tmp += 1
        if tmp == m:
            ans = c[0][1]
            break
else:            
 for i in range(pow(10,n-1),pow(10,n)):
    tmp = 0
    for j in range(m):
        if str(i)[c[j][0]-1] == str(c[j][1]):
            tmp += 1
    if tmp == m:
         ans = i
         break
print(ans)   

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a,b;
        a = scan.nextInt(); b = scan.nextInt();
        if(a <= 8 && b <= 8)
            System.out.println("Yay!");
        else
            System.out.println(":(");
    }
}


Measured memory_bytes: 21972
import java.util.*

fun main(args: Array<String>) {
    val N = readLine()!!.toLong()

    val fact = factors(N)

    println(
        fact.map { it - 1 }
            .filter { it != 0L && N / it == N % it }
            .sum()
    )

//    for (N in 1..200L) {
//        val list = ArrayList<Long>()
//        for (i in 2 until N) {
//            if (N % i == N / i) {
//                list.add(i)
//            }
//        }
//        println("$N: ${list.joinToString(" ")}")
//    }
}

fun factors(n: Long): List<Long> {
    var i = 1L
    val factors = ArrayList<Long>()

    while(i * i <= n) {
        if (n % i == 0L) {
            factors.add(i)

            if (n / i != i) {
                factors.add(n / i)
            }
        }
        i++
    }
    factors.sort()

    return factors
}


Measured memory_bytes: 33792
#include <iostream>
using namespace std;
int main(void){
    int W,H,x,y,r;
    cin>>W;
    cin>>H;
    cin>>x;
    cin>>y;
    cin>>r;
    
    if((x+r)<=W&&(x-r)>=0&&(y+r)<=H&&(y-r)>=0){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    cout<<endl;
    
    return 0;
}


Measured memory_bytes: 3112
num = gets.to_i
num = num -2
line =gets.split.map(&:to_i)
i = 1
ans = 0
num.times do
  a = line[i-1]
  b = line[i]
  c = line[i+1]
  if a < b
    if b < c
      ans += 1
    end
  elsif b < a
    if c < b
      ans += 1
    end
  end
 i += 1
end
p ans

Measured memory_bytes: 1788
#include<iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    char s[n];
    cin >> s;

    int i = 0;
    int x = 0;
    int ans = 0;

    while(i<n){
        if(s[i]=='I')x++;
        else if(s[i]=='D')x--;
        if(ans<x)ans = x;
        i++;
    }
    cout << ans << endl;
}


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

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] array = br.readLine().split(" ");
        int a = Integer.parseInt(array[0]);
        int b = Integer.parseInt(array[1]);
        int c = Integer.parseInt(array[2]);
        if(a < b && b < c){
    		System.out.println("Yes");
        }else{
        	System.out.println("No");
        }
	}
}

Measured memory_bytes: 16892
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	double A;

	double sum = 0.0;
	cin >> N;
	rep(i, 0, N)
	{
		cin >> A;
		sum += 1 / A;
	}

	cout << fixed << setprecision(10) << 1.0 / sum << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdint>
#include <cmath>
#include <vector>
#include <map>
#include <climits>

using namespace std;

int main()
{
    int H, N;
    cin >> H >> N;
    int suma = 0;
    for(int i = 0; i < N; ++i){
        int a;
        cin >> a;
        suma += a;
    }
    
    cout << (suma < H ? "No" : "Yes") << '\n';
}


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


#define pb push_back 
#define rep(i, n, a) for(int i = a;i< n;i++)
#define all(x) (x).begin(), (x).end()
#define so(x) sort(x.begin(), x.end());
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>>vii;
typedef vector<ll> vl;
typedef vector<vector<ll>>vll;
typedef pair <int, int> pii;
typedef pair<ll, ll> pll;

void printVec(vector<int> &A){
    for(int i=0;i< A.size();i++){
        cout<<A[i]<<' ';
    }
    cout <<endl;
}

void printArr(int arr[], int n){
    for(int i =0;i< n;i++){
        cout<<arr[i]<<' ';
    }
    cout <<endl;
}

vector<vll> dp;
vi rs;
vi gs;
vi bs;


ll getAns(int r, int g, int b){
    if(r < 0 || g < 0 || b < 0)return 0;
    if(dp[r][g][b] >= 0) return dp[r][g][b];
    if(r == 0 && g == 0 && b == 0)return 0;
    if(r == 0){
        if(g == 0 || b == 0)return 0;
        dp[r][g][b] = gs[g-1]*bs[b-1] + getAns(r, g-1, b-1);
        return dp[r][g][b];
    }
    if(g == 0){
        if(r == 0 || b == 0)return 0;
        dp[r][g][b] = rs[r-1]*bs[b-1] + getAns(r-1, g, b-1);
        return dp[r][g][b];
    }
    if( b == 0){
        if(r == 0 || g == 0)return 0;
        dp[r][g][b] = rs[r-1]*gs[g-1] + getAns(r-1, g-1, b);
        return dp[r][g][b];
    }
    dp[r][g][b] = rs[r-1]*gs[g-1] + getAns(r-1, g-1, b);
    dp[r][g][b] = max(dp[r][g][b],rs[r-1]*bs[b-1] +getAns(r-1, g, b-1));
    dp[r][g][b] = max(dp[r][g][b], bs[b-1]*gs[g-1] + getAns(r, g-1, b-1));
    return dp[r][g][b];
}


void solve(){
    int n;
    cin>>n;
    vi a(n, 0);
    for(int i= 0;i< n;i++)cin>>a[i];
    so(a);
    int ans =0;
    for(int i = 0;i< n;i++){
        for(int j = i+1;j< n;j++){
            for(int k = j+1;k< n;k++){
                if( a[i] + a[j] > a[k] && a[i] != a[j] && a[j] != a[k] )ans++;
            }
        }
    }
    cout<<ans<<endl;
}

int main(){
    int t;
    // cin>>t;
    t = 1;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3628
#include<stdio.h>

int Exhaustive(int,int);

int n,A[100];

int main()
{
  int yamagami,a,i;

    scanf("%d",&n);
    for(i=0;i<n;i++)
      scanf("%d",&A[i]);

    scanf("%d",&yamagami);

    for(i=0;i<yamagami;i++)
      {
        scanf("%d",&a);
        if(Exhaustive(0,a))
          printf("yes\n");
        else
          printf("no\n");
      }

    return 0;
  }

  int Exhaustive(int a,int b)
  {
    if(b==0)
      return 1;
    if(a>=n)
      return 0;

    int res=Exhaustive(a+1,b)||Exhaustive(a+1,b-A[a]);
    return res;
  }




Measured memory_bytes: 2120
h,w = map(int,input().split())
a = [input() for i in range(h)]

flagh = [0]*h
flagw = [0]*w

for i in range(0,h):
    if a[i]=="."*w:
        flagh[i] = 1
    for j in range(0,w):
        if a[i][j] == ".":
            flagw[j] += 1

for i in range(h):
    if flagh[i] != 1:
        for j in range(w):
            if flagw[j] != h:
                print(a[i][j],end="")
        print("")


Measured memory_bytes: 4468
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-10;
const int INF = 0x3f3f3f3f;
const ll mod  = 1e9 + 7;
const ll maxn = 1e6 + 5;

ll h,w;
char e[30][30];
int dis[30][30];
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};


int bfs(int x,int y){
	memset(dis,INF,sizeof(dis));
	queue<P>q;
	q.push({x,y});
	dis[x][y]=0;
	while(!q.empty()){
		P top=q.front();
		q.pop();
		for(int i=0;i<4;i++){
			int tx=top.first+dx[i];
			int ty=top.second+dy[i];
			if(tx>0 && tx<=h && ty>0 && ty<=w && e[tx][ty]=='.' && dis[tx][ty]==INF){
				dis[tx][ty]=dis[top.first][top.second]+1;
				q.push({tx,ty});
			}
		}
	}
	int ans=0;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(dis[i][j]!=INF) ans=max(ans,dis[i][j]);
		}
	}
	return ans;
}

int main(){
	cin>>h>>w;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin>>e[i][j];
		}
	}
	int ans=0;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(e[i][j]=='.') ans=max(ans,bfs(i,j));
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(c,itr) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	int x;
	cin>>x;
	int a=x/100,b=x%100;
	if(a*5>=b){
		cout<<1;
	}
	else{
		cout<<0;
	}
	re 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
string s1,s2,s3,ans;
cin>>s1;
cin>>s2;
cin>>s3;
 ans+=s1[0];
ans+=s2[1];
ans+=s3[2];
cout<<ans;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N;
    cin >> N;
    bool able = true;
    rep(i, N){
        int A;
        cin >> A;
        if(A%2 == 0){
            if(A%3 != 0&& A%5 != 0) able = false;
        }
    }
    if(able) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
}

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

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

    vector<double> data(n + 1);
    data.at(0) = 0;
    for (int i = 1; i < n + 1; i++){
        int num;
        cin >> num;
        data.at(i) = data.at(i - 1) + num * (num + 1) / 2.0 / num;
    }

    double max = -1;
    for (int i = 0; i <= n - k; i++){
        double test = data.at(i + k) - data.at(i);
        if (max < test){
            max = test;
        }
    }

    cout << fixed;
    cout << setprecision(9) << max << endl;
}

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

int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        int flag=1;
        for(int i=0;i<n;i++)
        {
            char s[2];
            scanf("%s",s);
            if(s[0]=='Y')
                flag=0;
        }
        if(!flag)
        {
            printf("Four\n");
        }
        else
        {
            printf("Three\n");
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  priority_queue<int> red, green, none;
  rep(i, A)
  {
    int p;
    cin >> p;
    red.push(p);
  }

  rep(i, B)
  {
    int q;
    cin >> q;
    green.push(q);
  }

  rep(i, C)
  {
    int r;
    cin >> r;
    none.push(r);
  }

  std::priority_queue<
      int,              // 要素の型はint
      std::vector<int>, // 内部コンテナはstd::vector (デフォルトのまま)
      std::greater<int> // 昇順 (デフォルトはstd::less<T>)
      >
      queX, queY;
  rep(i, X)
  {
    queX.push(red.top());
    red.pop();
  }

  rep(i, Y)
  {
    queY.push(green.top());
    green.pop();
  }

  while (none.size() > 0)
  {
    if (queX.top() > none.top() && queY.top() > none.top())
      break;
    if (queX.top() > queY.top())
    {
      queY.pop();
      queY.push(none.top());
      none.pop();
    }
    else
    {
      queX.pop();
      queX.push(none.top());
      none.pop();
    }
  }

  long long ans = 0;
  while (queX.size())
  {
    ans += queX.top();
    queX.pop();
  }

  while (queY.size())
  {
    ans += queY.top();
    queY.pop();
  }

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

Measured memory_bytes: 2552
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i, a, n) for (int i=(a); i<(n); i++)
#define per(i, a, n) for (int i=(a); i>(n); i--)
typedef long long ll;
const int maxn = 2e5+5;
const int mod = 998244353;
using namespace std;

ll dp[maxn], l[maxn], r[maxn], sum[maxn];

void solve() {
	ll n,k; cin >> n >> k;
	for(int i=1; i<=k; i++) {
		cin >> l[i] >> r[i];
	}
	dp[1] = sum[1] = 1;
	for(int i=2; i<=n; i++) {
		for(int j=1; j<=k; j++) {
			if (i > l[j])
				dp[i] = (dp[i] + sum[i-l[j]] - sum[max(i-r[j]-1,0ll)] + mod)%mod;
		}
		sum[i] = (dp[i] + sum[i-1])%mod;
	}
	cout << dp[n] << '\n';
}

int main(int argc, char * argv[]) 
{
	ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef DEBUG
	freopen("C:/Users/Fish_Brother/Desktop/in", "r", stdin);
	//freopen("C:/Users/Fish_Brother/Desktop/out", "w", stdout);
#endif

	//int t; cin >> t; while(t--)
	solve();

    return 0;
}

Measured memory_bytes: 6636
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;


int main(void) {
	vector<int> a;
	int sum = 0;
	int n;
	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	if (sum % 10 == 0) {
		sort(a.begin(), a.end());
		for (int i = 0; i < n; i++) {
			if ((sum - a[i]) % 10 != 0) {
				sum -= a[i];
				break;
			}
		}
	}
	cout << ((sum % 10) ? sum : 0) << endl;
	return 0;
}


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

#define ll long long int
#define ld long double
#define clr(arr) memset(arr,0,sizeof(arr))
#define nn '\n'

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

    int t = 1;
    //cin>>t;
    while(t--)
    {
        int x;
        cin>>x;
        if(x>=1800) cout<<1<<endl;
        else if(x>=1600) cout<<2<<endl;
        else if(x>=1400) cout<<3<<endl;
        else if(x>=1200) cout<<4<<endl;
        else if(x>=1000) cout<<5<<endl;
        else if(x>=800) cout<<6<<endl;
        else if(x>=600) cout<<7<<endl;
        else cout<<8<<endl;
    }

    return 0;
}



Measured memory_bytes: 3648
n, q = gets.split.map(&:to_i)
processes = readlines.map(&:split).each { |p| p[1] = p[1].to_i }

time = 0
until processes.empty?
  p = processes.shift
  p[1] = p[1] - q
  time += q
  if p[1] > 0
    processes.push(p)
  else
    time += p[1]
    puts "#{p[0]} #{time}"
  end
end



Measured memory_bytes: 19252
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

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

	char table[N],buf[2];
	for(int i = 0; i < N; i++){
		scanf("%s",buf);
		table[i] = buf[0];
	}

	ll dp[N+1][N+1];

	for(int i = 0; i <= N; i++){
		for(int k = 0; k <= N; k++)dp[i][k] = 0;
	}

	dp[0][0] = 1;

	for(int i = 0; i <= N-1; i++){
		switch(table[i]){
		case '-':
			for(int k = 0; k <= i; k++){
				dp[i+1][k] = dp[i][k];
			}
			break;
		case 'D':
			for(int k = 0; k <= i; k++){
				dp[i+1][k] += k*dp[i][k];
				dp[i+1][k] %= MOD;
				if(k == 0)continue;
				dp[i+1][k-1] += ((k*dp[i][k])%MOD)*k;
				dp[i+1][k-1] %= MOD;
			}
			break;
		case 'U':
			for(int k = 0; k <= i; k++){
				dp[i+1][k+1] += dp[i][k];
				dp[i+1][k+1] %= MOD;
				dp[i+1][k] += k*dp[i][k];
				dp[i+1][k] %= MOD;
			}
			break;
		}
	}

	printf("%lld\n",dp[N][0]%MOD);

	return 0;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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

    int n, m;
    cin >> n >> m;

    int ans, tmp;
    int inf = 500000000;
    int x = pow(2, n);
    vector<int> dp(x+1, inf);

    REP(i, m){
        int a, b;
        cin >> a >> b;
        int c,code = 0;
        REP(j,b){
            cin >> c;
            code += pow(2, c-1);
        }
        dp[code] = min(dp[code], a);
    }

    FOR(i,1,x){
        FOR(j,i,x){
            dp[(i | j)] = min(dp[(i | j)], dp[i] + dp[j]);
        }
    }
    ans = dp[SZ(dp) - 2];
    if(ans==inf){
        cout << -1 << "\n";
    }else{
        cout << ans << "\n";
    }

    return 0;
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  
  if((a==b && b!=c ) || (b==c && c!=a) || (a==c && c!=b)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    if(A == B){
      System.out.println(C);
    }else if(A == C){
      System.out.println(B);
    }else{
      System.out.println(A);
    }
  }
}


Measured memory_bytes: 21204
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"

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

  int A;
  std::cin >> A;

  int B;
  std::cin >> B;

  std::cout << (A-1) * (B-1) << '\n';
  return 0;
}


Measured memory_bytes: 256
N = int(input())
S = [list(map(str, input())) for _ in range(N)]
S.sort()
for s in S:
    s.sort()

ans = 0
dic = {}

for s in S:
    ss = "".join(s)
    if ss in dic:
        ans += dic[ss]
        dic[ss] += 1
    else:
        dic[ss] = 1

print(ans)

Measured memory_bytes: 39272
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <numeric>
#include <algorithm>
#include <utility>

// 14:01



using std::cout;
using std::cin;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


int main() {
    int task = 1;
//    cin >> task;

    while (task--) {
        int x, a, b;
        cin >> x >> a >> b;
        if (b <= a) {
            cout << "delicious" << "\n";
            continue;
        }
        if (b - a > x) {
            cout << "dangerous" << "\n";
        } else {
            cout << "safe" << "\n";
        }

    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

//A Thief
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int Case = 1;
		while(true){
			int W = sc.nextInt();
			if(W==0)break;
			int n = sc.nextInt();
			int[] w = new int[n+1];
			int[] v = new int[n+1];
			for(int i=1;i<=n;i++){
				String[] s = sc.next().split(",");
				v[i] = Integer.parseInt(s[0]);
				w[i] = Integer.parseInt(s[1]);
			}
			int[][] dp = new int[n+1][W+1];
			int maxV = Integer.MIN_VALUE;
			int minW = Integer.MAX_VALUE;
			for(int i=1;i<=n;i++){
				for(int j=1;j<=W;j++){
					if(j-w[i]>=0){
						dp[i][j] = Math.max(dp[i-1][j], dp[i-1][j-w[i]]+v[i]);
						if(maxV < dp[i][j]){
							maxV = dp[i][j];
							minW = j;
						}
						else if(maxV == dp[i][j]){
							minW = Math.min(minW, j);
						}
					}
					else dp[i][j] = dp[i-1][j];
				}
			}
			System.out.println("Case " + Case++ + ":\n" + maxV + "\n" + minW);
			
		}
	}
}

Measured memory_bytes: 0
// https://atcoder.jp/contests/abc133/tasks/abc133_a

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF (1e9)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define LEN(x) (sizeof(x) / sizeof(*(x)))
// ll gcd(long a, long b) { return b ? gcd(b, a % b) : a; }
// ll lcm(long a, long b) { return a * b / gcd(a, b); }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(n * a, b) << endl;

    return 0;
}

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

using namespace std;

int main(){
  int n,tmp;
    cin >> n;    
  vector<int> a(n);
  for(int A=0;A<n;++A){
    cin >> a[A];
  }for(int b=0;b<n-1;++b){    
    for(int c=0;c<n-1;++c){
      if(a[c] > a[c+1]){
	tmp = a[c+1];
	a[c+1] = a[c];
	a[c] = tmp;
      }
    }
  }
  long long sum = 0;
  for(int i=0;i<n;++i){
    sum += a[i];
  }
 cout << a[0] << " " << a[n-1] << " " << sum << endl;

 return 0;
}


Measured memory_bytes: 3148
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		int[] s=sc.Ia;
		long q=0;
		StringBuilder sb=new StringBuilder();
		sb.Append("Yes\n");
		for(int i = 1;i<=s[0];i++) {
			int[] a=new int[s[1]];
			if(i%s[2]==0){
				for(int j = s[3]-1;j<s[1];j+=s[3]) {
					a[j]-=(int)1e9;
					q-=(int)1e9;
				}
			}
			if(i%s[2]==1||s[2]==1){
				for(int j = 0;j<s[1];j+=s[3]) {
					a[j]=(int)1e9-1;
					q+=(int)1e9-1;
				}
			}
			sb.Append(String.Join(" ",a)+"\n");
		}
		if(q<=0){Console.WriteLine("No");}
		else{Console.Write(sb);}
	}
}
public class Sc{
	private string[] a;
	private int n=-1,m=0;
	public int I{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return int.Parse(a[n]);}}
	public long L{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return long.Parse(a[n]);}}
	public double D{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return double.Parse(a[n]);}}
	public string S{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return a[n];}}
	public int[] Ia{get{if(n!=-1&&n!=a.Length-1){m=n;n=-1;return Array.ConvertAll(a.Skip(m+1).ToArray(),int.Parse);}return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

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

const int64_t mod = 998244353;

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

	int64_t N, X, M;
	cin >> N >> X >> M;

	int64_t curr = X, ans = X;
	vector<int> seen(M+5);
	seen[curr] = 1;

	for (int64_t i = 2; i <= N; ++i) {
		curr = (curr*curr)%M;
		// cout << curr << " " << seen[curr] << endl;
		ans += curr;
		if (seen[curr]) {
			int64_t rem = N-i;
			// cout << "rem " << rem << endl;
			// cout << rem << endl;
			vector<int64_t> cunt;
			int64_t at = (curr*curr)%M, s = curr;
			while (at != curr) {
				cunt.push_back(at);
				s += at;
				at = (at*at)%M;
			}
			cunt.push_back(curr);
			// for (int64_t c : cunt) {
			// 	cout << " f " << c << endl;
			// }
			if (rem < cunt.size()) {
				for (int j = 0; j < rem; ++j) {
					ans += cunt[j];
				}
			} else {
				ans += (rem/cunt.size())*s;
				// cout << (rem/cunt.size()) << "*" << s << endl;
				rem = (rem%cunt.size());
				for (int j = 0; j < rem; ++j) {
					ans += cunt[j];
				}
			}
			break;
		}
		seen[curr] = 1;
	}

	cout << ans << endl;

	
}

Measured memory_bytes: 4272
#define _CRT_SECURE_NO_WARNINGS

//#include "stdafx.h"
#include "iostream"
#include "fstream"
#include "algorithm"
#include "iomanip"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "map"
#include "set"
#include "list"
#include "deque"
#include "complex"
#include "bitset"
#include "cmath"
#include "unordered_set"
#include "unordered_map"
#include "iterator"
#include <ctime>
#include <cassert>
#include "numeric"
#include <cstdio>
#include "random"
#include "chrono"
#include "cstring"

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target_ans("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

//#define f(i,n) for(int i=0; i<n;i++)
//#define rf(i, n) for(int i=n-1;i>=0;i--)
//#define forn(i, j, n) for(int i=j; i<n; i++)
//#define ff(i, j, n) f(i, n)f(j, n)
#define pb emplace_back
#define maxi(a,b) a = max(a, b);
#define mini(a,b) a = min(a, b);
#define endl '\n'

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sqr(x) ((x) * (x))
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
//typedef long long ll;
typedef long double ld;

#define int long long
//#define int unsigned int
#define double ld
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<char> vc;
typedef vector<vi> vvi;

template<class T>
void show(const vector<T> &a)
{
	for (T x : a)
		cout << x << " ";
	cout << endl;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

vi xx = { 1, 0, -1, 0 };
vi yy = { 0, 1, 0, -1 };
string dir = "LRUD";

const int N = 3e5 + 50, oo = 2e18 + 500;
//const int mod = 998244353;
const int mod = 1e9 + 7;
//const int mod = 1e9 + 9;
const double eps = 1e-6, PI = 2 * acos(0.0);
int n, m, k;
long long cnt = 0;
int lg = 18;
vi g[N];
//vi rg[N];
vi visit(N, 0);

int sum(int b, int n)
{
	int ret = 0;
	while (n)
	{
		ret += n % b;
		n /= b;
	}
	return ret;
}

vi t;

void add(int ind, int v)
{
	for (int i = ind; i < SZ(t); i += i&-i)
	{
		t[i] += v;
	}
}

int get(int ind)
{
	int ret = 0;
	for (int i = ind; i; i -= i&-i)
	{
		ret += t[i];
	}
	return ret;
}

signed main()
{
	ios::sync_with_stdio(0);
	cout.tie(0); cin.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	cin >> n >> k;

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

	cnt = 0;
	vvi dp(n, vi(n));
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			dp[i][(i - j + n) % n] = a[j];
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 1; j < n; j++)
		{
			mini(dp[i][j], dp[i][j - 1]);
		}
	}

	cnt = oo;
	for (int x = 0; x < n; x++)
	{
		int val = k*x;
		for (int i = 0; i < n; i++)
		{
			val += dp[i][x];
		}
		mini(cnt, val);
	}

	cout << cnt;
}



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

using namespace std;

int main()
{
	// 入力
	int N;
	cin >> N;
	vector<int> p(N);
	for (int i = 0; i < N; i++)
	{
		cin >> p[i];
	}
	
	int count = 0;
	for (int i = 0; i < N; i++)
	{
		// 数列 p[i] の値が、{1, 2, ..., N}でない場合の個数を数える
		if (p[i] != i + 1)
		{
			count++;
		}
	}
	
	// 一度しかswapできないので、0個の場合は既に昇順、2個の場合swap
	if (count <= 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	
	// 出力
	return 0;
}

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

int main(){
int n;
cin >> n;
vector<ll> a(n);
for(int i = 0; i< n; i++)cin >> a[i];
int ans = 0;
for(int i = 0; i< n-2; i++){
  for(int j = i+1; j< n-1; j++){
    for(int k = j+1; k< n; k++){
       if(a[i] != a[j] && a[j] != a[k] && a[k] != a[i] && a[i]+a[j]>a[k] && a[j]+a[k]>a[i] && a[k]+a[i]>a[j]) ans++;
        }
     }
 }
cout << ans << endl;
return 0;
}



Measured memory_bytes: 3624
#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
soko = a[0]
urine = 0
ans = 1000
for i in range(len(a) - 1):
    if a[i] < a[i + 1]:
        ans += (ans // a[i]) * (a[i + 1] - a[i])
    #print(ans)
print(ans)


Measured memory_bytes: 9172
#include<stdio.h>
#include<string.h>


int main(){
  int a,b;
  int p=0;
  scanf("%d %d",&a,&b);
  
  if(a>b){
    p = p + a + a - 1;
  }
  else if(a<b){
    p = p + b + b - 1;
  }
  else
    p = p + a + b;
  
 printf("%d",p);
  return 0;
}

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

using namespace std;
long long a[10001];
long long x;
int main(){
    cin >> x;
    long long n = pow(1e18,1.0/5);
    for (long long i = 1; i <= n; i++) a[i] = i*i*i*i*i;
    for (long long i = n + 1; i <= 2*n; i++){
        long long temp = i - n;
        a[i] = - (temp*temp*temp*temp*temp);
    }
    long long p , q;
    for (int i = 0; i <= 2*n; i++)
        for (int j = 0; j <= 2*n; j++)
            if (a[i] - a[j] == x){
                p = ((i <= n) ? i : -(i - n)) , q = ((j <= n) ? j : -(j - n));
                //cout << p << " " << q << "\n";
            }
    cout << p << " " << q;
    return 0;
}

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

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

int main()
{
    ll N; cin >> N;
    ll ans = 0;
    rep(i,N) {
        if ((i+1) % 3 == 0) {
        }
        else if ((i+1) % 5 == 0) {
        }
        else {
//            cout << i+1 << endl;
            ans += (i+1);
        }

    }
    cout << ans << endl;

}


Measured memory_bytes: 3596
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int n,m; cin>>n>>m;
    vector<ip> bl(m);
    rep(i,m)cin>>bl[i].second>>bl[i].first;
    sort(bl.begin(),bl.end());
    int ans = 1, lim = bl[0].first;
    REP(i,m-1){
        if(bl[i].second>=lim){
            ++ans; lim = bl[i].first;
        }
    }
    cout<<ans<<endl; return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <string>
#include <queue>
#include <vector>
using namespace std;

struct Ope {
	string name;
	int time;
};

int main()
{
	Ope c;
	queue<Ope> que;
	int n, q, total = 0;
	cin >> n >> q;

	for (int i = 0; i < n; i++) {
		cin >> c.name >> c.time;
		que.push(c);
	}

	while (true) {
		if (que.size() == 0) break;
		c = que.front(); que.pop();
		if (c.time - q < 1) {
			total += c.time;
			cout << c.name << " " << total << "\n";
		}
		else {
			c.time -= q;
			que.push(c);
			total += q;
		}
	}
}


Measured memory_bytes: 6348
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  if(n == 1) cout << 1;
  else if(n % 2== 0) cout << 0.5;
  else cout << double((n/2) + 1)/double(n) ;
 return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	//"strings"
)

func main() {
	var n int
	fmt.Scan(&n)
	p := scanNums(n)
	count := 0
	for i := 0; i < n; i++ {
		if p[i] != i+1 {
			count++
		}
	}
	if count == 2 || count == 0 {
		fmt.Print("YES")
	} else {
		fmt.Print("NO")
	}
}

func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

Measured memory_bytes: 512
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define  div "%lld"
#define  pdiv "%lld\n"
using namespace std;
///check n=1;
///check corner case;
map<ll,ll>check,str;

int main()
{
    FIO;
     ll n,m;
     cin>>n>>m;
     ll x=n*(n-1);
     x/=2;
     x+=(m*(m-1))/2;
     cout<<x<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int x,y,z,i=1,ans=0;
  cin>>x>>y>>z;
  while(1){
    int n=i*y+(i+1)*z;
    if(n>x) break;
    else ans=i;
    i++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<ll,ll>
#define maxn 100005
using namespace std;
bool cmp(pii a,pii b)
{
	return a.fi < b.fi;
}
signed main()
{
    fast;
   
    ll n,t,i,j;
    cin>>n>>t;
    vector<pii> v;
    for(i=0;i<n;i++)
    {
    	ll a,b;
    	cin>>a>>b;
    	v.pb({a,b});
    }
    sort(v.begin(),v.end(),cmp);
    ll ans = 0;
    ll dp[n+2][t+3001];
    memset(dp,0,sizeof(dp));
    for(i=0;i<n;i++)
    {
    	for(j=0;j<t+3001;j++)
    	{
    		dp[i+1][j] = dp[i][j];
    	}
    	for(j=0;j<t;j++)
    	{
    		dp[i+1][j+v[i].fi] = max(dp[i+1][j+v[i].fi] , v[i].se + dp[i][j]);
    	}
    }
    cout << *max_element(dp[n]+0, dp[n]+(t+3001));
}

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

#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, init, n) for (int i = init; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

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

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

    int A, B;
    while (cin >> A >> B)
    {
        cout << A + B << endl;
    }
    
    return 0;
}


Measured memory_bytes: 2984