akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

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

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    long x = sc.nextLong();
    int year = 0;
    long bank = 100L;
    while (bank < x) {
      bank += bank / 100L;
      year++;
    }
    System.out.println(year);
  }
}

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

int main(){
    int H,W,i,j;
    while(1){
        cin >> H >> W;
        if(H == 0 && W == 0){
            break;
        }
        for(j=0;j<H;j++){
            for(i=0;i<W;i++){
                cout<<"#";
            }
            cout<<endl;
        }
        cout<<endl;    
    }
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e15;

int main() {
  string s;
  cin >> s;
  ll n=s.size();
  mat dp(n+1,vec(13,0));
  dp[0][0]=1;
  for(ll i=0;i<n;i++){
    for(ll j=0;j<13;j++) {
      if(s[i]=='?') {
        for(ll k=0;k<10;k++) {
          (dp[i+1][(j*10+k)%13]+=dp[i][j])%=mod;
        }
      }
      else {
        (dp[i+1][(j*10+(s[i]-'0'))%13]+=dp[i][j])%=mod;
      }
    }
  }
  cout << dp[n][5] << endl;
}

Measured memory_bytes: 13696
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
 
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> isPair;
using vvll = vector< vector<ll> >;
using vll = vector<ll> ;
 
const ll inf=1e10;
const ll maxs =1e3+5;
const ll mod = 1e9+7;

#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define line cout<<endl;
#define fr(i,b) for(ll i=1;i<=b;++i)
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fastio(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
ll n,m;
bool isPossible[maxs][maxs];
ll dp[maxs][maxs];
 
void solve()
{
    memset(dp,0,sizeof dp);
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=m;j++)
        {
            if(i==1&&j==1)
                dp[i][j]=1;
            else
            {
                if(isPossible[i][j])
                    dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
            }
        }
    }
    cout<<dp[n][m];
}
 
int main()
{
    fastio();
     ll t=1;
     // cin>>t;
     while(t--){
        cin>>n>>m;
        char ch;
        for(ll i=1;i<=n;i++)
        {
            for(ll j=1;j<=m;j++)
            {
                cin>>ch;
                if(ch=='.')
                    isPossible[i][j] = true;
                else
                    isPossible[i][j] = false;
            }
                
        }
        solve();        
     }
    return 0;
}

Measured memory_bytes: 9088
s = input()
n = len(s) - 1

if n == 0:
    print(s)
else:
    ans = 0
    for i in range(2 ** n):
        tmp = ''
        for j in range(n):
            tmp += s[j]
            if i & 1 << j:
                tmp += '+'
        tmp += s[j+1]
        if '+' in tmp:
            ans += eval(tmp)
        else:
            ans += int(tmp)

    print(ans)


Measured memory_bytes: 3060
N = gets.to_i
H = gets.split.map(&:to_i)

max = H[-1]
satisfied = true
H[0..-1].reverse.each do |h|
  if h <= max
    max = h
  else
    if h - 1 == max
      next
    else
      satisfied = false
      break
    end
  end
end

if satisfied
  puts 'Yes'
else
  puts 'No'
end


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

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))


