akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
void read(pp& x){ scanf("%d%d",&x.first, &x.second); }
void read(pll& x){ scanf("%lld%lld",&x.first, &x.second); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
void cppio(){ ios_base::sync_with_stdio(0); cin.tie(0); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define sz(x) (int)(x).size()

int main()
{
	cppio();

	ll S;
	read(S);

	ll x1 = 1e9;
	ll y2 = (S + x1 - 1) / x1;
	ll y1 = 1;
	ll x2 = x1*y2 - S;

	printf("0 0 %lld %lld %lld %lld\n", x1, y1, x2, y2);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long int;
int main() {
    ll K, S;
    cin >> K >> S;
    
    ll sum = 0;
    for (ll i = 0; i <= K; i++) {
        for (ll j = 0; j <= K; j++) {
            if (0 <= S - i - j && S - i - j <= K) {
                sum += 1;
            }
        }
    }
    cout << sum << endl;
}

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

using namespace std;

vector<vector<char>> rec(301,vector<char>(301,'#'));

int main(){
  int h[300],w[300],cnt = 0;
  while(1){
    cin >> h[cnt] >> w[cnt];
    if(h[cnt] == 0 && w[cnt] == 0) break;
    cnt++;
  }

  for(int k=0;k < cnt;k++){
    for(int i=0;i < h[k];i++){
      for(int j=0;j < w[k];j++){
        cout << rec.at(i).at(j);
        if(j == w[k]-1) cout << "\n";
      }
    }
    cout << "\n";
  }
  return 0;
}


Measured memory_bytes: 3116
#include <iostream>

using namespace std;
int main () {
    int i = 0;
    int j = 0;
    string s;
    cin >> s;
    for (auto c : s) {
        if (c == 'A' || c == 'C' || c == 'G' || c == 'T') {
            j++;
        } else {
            if (j > i) { i = j;}
            j = 0;
        }
    }
    if (j > i) { i = j; }
    cout << i << "\n";
}


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

int main() {
  int n, d_i1, d_i2, series = 0;
  cin >> n;
  for (int i = 0; (i < n) && (series != 3); ++i) {
    cin >> d_i1 >> d_i2; 
    series += (d_i1 == d_i2);
    if (d_i1 != d_i2)
      series = 0;
  }
  if (series == 3)
    cout << "Yes" << '\n';
  else
    cout << "No" << '\n';
}

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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

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

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

ll ans = 0;
ll n, m, q;
vll v(15);
vll a, b, c, d;

void check() {
  ll p = 0;
  rep(i, q) {
    if (v[b[i]] - v[a[i]] == c[i]) {
      p += d[i];
    }
  }
  chmax(ans, p);
}

void dfs(int idx) {
  if (idx > n) {
    check();
    return;
  }
  for (int i = v[idx - 1]; i <= m; i++) {
    v[idx] = i;
    dfs(idx + 1);
  }
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  cin >> n >> m >> q;
  a = vll(q);
  b = vll(q);
  c = vll(q);
  d = vll(q);
  rep(i, q) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  v[1] = 1;
  dfs(2);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using vin=vector<int>;
const int inf=1e9+7;
const ll INF=1e18;

int main() {
  int n;
  cin>>n;
  n%=10;
  if(n==2 ||n==4 ||n==5 ||n==7 ||n==9 ){
    cout<<"hon"<<endl;
  }
  else if(n==0||n==1 ||n==6 ||n==8 ){
    cout<<"pon"<<endl;
    }
  else{
    cout<<"bon"<<endl;
  }
}

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

using namespace std;

const int N = 101110;
int A[N];
vector <int> canTake;
int n;

int main(){
   // freopen("TASK.inp", "r", stdin);
    //freopen("TASK.out", "w", stdout);

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

    sort(A+1, A+n+1);

    for(int i=n; i>=1; i--){
        if(A[i] == A[i-1]){
            canTake.push_back(A[i]);
            i--;
        }
    }

    if (canTake.size() < 2)
        puts("0");
    else
       cout <<(long long)canTake[0] * canTake[1] << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <regex>
#include <stack>
#include <queue>
#include <vector>
#define MAX_N 100
#define INF 10000000

using namespace std;


int n;
string s;
int a[200000];

void solve() {
	string a = "No";
	if (s.rfind('F') != string::npos&&s.find('C') < s.rfind('F')) a = "Yes";
	cout << a << endl;
}

int main() {
	cin >> s;
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
int main(){
    int n, yen;
    cin >> n >> yen;
    int flag=0, a, b, c;
    for(int i=0;i<=n;i++){
        for(int j=0;i+j<=n;j++){
            if((10000*i+5000*j+1000*(n-i-j))==yen){
                flag = 1;
                a = i; b = j; c = (n-i-j);
            }

        }
    }
    if(flag==0)
        cout << "-1 -1 -1" << '\n';
    else
        cout << a << " " << b << " " << c << " " << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  vector<int> p(n);
  for(int i=0; i<n; i++){
    cin >> p[i];
  }
  
  int j=0;
  int num=0;
  while(j<n-2){
    if(p[j] >= p[j+1] && p[j+2] < p[j+1]){
      num++;
    }
    else if(p[j] > p[j+1] && p[j+2] <= p[j+1]){
      num++;
    }
    else if(p[j] <= p[j+1] && p[j+2] > p[j+1]){
      num++;
    }
    else if(p[j] < p[j+1] && p[j+2] >= p[j+1]){
      num++;
    }
    j++;
  }
  
  cout << num << endl;
}


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

int main(){
  int n;
  cin >>n;
  vector<int> a(n);
  map<int, int> mp;
  ll sum = 0;
  rep(i,n){
    cin >>a[i];
    sum += a[i];
    mp[a[i]]++;
  }
  int q; cin >>q;
  rep(i,q){
    int b,c;
    cin >>b >>c;
    sum += (c-b)*mp[b];
    mp[c] += mp[b];
    mp[b] = 0;
    cout << sum << endl;
  }
  return 0; 
}

Measured memory_bytes: 7920
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const ll INF = 10000000000;//INFinity
using namespace std;//namespace

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}//transform
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//#define int long long // yabai

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout

#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define ALL(obj) (obj).begin(),(obj).end()// iterator

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){

    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n)cin>>a[i];

    // 2 nara 2or4 1 nara 4

    int four_=0;
    int two_=0;
    int one_=0;
    REP(i,n){
        if(a[i]%4==0)four_++;
        else if(a[i]%2==0)two_++;
        else one_++;
    }

    four_-=one_;
    if(two_==0)four_++;
    cout<<(four_<0?"No":"Yes")<<endl;

    return 0;
}


Measured memory_bytes: 640
from collections import Counter

n,m = map(int,input().split())
l1 = []

for i in range(m):
    l1.append(list(map(int,input().split())))

l1 = list(set(list(map(tuple, l1))))

ans = ''
for i in range(len(l1)):
    for j in range(len(l1)):
        if i < j:
            if l1[i][0] == l1[j][0]:
                ans = -1
                
if n > 1:
    for i in range(len(l1)):
        if l1[i][0] == 1 and l1[i][1] == 0:
            ans = -1
            
if not ans == -1:
    for i in range(1,n+1):
        new = ''
        for j in range(len(l1)):
            if i == l1[j][0]:
                new = str(l1[j][1])
        if len(new) == 0:
            if i == 1 and n != 1:
                new = '1'
            else:
                new = '0'
        ans = ans + new
print(ans)
    

Measured memory_bytes: 3444
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.parseLong;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
//import static java.lang.System.*;

import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		int[] a = new int[n];
		int max1=0;
		int max2=0;
		int i1 = -1;
		int i2 = -1;
		for(i=0;i<n;i++) {
			a[i] = parseInt(sc.next());
			if(max1<a[i]) {
				max1=a[i];
				i1=i;
				continue;
			}
			if(max2<a[i]) {
				max2=a[i];
				i2=i;
			}
		}
		sc.close();
		PrintWriter out = new PrintWriter(System.out);
		for(i = 0; i < n; i++) {
			if(i==i1) {
				out.println(max2);
			} else {
				out.println(max1);
			}
		}
		out.flush();
	}
}


Measured memory_bytes: 51056
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

long long n, k;
vector<pair<long long, long long>> v;

long long solve();

int main() {
  cin >> n >> k;
  for(int i = 0; i < n; ++i) {
    long long x, y;
    cin >> x >> y;
    v.push_back(make_pair(x, y));
  }
  sort(v.begin(), v.end());
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long now = 0, sum = 0;
  while(sum + v[now].se < k) {
    sum += v[now].se;
    ++now;
  }
  return v[now].fi;
}

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

int N;
long long a[10000];

int main() {
    cin >> N;
    rep(i, N) cin >> a[i];

    long long ans = 0;
    rep(i, N) {
        while (a[i] % 2 == 0) {
            a[i] = a[i] / 2;
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int ans = 1001001001;
		for (int i = 0; i < s.length() - 2; i++) {
			int tmp = Integer.parseInt(s.substring(i, i + 3));
			ans = Math.min(ans, Math.abs(753 - tmp));
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 1001001001001001001;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
    ll N,K;
    cin >> N >> K;
    ll ans = 0;
    while(N){
        N /= K;
        ans++;
    }
    cout << ans << endl;
}


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

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

    ll ans = 0;
    rep(i, m) {
        int a;
        cin >> a;
        ans += a;
    }

    cout << max(n - ans, -1ll) << endl;
    return 0;
}


Measured memory_bytes: 3620
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)


"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
n = ip()                                     #入力整数1つ
#s,c= (int(i) for i in input().split())       #入力整数横2つ以上
a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文

a.sort()
cnum = a[0]
ct = 1
s = 0
if n==1:
    if a[0] != 1:
        print(1)
        j(-1)
    else :
        print(0)
        j(-1)
for i in range(1,n):
    if a[i] != cnum:
        if ct != cnum:
            if ct > cnum:
                s+=ct-cnum
            else : s+=ct
        ct = 1
        cnum = a[i]
    else:
        ct+=1
if ct != cnum:
    if ct > cnum:
        s += ct - cnum
    else:
        s += ct
print(s)

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

typedef struct d{
  int p;
  int d;
  int k;
  int *key;
}data;

data *tree;

void dataprinter(data out){
  puts("-----data-----");
  printf("p=%d d=%d k=%d\n",out.p, out.d, out.k);
  for(int i=0; i<out.k; i++){
    printf("%d ",out.key[i]);
  }
  printf("\n");
  puts("=====data=====");
}

void init(int n){
  int i;
  for(i=0; i<n; i++){
    tree[i].p = -1;
    tree[i].d = 0;
    tree[i].k = 0;
  }
}

void maketree(void){
  int i, id;

  scanf("%d ",&id);
  scanf("%d ",&tree[id].k);
  tree[id].key = (int *)malloc(sizeof(int) * tree[id].k);
  for(i=0; i<tree[id].k; i++){
    scanf("%d",&tree[id].key[i]);
    tree[tree[id].key[i]].p = id;
    tree[tree[id].key[i]].d = tree[id].d + 1;
  }
}

int isParent(int i){
  if(tree[i].p == -1) return 0;
  else return (isParent(tree[i].p)) + 1;
}

void printer(int n){
  int i,j;

  for(i=0; i<n; i++){
    printf("node %d: parent = %d, depth = %d, ",i, tree[i].p, tree[i].d);
    if(tree[i].d == 0){
      printf("root, [");
      for(j=0; j<tree[i].k; j++){
        printf("%d",tree[i].key[j]);
        if(j != tree[i].k-1) printf(", ");
      }
      printf("]\n");
    }
    else if(tree[i].k == 0){
        printf("leaf, []\n");
    }
    else{
      printf("internal node, [");
      for(j=0; j<tree[i].k; j++){
        printf("%d",tree[i].key[j]);
        if(j != tree[i].k-1) printf(", ");
      }
      printf("]\n");
    }
  }

}

int main(){
  int i, n;

  scanf("%d",&n);
  tree = (data *)malloc(sizeof(data) * n);
  init(n);
  for(i=0; i<n; i++){
    maketree();
  }
  for(i=0; i<n; i++){
    // dataprinter(tree[i]);
    tree[i].d = isParent(i);
  }
  printer(n);

  return 0;
}



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

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

int main(void){
	int N=0,K=0,min=0;
	scanf("%d %d",&N,&K);
  int h[N];
  for(int i=0;i<N;i++){
  	scanf("%d",&h[i]);
  }
	qsort(h,N,sizeof(int),comp);
  min=h[N-1]-h[0];
	for(int i=0;i<N-K+1;i++){
    	if(min>h[i+K-1]-h[i]) min=h[i+K-1]-h[i];
    }
  printf("%d",min);
	return 0;
}

Measured memory_bytes: 892
import scala.io.StdIn._

object Main{
    def main(args:Array[String]){
        val s  = readLine.split(" ").map(_.toInt)
        var f = false
        for (i <- 1 to s(1)) {
            if (s(0) * i % s(1) == s(2)) {
                f = true
            }
        } 
        if (f) {
            printf("YES\n")
        } else {
            printf("NO\n")
        }
    }
}

Measured memory_bytes: 25412
#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b; return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b; return true;
    }
    return false;
}
#define pb push_back
#define mp make_pair
#define mt make_tuple

