akhauriyash/Code-Regression huggingface dataset:
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

// template version 2.0
using namespace std;
#include <bits/stdc++.h>

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T> inline void chmax(T &a, const T &b) { if ((a) < (b)) (a) = (b); }
template <class T> inline void chmin(T &a, const T &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define cdiv(a, b) (((a) + (b)-1) / (b))
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


int solve() {
    ll n;cin>>n;

    // rep(i, 1, n){
    //     if (n/i == n%i) {
    //         dump(i, n%i);
    //     }
    // }
    ll ans = 0;
    for(ll r=1; r * r <= n; r++){
        if ((n - r) % r == 0) {
            ll m = (n-r)/r;
            if (r < m) ans += m;
            dump(m, r);
        }
    }
    cout << ans << endl;

    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


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

int main(){
  int64_t N,ans = 1;
  int64_t count = 0;
  cin >> N;
  if (N % 2 == 1) cout << 0 << endl;
  else {
    N /= 2;
    for (int i = 1; i < 50; i++){
      if (N / ans >= 5){
        ans = pow(5,i);
        count += N / ans;
      }
      else break;
    }
    cout << count << endl;
  }
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
typedef long long int ll;
typedef long double ld;
using namespace std;


vvl Blue = vv(2000, 2000, 0, ll);
vvl ver = vv(2000, 2000, 0, ll);
vvl ver_line = vv(2000, 2000, 0, ll);
vvl left_hori = vv(2000, 2000, 0, ll);
vvl H = vv(2000, 2000, 0, ll);
vvl V = vv(2000, 2000, 0, ll);


ll get_blue(ll a, ll b, ll c, ll d){
  a--;b--;c--;d--;
  ll ret = Blue[c][d];
  if(a!=0) ret-=Blue[a-1][d];
  if(b!=0) ret-=Blue[c][b-1];
  if(a!=0&&b!=0) ret+=Blue[a-1][b-1];
  return ret;
}
ll get_p(ll a, ll b, ll c, ll d){

  a--;b--;c--;d--;
  ll ret_H = H[c][d];
  if(a!=0) ret_H-=H[a-1][d];
  ret_H-=H[c][b];
  if(a!=0) ret_H+=H[a-1][b];

  ll ret_V = V[c][d];
  if(b!=0) ret_V-=V[c][b-1];
  ret_V-=V[a][d];
  if(b!=0) ret_V += V[a][b-1];
  //std::cout << "test" <<  ret_H << " " << ret_V  << '\n';
  return ret_V + ret_H;
}

int main(int argc, char const *argv[]) {
  ll n, m, q;
  std::cin >> n >> m >> q;
  std::vector<string> s(n);
  for(int i=0;i<n;i++) std::cin >> s[i];

  for(int j=0;j<m;j++)
    for(int i=0;i<n;i++)
      ver[i][j] =  (i==0?0:ver[i-1][j]) + (s[i][j]=='1'?1:0);
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++)
      Blue[i][j] = (j==0?0:Blue[i][j-1]) + ver[i][j];

  for(int j=0;j<m;j++)
    for(int i=1;i<n;i++)
      ver_line[i][j] =  ver_line[i-1][j]+ (s[i][j]=='1'&&s[i-1][j]=='1'?1:0);
  for(int j=1;j<m;j++)
    for(int i=0;i<n;i++)
      left_hori[i][j] = (i==0?0:left_hori[i-1][j]) + (s[i][j]=='1'&&s[i][j-1]=='1'?1:0);

  for(int j=0;j<m;j++)
    for(int i=0;i<n;i++)
      V[i][j] = (j==0?0:V[i][j-1]) + ver_line[i][j], H[i][j] = (j==0?0:H[i][j-1]) + left_hori[i][j];

  //std::cout << H[2][3] << " " << V[2][3] << '\n';
  for(int i=0;i<q;i++){
    ll a, b, c, d;std::cin >> a >> b >> c >> d;
    //std::cout << get_blue(a, b, c, d) << '\n';
    //std::cout << get_p(a, b, c, d) << '\n';
    std::cout << get_blue(a, b, c, d) -  get_p(a, b, c, d) << '\n';
  }
  return 0;
}


Measured memory_bytes: 197376
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1<<30;
const ll MOD = 1000000007;

int main(void) {

    int x; cin >> x;
    while(1) {
        bool flg = true;
        for (int i = 2; i * i <= x; i++) {
            if (x % i == 0) {
                flg = false;
                break;
            }
        }
        if (flg) {
            cout << x << endl;
            return 0;
        }
        x++;
    }


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<n;i++)
int main(){
  int n; cin>>n; int memo=0;
  if(n==2) cout<<2<<endl;
  else{
  
  while(memo==0||memo==1){
    memo=0;
    for(int j=1;j*j<n;j++){
      if(n%(j+1)==0){
        memo=1;
        break;
      }
    }
    
    if(memo==0){
        memo=n;
        break;
    }
    n++;
  }
  cout<<memo<<endl;
 }
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 998244353


def resolve():
    n = int(input())
    D = list(map(int, input().split()))

    tree = [0 for _ in range(max(D) + 1)]
    for i in range(n):
        idx = D[i]
        tree[idx] += 1

    if D[0] != 0 or tree[0] != 1 or 0 in tree:
        print(0)
        exit()

    res = 1
    for i in range(len(tree) - 1):
        res *= pow(tree[i], tree[i + 1], mod)

    print(res % mod)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 57644
#include<stdio.h>

int main(void)
{
	int i, a[3], flag,total=0;

	scanf("%d%d%d", &a[0],&a[1],&a[2]);

	flag = 0;

	if (a[0] < a[1])
		flag = 1;

	if (a[flag] < a[2])
		flag = 2;

	for (i = 0; i < 3; i++)
		total += a[i];

	if (a[flag] == (total - a[flag]))
		printf("Yes\n");
	else
		printf("No\n");

	return 0;
}

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

#define endl '\n'

long long const N = 1e5 + 1, M = 1e9 + 7;
long long fn[N], fd[N], iv[N];

void initnck(){
    iv[1] = fn[1] = fd[1] = fn[0] = fd[0] = 1;
    for (long long i=2; i<N; i++){
        iv[i] = (M - (M/i) * iv[M%i] % M) % M;
        fn[i] = fn[i-1]*i%M;
        fd[i] = fd[i-1]*iv[i]%M;
    }
}

long long nck(long long n, long long k){
    return fn[n] * fd[n-k] % M * fd[k] % M;
}

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

    initnck();
    long long n,k, a[N]; cin >> n >> k;

    for (int i=1; i<=n; i++) cin >> a[i];
    sort(a+1, a+n+1);

    long long maxs = 0, mins = 0;
    for (int i=1; i<=n; i++){
        if (i>=k) maxs = (maxs + a[i] * nck(i-1, k-1) + M)%M;
        if (i<=n-k+1) mins = (mins + a[i] * nck(n-i, k-1) + M)%M;
    }
    cout << (maxs - mins + M)%M << endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std; 
using lint  =                           long long int;
using pint  =                           pair<int, int>;
using plint =                           pair<lint, lint>;
#define vli                             vector<lint>
#define pb                              push_back
#define ALL(x)                          begin(x),end(x)
#define inf                             (1LL<63)-1
#define MOD                             1000000007
#define SZ(x)                           ((lint)(x).size())
#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)
#define                                 f_ip   ios_base::sync_with_stdio(false); cin.tie(NULL);
#define                                 debug(x) cerr << #x << " " << (x) << endl
struct fast_ios                         { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T>                    istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T>                    bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T>                    bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }

lint pow_mod(lint base,lint expo) { 
   lint ret = 1;
   for(;expo;) { 
      if(expo&1)  ret = (ret*base)%MOD; 

      expo = (expo>>1);
      base = (base*base)%MOD;
   }
   return ret;
}

/* -------
         |
    **   |
   -------      
   |
   ---------------------------------------------------------------------------------------------------------------------------------*/

void solve(){  
  float r;
  cin >> r;

  cout << M_PI * 2 * r << endl;
}

int main(){   
  
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

 solve();

 return 0;
}


Measured memory_bytes: 3828
import java.util.*;
import java.io.*;
 
public class Main {
    static boolean[] arrived;
    static ArrayList<ArrayList<Integer>> li;
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int w = sc.nextInt();
        int h = sc.nextInt();
        int n = sc.nextInt();
        int xl = 0;
        int xr = w;
        int hd = 0;
        int hu = h;
        for(int i = 0; i < n; i++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            int a = sc.nextInt();
            if(a == 1){
                xl = Math.max(xl,x);
            }else if(a == 2){
                xr = Math.min(xr,x);
            }else if(a == 3){
                hd = Math.max(hd,y);
            }else{
                hu = Math.min(hu,y);
            }
        }
        System.out.println(Math.max(0,xr-xl)*Math.max(0,hu-hd));
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }
    
    public void close() throws Exception{
        this.reader.close();
        return;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}

Measured memory_bytes: 25832
import sys

input = sys.stdin.readline

N = int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))

if N == 1:
    if T[0] == A[0]:
        print(1)
    else:
        print(0)
    sys.exit()

mod = 10**9 + 7
ans = 1
for i in range(N):
    if i == 0:
        if A[i] < T[i]:
            print(0)
            sys.exit()
    elif i == N-1:
        if T[i] < A[i]:
            print(0)
            sys.exit()
    else:
        if T[i-1] < T[i] and A[i+1] < A[i] and T[i] != A[i]:
            print(0)
            sys.exit()
        else:
            if T[i-1] < T[i]:
                if A[i] < T[i]:
                    print(0)
                    sys.exit()
            elif A[i+1] < A[i]:
                if T[i] < A[i]:
                    print(0)
                    sys.exit()
            else:
                ans *= min(T[i], A[i])
                ans %= mod

print(ans)

Measured memory_bytes: 25324
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

//BufferReader
public class Main {
//    static long dp[][];
//    static int n;
//    static int a[];
//    static int ans[];

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;


        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) {
        FastReader sc=new FastReader();
        int k=sc.nextInt();
        String s=sc.next();
        if ( s.length()>k )
        {
            System.out.println(s.substring(0,k)+"...");
        }else System.out.println(s);
    }


}