SINT32 main() {
    SINT32 n;
    scanf("%d",&n);


    SINT32 ans = 0;

    SINT8 A[1001] = {'0'};
    scanf("%s",A);

    SINT8 B[1001] = {'1'};
    scanf("%s",B);

    SINT8 C[1001] = {'2'};
    scanf("%s",C);


    for (SINT32 i = 0; i < n; i++) {
        if (A[i] == B[i]) {
            if (C[i] == B[i]) {

            } else {
                ans = ans + 1;
            }

        } else {
            if (C[i] == B[i]) {
                ans = ans + 1;
            } else {
                if (C[i] == A[i]) {
                    ans = ans + 1;
                } else {
ans = ans + 2;
                }

            }

        }
    }




    printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
# 2019/06/02
# AtCoder Grand Contest 024 - A

# Input
a, b, c, k = map(int, input().split())

if k % 2 == 0:
    ans = a - b
else:
    ans = b - a

if ans > 10 ** 18:
    ans = "Unfair"

# Output
print(ans)


Measured memory_bytes: 2940
N, K = map(int, input().split())
dic = {}
dic['s'], dic['p'], dic['r'] = map(int, input().split())
T = input()
score = [0]*N
for i in range(N):
  if i>=K and T[i]==T[i-K] and score[i-K]>0:
    continue
  score[i] = dic[T[i]]
print(sum(score))

Measured memory_bytes: 9948
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define pb push_back
const long long mod=1e9+7;
int main()
{
    ll t,n,x,i,j;
    cin>>n;
    vector<ll>v;

    while(n--)
    {
        cin>>x;
        v.pb(x);
    }

    ll sum=0;

    for(i=0; i<63; i++)
    {
        ll one=0,zero=0;
        for(j=0; j<v.size(); j++)
        {
            if(v[j]%2==0)
                zero++;
            else
                one++;
            v[j]/=2;
        }
        one%=mod;
        zero%=mod;

        sum= (sum+(((zero*one)%mod * ((1ll<<i)%mod))%mod))%mod;
    }

    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 5872
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
using namespace std;
int main(){
  int n,k,h,l;
  long long int s;
  vector<int> v={};
  cin>>n>>k;
  if(n<=k){
    cout<<0<<endl;
    return 0;}
  for(int i = 0; i < n; i++) {
    cin>>l;
    v.push_back(l);
  }
  sort(v.begin(),v.end());
  s=0;
  for(int i=0;i<n-k;i++){
    s+=v[i];
  }
  cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

struct Point{
    double x, y;

    Point() {}
    Point(double x, double y) : x{x}, y{y} {}

    Point operator + (const Point& p) const
    {
        return Point(x + p.x, y + p.y);
    }

    Point operator - (const Point& p) const
    {
        return Point(x - p.x, y - p.y);
    }

    Point operator * (const double& k) const
    {
        return Point(x * k, y * k);
    }

    Point operator / (const double& k) const
    {
        return Point(x / k, y / k);
    }

    bool operator < (const Point& p) const
    {
        return x != p.x ? x < p.x : y < p.y;
    }
};

double dot(const Point& a, const Point& b)
{
    return a.x * b.x + a.y * b.y;
}

double cross(const Point& a, const Point& b)
{
    return a.x * b.y - b.x * a.y;
}

double norm(const Point& p)
{
    return dot(p, p);
}

double abs(const Point& p)
{
    return sqrt(norm(p));
}

pair<Point,double> smallest_enclosing_circle(const vector<Point>& pts)
{
    Point p(0, 0);
    for (int i = 0; i < (int)pts.size(); i++) {
        p = p + pts[i];
    }
    p = p * (1. / pts.size());
    double d = 0.5;
    constexpr double EPS = 1e-7;
    while (d > EPS) {
        for (int k = 1; k <= 150; k++) {
            for (int i = 0; i < 100; i++) {
                int s = 0;
                for (int j = 0; j < (int)pts.size(); j++) {
                    if (abs(pts[j] - p) > abs(pts[s] - p)) {
                        s = j;
                    }
                }
                p = p + (pts[s] - p) * d;
            }
            d *= 0.5;
        }
    }
    double max_dist = 0;
    for (int i = 0; i < (int)pts.size(); i++) {
        if (abs(pts[i] - p) > max_dist + EPS) {
            max_dist = abs(pts[i]-p);
        }
    }
    return make_pair(p, max_dist);
}

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

    vector<Point> p(N);
    for (int i = 0; i < N; i++) {
        std::cin >> p[i].x >> p[i].y;
    }

    printf("%.10f\n", smallest_enclosing_circle(p).second);
    return 0;
}


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

typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}

int main(void)
{
    cin.tie(0); ios::sync_with_stdio(false);
    cout<<std::fixed<<std::setprecision(10);

    ll n, k;
    cin >> n >> k;
    
    ll w_max = 0;
    vector<ll> w(n); rep(i, n) { cin >> w[i]; chmax(w_max, w[i]); }
    vector<ll> s(n); rep(i, n) { if (i==0) s[0]=w[0]; else s[i]=s[i-1]+w[i]; }

    ll l = w_max-1, r = w_max * n;

    while (r - l > 1) {
        ll c = l + (r - l) / 2;
        // cerr << l << " " << c << " " << r << endl;

        bool ok = false;
        {
            vector<ll>::iterator it = s.begin();
            ll sw = c;
            rep(i, k) {
                it = upper_bound(it, s.end(), sw);
                if (it == s.end()) {    
                    ok = true;
                    break;
                }
                sw = *(it-1) + c;
            }
        }
        (ok ? r : l) = c;
    }

    cout << r << endl;
}



Measured memory_bytes: 4412
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define ll long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010
 
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int abs(int a){if(a<0)return -a;return a;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}

void swapl(ll* a,ll* b){ll tmp=*a;*a=*b;*b=tmp;}
ll absl(ll a){if(a<0)return -a;return a;}
ll dupl(ll a,ll d){if(a%d==0)return a/d;else return a/d+1;}
ll modl(ll a,ll m){if(a<0)return a%m+m;else return a%m;}

ll GCD(ll a,ll b){ll c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
ll LCM(ll a,ll b){return a*b/GCD(a,b);}

ll factorial(ll n, ll m) {return n < m ? 1 : n*factorial(n-1, m);}

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

// ll dp[]


int main(){
  ll x;
  ll m = 100;
  ll index =0;

  scanf("%lld", &x);
  
  while (1)
  {
      m += (m/100);
      index++;
      if(m >= x) break;
  }
  

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

  return 0;
}

Measured memory_bytes: 1736
import sys

d_num = int(sys.stdin.readline().strip())

graph_list = []

for _ in range(0, d_num):
    array = sys.stdin.readline().strip().split(" ")
    if len(array) <= 2:
        graph_list.append([])
    else:
        graph_list.append([int(array[i]) - 1 for i in range(2, len(array))])

t = 1
result = [[] for _ in range(0, d_num)]
searched_list = []
stack = []

while True:
    if len(stack) == 0:
        ll = filter(lambda x: x not in searched_list, range(0, d_num))
        if len(ll) == 0:
            break
        stack.append(ll[0])
        result[ll[0]].append(t)
        searched_list.append(ll[0])
    else:
        node = stack[-1]
        children = filter(lambda x: x not in searched_list, graph_list[node])
        if len(children) != 0:
            next_node = children[0]
            stack.append(next_node)
            result[next_node].append(t)
            searched_list.append(next_node)
        else:
            stack.pop()
            result[node].append(t)
    t += 1

s = ""

for i in range(0, len(result)):
    print str(i+1) + " " + str(result[i][0]) + " " + str(result[i][1])

Measured memory_bytes: 6456
#include<iostream>
#include<sstream>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<string>
#include<numeric>
#include<set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using vi = vector<int>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using vpii = vector<pii>;
static const double pi = 3.141592653589793;

int main(){
  int a, b, x;
  cin >> a >> b >> x;

  if(a*a*b / 2.0 <= x)
    cout << setprecision(10) << atan((double)(2 * (a*a*b - x) / (double)(a*a*a))) / pi * 180.0 << endl;
  else
    cout << setprecision(10) << atan((double)(a*b*b) / (double)(2.0 * x)) / pi * 180.0 << endl;
  
  return 0;
}

Measured memory_bytes: 256
N, T = map(int, input().rstrip().split())
li = [[int(_) for _ in input().rstrip().split()] for _ in range(N)]

temp = []
for i in range(N):
    if li[i][1] <= T:
        temp.append(li[i][0])

if len(temp) == 0:
    print("TLE")
else:
    print(min(temp))

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

int main(){

  int R, G, B, N;
  cin >> R >> G >> B >> N;

  int ans = 0;
  for(int i=0; i< N/R+1; i++){
    for(int j=0; j<N/G+1; j++){
      int v = N-R*i-G*j;
      if(v >=0 && v % B == 0) ans++;
    }
  }
  cout << ans << endl;

}

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

using namespace std;
typedef long long ll;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
map<ll,ll> prime_factor(ll x){map<ll,ll> ret;ll tmp=x;for(ll i=2;i*i<=x;i++){while(tmp%i==0){ret[i]++;tmp/=i;}}if(tmp!=1) ret[tmp]++;return ret;}
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;}

int main(){
	ll A,B; cin>>A>>B;
    ll X=gcd(A,B);
    if(X==1) cout<<1;
    else{
        map<ll,ll> m=prime_factor(X);
        ll ans=1;
        for(auto itr=m.bg;itr!=m.ed;itr++){
            ans++;
        }
        cout<<ans;
    }
    
}

Measured memory_bytes: 256
n,x = gets.split.map(&:to_i)
i_n = n.times.map{ gets.to_i}

rmd = x - i_n.inject(0){|sum,num| sum += num }

counter = 0
while rmd >= i_n.min
  rmd = rmd - i_n.min
  counter += 1
end

puts counter + n

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

lld C[51][51] = {0};  //C[n][k] == nCk

void pascal(lld n)
{
	for(lld i = 0; i <= n; i++)
	{
		for(lld j = 0; j <= n; j++)
		{
			if (i == 0 || i < j)
			{
				C[i][j] = (lld)0;
			}else if (j == 0 || i == j)
			{
				C[i][j] = (lld)1;
			}else
			{
				C[i][j] = C[i-1][j-1] + C[i-1][j];
			}
		}
	}
}

int main()
{
	lld n,a,b;
	cin >> n >> a >> b;
	vector<lld> v(n);
	for(int i = 0; i < n; i++)
	{
		cin >> v[i];
	}
	sort(v.begin(),v.end(),greater<lld>());
	vector<double> ave(n);

	lld sum = 0;
	double max_ave=0.0;
	for(int i = 0; i < a; i++)
	{
		sum += v[i];
	}

	// for(int i = a-1; i < b; i++)
	// {
	// 	max_ave = max(max_ave,ave[i]);
	// }
	max_ave = (double)sum/a;

	printf("%.12f\n", max_ave);
	pascal(n);

	lld ans = 0;
	// for(lld i = a; i <= b; i++)
	// {
	// 	multiset<lld> ss,tt;
	// 	for(int j = 0; j < n; j++)
	// 	{
	// 		ss.insert(v[j]);
	// 	}
	// 	for(int j = 0; j < i; j++)
	// 	{
	// 		tt.insert(v[j]);
	// 	}
	// 	lld y = 0;
	// 	sum = 0;
	// 	int k = 0;
	// 	while(1)
	// 	{
	// 		sum += ss.count(v[k]);
	// 		if (sum >= i)
	// 		{
	// 			y = ss.count(v[k]);
	// 			//sum -= ss.count(v[k]);
	// 			break;
	// 		}
	// 		ss.erase(v[k]);
	// 		k++;
	// 	}
	// 	lld x = tt.count(v[k]);
	// 	//cout << "x = " << x <<  " y = " <<  y << endl;
	// 	ans += C[y][x];
	// }

	if (v[0] == v[a-1])
	{
		multiset<lld> ss;
		for(int j = 0; j < n; j++)
		{
			ss.insert(v[j]);
		}
		lld y = ss.count(v[0]);
		for(int i = a; i <= min(b,y); i++)
		{
			ans += C[y][i];
		}
	}else
	{
		multiset<lld> ss,tt;
		for(int j = 0; j < n; j++)
		{
			ss.insert(v[j]);
		}
		for(int j = 0; j < a; j++)
		{
			tt.insert(v[j]);
		}

		lld y = ss.count(v[a-1]);
		lld x = tt.count(v[a-1]);

		ans += C[y][x];
	}
	cout << ans << endl;

	return 0;
}

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

int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  int ans;
  if (x < y) {
    ans = min({a * x + b * y, 2 * c * x + b * (y - x), 2 * c * y});
  } else {
    ans = min({a * x + b * y, 2 * c * y + a * (x - y), 2 * c * x});
  }
  cout << ans << endl;
  return 0;
}

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