string longest(const vector<string> strs) {
    string ret = "";
    for(auto &str: strs) {
        if (SIZE(str) > SIZE(ret)) ret = str;
    }
    return ret;
}

int main(void)
{
    cin.sync_with_stdio(false);
    string s;
    string t;
    cin >> s >> t;
    int a = SIZE(s);
    int b = SIZE(t);

    // 文字列の長さ
    vector<vector<int>> dp(a + 1, vector<int>(b + 1));
    // 3方向のうちどの方向で文字列を長くしたか
    vector<vector<int>> bt(a + 1, vector<int>(b + 1));

    REP(i, a) {
        REP(j, b) {
            auto cand1 = dp[i + 1][j];
            auto cand2 = dp[i][j + 1];

            if (s[i] == t[j]) {
                auto cand3 = dp[i][j] + 1;
                if (cand3 >= cand1 && cand2 >= cand1) {
                    dp[i + 1][j + 1] = cand3;
                    bt[i + 1][j + 1] = 3;
                }
                else if (cand1 >= cand2) {
                    dp[i + 1][j + 1] = cand1;
                    bt[i + 1][j + 1] = 1;
                } else {
                    dp[i + 1][j + 1] = cand2;
                    bt[i + 1][j + 1] = 2;
                }
            } else {
                if (cand1 >= cand2) {
                    dp[i + 1][j + 1] = cand1;
                    bt[i + 1][j + 1] = 1;
                } else {
                    dp[i + 1][j + 1] = cand2;
                    bt[i + 1][j + 1] = 2;
                }
            }            
        }
    }

    // cout << "dp: " << endl;
    // REP(i, a + 1) {
    //     REP(j, b + 1) { 
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    // cout << "backtrace: " << endl;
    // REP(i, a + 1) {
    //     REP(j, b + 1) { 
    //         cout << bt[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    string ans;
    int i = a;
    int j = b;

    int cnt = 0;
    while(!(i == 0 || j == 0)) {
        // cout << "i, j = " << i << ", " << j << endl;
        if (bt[i][j] == 1) {
            --j;
        }
        else if (bt[i][j] == 2) {
            --i;
        }
        else if (bt[i][j] == 3) {
            ans += s[i-1];
            --i; --j;
        }
        ++cnt;
    }
    reverse(ALL(ans));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 70912
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	int n,m;scanf("%d%d",&n,&m);
	if(m<=0 && m+n-1>=0)
		printf("%d\n",(m+n-1+m)*n/2);
	else{
		if(m+n-1<0) printf("%d\n",(m+n-2+m)*(n-1)/2);
		else printf("%d\n",(m+1+m+n-1)*(n-1)/2);
	}
	
	return 0;
}

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