Measured memory_bytes: 36420
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N =  int(sys.stdin.readline())
X = sum(map(int,list(str(N))))
if N % X == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 66028
#include <stdio.h>
#define N 10000
int s[N];

int p;

void rr(int x) {
  s[p]=x;
  p++;
}

int pp() {
  p--;
  return s[p];
}

int main() {

  p=0;

  char c[10];

  while(scanf("%s",c)==1)
  {
    if(c[0]=='*'||c[0]=='-'||c[0]=='+')
    {
      int x=pp();
      int y=pp();
      if(c[0]=='*') rr(x*y);
      else if(c[0]=='-') rr(y-x);
      else if(c[0]=='+')rr(x+y);
    }
    else {
      int x=0,k=0;
      while(c[k]>='0' && c[k]<='9')
      {
	        x*=10;
	        x+=c[k]-'0';
	        k++;
      }

      rr(x);
    }
  }

  printf("%d\n",pp());


  return 0;
}



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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, p[111111];

int main() {
	cin >> n;
	rep(i,n) cin >> p[i];
	
	int ans = 0;
	rep(i,n-1) {
		if (p[i]==i+1) {
			swap(p[i], p[i+1]);
			ans++;
		}
	}
	if (p[n-1]==n) ans++;
	cout << ans << ln;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		try(Scanner sc=new Scanner(System.in)){
			int casenum=0;
			while(sc.hasNext()) {
				int a=sc.nextInt();
				int b=sc.nextInt();
				if(a==0) break;
				int n=sc.nextInt();
				int[][] dp=new int[a+1][b+1];
				boolean[][] ob=new boolean[a+1][b+1];
				for(int i=0; i<n; i++) {
					int w=sc.nextInt();
					int h=sc.nextInt();
					dp[w][h]=0;
					ob[w][h]=true;
				}
				for(int i=1; i<=a; i++) {
					dp[i][0]=0;
				}
				for(int i=1; i<=b; i++) {
					dp[0][i]=0;
				}
				dp[1][1]=1;
				ob[1][1]=true;
				
				for(int i=1; i<=a; i++) {
					for(int j=1; j<=b; j++) {
						if(ob[i][j]) continue;
						dp[i][j]=dp[i][j-1]+dp[i-1][j];
						//System.out.println("dp["+i+"]["+j+"]="+dp[i][j]);
					}
				}
				System.out.println(dp[a][b]);
			}
		}
	}
} 