#define MAX 30


int in[MAX];

int w , n;

int Left , Right;


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

	for (int i = 0; i < w; i++)
	{
		in[i] = i + 1;
	}

	for (int i = 0; i < n; i++)
	{
		scanf("%d,%d" , &Left , &Right);

		int tmp = in[Left - 1];
		in[Left - 1] = in[Right - 1];
		in[Right - 1] = tmp;
	}

	for (int i = 0; i < w; i++)
	{
		cout << in[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1240
/*
You're my honeybunch, sugar plum
Pumpy-umpy-umpkin
You're my sweetie pie
You're my cuppycake, gumdrop
Snoogums, boogums, you're
The apple of my eye

And I love you so
And I want you to know
That I'm always be right here
And I want to sing
Sweet songs to you
Because you are so dear...

*/
#include<iostream>

#define boost ios::sync_with_stdio(0); cin.tie(0);
#define ll long long
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define pai pair<int, int>
#define ar array

using namespace std;
int const maxn=2e9;
int const naxn=1e9+7;
ll dp[3000];

void solve(){
    dp[3]=1;
   int n;
   cin >> n;
   for(int i=4;i<=n;i++)   dp[i]=(dp[i-1]+dp[i-3])%1000000007;
    cout << dp[n];
}

int main(){
   boost;
        solve();
    
}


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

int main(){
   int a,b[15],c;
  cin >> a;
  
  for(int i=0;i<a;i++){
    cin>>b[i];
  }

  sort(b,b+a,greater<int>());
  c = b[0]/2;
  for(int i =1;i<a;i++){
    c += b[i];
  }
  
  cout << c << endl;
}
    
  
 


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

// g++ -std=c++17 -O2 -Wall template.cpp -o template
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n, m, c;
    cin >> n >> m >> c;
    int b[m];
    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }
    int correct = 0;
    for (int j = 0; j < n; j++) {
        long long tot = 0;
        for (int i = 0; i < m; i++) {
            int a;
            cin >> a;
            tot += a * b[i];
        }
        if (tot + c > 0)
            correct++;
    }
    cout << correct << endl;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

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

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}
int main()
{
    int k;
    cin >> k;
    string s;
    cin >> s;
    int n = s.size();

    if(n <= k) cout << s << endl;
    else{
        rep(i,k){
            cout << s[i];
        }
        cout << "..." << endl;
    }

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;	

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

	for (int x = 1; x <= 9; x++) {
		for (int y = 1; y <= 9; y++) {
			if (x * y == n) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;
}


Measured memory_bytes: 3600
import sys
readline = sys.stdin.readline

N,M = map(int,readline().split())
keys = [None] * M
for i in range(M):
  cost,b = map(int,readline().split())
  bit = 0
  target = list(map(int,readline().split()))
  for t in target:
    bit += (1 << (t - 1))
  keys[i] = (cost, bit)
    
# 全ての鍵の組み合わせでDP
INF = 10 ** 8 + 1
dp = [INF for i in range(2 ** N)]
dp[0] = 0
for key in keys:
  cost, bit = key
  for j in range(len(dp) - 1, -1, -1):
    if dp[j] == INF:
      continue
    if dp[j | bit] > dp[j] + cost:
      dp[j | bit] = dp[j] + cost

if dp[-1] == INF:
  print(-1)
else:
  print(dp[-1])

Measured memory_bytes: 3188
//struct cmp {bool operator()(const pair<int, char> &a, const pair<int, char> &b) {if (a.first == b.first) {return a.second > b.second;} else {return a.first > b.first;}}};
#include<bits/stdc++.h>
#define endl "\n"
#define _  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define ll long long
//#define int long long
#define MOD 1000000007
#define DEBUG cout<<"Hello1\n";
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))
#define deb(...) debug(#__VA_ARGS__, __VA_ARGS__);
const int N = 2e5 + 5;
const ll inf = LLONG_MAX;
using namespace std;

