akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define mod 1000000007LL
#define eps 1e-13
#define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define endl '\n'
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mp make_pair
#define F first
#define S second
#define pb(x) push_back(x)
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define foi(i,a,n) for(i = (a); i <= (n); i++)
#define pd(x) cout<<x
#define sd(x) cin>>x
#define nl cout<<endl
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0)
#define gcd __gcd
#define clr(x) memset(x,0,sizeof(x))
#define all(a) (a).begin(), (a).end()
#define foreach(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define sz(a) (int)((a).size())
//int a[25]= { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 };
//int dw[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
//int dw[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
//ll fibonacci[2][2] = {{0,1},{1,1}};
//ll identity[2][2] = {{1,0},{0,1}};

int main() {
    sws;
	ll i,j,k;
	ll n;
	cin>>n;
	vector<pll> ans;
	fo(i,1,n+1) {
		ll last = (n/2)*2;
		fo(j,i+1,n+1) {
			if (j == (last - i + 1)) continue;
			ans.pb(mp(i,j));
		}
	}
	cout << sz(ans) << endl;
	for(auto it : ans) {
		cout << it.F << " " << it.S << endl;
	}
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main()
{
	int a = 0;
	int temp = 0;
	int count = 0;
	while (cin >> temp) 
	{
		if(count==1)
		{
			cout << (a + temp)<<endl;
			count = 0;
		}
		else
		{
			a = temp;
			count++;
		}
	}
	return 0;
}


Measured memory_bytes: 3108
#include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
_T _DEF(T,in,int c){T n=0;int m=1;while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int, in){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_T _SCAN(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_DEF(bool, scan, char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_OUT(string s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b,m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=n%10*m+'0',n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}

int main() {
	vector<int> dp;
	for (int n = in(); n; n--) {
		int a = in();
		auto r = lower_bound(dp.begin(), dp.end(), a);
		if (r == dp.end())
			dp.push_back(a);
		else
			*r = a;
	}
	outl((int) dp.size());
}


Measured memory_bytes: 2832
import numpy as np
MOD = 10 ** 9 + 7

def pow_mod(value, exp):
    r = 1
    while exp:
        if exp % 2:
            r *= value
            r %= MOD
        value *= value
        value %= MOD
        exp //= 2
    return r

fact = [1] * 1000001
for i in range(1, 1000000+1):
    fact[i] = fact[i-1] * i % MOD

x, y = map(int, input().split())
if (x + y) % 3 or x > y * 2 or y > x * 2:
    print('0')
    exit()

a, b = map(int, np.linalg.solve([[2, 1], [1, 2]], [x, y]))
ans = fact[a + b] % MOD
ans *= pow_mod(fact[a], MOD-2)
ans %= MOD

ans *= pow_mod(fact[b], MOD-2)
ans %= MOD
print(ans)


Measured memory_bytes: 53572
import math

n = int(input().rstrip())
x = [0] * (n)

line = input().rstrip().split(' ')
sum = 0
for i in range(n):
    x[i] = int(line[i])
    sum += x[i]

ave = int(round((sum / n), 0)) 

ans = 0
for i in range(n):
    ans += (x[i] - ave) ** 2

print(ans)

Measured memory_bytes: 3188
#include<cstdio>
#include<cmath>
//#include<algorithm>
int a, b, h, m;
double szj, fzj, j, ans;
int main(){
	scanf("%d%d%d%d", &a, &b, &h, &m);
	szj=(h*60+m)*0.5;
	fzj=6*m;
	j=fabs(szj - fzj);
	if(j > 180) j = 360 - j;
	printf("%.20f",sqrt(a * a + b * b -2 * cos(j * M_PI / 180) * a * b));
	return 0;
}

Measured memory_bytes: 2604
import sys

def solve():
    input = sys.stdin.readline
    N = input().strip("\n")
    total = 0
    for i in range(len(N)):
        total += int(N[i])
        total %= 9
    if total == 0: print("Yes")
    else: print("No")

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 9336
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

const int m = 26;

int main(){
    int D; cin >> D;
    vl c(m); rep(i,m) cin >> c[i];
    vvl s(D,vl(m));
    rep(i,D) rep(j,m) cin >> s[i][j];
    vl t(D); rep(i,D) cin >> t[i], t[i]--;
    int M; cin >> M;
    while(M--){
        int d,q; cin >> d >> q; d--; q--;
        vl last(m,0);
        t[d] = q;
        ll score = 0;
        rep(i,D){
            last[t[i]] = i+1;
            score += s[i][t[i]];
            rep(j,m){
                score -= c[j] * (i+1 - last[j]);
            }
        }
        cout << score << "\n";
    }
}

Measured memory_bytes: 3672
#include<iostream>
#include<cstring>
#include<cstdio>
#define MAIN 200010
using namespace std;
const long long p = 1000000007;
long long fact[MAIN] = {1}, inv[MAIN] = {1};
long long Lucas ( long long a, long long m ) {
	long long ans = fact[a];
	ans = ( ans * inv[a - m] % p ) * inv[m] % p;
	return ans;
}
long long power ( long long a, long long b ) {
	long long ans = 1;
	while ( b ) {
		if ( b & 1 ) ans = ( ans * a ) % p;
		b = b >> 1;
		a = ( a * a ) % p;
	}
	return ans;
}
int main() {
	long long h, w, a, b;
	scanf ( "%lld%lld%lld%lld", &h, &w, &a, &b );
	for ( int i = 1; i <= 200000; i++ ) {
		fact[i] = ( fact[i - 1] * i ) % p;
		inv[i] = power ( fact[i], p - 2 );
	}
	long long ans = 0;
	for ( long long i = 1; i <= w - b; i++ )
		ans = ( ans + Lucas ( a + i - 2, i - 1 ) * Lucas ( h - a + w - i - 1, w - i ) ) % p;
	printf ( "%lld\n", ans );
	return 0;
}


Measured memory_bytes: 3328
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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 N,X,T; cin>>N>>X>>T;
  ll count=N/X; if(N%X!=0) count++;
  cout<<count*T<<endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <bits/stdc++.h> //for all of STL
#include <numeric> //for accumulate(v.begin(),v.end(),0)
// #include <algorithm>
// #include <vector>

using namespace std;
int64_t n,t,i,j,k,l,flag,c,s,m,a,b,d;
int main()
{
    //long n;
    // cout<<__builtin_popcount(num)<<endl; //for counting number of set (1) bits in a number
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    // cout.tie(NULL);
    // for faster I/O fr CP
    
    cin>>n;
    
    unordered_map<string,int64_t> ump;
    c=0;
    for(i=0;i<n;i++){
        string s;
        cin>>s;
        if(ump[s]==0){
            ump[s]++;
            c++;
        }
    }
    cout<<c<<"\n";
return 0;
}



Measured memory_bytes: 17672
//http://arc071.contest.atcoder.jp/tasks/arc071_b

#include <stdio.h>
#define ArrLen 100000
#define Modulo 1000000007

long long findLineMod(int n) {
//    int arr[ArrLen];
    long long result = 0;
    long long left, right;
    scanf("%lld", &left);
    for(int i = 1; i < n; i++) {
        scanf("%lld", &right);
        long long diff = (right - left) % Modulo;
        long long times = ((long long)i * (n - i)) % Modulo;
        result += (diff * times) % Modulo;
        result %= Modulo;
        left = right;
    }
//    for(int i = 1; i < n; i++) {
//        for(int j = 0; j < i; j++) {
//            result += arr[i] - arr[j];
//            result %= Modulo;
//        }
//    }
    
    return result;
}

int main() {
    int m, n;
//    printf("%lu, %lu, %lu\n", sizeof(int), sizeof(long), sizeof(long long));
    scanf("%d%d", &m, &n);
    long long xSum = findLineMod(m);
    long long ySum = findLineMod(n);
    
    long long product = xSum * ySum;
    product %= Modulo;
    
    printf("%lld\n", product);
    
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  string S[N];
  for(int i=0;i<N;i++) cin >> S[i];
  bool V[N][N];
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(S[i][j]=='1') V[i][j]=true;
      else V[i][j]=false;
    }
  }
  
  vector<int> state(N,-1);
  queue<int> Q;
  state[0] = 0;
  Q.push(0);
  while(!Q.empty()){
    int u = Q.front();
    Q.pop();
    for(int v=0;v<N;v++){
      if(V[u][v]==false) continue;
      if(state[v]==-1){
        if(state[u]==0) state[v] = 1;
        else state[v] = 0;
        Q.push(v);
      }
      else if(state[u]==state[v]){
        cout << -1 << endl;
        return 0;
      }
    }
  }
  
  int dp[N][N] , inf=100000000;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(i==j) dp[i][j] = 0;
      else if(V[i][j]==true) dp[i][j] = 1;
      else dp[i][j] = inf;
    }
  }
  for(int k=0;k<N;k++){
    for(int i=0;i<N;i++){
      if(dp[i][k]==inf) continue;
      for(int j=0;j<N;j++){
        if(dp[k][j]==inf) continue;
        dp[i][j] = min(dp[i][j],dp[i][k]+dp[k][j]);
      }
    }
  }
  
  int ans=1;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(dp[i][j]==inf) continue;
      ans = max(ans,dp[i][j]+1);
    }
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
from functools import reduce
n, k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
tmp_max = sum([i / 2 + 0.5 for i in p[0:k]])
tmp = tmp_max
idx = 0
for i in range(1, len(p) - k + 1):
	tmp -= p[i - 1] / 2 + 0.5
	if i + k - 1 < len(p):
		tmp += p[i + k - 1] / 2 + 0.5
	tmp_max = max(tmp_max, tmp)