Measured memory_bytes: 26180
#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
using namespace std;
const int N = 1e5;
vector<int> adj[N+1];
int signpost[N+1];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, m; cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        int u, v; cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    memset(signpost,-1,sizeof signpost);
    queue<int> frontier;
    frontier.push(1);

    while(!frontier.empty())
    {
        int u = frontier.front();
        frontier.pop();
        for(const int& v : adj[u])
            if(signpost[v]==-1)
            {
                signpost[v] = u;
                frontier.push(v);
            }
    }
    cout<<"Yes"<<'\n';
    for(int d = 2; d <= n; d++)
        cout<<signpost[d]<<'\n';

    cout<<flush;
    return 0;
}

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

using namespace std;

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

    int n;
    while (true)
    {
        cin >> n;
        if (n == 0)
            break;
        bool flag = true;
        std::vector<int> vote(26);
        for (int i = 1; i <= n; i++)
        {
            char c;
            cin >> c;
            vote[c - 'A']++;
            std::vector<int> tmp;
            for (int i = 0; i < 26; i++)
                tmp.push_back(vote[i]);
            sort(tmp.rbegin(), tmp.rend());
            int ma = tmp[0], next = tmp[1];
            if (ma > next + (n - i))
            {
                for (int j = 0; j < 26; j++)
                {
                    if (vote[j] == ma)
                    {
                        cout << (char)('A' + j) << " " << i << endl;
                        flag = false;
                    }
                }
                for (int j = 1; j <= n - i; j++)
                {
                    char gomi;
                    cin >> gomi;
                }
                break;
            }
        }
        if (flag)
            cout << "TIE" << endl;
    }
}


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