template<typename T> void debug(string s, T x) {cout << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cout << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}
template<class T>
void print_container(T &container) {for (auto &t : container) {cout << t << " ";} cout << endl;}
//Pain is temporary Glory is forever!!
//Think quick,Code Fast!!

void solve() {
	for (int i = 0; i < 5; i++) {
		int x; cin >> x;
		if (x == 0) {
			cout << i + 1 << endl;
		}
	}
}

int32_t main() {
	_

	solve();
}





Measured memory_bytes: 3652
n = int(input())
numbers = list(map(int, input().split()))
min_num = min(numbers)
max_num = max(numbers)
cost = -1
for i in range(min_num, max_num):
    temp = 0
    for number in numbers:
        temp += (number - i) ** 2
    
    if cost == -1 or temp < cost:
        cost = temp
if cost == -1:
    cost = 0
print(cost)

Measured memory_bytes: 3064
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        double A = s.nextInt();
        double B = s.nextInt();

        double n = Math.ceil((B - A) / (A - 1.0) + 1.0);
        System.out.println((int)n);
    }

}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	cout << fixed << setprecision(8);
	int n; cin>>n;
	double ans=0;
	rep(i,0,n){
		double x; cin>>x;
		string s; cin>>s;
		if(s=="JPY")ans+=x;
		else{
			ans+=(x*380000.0);
		}
	}
	cout<<ans<<endl;
	return 0;
}

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