print(tmp_max)

Measured memory_bytes: 33168
#include <stdio.h>

int main (void){
    int a=0;
    int b=0;

    scanf("%d%d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }
    if(a>b){
        printf("a > b\n");
    }
    if(a==b){
        printf("a == b\n");
    }

}



Measured memory_bytes: 2112
// D - Triangles
// 累積和による方法(他人のコードは勉強になるけど疲れるW)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

ll solve(int N, vi &L){
	vi csum(2000+1); //[length]<count>: 累積和: cumulative sum
	rp(i, 0, N) csum[L[i]]++;
	rp(i, 1, csum.size()) csum[i] += csum[i-1]; // その長さまでの棒の個数
	ll ans = 0;// 棒の本数が入り、三角形の三倍以上の数になるのでlonglong
	rp(ia, 0, N-1){
		rp(ib, ia+1, N){
			int a = L[ia], b = L[ib];
			int minL = abs(a - b), maxL = a + b; // |a-b| < c < a+b : cの範囲
			ans += csum[maxL-1] - csum[minL]; // maxL-1 に注意！cの範囲に(等号はない)にある棒の数を足す
			if(minL<a && a<maxL) ans--; // cの範囲にaがあれば一本不要
			if(minL<b && b<maxL) ans--; // cの範囲にbがあれば一本不要
		}
	}
	return ans/3; //3本で△1つ
}

int main(){
	int N; cin>>N;
	vi L(N); rp(i, 0, N) cin>>L[i];
	cout<< solve(N, L) <<endl;
}

Measured memory_bytes: 256
#include <iostream>

#define REP(i, n) for (int i = 0; i < n; i++)
#define debug(x) cerr << #x << " = " << (x) << endl;

using namespace std;

int main() {
	while (1) {
		int furui[323456], n, ans;
		
		cin >> n;
		if (n==0) break;
		REP(i, 2*n+1) furui[i] = i;
		ans = 0;

		for (int i = 2; i <= 2 * n; i++) {
			if (furui[i] > 0) {
				//debug(i);
				if (i > n) ans++;
				for (int k = 1; i * k <= 2 * n; k++) {
					furui[i * k] = 0;
				}
			}
		}

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



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

#define all(v) v.begin(), v.end()
#define V vector
#define P pair
#define M map
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;

int main() {
    ll a, b, c; cin >> a >> b >> c;
    ll k; cin >> k;

    ll sum = 0;
    if(a <= k){
        sum += a;
        k -= a;
    }else{
        cout << k << endl;
        return 0;
    }
    if(b <= k){
        k -= b;
    }else{
        cout << sum << endl;
        return 0;
    }
    if(c <= k){
        sum -= c;
    }else{
        cout << sum - k << endl;
        return 0;
    }
    cout << sum << endl;
}


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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main(void){
    int n, d;
    cin >> n >> d;
    cout << ((n+(2*d))/(2*d+1)) << endl;
    return 0;
}


Measured memory_bytes: 256
def main():
    S = input()
    while True:
        if S[-7:] == "dreamer":
            S = S[:-7]
        elif S[-6:] == "eraser":
            S = S[:-6]
        elif S[-5:] == "erase":
            S = S[:-5]
        elif S[-5:] == "dream":
            S = S[:-5]
        else:
            print("NO")
            break

        if len(S) == 0:
            print("YES")
            break


if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
#!/usr/bin/python3

import math
import os
import sys


DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def solve(N, A):
    allxor = 0
    for a in A:
        allxor ^= a

    while len(A) < 61:
        A.append(0)
    M = len(A)

    row = 0
    ans = 0
    for bi in range(61, -1, -1):
        b = 1 << bi
        if b & allxor:
            ans |= b
            continue

        if not (A[row] & b):
            j = -1
            for i in range(row + 1, M):
                if A[i] & b:
                    j = i
                    break
            if j == -1:
                continue

            A[row], A[j] = A[j], A[row]

        assert A[row] & b
        if not (ans & b):
            ans ^= A[row]

        for i in range(row + 1, M):
            if A[i] & b:
                A[i] ^= A[row]
            assert not (A[i] & b)

        row += 1

    return ans + (ans ^ allxor)


def main():
    N = int(inp())
    A = [int(e) for e in inp().split()]
    print(solve(N, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 75888
#include<iostream>
#include<string>
using namespace std;
#define MAX 100010
bool seats(int n, string s);
int main(){
    int a,b;
    cin>>a>>b;
    if((a * b) % 2 == 0){
        cout<<"Even"<<endl;
    }
    else{
        cout<<"Odd"<<endl;
    }
    
    
    return 0;


}

Measured memory_bytes: 256
// Problem : C - HSI
// Contest : AtCoder - AtCoder Beginner Contest 078
// URL : https://atcoder.jp/contests/abc078/tasks/arc085_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}
int Pow(int n,int x)
{
	int ans=1;
 	while(x>0)
 	{
 		if(x&1)
 		{
 			ans=(ans*n);
 		}
 		n=(n*n);
 		x=x>>1;
 	}
  	return ans;
 }
void solve()
{
	int n,m;cin>>n>>m;
	cout<<((n-m)*100+m*1900)*Pow(2,m);
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 3656
A, B, C, D, E, F = list(map(int, input().split()))

s1 = set()
for i in range(0, 31, A):
    for j in range(0, 31, B):
        if 0 < i + j and i * 100 + j * 100 <= F:
            s1.add(i + j)

s2 = set()
for i in range(0, F, C):
    for j in range(0, F, D):
        if i + j <= F:
            s2.add(i + j)

concent = 0
total = 0
sugar = 0
for ab in s1:
    for cd in s2:
        if cd / ab <= E and ab * 100 + cd <= F:
            if concent <= cd / ab:
                concent = cd / ab
                total = ab * 100 + cd
                sugar = cd


print(total, sugar)


Measured memory_bytes: 3188
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<complex>
#include<sstream>
#include<climits>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 100000, INF = 1e9;
int N, K;
int A[MAX_N], B[MAX_N];
int U[MAX_N], P[MAX_N];
int ans[MAX_N+1];
int LB[MAX_N+1], UB[MAX_N+1];

vector<int> G[MAX_N+1];
int d[MAX_N+1];
bool visited[MAX_N+1];

void check(int v, int dist) {
  visited[v] = true;
  d[v] = dist;
  for (int i = 0; i < G[v].size(); ++i) {
    int u = G[v][i];
    if (!visited[u]) {
      check(u,dist+1);
    }
  }
  return;
}

void dfs(int v) {
  
  for (int i = 0; i < G[v].size(); ++i) {
    if (d[v] < d[G[v][i]]) {
      dfs(G[v][i]);
    }
  }

  for (int i = 0; i < G[v].size(); ++i) {
    if (d[v] < d[G[v][i]]) {
      LB[v] = max(LB[v], LB[G[v][i]]-1);
      UB[v] = min(UB[v], UB[G[v][i]]+1);
    }
  }

  if (UB[v] <= LB[v]) {
    LB[v] = INF;
    UB[v] = -INF;
  }
}

void make(int v, int pn) {
  if (pn+1 >= LB[v] && pn+1 < UB[v]) {
    ans[v] = pn+1;
  } else {
    ans[v] = pn-1;
  }

  for (int i = 0; i < G[v].size(); ++i) {
    if (d[v] < d[G[v][i]]) {
      make(G[v][i], ans[v]);
    }
  }
}

int main() {
  cin >> N;
  for (int i = 0; i < N-1; ++i) cin >> A[i] >> B[i];
  cin >> K;
  for (int i = 0; i < K; ++i) cin >> U[i] >> P[i];

  for (int i = 0; i < N-1; ++i) {
    G[A[i]].push_back(B[i]);
    G[B[i]].push_back(A[i]);
  }

  fill(visited, visited+N+1, false);
  check(U[0],0);

  for (int i = 0; i < K; ++i) {
    if (d[U[i]]%2 != abs(P[i]-P[0])%2) {
      cout << "No" << endl;
      return 0;
    }
  }

  fill(LB, LB+N+1, -INF);
  fill(UB, UB+N+1, INF);
  for (int i = 0; i < K; ++i) {
    LB[U[i]] = P[i]; UB[U[i]] = P[i]+1;
  }
  dfs(U[0]);

  if (LB[U[0]] >= UB[U[0]]) {
    cout << "No" << endl;
    return 0;
  } else {
    cout << "Yes" << endl;
    make(U[0], LB[U[0]]-1);
    for (int i = 1; i <= N; ++i) {
      cout << ans[i] << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 13696
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        char[] s = sc.next().toCharArray();
        for(char c : s){
            pw.print(c == '9' ? '1' : '9');
        }
        pw.println();
        pw.flush();
    }

    static class GeekInteger {
        public static void save_sort(int[] array) {
            shuffle(array);
            Arrays.sort(array);
        }
 
        public static int[] shuffle(int[] array) {
            int n = array.length;
            Random random = new Random();
            for (int i = 0, j; i < n; i++) {
                j = i + random.nextInt(n - i);
                int randomElement = array[j];
                array[j] = array[i];
                array[i] = randomElement;
            }
            return array;
        }
 
    }
}

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 String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    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: 25328
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<map>
#include<string>
#include<numeric>
#include<set>
using namespace std;

int iabs(int m){
    if(m >= 0) return m;
    else return -m;
}

int main(){
    int N, L;
    cin >> N >> L;

    int tot = N*L + N*(N+1)/2 - N;
    int mini = L;

    for(int i = 2; i <= N; i++){
        if(iabs(L+i-1) < iabs(mini)) mini = L+i-1;
    }

    cout << tot - mini << endl;

    return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <bits/stdc++.h>
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 vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//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(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//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;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int N,Y; cin >> N >> Y;
    REP(i,N+1)REP(j,N+1){
        if(i+j > N) continue;
        if(10000*i+5000*j+1000*(N-i-j) == Y){
            cout << i << " " << j << " " << N-i-j << endl;
            return 0;
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define PB push_back
#define SZ(x) ((int)(x).size())
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
typedef vector<int>VI;
const int N=200005;
int n,ans[N],num[N];
int pp,lnk[N],nxt[N*2],to[N*2];
void ae(int k1,int k2){to[++pp]=k2,nxt[pp]=lnk[k1],lnk[k1]=pp;}
int get(int k1,int k2,int k3){
	if(k1>k3)return 0;
	int res=1;
	for(int i=lnk[k1];i;i=nxt[i])if(to[i]!=k2)res+=get(to[i],k1,k3);
	return res;
}
void dfs(int k1,int k2,int k3,int k4){
	if(k1==1){
		for(int i=lnk[k1];i;i=nxt[i])if(to[i]!=k2){
			dfs(to[i],k1,k3,k4);
		}
		return;
	}
	if(k1>k3){
		if(k3>0){
			int sum=0;
			for(int i=lnk[k1];i;i=nxt[i])if(to[i]!=k2){
				int t=get(to[i],k1,k3);
				num[to[i]]=-t;
				sum+=t;
			}
			ans[k1]=k4+sum+1;
		}else ans[k1]=1;
		for(int i=lnk[k1];i;i=nxt[i])if(to[i]!=k2){
			int t=get(to[i],k1,k1);
			num[to[i]]+=t;
		}
		for(int i=lnk[k1];i;i=nxt[i])if(to[i]!=k2)dfs(to[i],k1,k1,ans[k1]+num[to[i]]);
	}else{
		ans[k1]=k4;
		for(int i=lnk[k1];i;i=nxt[i])if(to[i]!=k2)dfs(to[i],k1,k3,k4);
	}
}
int main(){
	scanf("%d",&n);
	rep(i,1,n-1){
		int k1,k2;scanf("%d%d",&k1,&k2);
		ae(k1,k2),ae(k2,k1);
	}
	dfs(1,0,0,0);
	rep(i,2,n)printf("%d ",ans[i]);
	return 0;
}

Measured memory_bytes: 27108
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, N, a, b) for(int i = a; i < N; i += b)
typedef long long ll;

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

	ll ans = 1;
	for (int i = 1; i <= N; i++){
		ans *= i;
		ans %= 1000000007;
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
//設定言語check
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;

int main(){
  int H, W, K, count, ans = 0, selH = 1, selW = 1 ;
  cin >> H >> W >> K ;
  char board[W][H] ;
  int bolH[H], bolW[W] ;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> board[j][i] ;
      if(i == 0) selW *= 2 ;
    }
    selH *= 2 ;
  }
  for(int caseH=0;caseH<selH;caseH++){
    for(int i=0;i<H;i++){
      bolH[i] = ((caseH >> i) % 2) ;
    }
    for(int caseW=0;caseW<selW;caseW++){
      for(int i=0;i<W;i++){
        bolW[i] = ((caseW >> i) % 2) ;
      }
      count = 0 ;
      for(int i=0;i<H;i++){
        if(bolH[i] == 0) continue ;
        for(int j=0;j<W;j++){
          if(bolW[j] == 0) continue ;
          if(board[j][i] == '#' ) count++ ;
        }
      }
      if(count == K) {
        ans++ ;
      }
    }
  }
  cout << ans << endl ;
  return 0 ;
}  

Measured memory_bytes: 3628
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
#include <map> // pair
#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;

using namespace std;
using ll = long long;
typedef pair <ll, ll > pll;

int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll n, m, K;
	ll memo[1003][1003] = { {} };
	ll memox[1003] = {};
	ll memoy[1003] = {};
	ll x[1000006] = {};
	ll y[200005] = {};
	ll z[200005] = {};
	string s;
	string s1, s2;
	//IntStack yStack;
	//charStack Stack;
	cin >> a;
	cin >> b;
	vector<pair<int, int> > pairs(a);
	for (int i = 0; i < a; i++)
	{
		cin >> x[i];
	}
	x[a] = 999999999999;
	for (int i = 0; i < a; i++)
	{
		if (x[i] + b > x[i + 1])
		{
			ans += x[i + 1] - x[i];
		}
		else
		{
			ans += b;
		}
	}
	cout << ans << endl;


	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}

//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

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



int main(void)
{
  string s;
  set<char> se;
  cin >> s;
  REP(i, s.size()) {
    se.insert(s[i]);
  }
  if(s.size() == se.size()) {
    cout << "yes" << endl;
  } else {
    cout << "no" << endl;
  }
}


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

typedef long long ll;

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

struct edge{
  int to;
  int a;
  ll b;
};

int n,m;
ll s;
vector<edge> g[55];
ll c[55];
ll d[55];
ll di[55][2505];
bool use[55][2505];
const ll INF = 1e18;

int main() {
cin >> n >> m >> s;
s = min(2500ll,s);
for(int i = 0; i < m; i++) {
  int u,v,a,b;
  cin >> u >> v >> a >> b;
  u--,v--;
  g[u].push_back(edge{v,a,b});
  g[v].push_back(edge{u,a,b});
}

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

for(int i = 0; i < n; i++) {
  for(int j = 0; j <= 2500; j++) {
    di[i][j] = INF;
  }
}

di[0][s] = 0;
priority_queue<PP, vector<PP>,greater<PP> > q;

q.push(PP(0,P(s,0)));

while(!q.empty()) {
  PP p = q.top();
  q.pop();
ll time = p.first;
int ginka = p.second.first;
int u = p.second.second;

if(di[u][ginka] < time) continue;



  if(di[u][min(2500ll,c[u] + ginka)] > di[u][ginka] + d[u]) {
    di[u][min(2500ll,c[u]+ginka)] = di[u][ginka] + d[u];
    q.push(PP(di[u][min(2500ll,c[u]+ginka)],P(min(2500ll,c[u]+ginka),u)));
  }

for(int i = 0; i < g[u].size(); i++) {
  edge e = g[u][i];

  if(ginka - e.a >= 0 && di[e.to][ginka-e.a] > di[u][ginka] + e.b) {
    di[e.to][ginka-e.a] = di[u][ginka] + e.b;
    q.push(PP(di[e.to][ginka-e.a],P(ginka-e.a,e.to)));
  }
}
}



for(int i = 1; i < n; i++) {
  ll ans = INF;
  for(int j = 0; j <= 2500; j++) {
    ans = min(ans,di[i][j]);
  
  }
  cout << ans << endl;
}




}

Measured memory_bytes: 6268
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MOD = (int)1e9 + 7;
//const int NMAX = 10000005;
//ll dp[NMAX][NMAX];
ll modpow(ll a, ll b){
  ll r = 1; 
  while (b){
    if (b & 1) 
      r = r*a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
    return r;
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x, y;
  cin >> x >> y;
  int n = x + y;
  if (n % 3) return puts("0"), 0;
  n/=3;
  if (x < n || y < n) return puts("0"), 0;
  x -= n; y -= n;
  ll a = 1, b = 1;
  for (int i = 1; i <= x + y ; i++)
    a = a * i % MOD;
  for (int i = 1; i <= x; i++)
    b = b * i % MOD;
  for (int i = 1; i <= y; ++i)
    b = b * i % MOD;
  ll ans  = a * modpow(b, MOD-2) % MOD;
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from fractions import gcd
def f(a,b,c,d):
    if a<b:
        return 0
    if b>d:
        return 0
    if b-1<=c:
        return 1
    x=a%b
    #print(3)
    if b==d:
        if c<x:
            return 0
        elif c>=x:
            return 1
    #print(4)
    if c<x:
        return 0
    e=(d-b)%b
    d1=gcd(e,b)
    q=(c+1-x)//d1
    q1=(b-1-x)//d1
    #print(d1,q,q1,x,(c+1-x)%d1)
    if q<q1:
        return 0
    if (c+1-x)%d1==0:
        return 0
    return 1
T=int(input())
X=[[int(i) for i in input().split()] for i in range(T)]
for a,b,c,d in X:
    s=f(a,b,c,d)
    if s:
        print('Yes')
    else:
        print('No')




Measured memory_bytes: 65644
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
ll A, B;

ll dp[5010][5010];
int P[5010];

void solve() {
	cin >> N >> A >> B;
	rep(i, 0, N) cin >> P[i];
	rep(i, 0, N + 1) {
		rep(j, 0, N + 1) {
			dp[i][j] = linf;
		}
	}
	dp[0][0] = 0;
	rep(i, 0, N) {
		rep(j, 0, N + 1) {
			if(dp[i][j] == linf) continue;
			if(j < P[i]) {
				MIN(dp[i + 1][P[i]], dp[i][j]);
				MIN(dp[i + 1][j], dp[i][j] + A);
			}
			else if(P[i] < j) {
				MIN(dp[i + 1][j], dp[i][j] + B);
			}
		}
		// debug(vl(dp[i + 1], dp[i + 1] + N + 1));
	}
	ll res = linf;
	rep(j, 0, N + 1) MIN(res, dp[N][j]);
	cout << res << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 195968
fn getline() -> String{
    let mut __ret=String::new();
    std::io::stdin().read_line(&mut __ret).ok();
    return __ret;
}

fn main(){
    let s=getline();
    let a:Vec<_>=s.trim().split(' ').collect();
    let n:i32=a[0].parse().unwrap();

    let mut min_sum = -1;
    for a in 1..n{
        let b = n-a;
        let a_str = format!("{:?}", a);
        let b_str = format!("{:?}", b);
        let mut sum:i32 = 0;
        for c in a_str.chars(){
            let x = format!("{}", c);
            let s:i32 =  x.parse().unwrap();
            sum += s;
        }
        for c in b_str.chars(){
            let x = format!("{}", c);
            let s:i32 =  x.parse().unwrap();
            sum += s;
        }
        if(min_sum < 0){
            min_sum = sum;
        }
        else{
            if(min_sum > sum){
                min_sum = sum;
            }
        }
    }
    println!("{} ",min_sum);
}

Measured memory_bytes: 4352
#include <cstdio>
int main() {
	int A,B;
  	scanf("%d%d",&A,&B);
  	int cost = B;
  	if(6<=A && A<=12) {
    	cost /= 2;
    }else if(A<6) {
    	cost = 0;
    }
  	printf("%d", cost);
}

Measured memory_bytes: 128
#include <stdio.h>
int main(void){
    int N = 0;
    int sum = 0;
    int max = 100;
    int x = 0;
    scanf("%d", &N);
    for (int i = 0; i < N; i++){
        scanf("%d", &x);
        sum += x;
        if(x > max){
            max = x;
        }
    }
    
    printf("%d", sum - max / 2);
    return 0; 
}

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

template<class T, class E>
struct SegTree{
  typedef function<T(T,T)> F;
  typedef function<T(T,E)> G;
  typedef function<E(E,E)> H;
  typedef function<E(E,int)> P;
  int n;
  F f;
  G g;
  H h;
  P p;
  T d1;
  E d0;
  vector<T> dat;
  vector<E> lazy;
  SegTree(int n_, F f, G g, H h, T d1, E d0, P p=[](E a, int b){ return a; })
    : f(f), g(g), h(h), d1(d1), d0(d0), p(p) {
    n = 1;
    while (n < n_) n *= 2;
    dat.resize(2 * n - 1, d1);
    lazy.resize(2 * n - 1, d0);
  }
  void eval(int k, int l, int r) {
    if (lazy[k] == d0) return;
    dat[k] = g(dat[k], p(lazy[k], r - l));
    if (k < n - 1) {
      lazy[2 * k + 1] = h(lazy[2 * k + 1], lazy[k]);
      lazy[2 * k + 2] = h(lazy[2 * k + 2], lazy[k]);
    }
    lazy[k] = d0;
  }
  void update(int a, int b, E x, int k = 0, int l = 0, int r = -1) {
    // cerr << "update: a = " << a << ", b = " << b << ", x = " << x << ", k = " << k << ", l = " << l << ", r = " << r << endl;
    if (r == -1) r = n;
    eval(k, l, r);
    if (b <= l || r <= a) return;
    if (a <= l && r <= b) {
      lazy[k] = h(lazy[k], x);
      eval(k, l, r);
    }
    else {
      update(a, b, x, 2 * k + 1, l, (l + r) / 2);
      update(a, b, x, 2 * k + 2, (l + r) / 2, r);
      dat[k] = f(dat[2 * k + 1], dat[2 * k + 2]);
    }
  }
  // return op[a..b)
  // k: node id, [l, r): node interval
  E query(int a, int b, int k = 0, int l = 0, int r = -1) {
    // cerr << "query: a = " << a << ", b = " << b << ", k = " << k << ", l = " << l << ", r = " << r << endl;
    if (r == -1) r = n;
    eval(k, l, r);
    if (r <= a || b <= l) return d1;
    if (a <= l && r <= b) return dat[k];
    E vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
    E vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
    return f(vl, vr);
  }
  void print() {
   int j = 2;
   for (int i = 0; i < 2 * n - 1; i++) {
     cerr << "(" << dat[i] << ", " << lazy[i] << ")";
     if (i == j - 2) { cerr << endl; j *= 2;}
     else { cerr << " "; }
   }
 }
};

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

  int n, q;
  cin >> n >> q;
  SegTree<ll, ll> seg(
    n,
    [](ll a, ll b){ return a + b; },
    [](ll a, ll b){ return a + b; },
    [](ll a, ll b){ return a + b; },
    0,
    0,
    [](ll a, int b){ return a * b; }
  );
  rep(i, q) {
    int t;
    cin >> t;
    if (t == 0) {
      int a, b;
      ll v;
      cin >> a >> b >> v;
      a--;
      seg.update(a, b, v);
    }
    else {
      int a, b;
      cin >> a >> b;
      a--;
      cout << seg.query(a, b) << endl;
    }

    // cerr << "i = " << i << endl;
    // seg.print();
  }

  return 0;
}



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

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        double n = scanner.nextDouble();
        int org_n = (int)n;

        int tmp =0;

        for (int i=0;i<11;i++) {
        	tmp += (n/Math.pow(10, 9-i));
        	n = (n%Math.pow(10, 9-i));
        }

        if ((org_n%tmp==0)) {
        	System.out.println("Yes");
        }else {
        	System.out.println("No");
        }

    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}

Measured memory_bytes: 21332
n,m=map(int,input().split())
std = [list(map(int,input().split())) for _ in range(n)]
chk = [list(map(int,input().split())) for _ in range(m)]

for i in range(n):
    chk_id = 0
    d = float("inf")
    for j in range(m):
        d1 = abs(std[i][0] - chk[j][0]) + abs(std[i][1] - chk[j][1])
        if d1 < d:
            d = d1
            chk_id = j+1
    print(chk_id)

Measured memory_bytes: 3064
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
//#include<unordered_map>//イテレータあるけど順序保持しないmap
//#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI acos(-1.0)
#define answer(ans) cout<<ans<<endl;
#define input(N) cin >> N ;


signed main() {
int N,ans=0;

cin >> N;
vector<ll> L(N);
REP(i,N){
    cin >>L[i];
}
vector<ll> S(3);
for(int i=0;i<N;i++){
    for(int j=i;j<N;j++){
        for(int k=j;k<N;k++){
            if(i!=j&&j!=k&&k!=i && L[i]!=L[j]&&L[j]!=L[k]&&L[k]!=L[i]){
                S[0]=L[i];
                S[1]=L[j];
                S[2]=L[k];
                sort(S.begin(),S.end());
                if(S[0]+S[1]>S[2]){
                    ans+=1;
                }
            }
        }
    }
}

answer(ans);
return 0;
}


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

int main (){

    int N,ans;
    cin >> N;
    
    
    if(N%2 == 1){
        ans = N*(N-1)/2-(N-1)/2;
        cout << ans << endl;
        
        for(int i=1;i<=N-1;i++){
            for(int j=i+1;j<=N;j++){
                if(j==N-i){
                    continue;
                }
                else{
                    cout << i << " " << j << endl;
                }
            }
        }
    }

    else{
        ans = N*(N-1)/2-(N)/2;
        cout << ans << endl;
        
        for(int i=1;i<=N-1;i++){
            for(int j=i+1;j<=N;j++){
                if(j==N+1-i){
                    continue;
                }
                else{
                    cout << i << " " << j << endl;
                }
            }
        }
    }
}
//辺を入れるのでなく、完全グラフから要らない編を削る（補集合を考える）

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}


int main() {
	int n, m, x, y;
	cin >> n >> m >> x >> y;
	vector<int> vx(n);
	vector<int> vy(m);
	for (int i = 0; i < n; i++) {
		cin >> vx[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> vy[i];
	}
	int flag = 1;
	for (int i = x + 1; i <= y; i++,flag=1) {
		for (auto c : vx) {
			if (i <= c) {
				flag = 0;
				break;
			}
		}
		if (flag == 1) {
			for (auto c : vy) {
				if (i > c) {
					flag = 0;
					break;
				}
			}
		}
		if (flag == 1) {
			cout << "No War" << endl;
			return 0;
		}
	}
	cout << "War" << endl;
}


Measured memory_bytes: 256