int main() {
string s;
cin >> s;
int N = s.size();
for (int k = 0; k < N ; k++) {
if (s.at(k) == 'a') {
cout << "vowel" << endl;
break;
}
if (s.at(k) == 'i') {
cout << "vowel" << endl;
break;
}
if (s.at(k) == 'u') {
cout << "vowel" << endl;
break;
}
if (s.at(k) == 'e') {
cout << "vowel" << endl;
break;
}
if (s.at(k) == 'o') {
cout << "vowel" << endl;
break;
}
if (k == N-1) {
  cout << "consonant" << endl;
  break;
}
}
}


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

int main() {
	int r=0;
	string A,B;
	cin >> A >> B;

	if(A.size() > B.size())
		r = 1;
	else if(A.size() < B.size())
		r = -1;
	else
		rep(i,A.size())
			if(A.at(i) > B.at(i)) {
				r = 1;
				break;
			} else if(A.at(i) < B.at(i)) {
				r = -1;
				break;
			}

	if(r == 1)
		cout << "GREATER";
	else if(r == -1)
		cout << "LESS";
	else
		cout << "EQUAL";
	cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	cout<<(n>=30?"Yes":"No")<<endl;
	return 0;
}


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


int main(void) {
    string s, t;
    cin >> s >> t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    if(s < t)cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include<cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include<iostream>
#include<list>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include <vector>

#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)

using namespace std;

int main(){
	int N, K, x[100000];
	ll ans, left, right, tmp;
	cin >> N >> K;
	REP(i, N){
		scanf(" %d", &x[i]);
	}
	
	ans = 2000000000000000;
	REP(i, N - K + 1){
		left = x[i];
		right = x[i + K - 1];
		if (left*right >= 0){
			ans = min(ans, max(abs(left), abs(right)));
		}
		else{
			tmp = 2 * min(-1 * left, right) + max(-1 * left, right);
			ans = min(ans, tmp);
		}
	}

	

	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;


int main() {

    long X;
    cin >> X;

    long sum = 0;

    sum += (X / 500L) * 1000;

    sum += ((X % 500L) / 5) * 5;
    cout << sum << "\n";

    return 0;
}


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

using namespace std;

typedef long long ll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define fi first
#define si second
#define pb push_back
#define all(name) (name.begin(), name.end())
#define fact(n) vector<ll> ft(1, 1LL);rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod);
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) ((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod)
#define deb(x) cerr << "[" << #x << " " << x << << "]\n";
// #define int ll

ll power(ll x, ll y) {
     ll res = 1;x %= mod;
    while (y > 0) {
        if (y & 1)res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}
/*================================================================*/




void solve() {
    int k;
    ll ans = 0;
    cin >> k;
    rep(i, 1, k+1){
        rep(j, 1, k+1){
            ll x = __gcd(i, j);
            rep(l, 1, k+1)ans += __gcd(x, l);
        }
    }
    cout << ans;
}

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


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define mod 1000000007
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
bool vis[200005];
vector<int> vec[2000005], v1;
int child[2000005];
int parent[2000005];
int div1[100005];
int min_indx[200005];
int count1 = 0;
int height = 0;
int max_indx[200005];
void dfs(int node)
{

    vis[node] = 1;

    min_indx[count1] = node;
    max_indx[node] = min(max_indx[node], count1);
    count1++;

    //  count1++;
    child[node] = height++;
    for (int i = 0; i < vec[node].size(); i++)
    {
        if (!vis[vec[node][i]])
        {
            dfs(vec[node][i]);
            min_indx[count1] = node;
            max_indx[node] = min(max_indx[node], count1);
            count1++;
        }
    }
    height--;
}
int MAXN = 200005;
int LOGMAXN = (int)log2(200005) + 1;
int M[200005][60];
int ans[200005];
void fun(int a, int b, int c)
{
    //ll val = 1;

    while (a <= b)
    {
        ans[a] += c;
        int p = -a;
        a += (a & p);
    }
}
int find1(int a)
{
    int sum = 0;
    while (a != 0)
    {
        sum += ans[a];
        int p = -a;
        a -= (a & p);
    }
    return sum;
}
void process2(int A[], int N)
{
    int i, j;

    for (i = 0; i < N; i++)
        M[i][0] = i;
    for (j = 1; 1 << j <= N; j++)
        for (i = 0; i + (1 << j) - 1 < N; i++)
            if (find1(M[i][j - 1]) < find1(M[i + (1 << (j - 1))][j - 1]))
                M[i][j] = M[i][j - 1];
            else
                M[i][j] = M[i + (1 << (j - 1))][j - 1];
}
int arr1[1000005], arr2[1000005];
int32_t main()
{
    FAST;
    int a, b;
    int n;
    cin >> n;
    int k;
    cin >> k;
    int ans = 1;
    for (int i = 0; i < n; i++)
    {
        ans = min(2 * ans, ans + k);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 50484
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int N;
  cin >> N;
  vector<ll> h(N);
  ll dp[N];

  rep(i, N){
    cin >> h[i];
    dp[i] = -1;
  }
  dp[0] = 0;
  dp[1] = abs(h[1]-h[0]);
  for(int i = 2; i < N; i++){
    dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]));
  }
  cout << dp[N-1] << endl;

}


Measured memory_bytes: 1792
def main():
    s = input()

    n_cnt = s.count("N")
    w_cnt = s.count("W")
    s_cnt = s.count("S")
    e_cnt = s.count("E")

    if (n_cnt == 0 and s_cnt == 0) or (n_cnt > 0 and s_cnt > 0):
        if (w_cnt == 0 and e_cnt == 0) or (w_cnt > 0 and e_cnt > 0):
            print("Yes")
            exit()

    print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 61936
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;

ll Pow(ll n, ll k) {
	ll ans = 1, a = n % MOD;
	while (k > 0) {
		if (k & 1) {
			ans *= a;
			ans %= MOD;
		}
		a *= a;
		a %= MOD;
		k >>= 1;
	}
	return ans;
}

ll Inverse(ll a) {
	return Pow(a, MOD - 2);
}

void Facto_Ini(vector<ll> &k) {
	ll a = 1, i;
	for (i = 1; i < k.size(); i++) {
		a *= i;
		a %= MOD;
		k[i] = a;
	}
	return;
}

ll Combi(int n, int a, vector<ll> &k) {
	a = min(n - a, a);
	if (a < 0)
		return 0ll;
	if (a == 0)
		return 1ll;
	ll ans = k[n] * Inverse(k[a]);
	ans %= MOD;
	ans *= Inverse(k[n - a]);
	ans %= MOD;
	return ans;
}

int main(void) {
	int num, i, l, a;
	ll ans;
	cin >> num;
	num++;
	vector<int> p(num, 0);
	vector<ll> k(num + 1, 0);
	for (i = 1; i <= num; i++) {
		cin >> a;
		if (!p[a])
			p[a] = i;
		else {
			l = p[a];
			l += num - i - 1;
			break;
		}
	}
	Facto_Ini(k);
	for (i = 1; i <= num; i++) {
		ans = Combi(num, i, k) - Combi(l, i - 1, k);
		if (ans < 0)
			ans += MOD;
		cout << ans << "\n";
	}
	return 0;
}	

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

int main(void){
    string s;
    cin >> s;
    int goo = 0, cnt=0;
    for(int i=0;i<s.size();++i){
        if(s[i]=='g'){
            if(goo<=0) ++goo;
            else{
                ++cnt;
                --goo;
            }
        }else{
            if(goo<=0){
                --cnt;
                ++goo;
            }else{
                --goo;
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<map>
#include<stdlib.h>
using namespace std;

int main(){
    long long n, k;
    cin >> n >> k;
    vector<long long> a(n),b(n,0),c(n,0);
    for(int i=0;i<n;i++)cin >> a[i];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i<j&&a[i]<a[j])b[j]++;
            if(i>j&&a[i]<a[j])c[j]++;
        }
    }
    long long ans=0,t=(k*(k-1)/2)%1000000007;
    for(int i=0;i<n;i++){
        ans+=k*c[i]+(c[i]+b[i])*t;
        ans%=1000000007;
        /*ans=(ans+c[i]*k*(k+1)/2)%1000000007;
        ans=(ans+b[i]*k*(k-1)/2)%1000000007;*/
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

int dp[100000];

int main()
{
    string s;
    cin >> s;
    if(s[0] == s[1] && s[1] == s[2]){
        cout << "No";
    }else{
        cout << "Yes";
    }

}

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

int main() {
  std::ios_base::sync_with_stdio(false);
      std::cin.tie(NULL);
// int n;
// std::cin >>n;
// while (n>0) {
//    n-=1000;
// }
// std::cout << abs(n) << '\n';
std::map<string, int> mapp;
int n;
std::cin >>n;
mapp["AC"]=0;
mapp["TLE"]=0;
mapp["WA"]=0;
mapp["RE"]=0;
while (n--) {
  string a;
  std::cin >>a;
  mapp[a]++;
}

std::cout <<"AC"<<" x"<< ' ';
std::cout <<mapp["AC"] << '\n';
std::cout <<"WA"<<" x"<< ' ';
std::cout <<mapp["WA"] << '\n';
std::cout <<"TLE"<<" x"<< ' ';
std::cout <<mapp["TLE"] << '\n';
std::cout <<"RE"<<" x"<< ' ';
std::cout <<mapp["RE"] << '\n';

return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define int long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define w(x) int x;cin>>x;while(t--)
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

 

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__);
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

const int POSITIVE_INFINITY = 9223372036854775807;
const int NEGATIVE_INFINITY = -9223372036854775807;
const int MOD = 1000000007;
const ld PI = acos(-1.0);
const int INF = 1e18;
const int MX = 1000001;


int32_t main() {
    io;
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
    double d,t,s;
    cin>>d>>t>>s;
    if(d/t<=s){
        cout<<"Yes";
    }
    else cout<<"No";
    
    
 
    return 0;
}


Measured memory_bytes: 3716
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <iomanip>
#include <assert.h>

using namespace std;

typedef long long ll;

string s;

ll ans;

int main()
{
	cin >> s;
	int cnt = 0;
	for (int i = 0;i < s.size();i++)
		if (s[i] == 'W')
		{
			ans += i - cnt;
			cnt++;
		}
	cout << ans << endl; 
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <utility>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)

using namespace std;

struct Obs
{
    int h;
    bool ok; 
};


int main(){
    int n,m;
    int cnt = 0;
    cin >> n >> m;
    vector<Obs> Ob(n);
    rep(i,n){
        cin >> Ob[i].h;
        Ob[i].ok = true;
    } 
    pair<int,int> L[m];
    rep(i,m){
        cin >> L[i].first >> L[i].second;
        L[i].first--;
        L[i].second--;
    } 
    rep(i,m){
        if(Ob[L[i].first].h == Ob[L[i].second].h) Ob[L[i].first].ok = Ob[L[i].second].ok = false;
        else if(Ob[L[i].first].h < Ob[L[i].second].h) Ob[L[i].first].ok = false;
        else Ob[L[i].second].ok = false;
    }
    rep(i,n){
        if(Ob[i].ok==true){
            cnt++;
        } 
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 4840
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define bitsz(x) int(__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
 
int main() {
    int n,r; cin >> n >> r;
    if (n>=10) cout << r << endl;
    else cout << r+100*(10-n) << endl;
}


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

void tree(vector<int> &h,int start,int end,int &ans){
	int t=*min_element(h.begin()+start,h.begin()+end+1);//木の高さ
	vector<int>::iterator min=min_element(h.begin()+start,h.begin()+end+1);
	int tmp=distance(h.begin(),min);
	ans+=t;
	for(int i=start;i<=end;i++)h[i]-=t;
	if(*max_element(h.begin()+start,h.begin()+end+1)>=0){
		if(tmp-1>=start)tree(h,start,tmp-1,ans);
		if(tmp+1<=end)tree(h,tmp+1,end,ans);
	}
}


signed main(){
	int N,ans;
	ans=0;
	cin>>N;
	vector<int> h(N);
	for(int i=0;i<N;i++)cin>>h[i];
	tree(h,0,N-1,ans);
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int anser(int A, int B, int C, int K) {
  int max;
  if (K <= A) {
    max = K;
    return max; }
  K -= A;
  if (K <= B) {
    max = A;
    return max; }
  K -= B;
  max = A - K;
  return max;
}
    
  

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  cout << anser(A, B, C, K) << endl;
}

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

class Dice{
	public:
	int face[6];
	
	Dice(){}
	void direction(char ch){
			if(ch == 'E') rotate(0,2,5,3);
			if(ch == 'W') rotate(0,3,5,2);
			if(ch == 'S') rotate(0,1,5,4);
			if(ch == 'N') rotate(0,4,5,1);
	}

	void rotate(int a,int b,int c,int d){
		int temp[4] = {};

		temp[0] = face[a];
		temp[1] = face[b];
		temp[2] = face[c];
		temp[3] = face[d];
		//ダイス入れ替え
		face[a] = temp[3];
		face[b] = temp[0];
		face[c] = temp[1];
		face[d] = temp[2];

	}
};

int main(){
	Dice dice1;
	string D;
	
	for(int i = 0;i < 6;i++){
		cin >> dice1.face[i];
	}
		cin >> D;
	for(int j = 0;j < D.size();j++){
		dice1.direction(D[j]);
	}
	cout << dice1.face[0] << endl;
	return 0;
}

Measured memory_bytes: 1204
using System;
using System.Linq;
using System.Collections.Generic;

namespace abc155
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            var temp = a.Where(s=>s%2==0);
            var ans = temp.Where(x => (x % 3 == 0 || x % 5 == 0)).Count() == temp.Count() ? "APPROVED " : "DENIED ";
            Console.WriteLine(ans);

        }
    }
}

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

using namespace std;

#define INF 100000000

struct edge {
	int to, cost;
};

int main() {
	int c, n, m, s, d;
	while (cin >> c >> n >> m >> s >> d) {
		if (c == 0 && n == 0 && m == 0 && s == 0 && d == 0) {
			break;
		}
		vector<edge> ff[101];
		vector< vector<int> > ddd(n+1, vector<int>(n+1, INF));
		int a, b, f;
		for (int i = 0; i < m; i++) {
			cin >> a >> b >> f;
			edge e;
			e.to = b;
			e.cost = f;
			ff[a].push_back(e);
			e.to = a;
			ff[b].push_back(e);
			ddd[a][b] = ddd[b][a] = f;
		}
		for (int i = 1; i <= n; i++) {
			ddd[i][i] = 0;
		}
		for (int k = 1; k <= n; k++) {
			for (int i = 1; i <= n; i++) {
				for (int j = 1; j <= n; j++) {
					ddd[i][j] = min(ddd[i][j], ddd[i][k]+ddd[k][j]);
				}
			}
		}
		vector<int> isd[101];
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				if (ddd[i][j] != INF) {
					isd[i].push_back(j);
				}
			}
		}
		vector< vector< vector<int> > > dp(n+1, vector< vector<int> >(n+1, vector<int>(c+1, INF)));
		for (int i = 1; i <= n; i++) {
			dp[s][i][0] = ddd[s][i];
		}
		for (int k = 1; k <= c; k++) {
			for (int p = 0; p < isd[s].size(); p++) {
				int pp = isd[s][p];
				dp[s][pp][k] = dp[s][pp][k-1];
				for (int i = 0; i < isd[s].size(); i++) {
					int ii = isd[s][i];
					
						for (int q = 0; q < ff[ii].size(); q++) {
							int qq = ff[ii][q].to;
							if (ddd[qq][pp] == INF) continue;
							if (dp[s][pp][k] > dp[s][ii][k-1]+(ff[ii][q].cost/2)+ddd[qq][pp]) {
								dp[s][pp][k] = dp[s][ii][k-1]+(ff[ii][q].cost/2)+ddd[qq][pp];
							}
						}
					
				}
			}
		}
		cout << dp[s][d][c] << endl;
	}
	return 0;
}

Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
#define ios std::ios::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int
#define PI acos(-1.0)
#define EPS 1e-9 //epsilon 10^-9, checking for equality 
#define pb push_back
#define fi first
#define se second
#define go(i,a,n) for(int i=a;i<n;i++)
#define og(i,a,n) for(int i=n-1;i>=a;i--)
#define rep(i,n) go(i,0,n)
#define per(i,n) og(i,0,n)
#define sz(x) (x.size())
#define isort(x) sort(x.begin(),x.end())
#define dsort(x) sort(x.rbegin(),x.rend())
#define all(x) x.begin(),x.end()
#define rall(x) (x).rbegin(),(x).rend()
#define pr(x) cout<<(x)<<endl
#define exist(e,s) ((s).find(e)!=(s).end()) //Element e in structure s
#define existstr(c,s) ((s).find(c) !=string::npos) //Character in structure
#define fo(x,s) for(auto &x:s) //for all x in structure s
typedef vector<int> vi;typedef vector<ll> vll;typedef vector< vector<int> > vvi;
typedef vector< vector<ll> > vvll;typedef pair<int,int> ii;typedef pair<int, pair<int,int> > iii;
typedef pair<ll,ll> pll;typedef vector<ii> vii;typedef vector<iii> viii;typedef map<int,int> mii;
const int inf=1e9+7; //10^9 +7
inline void rvi(vi& v, int n){int temp; go(i,0,n){cin>>temp;v.pb(temp);}}
inline void rvll(vll& v, int n){ll temp;go(i,0,n){cin>>temp;v.pb(temp);}}
inline void prvi(vi&a){go(i,0,a.size()){cout<<a[i]<<" ";}cout<<endl;}
inline void prvll(vll&a){go(i,0,a.size()){cout<<a[i]<<" ";}cout<<endl;}
inline void prmii(map<int,int>& m){for(auto x:m){cout<<x.fi<<" "<<x.se<<endl;}}
inline vll prefixsum(vi& a){vll b;b.pb(a[0]);go(i,1,a.size()){b.pb(a[i]+b[i-1]);}return b;}
inline vll suffixsum(vi& a){vll b(sz(a));b[sz(a)-1]=a[sz(a)-1];og(i,0,sz(a)-1){b[i]=a[i]+b[i+1];}return b;}
inline vll prefixsum(vll& a){vll b;b.pb(a[0]);go(i,1,a.size()){b.pb(a[i]+b[i-1]);}return b;}
inline vll suffixsum(vll& a){vll b(sz(a));b[sz(a)-1]=a[sz(a)-1];og(i,0,sz(a)-1){b[i]=a[i]+b[i+1];}return b;}
void solve();
int main(){ios;solve();return 0;}
//--------SOLVE---------------------------------------------------------------------
void solve()
{
	int n;cin>>n;
	int a[2][100];
	rep(i,2)
	{
		rep(j,n) cin>>a[i][j];
	}
	ll ans=-1;
	ll sum=0;
	rep(i,n)
	{
		ll sum=0;
		for(int k=0;k<=i;k++) sum+=a[0][k];
		for(int j=i;j<n;j++) sum+=a[1][j];
		ans= max(ans,sum);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[i];

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

class OSA_K{
public:
  vector<ll> minFactor;
  
  OSA_K(ll sz_):minFactor(sz_,-1){
    REP2(i,2,sz_){
      if(minFactor[i]==-1){
        for(ll j=i;j<=sz_;j+=i){
          minFactor[j]=i;
        }
      }
    }
  }

  void init(ll sz_){
    minFactor.assign(sz_,-1);
    REP2(i,2,sz_){
      if(minFactor[i]==-1){
        for(ll j=i;j<=sz_;j+=i){
          minFactor[j]=i;
        }
      }
    }
  }

  map<ll,int> OSAprime(ll n){
    map<ll,int> ret;
    while(n!=1){
      int cnt=0;
      int prime=minFactor[n];
      while(minFactor[n]==prime){
        cnt++;
        n/=prime;
      }
      ret[prime]+=cnt;
    }

    return ret;
  }
};

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


int main()
{
  ll N;
  cin >> N;
  vector<ll> A(N);
  REP(i, N) cin >> A[i];
  
  ll x=A[0];
  REP(i,N-1){
    x=gcd(x,A[i+1]);
  }

  if(x!=1){
    cout << "not coprime" << endl;
  }else{
    set<ll> st;
    int flag=0;
    OSA_K Osa(1000000);
    map<ll,int> mp;
    REP(i,N){
      for(auto x:Osa.OSAprime(A[i])){
        if(mp[x.fi]!=0){
          flag=1;
          break;
        }
        mp[x.fi]++;
      }
    }

    if(flag==1){
      cout << "setwise coprime" << endl;
    }else{
      cout << "pairwise coprime" << endl;
    }
  }
}

Measured memory_bytes: 23812
N = int(input())
A = [0]*N
for i in range(0, N):
    A[i] = int(input())
B = A.copy()
B.sort()
m1, m2 = B[N-1], B[N-2]
for i in range(0, N):
    if A[i] != m1:
        print (m1)
    else:
        print (m2)

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

#define ll long long
#define pb push_back
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cerr << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define _ ios_base::sync_with_stdio(0);cin.tie(NULL);

void solve() {
    ll n, m, k;
    cin >> n >> m >> k;
    ll a[n], b[m];
    for(ll i = 0; i<n; i++) cin >> a[i];
    for(ll i = 0; i<m; i++) cin >> b[i];
    ll pre1[n] = {}, pre2[m] = {};
    pre1[0] = a[0];
    for(ll i = 1; i<n; i++) pre1[i] = pre1[i-1] + a[i];
    pre2[0] = b[0];
    for(ll i = 1; i<m; i++) pre2[i] = pre2[i-1] + b[i];

    ll ans = 0;
    ll take = 0;
    ll rem = k - take;
    auto it = upper_bound(pre2, pre2+m, rem) - pre2;
    ll curr = (it);
    ans = max(ans, curr);
    for(ll i = 0; i<n; i++) {
        take = pre1[i];
        rem = k - take;
        if(rem < 0) continue;
        auto it = upper_bound(pre2, pre2+m, rem) - pre2;
        curr = (it + i + 1);
        ans = max(ans, curr);
    }
    cout << ans << '\n';
}

int main() {_
    int t = 1;
    //cin >> t;
    // Please remember to uncomment for taking test cases
    for(int i = 1; i<=t; i++) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 9900
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

struct UnionFind{
    int num;
    vector<int> par,rank;
    UnionFind(int n):num(n),par(n),rank(n,1){
        iota(all(par),0);
    }
    int root(int x){
        if (par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    bool merge(int x, int y){
        x=root(x),y=root(y);
        if (x==y) return false;
        if (rank[x]<rank[y]) swap(x,y);
        par[y]=x;
        rank[x]+=rank[y];
        --num;
        return true;
    }
    bool same(int x, int y){
        return root(x)==root(y);
    }
    int size(int x){
        return rank[root(x)];
    }
    int count(){
        return num;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M; cin >> N >> M;
    vector<int> deg(N,0);
    vector<Pii> es(M);
    rep(i,M){
        int a,b; cin >> a >> b;
        ++deg[--a],++deg[--b];
        es[i]={a,b};
    }
    int six=0,four=0;
    rep(i,N){
        if (deg[i]%2==1){
            cout << "No" << endl;
            return 0;
        }
        if (deg[i]==6) ++six;
        if (deg[i]==4) ++four;
    }
    if (six>=1||four>=3){
        cout << "Yes" << endl;
        return 0;
    }
    if (four<=1){
        cout << "No" << endl;
        return 0;
    }
    vector<int> fours;
    rep(i,N) if (deg[i]==4) fours.push_back(i);
    int u=fours[0],v=fours[1];
    UnionFind uf(N);
    bool ok=false;
    rep(i,M){
        int a=es[i].first,b=es[i].second;
        if (a==v||b==v) continue;
        if (uf.same(a,b)) ok=true;
        uf.merge(a,b);
    }
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 2176
// execute g++ main.cpp -std=c++14 -I C:\Users\naoya\Desktop\code\Atcoder
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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


char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

const ll mod = 1e9 + 7;

int main(){
    ll n; cin >> n;
    ll ans = 1, c1 = 1, c0 = 1;
    REP(i, 0, n){
        ans *= 10;
        ans %= mod;
        c1 *= 9;
        c1 %= mod;
        c0 *= 8;
        c0 %= mod;
    }
    ll ca = ((ans - c1 + mod) % mod) * 2, caa = (ans - c0 + mod) % mod;
    cout << (ca - caa + mod) % mod << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  string S,T;
  cin >> S >> T;
  int counter=0;
  for(int i=0; i<S.length(); i++){
    if(S.at(i)!=T.at(i)) counter++;
  }
  cout << counter << endl;
  return 0;
}


Measured memory_bytes: 3928
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

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

	string number;
	cin >> number;

	long long K;
	cin >> K;

	if (K == 1)
	{
		cout << number[0];
	}
	else
	{
		bool check_all_one = true;
		for (int i = 0; i < K; i++)
		{
			if (number[i] != '1')
			{
				cout << number[i];
				check_all_one = false;
				break;
			}
		}

		if (check_all_one)
		{
			cout << 1;
		}
	}

	return 0;
}


Measured memory_bytes: 256