int leap(int year){

  int cnt;

  cnt = (year - year % 4) / 4 - (year - year % 100) / 100 + (year - year % 400) / 400;

  return cnt;

}

int main(){

  int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int y1, m1, d1, y2, m2, d2, day_cnt1, day_cnt2;
  
  while(cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2){
    if(y1 < 0 || m1 < 0 || d1 < 0 || y2 < 0 || m2 < 0 || d2 < 0) break;
  
    day_cnt1 = 365 * (y1 - 1);
    day_cnt2 = 365 * (y2 - 1);
    
    for(int i=1; i<13; i++){
      if(m1 > i) day_cnt1 += month[i];
      if(m2 > i) day_cnt2 += month[i];
      if(m1 == i) day_cnt1 += d1;
      if(m2 == i) day_cnt2 += d2;
    }
    
    if(m1 == 1 || (m1 == 2 && d1 <= 28)) day_cnt1 += leap(y1 - 1);
    else day_cnt1 += leap(y1);
    if(m2 == 1 || (m2 == 2 && d2 <= 28)) day_cnt2 += leap(y2 - 1);
    else day_cnt2 += leap(y2);
    
    cout << day_cnt2 - day_cnt1 << endl;
  }
  

  return 0;

}

Measured memory_bytes: 1160
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    n, k = map(int, readline().split())
    print((((n-k)+(k-1)-1)//(k-1))+1)
if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

#define MAX 256

int main(void){
	
	int k = 0, i = 0;

	int m[MAX] = { 0 };
	int f[MAX] = { 0 };
	int r[MAX] = { 0 };

	while (k == 0){
		scanf("%d%d%d", &m[i], &f[i], &r[i]);
		if (m[i] + f[i] + r[i] == -3)k = 1;
		i++;
	}

	for (int j = 0; j < i - 1; j++){
		if (m[j] == -1 || f[j] == -1){
			printf("F\n");
		}
		else if ((m[j] + f[j]) >= 80){
			printf("A\n");
		}
		else if ((m[j] + f[j]) >= 65){
			printf("B\n");
		}
		else if ((m[j] + f[j]) >= 50){
			printf("C\n");
		}
		else if ((m[j] + f[j]) < 30){
			printf("F\n");
		}
		else{
			if (r[j] >= 50){
				printf("C\n");
			}
			else{
				printf("D\n");
			}
		}
	}

	return 0;
}

Measured memory_bytes: 3120
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int h, w;
int d[10][10];
void warshall_floyd(int n) {
  for (int k = 0; k < n; k++){       // 経由する頂点
    for (int i = 0; i < n; i++) {    // 始点
      for (int j = 0; j < n; j++) {  // 終点
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h>>w;
    int a[h][w];
    for (int i = 0; i < 10; i++)
    {
        for(int j=0;j<10;j++){
            cin>>d[i][j];
        }
    }
    warshall_floyd(10);
    int ans = 0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int temp;
            cin >> temp;
            if(temp==-1)continue;
            ans+=d[temp][1];
        }
    }
    cout << ans << "\n";
}



Measured memory_bytes: 256
#include <iostream>
main(){int b[5][4],s,t,x,y;char l[8];for(;;){for(int i=0;i<20;i++)b[i%5][i/5]=0;s=t=9;for(y=0;y<8;y++){if(!(std::cin>>l))break;for(x=0;x<8;x++){if(l[x]=='1'){if(t==9){s=x-1;t=y;}b[x-s][y-t]=1;}}}if(y<8)break;char a=65;if(b[1][3])a=66;if(b[4][0])a=67;if(b[0][2])a=68;if(b[3][1])a=69;if(b[2][2])a=70;if(b[0][1]&&b[2][0])a=71;std::cout<<a<<"\n";}}

Measured memory_bytes: 0
sl = list(input())
k = int(input())

for i in range(len(sl)):
    ord_s = ord(sl[i])
    use = 123 - ord_s
    if k - use >= 0 and sl[i] != "a":
        sl[i] = "a"
        k -= use

if k > 0:
    sl[-1] = chr((ord(sl[-1]) + k - 97) % 26 + 97)

print("".join(sl))



Measured memory_bytes: 49520
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
auto fl = [](auto a, auto b) { assert(b != 0); return a / b - (a % b != 0 && ((a >= 0) != (b >= 0)) ? 1 : 0); };
auto ce = [](auto a, auto b) { assert(b != 0); return a / b + (a % b != 0 && ((a >= 0) == (b >= 0)) ? 1 : 0); };
auto mo = [](auto a, auto b) { assert(b != 0); a %= b; if(a < 0) { a += abs(b); } return a; };
LL gcd(LL a, LL b) { return (b == 0 ? a : gcd(b, a % b)); }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)

// ---- ----

int main() {
	int a, b;
	cin >> a >> b;
	
	string s, t;
	inc(i, b) { s += to_string(a); }
	inc(i, a) { t += to_string(b); }
	
	cout << min(s, t) << endl;
	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            while (true)
            {
                string[] input = Console.ReadLine().Split(' ');

                int n = int.Parse(input[0]);
                int m = int.Parse(input[1]);

                if (n == 0 && m == 0) break;

                List<int> players = new List<int>();
                for (int i = 1; i <= n; i++) players.Add(i);

                int pos = -1;

                for (int i = n; i > 1; i--)
                {
                    pos += m;
                    pos %= players.Count;

                    players.RemoveAt(pos);
                    pos--;
                }
                sb.AppendLine(players[0].ToString());
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9232
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import Data.List

solve :: Int -> Int -> [Int] -> Int
solve n x as = minimum (take n costRot)
  where
  costRot = unfoldr f (0, as ++ as, as)
    where f (k,rs,ps) = Just (sum qs + k*x, (k+1, tail rs, qs))
            where qs = zipWith min rs ps

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> Int
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_n,bs_x]:remLines1 = remLines0
      n = readBInt bs_n
      x = readBInt bs_x
      line2:remLines2 = remLines1
      as = map readBInt line2
  in solve n x as

outAnswer :: Int -> IO ()
outAnswer = putStrLn . show

main :: IO ()
main = outAnswer . tmain =<< B.getContents


Measured memory_bytes: 1276
[n, k] = [int(x) for x in input().split()]
num_list = [int(x) for x in input().split()]
num_dict = {}
for num in num_list:
    num_dict[num] = num_dict.get(num, 0) + 1
sorted_count = sorted(num_dict.values())
if len(sorted_count) - k > 0:
    print(sum(sorted_count[:len(sorted_count)-k]))
else:
    print(0)


Measured memory_bytes: 98896
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
class Main {
    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String str[] = br.readLine().split(" ");
        long sum = 0;
        int a = 0;
        int max = -1000000;
        int min = 1000000;
        for(int i = 0; i < n; i++){
            a = Integer.parseInt(str[i]);
            if(a > max) max = a;
            if(a < min) min = a;
            sum += a;
        }
        System.out.println(min+" "+max+" "+sum);
    }
}

Measured memory_bytes: 28500
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
int n;
ll x[100100];
int main() {
    cin>>n;
    ll sum=0,a=0;
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&x[i]);
        if(x[i]<0)
            a++;
        x[i]=abs(x[i]);
    }
    sort(x,x+n);
    for(int i=0;i<n;i++)
        sum+=x[i];
    if(a%2)
        sum-=x[0]*2;
    cout<<sum;
    return 0;
}