int main()
{
 int n,m;
    cin>>n;
     int t[n];
     int s[n];
        for(int a=0;a<n;a++)
        {
            cin>>t[a];

            s[a]=t[a];
        }
        cin>>m;
        int p[m]={0};
        int x[m]={0};
        int sum[m]={0};
        for(int a=0;a<m;a++)
        {
           cin>>p[a]>>x[a];
        }
        for (int z=0;z<m;z++)
        {
            for(int i=0;i<n;i++)
            {
                if(p[z]==(i+1))
                {
                    t[i]=x[z];
                }
                    sum[z]+=t[i];
                    t[i]=s[i];
            }
        }
        for(int z=0;z<m;z++)
        {
            printf("%d \n",sum[z]);
        }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
string s;
int main()
{
	cin >> s;
	
	for(int i=0; i<s.size()-1; i++)
	{
		int start=i,end=i+1,chk[27]={0};
		chk[s[i]-'a']++,chk[s[i+1]-'a']++;
		while(1<=end-start)
		{
			int len=(end-start+1)/2;
			for(int i=0; i<26; i++)
			{
				if(chk[i]>len)
				{
					cout << start+1 << " " << end+1 << "\n";
					return 0;
				}
			}
			if(start>=1&&chk[s[start-1]-'a'])
			start--,chk[s[start]-'a']++;
			else if(end+1<s.size()&&chk[s[end+1]-'a'])
			end++,chk[s[end]-'a']++;
			else
			break;
		}
	}
	cout << -1 << " " << -1 << "\n";
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll cnt[15];
int main(){
	ll n;
	cin>>n;
	bool f=0;
	for(int i=0;i<n;i++){
		ll x;
		cin>>x;
		cnt[x]++;
		if(cnt[x]==3||x==0)f=1;
	}
	if(f)cout<<0<<endl;
	else{
		vector<ll>v,w;
		v.push_back(0ll);
		for(int i=1;i<=12;i++){
			if(cnt[i]==2){
				v.push_back(i);
				w.push_back(24-i);
			}else if(cnt[i]==1)w.push_back(i);
		}
		// for(auto x:v)cout<<x<<' ';
		// cout<<endl;
		// for(auto x:w)cout<<x<<' ';
		// cout<<endl;
		ll ans=0;
		for(int i=0;i<(1<<w.size());i++){
			vector<ll>num=v;
			for(int j=0;j<w.size();j++){
				if(i&(1<<j))num.push_back(w[j]);
				else num.push_back(24-w[j]);
			}
			num.push_back(24);
			sort(num.begin(),num.end());
			ll mi=1e9;
			for(int j=1;j<num.size();j++)mi=min(mi,num[j]-num[j-1]);
			ans=max(ans,mi);
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define pb push_back
#define int long long int
#define vec vector<int>
#define REP(i,a,b) for(i=a;i<b;i++)
using namespace std;
main()
{
  int n;
  cin>>n;
  int a[n],i;
  for(i=0;i<n;i++)
    cin>>a[i];
  int ans=0;
  for(i=0;i<n;i++)
  {
    if((i+1)%2 && a[i]%2)
        ans++;
  }
  cout<<ans<<"\n";
}


Measured memory_bytes: 3636
<?php
$input = file_get_contents('php://stdin');


$n = intval(explode(" ", $input)[0]);
$a = intval(explode(" ", $input)[1]);
$b = intval(explode(" ", $input)[2]);

$p = pow(10, 9) + 7;

function modpow($a, $exp, $mod)
{
  if ($exp == 0) return 1;
  if ($exp == 1) return $a % $mod;
  if ($exp % 2 == 0) {
    $d = modpow($a, $exp / 2, $mod);
    return ($d * $d) % $mod;
  }
  return (modpow($a, $exp - 1, $mod) * $a) % $mod;
}

$ret = modpow(2, $n, $p) - 1;

$upper = 1;
$lower = 1;
for ($i = 0; $i < $b; $i++) {
  $upper = ($upper * ($n - $i)) % $p;
  $lower = ($lower * ($i + 1)) % $p;
}
if ($lower % $p != 0) {
  $ret -= ($upper * modpow($lower, $p - 2, $p)) % $p;
}

$upper = 1;
$lower = 1;
for ($i = 0; $i < $a; $i++) {
  $upper = ($upper * ($n - $i)) % $p;
  $lower = ($lower * ($i + 1)) % $p;
}
if ($lower % $p != 0) {
  $ret -= ($upper * modpow($lower, $p - 2, $p)) % $p;
}

while ($ret < 0) $ret += $p;

echo $ret . PHP_EOL;


Measured memory_bytes: 4604
#include <stdio.h>
#include <stdlib.h>
#define LEN 100005

typedef struct pp {
	char name[100];
	int timeNeeded;
}P;

void enqueue(P);
P dequeue();
int isEmpty();

P Q[LEN + 1];
int head, tail, n;

int main() {
	int elaps = 0, c;
	int i, q;
	P u;
	scanf("%d %d", &n, &q);
	
	for (i = 0; i < n; i++) {
		scanf("%s", Q[i].name);
		scanf("%d", &Q[i].timeNeeded);
		enqueue(Q[i]);
	}
	if (n == 1) {
		printf("%s %d\n", Q[0].name, Q[0].timeNeeded);
		return 0;
	}

	while(!isEmpty()){
		u = dequeue();
		if (u.timeNeeded > q) {
			u.timeNeeded -= q;
			elaps += q;
			enqueue(u);
		}
		else {
			elaps += u.timeNeeded;
			printf("%s %d\n", u.name, elaps);
		}
	}

	return 0;
}

void enqueue(P x) {
	Q[tail] = x;
	(tail + 1 > n) ? tail = 0 : tail++;
}

P dequeue() {
	P x = Q[head];
	(head + 1 > n) ? head = 0 : head++;
	return x;
}

int isEmpty() {
	return head == tail;
}

int isFull() {
	return head == (tail + 1) % n;
}



Measured memory_bytes: 6768
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
 
int d[101];
int V, E;
 
struct edge { int from, to, cost; };
 
vector<edge> es;
 
bool find_negative_loop() {
  memset(d, 0, sizeof(d));
   
  for(int i=0; i<V; i++) {
    for(int j=0; j<E; j++) {
      edge e = es[j];
      if(d[e.to] > d[e.from]+e.cost) {
    d[e.to] = d[e.from] + e.cost;
    if(i == V-1) return true;
      }
    }
  }
  return false;
}
 
int main() 
{
  int s, t;
  cin >> V >> E;
  for(int i=0; i<E; i++) {
    cin >> s >> t;
    s--, t--;
    es.push_back((edge){s, t, -1});
  }
   
  cout << find_negative_loop() << endl;
   
  return 0;
}

Measured memory_bytes: 1236
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n;
string s;
ll su[4010][3];
char ch[3] = {'R','G','B'};

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n;
    cin>>s;
    rep(i,4010)rep(j,3){
        su[i][j] = 0;
    }
    rep(i,n){
        rep(j,3){
            su[i+1][j] += su[i][j];
            if(s[i]==ch[j]){
                su[i+1][j] += 1;
            }
        }
    }
    ll ans = 0;
    rep(i,n){
        repi(j,i,n){
            if(s[i]!=s[j]){
                ll el;
                rep(k,3){
                    if(ch[k]!=s[i] && ch[k]!=s[j])el = k;
                }
                ans += su[n][el] - su[j+1][el];
                if(s[j+j-i]==ch[el])ans--;
            }
        }
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 3744
#include <stdio.h>
#include <string.h>
#include <limits.h>

#define INFTY (INT_MAX);
int S[500001];
int L[500001];
int R[500001];
	int N;
	int ans;
/////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
void merge(int *A, int left, int mid, int right)
{
	int i;
	int j;
	int k;
	int n1 = mid - left;
	int n2 = right - mid;

//  L[0...n1], R[0...n2] ?????????

	for ( i = 0 ; i < n1 ; i++ ) {
		L[i] = A[left + i];
	}

	for ( i = 0 ; i < n2 ; i++ ) {
		R[i] = A[mid + i];
	}

	L[n1] = INFTY;
	R[n2] = INFTY;
	i = 0;
	j = 0;
	for ( k = left ; k < right ; k++ ) {
		ans++;
		if ( L[i] <= R[j] ) {
			A[k] = L[i];
			i = i + 1;
		} else {
			A[k] = R[j];
			j = j + 1;
		}
	}
}

/////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
void mergeSort(int *A, int left, int right)
{
	int mid;
	if (left+1 < right) {
		mid = (left + right)/2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}
/////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
int main(void)
{
	int i;
//
	scanf("%d", &N);
	for ( i = 0 ; i < N ; i++ ) {
		scanf("%d", &S[i] );
	}

	mergeSort(S, 0, N);

	for ( i = 0 ; i < N ; i++ ) {
		printf("%d", S[i]);
		if ( i < N-1 ) {
			printf(" ");
		} else {
			printf("\n");
		}
	}
	printf("%d\n", ans);

	return 0;
}

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

namespace ConsoleApp17
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = Convert.ToInt32(input[0]);
            int b = Convert.ToInt32(input[1]);

            int c = b;
            if(a<=12&&a>=6)
            {
                c = b / 2;
            }
            else if(a>13)
            {
                c = b;
            }
            else if(a<=5)
            {
                c = 0;
            }

            Console.Write(c);
            Console.Read();
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <functional>

#define INF 1000000000000000000
using namespace std;
typedef long long ll;


int main() {
	string o, e;
	cin >> o >> e;
	int l;
	string ans;
	l = o.size() + e.size();
	for (int i = 0; i < l; i++) {
		int id = i / 2;
		if (i % 2) {
			ans+=e[id];
		}
		else {
			ans+=o[id];
		}
	}
	cout << ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream> 
using namespace std;
int main(){
    long long nC,nS;
    cin>>nS>>nC;
    if(nS <= ((nS*2)+nC)/4)
        cout<<((nS*2)+nC)/4<<endl;
    else 
        cout<<nC/2<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using static System.Array;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

namespace AtcoderExpress
{


    class Program2
    {
        static long mod = 1000000007;
        static long[,] stic;
        static void Main(string[] args)
        {
            var HWK = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var H = HWK[0];
            var W = HWK[1];
            var K = HWK[2];

            var dp = new long[H + 2, W + 1];
            dp[1, 1] = 1;
            for (int i = 1; i <= H; i++)
            {
                for (int j = 1; j <= W; j++)
                {
                    for (int k = 0; k < (long)Pow(2,W-1); k++)
                    {
                        var flg = true;
                        var amid = Convert.ToString(k,2);
                        var rev = new string(amid.PadLeft(W - 1, '0').Reverse().ToArray());
                        //Console.WriteLine(rev);
                        for (int l = 1; l < rev.Length; l++)
                        {

                            if(rev[l] == '1' && rev[l - 1] == '1')
                            {
                                flg = false;
                                break;
                            }
                        }

                        
                        
                        if (flg)
                        {
                            if(j+1 <= W&& j-1 < rev.Length && rev[j-1] == '1')
                            {
                                dp[i + 1, j + 1] += dp[i, j];
                                dp[i + 1, j + 1] %= mod;
                            }
                            else if(j -2 >= 0 && rev[j - 2] == '1')
                            {
                                dp[i + 1, j - 1] += dp[i, j];
                                dp[i + 1, j - 1] %= mod;
                            }
                            else
                            {
                                dp[i + 1, j] += dp[i, j];
                                dp[i + 1, j] %= mod;
                            }
                        }

                    }
                }
            }

            //Console.WriteLine(dp[H, K]);
            //Console.WriteLine(dp[H, K+1]);
            Console.WriteLine(dp[H+1,K]);
        }

        static long culsticsum(int num)
        {
            if(num == 0)
            {
                return 1;
            }
            return (stic[num, 0] + stic[num, 1])%mod;
        }
        
        static long culstic(int num,int type)
        {
            
            if( stic[num,type] > 0)
            {
                return stic[num, type];
            }
            else
            {
                stic[num, type] = culstic(num-1,0)%mod;
                if(num == 0)
                {
                    stic[num, type] += culstic(num - 1, 1) % mod;
                }
            }
            return stic[num, type]%mod;
        }
    }
}


Measured memory_bytes: 17572
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>

#define ll long long
#define test(t) ll int t; cin>>t; while(t--)
#define F(i,L,R) for(ll int i=L;i<R;i++)
#define F2(i,L,R) for(ll int i=L;i>=R;i--)
#define get1(a) ll int a; cin>>a;
#define get2(a,b) ll int a,b; cin>>a>>b;
#define get3(a,b,c) ll int a,b,c; cin>>a>>b>>c;
#define pb push_back
#define mp make_pair
#define MAX 1000000001
using namespace std;



int main()
{ 
 

 ios_base::sync_with_stdio(0);

 

 get2(k,n);
 vector<ll int> diff;
 ll int val2;
 get1(val1);
 ll int first=val1,sum=0,maxval=INT_MIN;

 F(i,1,n)
 {
    get1(val2);
    diff.pb(val2-val1);
    val1=val2;
    sum+=diff[i-1];
    maxval=max(diff[i-1],maxval);
 }
 diff.pb(k- val1 + first);
 maxval=max(diff[n-1],maxval);
 sum+=diff[n-1];
 cout<< sum - maxval <<"\n";
  return 0;
 
}

Measured memory_bytes: 2420
import math
K = int(input())
s = 0
c = dict()
for a in range(1, K+1):
    for b in range(1, K+1):
        ab = math.gcd(a, b)
        if ab == 1:
            s += K
        else:
            for c in range(1, K+1):
                s += math.gcd(ab, c)
print(s)

Measured memory_bytes: 9180
#include<map>
#include<string>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<set>
#include<vector>
#include<cmath>
#include<queue>
using namespace std;


int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	int a, b;
	scanf("%d %d", &a, &b);
	if (a <= 8 && b <= 8)
		printf("Yay!\n");
	else
		printf(":(\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
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++)
typedef long long ll;

int main(){
  int N;
  cin >> N;
  string s[N];
  unordered_map<string,ll> mp;
  ll ans = 0;

  rep(i,N){
    cin >> s[i];
    sort(s[i].begin(),s[i].end());
    auto itr = mp.find(s[i]);
    if (itr != mp.end()) {
      ans += mp[s[i]];//値が設定されている場合
      mp[s[i]]++;
    }else{
      mp[s[i]] = 1;
    }
  }

  cout << ans << endl;

}


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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) cin >> vec.at(i);

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

  int ans = 1;
  for (int i = 1; i < N; i++) {
    if (vec.at(i - 1) == vec.at(i)) continue;
    else ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include<algorithm>
#include <queue>
#include <cmath>
#include <limits>
#include <map>
#include <iomanip>
using namespace std;
#define ll long long int

int main(){
  int n;
  cin >> n;
  int A[n+1];
  int answer[n+1];
  for (int i = 2; i <= n; i++)
  {
    A[i] = 0;
    cin >> A[i];
  }

  for (int i = 0; i <= n; i++)
  {
    answer[i] = 0;
  }

  for (int i = 2; i <= n; i++){
    answer[A[i]]++;
  } 

  for (int i = 1; i <= n; i++){
    cout << answer[i] << endl;
  }

    return 0;
}

Measured memory_bytes: 4756
n=int(input())
a=[0]+list(map(int,input().split()))+[0]

sum=0
for i in range(n+1):
  sum+=abs(a[i+1]-a[i])

for i in range(1,n+1):
  sa=abs(a[i+1]-a[i-1])-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])
  print(sum+sa)

Measured memory_bytes: 14044
import math

S=int(input())

if S==0:
    ans=[0,0,0,0,0,0]
elif S==10**18:
    ans=[0,0,10**9,0,10**9,10**9]
elif S%(10**9)==0:
    ans=[0,0,10**9,0,0]
    ans.append(S//(10**9))
else:
    ans=[0,0,10**9,1]
    ans.append(10**9-S%(10**9))
    ans.append(math.ceil(S/(10**9)))
print(*ans)

Measured memory_bytes: 38384
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
using namespace std;
using ll = long long;
ll MOD = 1e9+7;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    if(N==2){
        cout << 1 << endl;
    }else if(N==1){
        cout << 0 << endl;
    }else if(N%2==1){
        cout << (N)*((N-1)/2) << endl;
    }else{
        cout << (N)*((N-1)/2)+N/2 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

        long K = sc.nextLong();
        long A = sc.nextLong();
        long B = sc.nextLong();

        if (A >= K) { System.out.println(1); return; }
        if (A <= B) { System.out.println(-1); return; }
        
        long ans = (K-A)/(A-B);
        if ((K-A) % (A-B) != 0) {
            ans++;
        }
        ans = 2*ans+1;

        System.out.println(ans);
    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i, n) for (int i = 0; i < n; i++)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
int dxx[8] = { 1, 1, 1, 0, 0, -1, -1, -1 }, dyy[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };

int c[10][10];

int main() {
    int h, w;
    cin >> h >> w;
    rep (i, 10) rep (j, 10) cin >> c[i][j];
    int a[h][w];
    int ans = 0;
    rep (k, 10) {
        rep (i, 10) {
            rep (j, 10) {
                c[i][j] = min (c[i][k] + c[k][j], c[i][j]);
            }
        }
    }
    rep (i, h) {
        rep (j, w) {
            cin >> a[i][j];
            if (a[i][j] == -1) continue;
            ans += c[a[i][j]][1];
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 384
import itertools
import math
import fractions
import functools
k, n = map(int, input().split())
a = list(map(int, input().split()))

sub = [0] * n
for i in range(n-1):
    sub[i] = a[i+1]-a[i]

sub[n-1] = k - a[n-1] + a[0]

print(k-max(sub))

Measured memory_bytes: 104928
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		   Scanner scan = new Scanner(System.in);
		   double r = scan.nextDouble();
		   	   
		   System.out.printf("%.5f %.5f\n",Math.PI * r * r,2 * Math.PI * r);
	}

}



Measured memory_bytes: 28336
#include<bits/stdc++.h>
#define loop(i, a, b) for(int i = a; i < b; i++) 
#define rep(i, a) loop(i, 0, a)
using namespace std;
const int MOD = 1000000007;
const int inf = 1e8;
using vi = vector <int>;
using vvi = vector <vi>;
using vc = vector <char>;
using vvc = vector <vc>;
using vs = vector <string>;
using vvs = vector <vs>;
//g++ -std==c++14
//setprecision(10)
int main(){
    stack <int> st;
    int n;
    while(cin >> n){
        if(n)
            st.push(n);
        else{
            cout << st.top() << endl;
            st.pop();
        }
    }
}

Measured memory_bytes: 3096
import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as C

readInt' = fst.fromJust.C.readInt
readLnInt = map readInt'.C.words<$>C.getLine
readCsInt n = concat<$>replicateM n readLnInt

x ? (a,b) = if x then a else b
a~>(f,x) = [a] ++ (null x)?([],f x)
half = flip div 2
aliq = ((0==).).mod

main = do
 [n,m] <- readLnInt
 inputs <- readLnInt
 print $ solve n m inputs

solve n m as
 | sum as > n = -1
 | otherwise = n - (sum as)


Measured memory_bytes: 5452
#include <iostream>
#include <vector>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
int main()
{
    int A, B, C, D, E, F; cin >> A >> B >> C >> D >> E >> F;
    double maxratio = 0;
    int maxmass = 100*A, maxsugar = 0;
    for (int a = 0; a <= F; a += 100*A) {
        for (int b = 0; a + b <= F; b += 100*B) {
            for (int c = 0; a + b + c <= F; c += C) {
                for (int d = 0; a + b + c + d <= F; d += D) {
                    if ((c + d) > (a + b) / 100 * E) continue;
                    double r = (double)(c + d) / (a + b + c + d);
                    if (r > maxratio) {
                        maxratio = r;
                        maxmass = a + b + c + d;
                        maxsugar = c + d;
                    }
                }
            }
        }
    }
    cout << maxmass << ' ' << maxsugar << endl;
    return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DBG(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define DBG(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define CIN(type, ...) \
  type __VA_ARGS__;    \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define COUT(...) write_to_cout(__VA_ARGS__);

#define ALL(x) (x).begin(), (x).end()
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

const ll INF = 1LL << 50;
ll A[1000], B[1000];
ll dp[20001];

int main() {
  CIN(ll, H, N);
  REP(i, N) cin >> A[i] >> B[i];
  REP(i, 20000 + 1) dp[i] = INF;
  dp[0] = 0;
  ll ans = INF;
  for (int i = 0; i <= H; ++i) {
    for (int n = 0; n < N; ++n) {
      ll j = i + A[n];
      dp[j] = min(dp[j], dp[i] + B[n]);
      if (j >= H) ans = min(ans, dp[j]);
    }
  }
  COUT(ans);
}


Measured memory_bytes: 384
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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


int main(void) {
	int h, w;
	queue< pair<int, int> > que;
	pair<int, int> pa;//h,w
	int x, y;

	cin >> h >> w;
	vector<string> s(h);
	vector< vector<bool> > flag(h, vector<bool>(w, false));
	vector< vector<int> > cost(h, vector<int>(w, 0));
	int maxi = 0;
	FOR(i, 0, h - 1) {
		cin >> s[i];
	}

	FOR(i, 0, h - 1) {
		FOR(j, 0, w - 1) {
			if (flag[i][j] == false && s[i][j] == '#') {
				pa.first = i;
				pa.second = j;
				flag[i][j] = true;
				que.push(pa);
			}
		}
	}

	
	while (!que.empty()) {
		pa = que.front();
		que.pop();
		x = pa.first;
		y = pa.second;
		
		FOR(i, 0, 2) {
			FOR(j, 0, 2) {
				if (dx[i] != 0 && dy[j] != 0) {
					continue;
				}
				if (x + dx[i] >= 0 && x + dx[i] <= h - 1 && y + dy[j] >= 0 && y + dy[j] <= w - 1) {
					if (flag[x + dx[i]][y + dy[j]] == false && s[x + dx[i]][y + dy[j]] == '.') {
						pa.first = x + dx[i];
						pa.second = y + dy[j];
						que.push(pa);
						s[x + dx[i]][y + dy[j]] = '#';
						flag[x + dx[i]][y + dy[j]] = true;
						cost[x + dx[i]][y + dy[j]] = cost[x][y] + 1;
						if (maxi < cost[x + dx[i]][y + dy[j]]) {
							maxi = cost[x + dx[i]][y + dy[j]];
						}
					}
				}
			}
		}

	}

	
	cout << maxi << endl;

	return 0;
}

Measured memory_bytes: 13584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

/* 二分累乗法 */
ll bipow(ll a, ll b) {
    ll res = 1;
    for (; b; a = a * a , b >>= 1){
        if (b & 1) res = res * a;
    }
    return res;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i,N){
        cin >> A[i];
        A[i]%=2;
    }
    ll answer = bipow(3,N) - bipow(2,count(ALL(A),0));
    cout << answer << "\n";
}

Measured memory_bytes: 256