Measured memory_bytes: 1024
//* AuThOr GaRyMr *//
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
multiset<int> s,now;
int main(){
	int n;
	int odn;
	cin>>n;
	odn=n;
	n=1<<n;
	rb(i,1,n) {
		int ai;
		cin>>ai;
		s.insert(-ai);
	}
	multiset<int> :: IT ite;
	now.insert(-*s.begin());
	rb(i,1,odn){
		multiset<int> save=now;
		for(auto it : now){
			ite=s.upper_bound(-it);
			if(ite==s.end()){
				puts("No");
				return 0;
			} 
			else{
				save.insert(-*ite);
				s.erase(ite);
			}
		}
		now=save;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 24832
n = gets.chomp.to_i
hats = gets.chomp.split(" ").map(&:to_i)

uniq_hats = hats.uniq

if uniq_hats.size == 1 && uniq_hats[0] == 0
  puts "Yes"
  exit
end

uniq_hats_2 = Array.new(3) {Array.new(50, 0)}

if uniq_hats.size == 3 && hats.count(uniq_hats[0]) == hats.count(uniq_hats[1]) && hats.count(uniq_hats[1]) == hats.count(uniq_hats[2])
  uniq_hats.each_with_index do |uniq_hat, index1|
    50.times do |index2|
      uniq_hats_2[index1][index2] = uniq_hat[index2]
    end
  end
elsif uniq_hats.size == 2
  if hats.count(uniq_hats[0]) * 2 == hats.count(uniq_hats[1])
    uniq_hats.each_with_index do |uniq_hat, index1|
      50.times do |index2|
        uniq_hats_2[index1][index2] = uniq_hat[index2]
        if index1 == 1
          uniq_hats_2[index1][index2] += uniq_hat[index2]
        end
      end
    end
  elsif hats.count(uniq_hats[0]) == hats.count(uniq_hats[1]) * 2
    uniq_hats.each_with_index do |uniq_hat, index1|
      50.times do |index2|
        uniq_hats_2[index1][index2] = uniq_hat[index2]
        if index1 == 0
          uniq_hats_2[index1][index2] += uniq_hat[index2]
        end
      end
    end
  else
    puts "No"
    exit
  end
else
  puts "No"
  exit
end

uniq_hats_3 = Array.new(50, 0)
uniq_hats_2.each_with_index do |uniq_hat_2, index1|
  50.times do |index2|
    uniq_hats_3[index2] += uniq_hat_2[index2]
  end
end

if uniq_hats_3.include?(1) == false && uniq_hats_3.include?(3) == false
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 13340
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	i, j := 0, len(s)-1
	var cnt int
	for i < j { // i,jが重なっても1文字なので回文として問題ない
		if s[i] == s[j] {
			i++
			j--
		} else if s[i] == 'x' {
			// 後ろも'x'だったことにする
			i++
			cnt++
		} else if s[j] == 'x' {
			// 前も'x'だったことにする
			j--
			cnt++
		} else {
			cnt = -1
			break
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 1280
#include<iostream>

using namespace std;

int main(){
  int N;
  int a[111];
  int color[8] = {0};
  int i,k;
  int all = 0;
  cin >> N;
  for(i=0;i<=N-1;i++){
    cin >> a[i];
  }
  for(i=0;i<=N-1;i++){
    k = 0;
    while(a[i]>=400*(k+1)){
      k++;
    }
    if(k<8) color[k] = 1;
    else all++;
  }
  int ans = 0;
  for(i=0;i<=7;i++)
    ans += color[i];
  if(ans > 0) cout << ans << " " << ans + all;
  if(ans == 0) cout << 1 << " " << all;
}



Measured memory_bytes: 256
//love yjl forever
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int INF=0x3f3f3f3f,N=1e5+5;
int n,m,k;
int a[N],b[N];
int ans=INF;
int main()
{
/*	freopen("","r",stdin);
	freopen("","w",stdout);*/
	int i;
	cin>>n>>m>>k;
	int m1=INF,m2=INF;
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]),m1=min(m1,a[i]);
	for(i=1;i<=m;i++)
		scanf("%d",&b[i]),m2=min(m2,b[i]);
		
	for(i=1;i<=k;i++)
	{
		int x,y,c;
		scanf("%d%d%d",&x,&y,&c);
		ans=min(ans,a[x]+b[y]-c);
	}
	cout<<min(ans,m1+m2)<<endl;
}

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

using namespace std;
typedef long long ll;

int Judge(int n) {
	string s;
	printf("%d\n", n);
	cin >> s;
	if (s[0] == 'V')
		return 0;
	if (s[0] == 'M')
		return 1;
	else
		return 2;
}

int Judge(int n, string &s) {
	if (s[n] == '0')
		return 0;
	else if (s[n] == '1')
		return 1;
	else
		return 2;
}

int main(void) {
	int num, l = 0, r, p;
	cin >> num;
	vector<int> d(num, 0);
	d[0] = Judge(0);
	if (d[0] == 0)
		return 0;
	r = num - 1;
	d[r] = Judge(r);
	if (d[r] == 0)
		return 0;
	while (l != r) {
		p = (l + r) >> 1;
		d[p] = Judge(p);
		if (d[p] == 0)
			break;
		if ((p - l) & 1) {
			if (d[p] != d[l])
				l = p;
			else
				r = p;
		}
		else {
			if (d[p] != d[l])
				r = p;
			else
				l = p;
		}
	}
	return 0;
}

Measured memory_bytes: 1236
Q, H, S, D = map(int, input().split())
N = int(input())

n, cost = N * 4, 0
while 0 < n:
	if 8 <= n:
		offset = n // 8
		cost += (min(D, S * 2, H * 4, Q * 8) * offset)
		n -= (8 * offset)
		continue
	if 4 <= n:
		cost += min(S, H * 2, Q * 4)
		n -= 4
		continue
	if 2 <= n:
		cost += min(H, Q * 2)
		n -= 2
		continue
	if 1 <= n:
		cost += min(Q)
		n -= 1
		continue
print(cost)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<#x<<" " <<x<<endl;
const long long  N=2e5+10,big=1e18,mod=1e9+7;
const double pi=acos(-1);

long long n,m,k,mini=N,maxi=-N;
vector<pair<long long ,long long > >a[N];
bool color[N];

void dfs(long long i ,long long p,long long dis)
{
    color[i]=dis%2;
    for(auto j:a[i])
    {
        if(j.first!=p)
            dfs(j.first,i,dis+j.second);
    }
}
int main()
{
    cin>>n;
    for(int i=1;i<n;i++)
    {
        long long  x,y,z;
        cin>>x>>y>>z;
        a[x].push_back(make_pair(y,z));
        a[y].push_back(make_pair(x,z));
    }

    dfs(1,0,0);
    for(int i=1;i<=n;i++)
        cout<<color[i]<<endl ;

}



Measured memory_bytes: 11904
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int a[n], b, ans = 0;
    for(int i=0;i<n;i++){
    	cin >> a[i];
    }
    for(int i=0;i<n;i++){
    	cin >> b;
    	if(a[i] - b > 0){
    		ans += a[i] - b;
    	}
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
s = input()

n = len(s)-1
ans = 0
for i in range(2**n):
  t = s[0]
  for j in range(n):
    if i >> j & 1: t += "+" # 該当する場合のみ"+"を追加する
    t += s[j+1] # 次の文字を追加
  ans += eval(t) # 生成した文字列を計算
print(ans)

Measured memory_bytes: 9124
import java.util.*;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();

        if (s.equals(t.substring(0, t.length() - 1))) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35716
#include <bits/stdc++.h>
#define int long long
#define pii pair<int, int>
  
using namespace std;
const int inf = 1e9 + 7;


signed main() {
	/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/

    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);

   	double l;
   	cin >> l;
   	cout << setprecision(20) << (l / 3) * (l / 3) * (l / 3);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define boost ios::sync_with_stdio(false); cin.tie(0)
#define ll              long long int
#define ld              long double
#define mk              make_pair
#define pb              push_back
#define f               first
#define s               second
#define fo(i,a,b)       for(i=a;i<b;i++)
#define foe(i,a,b)      for(i=a;i<=b;i++)
#define all(x)          x.begin(),x.end()
#define vi              vector<int>
#define vl              vector <long long int>
#define pii             pair <int,int>
#define pll             pair <long long int, long long int>
#define vpii            vector< pair<int,int> >
#define vpll            vector < pair <long long int,long long int> >
#define MOD             1000000007
using namespace std;
const int inf = INT_MAX;
const ll inf64 = LLONG_MAX;


int main()
{
    boost;
    ll n,k;
    cin >> n >> k;
    vector <int> vis(n+1,-1);
    vi path;
    ll arr[n+1],i;
    foe(i,1,n)
    {
    	cin >> arr[i];
    }
    path.pb(1);
    vis[1] = 0;
    ll last = 1;
    ll curr;
    ll cnt = 1;
    while(true)
    {
    	if(vis[arr[last]] != -1)break;
    	curr = arr[last];
    	vis[curr] = cnt++;
    	path.pb(curr);
    	last = curr;
    }
    // for(auto x : path)cout << x << ' ';
    ll start = vis[arr[last]];
    if(k<path.size())
    {
    	cout << path[k];
    }
    else
    {
    	k -= path.size();
    	ll len = path.size()-start;
    	cout << path[start + (k%len)];
    }

    
    return 0;
}

Measured memory_bytes: 6628
from collections import Counter
 
M = 998244353
n = int(input())
a = map(int, input().split())
x, c = next(a), Counter(a)
r = 0
if x == c[0] == 0:
  r = x = 1
  try:
    for i in range(1, n):
      p = x; x = c.get(i); n -= x
      r = r * pow(p, x, M) % M
  except TypeError:
    pass
print((r, 0)[n > 1])

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

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

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

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

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
//vector <vector<int>> x(20, vector<int> (20)), y(20,vector<int> (20));
/*int counter_1 (int x) {
    if(x == 0) return 0;
    return counter_1(x >> 1) + (x & 1);
}*/

//int Counter(int x)
/*int factorial(int n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}*/
int main(){
    int n;
    cin >> n;
    VI a(n);
    REP(i,n){
        cin >> a[i];
    }
    bool ans=true;
    REP(i,n){
        if(a[i]%2==0&&a[i]%3!=0&&a[i]%5!=0){
            //cout << a[i] << endl;
            ans=false;
            break;
        }
    }
    if(ans==false) cout << "DENIED" << endl;
    else cout << "APPROVED"  << endl;
}

    



Measured memory_bytes: 256