akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
#include <stack>
using namespace std;

int R, C, N;

struct XYXY{
    int x1, y1, x2, y2;
};

int func(int x, int y){
    if(y == 0) return x;
    else if(x==R) return R+y;
    else if(y==C) return R+C+(R-x);
    else return R+C+R+(C-y);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> R >> C >> N;
    vector<XYXY> v;
    for(int i=0; i<N; i++){
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        if( (x1==0||x1==R||y1==0||y1==C) && (x2==0||x2==R||y2==0||y2==C) )
            v.push_back({x1, y1, x2, y2});
    }
    vector<pair<int, int>> v2;
    for(int i=0; i<v.size(); i++){
        v2.push_back(make_pair(func(v[i].x1, v[i].y1), i));
        v2.push_back(make_pair(func(v[i].x2, v[i].y2), i));
    }
    sort(v2.begin(), v2.end());
    stack<int> st;
    for(auto z : v2){
        if(!st.empty()){
            int tp = st.top();
            if(z.second == tp)
                st.pop();
            else
                st.push(z.second);
        }else st.push(z.second);
    }
    if(st.empty()) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 4848
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
------------------------
author : iiou16
------------------------
'''


def main():
    N = int(input())

    if N % 2 == 0:
        print(int(N / 2 - 1))
    else:
        print(N // 2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#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)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    ll cnt=0;
    ll x,y,n,d;
    cin>>n>>d;
    REP(i,n){
        cin>>x>>y;
        ld dis=sqrt(x*x+y*y);
        if(dis<=d)cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3648
N = int(input())
H = list(map(int, input().split()))

for i in range(N-1):
    if H[i]>H[i+1]: H[i+1] +=1

for i in range(N-1):
    if H[i]>H[i+1]:
        print('No')
        exit()

print('Yes')


Measured memory_bytes: 63984
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
const ll longinf=LONG_LONG_MAX;
const int inf=(1<<30)-1;


int main(){
      int n,m;
      cin>>n>>m;
      bool v[n];
      fill(v,v+n,true);
      rep0(i,m){
            int a,b;
            cin>>a>>b;
            --a,--b;
            v[a]=!v[a];
            v[b]=!v[b];
      }
      bool ok=true;
      rep0(i,n){
            if(!v[i]) ok=false;
      }
      if(ok) cout<<"YES"<<endl;
      else cout<<"NO"<<endl;
      return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define eps 1e-9
#define MOD 1000000007
#define INV_10 299473306
#define INF 1000000000
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	long long n, k;
	cin >> n >> k;
	int a[n+1], vu[n+1];
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		vu[i]=0;
	}
	vu[1]=1;
	vector<int>v;
	v.push_back(1);
	while(vu[v.back()]!=2)
	{
		v.push_back(a[v.back()]);
		vu[v.back()]++;
	}
	if(k < v.size())
		cout << v[k] << '\n';
	else
	{
		long long x=-1;
		for(int i = 0; i < v.size() && x==-1; i++)
		{
			if(v[i]==v.back())
				x=i;
		}
		k-=(x-1);
		long long y=(k%(v.size()-1-x))-1;
		if(y < 0)
			y+=(v.size()-1-x);
		cout << v[x+y] << '\n';
	}
}

Measured memory_bytes: 5844
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
	int N;
    string S, T, ans;
    cin >> N >> S >> T;

    rep(i, N) {
        ans += S.at(i);
        ans += T.at(i);
    }

    cout << ans << endl;
}

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

#define vec              vector<int>
#define vecll            vector<ll>
#define vpair            vector<pair<int, int>>
#define vpairll          vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vecll var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define prt(var)         cout << var << endl
#define prtd(n, var)     cout << fixed << setprecision(n) << var << endl
#define prt2(var1, var2) cout << var1 << " " << var2 << endl
#define prseq(var, n)    rep(i,n){cout << var[i] << " ";} cout << endl
#define prseql(var, n)   rep(i,n){cout << var[i] << " " << endl;}

//----------------------------------------------------------------

int main(void) {
  int n;
  cin >> n;
  vec a(n+1);
  rep(i,n){
    cin >> a[i+1];
  }

  vector<bool> ball(n+1);
  rep(i,n+1){
    ball[i] = false;
  }
  int ct=0;
  rep(i,n){
    int now = n-i;
    int chk = now;
    int ball_num=0;
    rep(j,n+1){
      chk += now;
      if(chk>n){
        break;
      } else {
        if(ball[chk]){
          ball_num++;
        }
      }
    }
    if(ball_num%2!=a[now]){
      ball[now]=true;
      ct++;
    }
  }


  prt(ct);
  rep(i,n){
    if(ball[i+1]){
      cout << i+1 << " ";
    }
  }
  cout << endl;



}


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

using namespace std;
const int N = 10;
long long n,m;

long long ab(long long a){
    if (a<0) return -a;
    return a;
}
long long mn(long long a,long long b){
    if (a<b) return a;
    return b;
}

long long f(long long n, long long m, long long a){
    if (n%2==0){
        return mn(a, ab(a - n/2*m));
    }else if(m%2==0){
        return mn(a, ab(a- m/2*n));
    }else{
        if (n > m) swap(n, m);
        long long gt = m/2*n;
        long long lt = m*n-gt;
        long long temp = gt - lt;
        temp = max(temp, abs(gt-a));
        temp = max(temp, abs(lt-a));
        a = mn(temp, a);
        return a;
    }
}

int main()
{
    while (cin>>n>>m){
        long long ans = n * m;
        for (int i=1;i<n;++i){
            ans = mn(ans, f(n-i, m, i*m));
            //printf("i = %d, ans = %d\n", i, ans);
        }
        for (int i=1;i<m;++i){
            ans = mn(ans, f(m-i, n, i*n));
        }
        cout<< ans<< endl;
    }
    return 0;
}


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

int N;

void sort_uniq(vector<ll> &v ){
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()), v.end());
}

vector<ll> Cumulative_sum(const vector<ll> &v, int x){
  int i;
  vector<ll> ret(N+1);
  ret[0] = 0;
  REP(i,N){
    ret[i+1] = ret[i];
    if(v[i] >= x) ret[i+1] += 1;
    else ret[i+1] -= 1;
  }
  return ret;
}

class BIT{
  public:
  vector<ll> bit; 
  BIT(const vector<ll> &v){
    //bit[0]は，無視
    //BITの外側では0index
    bit.resize(v.size()+1,0);
  }

  //iにwをたす
  void add(int i, int w){
    for(int x = i+1; x<=bit.size(); x += x&-x) bit[x] += w;
  }

  ll sum(int i){
    ll ret = 0;
    for(int x = i+1; x>0 ; x -= x&-x) ret+=bit[x];
    return ret;
  }
};

ll n_fall(vector<ll> S){
  int i;
  map<ll,int> f;
  vector<ll> v = S;
  sort_uniq(v);
  REP(i,v.size()){
    if(!f.count(v[i])) f[v[i]] = i;
  }
  BIT b = BIT(v);
  ll ret = 0;
  REP(i,S.size()){
    ll t_i = b.sum(f[S[i]]);
    b.add(f[S[i]],1);
    ret += i - t_i;
  }
  return ret;
}

int main(void){
  int i;
  cin >> N;
  ll M = (ll)N*(N+1)/2;
  vector<ll> a(N);
  vector<ll> sorted_a(N);
  REP(i,N){
    cin >> a[i];
    sorted_a[i] = a[i];
  }

  sort_uniq(sorted_a);

  int s = 0, e = sorted_a.size();
  while(e-s>1){
    int mid = (e+s)/2;
    ll x = sorted_a[mid];
    vector<ll> S = Cumulative_sum(a, x);
    ll n = M - n_fall(S);
    if(n >= M/2) s = mid;
    else e = mid;
  }
  cout << sorted_a[s] << endl;
  return 0;
}


Measured memory_bytes: 9416
// Problem : Replacing Integer
// Contest : Virtual Judge - AtCoder
// URL : https://vjudge.net/problem/AtCoder-abc161_c
// Memory Limit : 1048 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")  // disable
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define lll __int128
#define lp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define vec(v, type, sz) vector<type> v(sz)
#define in(v) \
    for (auto &i : v) cin >> i
#define all(v) v.begin(), v.end()
#define prv(v)                         \
    for (auto i : v) cout << i << " "; \
    cout << "\n"
#define MOD 1000000007
#define INF 1000000000
#define INFL 1000000000000000000ll
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define vi vector<int>
#define vl vector<ll>
#define vii(v, n, m, val) vector<vector<int>> v(n, vector<int>(m, val))
#define viii(v, i, j, k, val)        \
    vector<vector<vector<int>>> v(i, \
                                  vector<vector<int>>(j, vector<int>(k, val)))
#define pii pair<int, int>
#define pb push_back
#define file_io                       \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define testc   \
    int tcc;    \
    cin >> tcc; \
    for (int tc = 1; tc <= tcc; tc++)
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while (!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
    cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if (idx > 0)
        cerr << ", ";
    else
        cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss;
    ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef DB
#define debug(...) \
    debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
//#define int ll

signed main() {
	fast_io;
	ll n,k; cin>>n>>k;
	n%=k;
	cout<<min(n,abs(n-k));
}
// code!=think
// least efficient code to get ac


Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int N;
void dfs(string S, string& alp, int cnt){
    if((int)S.size()==N){
        cout << S << endl;
        return;
    }

    for(int i=0; i<=cnt+1; i++){
        dfs(S+alp[i], alp, max(cnt,i));
    }
}

int main(){
    cin >> N;
    string alp ="abcdefghij";

    dfs("a", alp, 0);
}

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

int main(){
    int K; cin >> K;
    int a=7;
    int k=K;

    int ans=1;
    bool flg = false;
    while(k--){
        if(a%K==0){
            flg = true;
            break;
        }
        a = a*10 + 7;
        a %= K;
        ans++;
    }

    if(flg){
        cout << ans << endl;
    }else{
        cout << -1 << endl;
    }
    
    
}


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

int n;
int left(int i) { return 2*i;}
int right(int i) { return 2*i+1;}

void maxHeapify(int a[],int i) 
{
  int l,r,largest,tmp;
  l = left(i); 
  r = right(i);
  if(l<=n && a[l]>a[i])   largest = l;
  else largest = i;
  if(r<=n && a[r]>a[largest]) largest = r;
  
  if(largest != i){
    tmp = a[i];
    a[i] = a[largest];
    a[largest] = tmp;
    maxHeapify(a,largest);
  }
}

void buildMaxHeap(int a[]) 
{
  int i;
  for(i=n/2; i>=1; i--) maxHeapify(a,i);
}
  
int main() 
{
  int *a;
  int i;
  
  scanf("%d",&n);
  a = (int*)malloc(sizeof(int)*n+1);
  for(i=1; i<=n; i++) scanf("%d",&a[i]);
  buildMaxHeap(a);
  for(i=1; i<=n; i++) printf(" %d",a[i]);
  printf("\n");
  return 0;
}

Measured memory_bytes: 2556
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int ans = 0;
vector<int> tree[100001];


void dfs1(int now, int depth, vector<int> &dist){
	dist[now] = depth;
	for (auto x : tree[now]){
		if (dist[x] == -1) dfs1(x, depth+1, dist);
	}
	return;
}

void dfs2(int now, int depth, vector<int> &distt, vector<int> &dista){
	ans = max(ans, max(distt[now]-1, depth));
	dista[now] = depth;
	for (auto x : tree[now]){
		if (dista[x] == -1 && distt[x] > depth+1) dfs2(x, depth+1, distt, dista);
	}
}

int main(){
	int n, u, v;
	vector<int> dist1(100001);
	vector<int> dist2(100001);

	cin >> n >> u >> v;

	for (int i = 1; i < n; i++){
		int a, b;
		cin >> a >> b;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}

	for (int i = 0; i <= 100000; i++){
		dist1[i] = -1;
		dist2[i] = -1;
	}

	dfs1(v, 0, dist1);
	dfs2(u, 0, dist1, dist2);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 10368
#include <cstdio>
#include <algorithm>
using namespace std;

const int Maxn = 3e6;
const int Mod = 998244353;

int fac[Maxn + 5], inv_fac[Maxn + 5];
inline int QuickPow(int a, int k) {
	int ret = 1;
	while(k) {
		if(k & 1)
			ret = 1LL * ret * a % Mod;
		a = 1LL * a * a % Mod;
		k >>= 1;
	}
	return ret;
}
void Init() {
	fac[0] = inv_fac[0] = 1;
	for(int i = 1; i <= Maxn; i++)
		fac[i] = 1LL * fac[i - 1] * i % Mod;
	inv_fac[Maxn] = QuickPow(fac[Maxn], Mod - 2);
	for(int i = Maxn - 1; i > 0; i--)
		inv_fac[i] = 1LL * inv_fac[i + 1] * (i + 1) % Mod;
}
inline int C(int n, int m) {
	return 1LL * fac[n] * inv_fac[m] % Mod * inv_fac[n - m] % Mod;
}

int main() {
#ifdef LOACL
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	Init();
	int N, M;
	scanf("%d %d", &N, &M);
	int ans = C(3 * M + N - 1, N - 1);
	ans = (ans - 1LL * C(M + N - 2, N - 1) * N % Mod + Mod) % Mod;
	for(int i = M + 1; i <= N && i <= 3 * M; i++)
		if((3 * M - i) % 2 == 0)
			ans = (ans - (1LL * C(N, i) * C((3 * M - i) / 2 + N - 1, N - 1) % Mod) + Mod) % Mod;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 23552
#pragma comment(linker, "/STACK:33554432")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <bitset>
#include <math.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using ld = long double;
using pll = pair<long long, long long>;

const int MAXN = 2e3 + 20;

void solve() {

    ll h;
    cin >> h;

    ll answr = 0;

    ll cnt = 1;

    while (h > 1){
        h = h / 2;
        answr += cnt;
        cnt *= 2;
    }


    cout << answr + cnt;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);

    solve();
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int>h;
    vector<int>sub;
    vector<int>ans;
    sub.push_back(1);
    for(int i = 0;i<n;++i){
        int temp;
        cin >> temp;
        h.push_back(temp);
        if(i!=0){
            if(h[i-1]<h[i])sub.push_back(i);
        }
    }
    int k = 0;
    if(sub.size()==1){
         ans.push_back(h.size()-1);
         k = 1;
    }
    else{
    ans.push_back(0);

    if(sub.size()!=0)
    {
    for(int j =1;j<sub.size();++j){
        ans.push_back(sub[j]-sub[j-1]-1);
    }
    ans.push_back(h.size()-sub[sub.size()-1]-1);
    sort(ans.begin(),ans.end());
    }
    k = ans.size();
    }
    cout << ans[k-1];
    return 0;
}

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

using ll = long long int;
typedef long double ld;
typedef pair<ll,ll> pll;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll ,null_type,less<ll >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//K-th smallest element(0-based)=> cout << k << "kth smallest: " << *A.find_by_order(k-1) << endl;
//NO OF ELEMENTS < X => cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;

#define sz(v) (ll)v.size()
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	ll k,n,a;
	cin>>k>>n;
	ll arr[n];
	for(ll i=0;i<n;i++)cin>>arr[i];
	if(n==1)
	{
		cout<<"0\n";
		return 0;
	}
	vector<ll> diff;
	ll s=0,mx=-1;
	for(ll i=1;i<n;i++)
	{
		diff.pb(arr[i]-arr[i-1]);
		s+=arr[i]-arr[i-1];
		mx=max(mx,arr[i]-arr[i-1]);
	}
	s+=k-arr[n-1]+arr[0];
	mx=max(mx,k-arr[n-1]+arr[0]);
	cout<<s-mx<<"\n";
	return 0;
}

Measured memory_bytes: 3956
<?php
declare(strict_types=1);

list($x, $n) = explode(" ", trim(fgets(STDIN)));
$p = explode(" ", trim(fgets(STDIN)));
$max = $x;
$min = $x;
for ($i = 0; $i < 101; $i++) {
    if (in_array($max, $p)) $max++;
    if (in_array($min, $p)) $min--;
}
if ($x - $min > $max - $x) echo $max;
else echo $min;

Measured memory_bytes: 16080
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package AtCoder;

import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;

/**
 *
 * @author Jagmohan Mandre
 */
class Main {
   public static void main(String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
         try {
          int D = sc.nextInt();
          int T = sc.nextInt();
          int S = sc.nextInt();
          double time = ((double)D / (double)S) ;
          if(time <= T){
              System.out.println("Yes");
          } else {
              System.out.println("No");
          }
        } catch (Exception e) {
            return;
        }
    }
}


Measured memory_bytes: 27000
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
 
public class Main {
    public static void main(String[] args) {
    	Main executer = new Main();
		executer.execute();
    }
    
    public void execute() {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			
			Integer numStr = Integer.valueOf(br.readLine());
			List<Integer> points = new ArrayList<Integer>();
			Integer maxPoint = 0;
			Integer answer = 0;
			
			for (int i = 1; i <= numStr ; i++) {
				Integer point = Integer.parseInt(br.readLine());
				points.add(point);
				maxPoint += point;
			}
			
			if (!isPer10(maxPoint)) {
				answer = maxPoint;
			} else {
				Collections.sort(points);
				
				Iterator<Integer> it = points.iterator();
				
				while (it.hasNext()) {
					Integer point = it.next();
					if (!isPer10(point)) {
						answer = maxPoint - point;
						break;
					}
				}
			}
			
			System.out.println(answer);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.err.println(ex.getMessage());
		}
	}
    
    private Boolean isPer10(Integer num) {
    	return (num % 10 == 0) ? true : false;
    }
}

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

#ifdef _DEBUG
#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#else
#define DUMP(x)
#endif

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define EREP(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define RREP(i, a, b) for (int i = (int)(a)-1; i >= (int)(b); --i)
#define rep(i, n) REP(i, 0, n)
#define erep(i, n) EREP(i, 0, n)
#define rrep(i, n) RREP(i, n, 0)
#define ALL(r) (r).begin(), (r).end()
using ll = int64_t;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main() {
    int d, g, p[10], c[10];
    ll result = 1000000000000;
    cin >> d >> g;
    rep(i, d) cin >> p[i] >> c[i];

    rep(bit, 1 << d) {
        ll sum = 0, res = 0;
        rep(i, d) {
            if (bit & (1 << i)) {
                sum += 100 * (i+1) * p[i] + c[i];
                res += p[i];
            }
        }
        if (sum >= g) {
            result = min(result, res);
        } else {
            rrep(i, d) {
                if (!(bit & (1 << i))) {
                    rep(j, p[i]) {
                        sum += 100 * (i+1);
                        res++;
                        if (j+1 == p[i]) {
                            sum += c[i];
                        }
                        if (sum >= g) {
                            result = min(result, res);
                            break;
                        }
                    }
                }
            }
        }
    }

    cout << result << endl;
}

signed main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong(), a = sc.nextLong(), b = sc.nextLong();
		System.out.println(n/(a+b)*a+Math.min((n-n/(a+b)*(a+b)),a));
		sc.close();
	}
}

Measured memory_bytes: 23892
#include "bits/stdc++.h"
using namespace std;
#define int long long
int mod=1e9+7;

signed main(){
  while(true){
    int n,m,a,b,c,t;
    cin>>n>>m>>a>>b>>c>>t;
    if(!(n||m||a||b||c||t))break;
    vector<vector<vector<int> > > P(31,vector<vector<int> >(n,vector<int>(n,0)));
    P[0][0][0]=b;
    P[0][0][1]=c;
    for(int i=1;i<n-1;i++){
      P[0][i][i-1]=a;
      P[0][i][i]=b;
      P[0][i][i+1]=c;
    }
    P[0][n-1][n-2]=a;
    P[0][n-1][n-1]=b;
    for(int i=0;i<30;i++){
      for(int j=0;j<n;j++){
        for(int k=0;k<n;k++){
          for(int l=0;l<n;l++)(P[i+1][j][k]+=(P[i][j][l]*P[i][l][k])%m)%m;
        }
      }
    }
    vector<int> s(n);
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=0;i<31;i++){
      if(t&(1<<i)){
        vector<int> tmp(n,0);
        for(int j=0;j<n;j++){
          for(int k=0;k<n;k++){
            tmp[j]+=P[i][j][k]*s[k];
          }
          tmp[j]%=m;
        }
        s=tmp;
      }
    }
    for(int i=0;i<n;i++){
      if(i)cout<<" ";
      cout<<s[i];
    }
    cout<<endl;
  }
}



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

int main(){
  int n,t,s=0,p=0,x;
  cin>>n>>t;
  while(n--){
    cin>>x;
    //ダブりを引く
    if(p>x)s-=p-x;
    p=x+t,s+=t;
  }
  cout<<s<<endl;
}


Measured memory_bytes: 256
N = int(raw_input())
nums = []
for i in range(2**N):
    nums.append(int(raw_input()))


for n in range(N-1, -1, -1):
    for i in range(2**n):
        if nums[2*i] < nums[2*i+1]:
            nums[i] = nums[2*i+1]-nums[2*i]
        elif nums[2*i] == nums[2*i+1]:
            nums[i] = nums[2*i]
        else:
            nums[i] = nums[2*i] - nums[2*i+1]
        
print nums[0]


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

int main(){
  int r,d,x2000;
  cin>>r>>d>>x2000;
  int x[11];
  x[0]=x2000;
  for(int i=1;i<=10;i++){
    x[i]=r*x[i-1]-d;
    cout<<x[i]<<endl;
  }
  return 0;
}



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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[200005];
ll B[200005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> A[i];
    }
    REP(i, N) {
        cin >> B[i];
    }
    priority_queue<pll, vector<pll>> q;
    REP(i, N) {
        q.push(pll(B[i], i));
    }

    ll ans = 0;
    while (!q.empty()) {
        pll t = q.top();
        q.pop();
        if (B[t.second] <= A[t.second])
            continue;
        ll left = B[(t.second - 1 + N) % N];
        ll right = B[(t.second + 1) % N];
        ll s = left + right;
        ll n = std::min((t.first - std::max(left, right) + s - 1) / s,
                        (t.first - A[t.second] + s - 1) / s);
        ans += n;
        B[t.second] = t.first - n * s;
        if (B[t.second] <= 0)
            break;
        q.push(pll(B[t.second], t.second));
    }

    REP(i, N) {
        if (A[i] != B[i]) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9584
fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map { it.toInt() }
    val AB = (1..N).map { readLine()!!.split(" ").map { it.toLong() } }.sortedBy { it[0] }

    var c = 0L
    var t = M.toLong()
    for (i in 0 until N) {
        if (t == 0L) break
        val (a, b) = AB[i]
        c += a * Math.min(b, t)
        t = Math.max(t - b, 0)
    }
    println(c)
}

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

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

	if (a < b){
		cout << "a < b" << endl;
	}else if(a > b){
		cout << "a > b" << endl;
	}else if(a == b){
		cout << "a == b" << endl;
	}else{
		cout << "error" << endl;
	}
	return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M;
ll A[1005], Key[1005], DP[1005][(1<<12)];

int main(){
  cin >> N >> M;
  for (int i = 1; i <= M; i++){
    int B;
    cin >> A[i] >> B;
    for (int j = 0; j < B; j++){
      int C; cin >> C;
      Key[i] += (1 << (C - 1));
    }
  }

  fill((ll*)DP, (ll*)(DP + M + 1), 1e18);
  DP[0][0] = 0;
  for (int i = 1; i <= M; i++){
    for (int j = 0; j < (1<<N); j++){
      DP[i][j] = DP[i-1][j];
    }
    for (int j = 0; j < (1<<N); j++){
      DP[i][(j|Key[i])] = min(DP[i][(j|Key[i])], DP[i-1][j] + A[i]);
    }
  }
  ll ans = DP[M][(1<<N)-1];
  if (ans == 1e18) ans = -1;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 35624
#include<stdio.h>
#include<string.h>
int main()
  { 
    char S[11];
    char T[12];
  int l,b,i,count=0;
    scanf("%s",S);
    scanf("%s",T);
    l=strlen(S);
    b=strlen(T);
    for(i=0;i<l;i++)
       { 
         if(S[i]==T[i])
           { 
             count++;
           }
      }
  if(count==l)
    { 
      printf("Yes");
    }
  else
    { 
      printf("No");
    } 
  return 0;
  }


Measured memory_bytes: 1712
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

long long MOD = 1000000007;

long long integerPow(long long x, long long n) {
    if (n == 0) return 1;
    if (n == 1) return x % MOD;
    return n & 1 ? ((x % MOD) * integerPow(((x % MOD) * x) % MOD, n / 2)) % MOD : integerPow(((x % MOD) * x) % MOD, n / 2);
}

int main() {
    string L;
    cin >> L;
    long long D = L.size();

    vector<ll> pops(D);
    pops[0] = L[0] - '0';
    for (long long i = 0; i < D - 1; ++i) {
        pops[i + 1] = pops[i];
        if (L[i + 1] == '1') {
            pops[i + 1]++;
        }
    }

    ll ans = 0;

    for (ll i = 0; i <= D - 1; ++i) {
        if (L[i] == '0') continue;

        if (i > 0) {
            ans += integerPow(2, pops[i - 1]) % MOD * integerPow(3, D - i - 1) % MOD;
            ans %= MOD;
        }
        else {
            ans += integerPow(3, D - 1);
            ans %= MOD;
        }
    }

    ans += integerPow(2, pops[D - 1]);
    ans %= MOD;

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 1848
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

const long long MOD = 998244353;

struct Segment {
	int l, r;
};

int n, k;
Segment seg[20];
long long ansCount;
long long f[200010];
long long lSum[200010];

int main()
{
	ansCount = 0;
	
	scanf("%d%d", &n, &k);
	for (int i = 0 ; i < k ; i++) {
		scanf("%d%d", &(seg[i].l), &(seg[i].r));
	}
	
	f[0] = 1;
	lSum[0] = 1;
	for (int i = 1 ; i <= n - 1 ; i++) {
		for (int j = 0 ; j < k ; j++) {
//			for (int p = seg[j].l ; p <= seg[j].r ; p++) {
//				int tgt = i + p;
//				if (tgt > n) {
//					break;
//				}
//				
//				f[tgt] = (f[tgt] + f[i]) % MOD;
//			}
			int l = i - seg[j].l;
			int r = i - seg[j].r - 1;
			long long sectSum = 0;
			if (l >= 0) {
				if (r < 0) {
					sectSum = lSum[l];
				} else {
					sectSum = lSum[l] - lSum[r];
				}
			}

			f[i] = (f[i] + sectSum) % MOD;
		}
		
		lSum[i] = lSum[i - 1] + f[i];
	}
	
	
	printf("%lld\n", f[n - 1]);
	
	return 0;
}




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

int main() {

    string N;
    cin >> N;

    if (N[0] == '7' || N[1] == '7' || N[2] == '7') {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3624
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scan(&tmp)
		arr[i] = tmp
	}
	sort.Sort(sort.IntSlice(arr))
	sum := 0
	for i := n - 1; i >= n - k; i-- {
		sum += arr[i]
	}
	fmt.Println(sum)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    int rp = 0;
    ll ans = 0;
    ll sum = 0;
    ll xsum = 0;
    for ( int lp = 0; lp < n; ++lp ) {
        while(1) {
            if ( rp >= n || (sum + a[rp]) != (xsum ^ a[rp]) ) break;
            sum += a[rp];
            xsum ^= a[rp];
            ++rp;
        }
        ans += rp - lp;
        if ( rp == lp ) ++rp;
        else {
            sum -= a[lp];
            xsum ^= a[lp];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <limits>

using namespace std;

void solve(int n, int prev, double sum);

struct Point
{
	Point() : x(0), y(0) {}
	Point(int x_, int y_) : x(x_), y(y_) {}

	int x;
	int y;
};

double distance(const Point& p1, const Point& p2)
{
	double ans = pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2);
	ans = sqrt(ans);
	return ans;
}

int factorial(int n)
{
	if (n == 0)
		return 1;

	int ans = 1;
	for (int i = 2; i <= n; i++)
	{
		ans *= i;
	}
	return ans;
}

vector<Point> points;
int N;
vector<bool> used;
vector<double> sums;
int cnt = 0;

double solve()
{
	for (int i = 0; i < N; i++)
	{
		used.at(i) = true;
		solve(N - 1, i, 0);
		used.at(i) = false;
	}

	double sum = 0;

	for (auto i : sums)
	{
		sum += i;
	}

	return sum / factorial(N);
}

void solve(int n, int prev, double sum)
{
	if (n == 0)
	{
		sums.at(cnt++) = sum;
		return;
	}

	for (int i = 0; i < N; i++)
	{
		if (used.at(i))
			continue;

		used.at(i) = true;

		double t = 0;
		if (prev != -1)
		{
			t = sum + distance(points.at(prev), points.at(i));
		}
		solve(n - 1, i, t);

		used.at(i) = false;
	}

}

int main()
{
	cout.precision(std::numeric_limits<double>::max_digits10);

	cin >> N;
	points.resize(N);
	used.resize(N);
	sums.resize(factorial(N));

	for (int i = 0; i < N; i++)
	{
		cin >> points.at(i).x >> points.at(i).y;
	}

	double ans = solve();

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
//#define DEBUG_MODE
#define endl '\n'
#ifdef DEBUG_MODE
#define DEBUG(X) debug_func(X, #X)
#define DEBUG_ENDL endl << flush
#define DEBUG_SEPARATOR_LINE cout<<"=================\n"
#else
#define DEBUG(X) 0
#define DEBUG_ENDL 0
#define DEBUG_SEPARATOR_LINE 0
#endif
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
#define DEBUG_ENDL_S(S) ((S).size() ? "\n" : "") << flush;
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
void debug_func_preffix(const string &s) { if(s.size()) cout << s << " = "; }
template <typename T>
void debug_func(const T &t, const string &s = "") {
    debug_func_preffix(s);
    cout << t << DEBUG_ENDL_S(s);
}
template <typename T, typename U>
void debug_func(const P<T, U> &p, const string &s = "") {
    debug_func_preffix(s);
    cout << "(";
    debug_func(p.first);
    cout << ", ";
    debug_func(p.second);
    cout << ")" << DEBUG_ENDL_S(s);
}
template <typename T>
void debug_func(const V<T> &v, const string &s = "") {
    for(ll i = 0; i < v.size(); i++) {
        string t = s + "[" + to_string(i) + "]";
        debug_func(v[i], t);
    }
}

void init_io() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(30);
}

int main() {
    init_io();
    string S;
    cin >> S;
    ll ans = 0;
    S += 'Z';
    for(ll i = 0; i < S.size() - 1; i++) {
        ll cnt = 0;
        for(ll j = i; j < S.size(); j++) {
            if(S[j] == 'A' ||
               S[j] == 'G' ||
               S[j] == 'C' ||
               S[j] == 'T') cnt++;
            else break;
        }
        chmax(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
  string s;
  cin>>s;
  int c0=0,c1=0;
  for(int i=0;i<s.length();i++)
  {
    if(s[i]=='1') c1++;
    else c0++;
  }
  cout<<2*(min(c1,c0));
  return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

// vector<vector<int>> data(3, vector<int>(4));

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

  string str;
  cin >> str;

  rep(i, str.length()) {
    if (str[i] == '?') {
      str[i] = 'D';
    }
  }
  cout << str;

  return 0;
}

Measured memory_bytes: 3768
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n, k = map(int,input().split())
    mod = 998244353
    LR = [tuple(map(int,input().split())) for i in range(k)]
    LR.sort()
    DP = [0] * (n + 1)#i(0-)番目まで行く方法f_iについて、f_i-f_(i-1)
    DP[1] = 1
    DP[2] = -1
    f = 0
    for i in range(1, n + 1):
        f = (f + DP[i])%mod
        for l, r in LR:
            if i + l > n:
                break
            DP[i + l] = (DP[i + l] + f)%mod
            if i + r + 1 > n:
                break
            DP[i + r + 1] = (DP[i + r + 1] - f)%mod
    print(f%mod)

        





if __name__=='__main__':
    main()

Measured memory_bytes: 16732
import sys
input = sys.stdin.readline

x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c=sorted(int(i) for i in input().split())[:-k-1:-1]

a.sort(reverse=True)
b.sort(reverse=True)
#c.sort(reverse=True)

ab = sorted(i+j for i in a for j in b)[:-k-1:-1]
abc = sorted(i+j for i in ab for j in c)[:-k-1:-1]

print(*abc[:k], sep="\n")

Measured memory_bytes: 161952
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using static System.Math;

namespace NewCompetitionProgramming
{
    public class Program
    {
        public static void Main(string[] args)
        {
            using (var sc = new SetConsole()) { Solve(); }
        }

        public static void Solve()
        {
            var n = GetString().ToLong();
            CWrite((n - 1) * (1 + (n - 1)) / 2);
        }

        static void CWrite<T>(T str) => Console.WriteLine(str);
        static string GetString() => Console.ReadLine();
        static T[] GetArray<T>()
        {
            var t = typeof(T);
            var str = Console.ReadLine();
            if (t == typeof(string))
            {
                return (T[])(object)str.Split();
            }
            if (t == typeof(int))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            if (t == typeof(long))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            if (t == typeof(double))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            throw new NotSupportedException($"{t} is not supported.");
        }
    }



    class SetConsole : IDisposable
    {
        readonly StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
        public SetConsole()
        {
            sw.AutoFlush = false;
            Console.SetOut(sw);
        }
        public void Dispose()
        {
            Console.Out.Flush();
            sw.AutoFlush = true;
            Console.SetOut(sw);
        }
    }

    static class ExtentionsLibrary
    {
        public static T[] CopyArray<T>(this T[] array)
        {
            var newArray = new T[array.Length];
            Array.Copy(array, newArray, array.Length);
            return newArray;
        }
        public static T[,] CopyTwoDimensionalArray<T>(this T[,] dArray)
        {
            var firstDimentionLength = dArray.GetLength(0);
            var secondDimentionLength = dArray.GetLength(1);
            var newDArray = new T[firstDimentionLength, secondDimentionLength];
            Array.Copy(dArray, newDArray, firstDimentionLength * secondDimentionLength);
            return newDArray;
        }
        public static T[] ToNumArray<T>(this string str)
        {
            var t = typeof(T);
            if (t == typeof(int))
            {
                return (T[])(object)str.Split().Select(int.Parse).ToArray();
            }
            if (t == typeof(long))
            {
                return (T[])(object)str.Split().Select(long.Parse).ToArray();
            }
            if (t == typeof(double))
            {
                return (T[])(object)str.Split().Select(double.Parse).ToArray();
            }
            throw new NotSupportedException();
        }
        public static int ToInt(this string str) => int.Parse(str);
        public static int ToInt(this char chr) => int.Parse(chr.ToString());
        public static long ToLong(this string str) => long.Parse(str);
    }
}


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

int main(){
  ll n, m, k;
  cin >> n >> m >> k;
  vector<ll> a(n+1,0);
  vector<ll> b(m+1,0);
  int c;
  rep(i,n){
    cin >> c;
    a.at(i+1) = a.at(i) + c;
  }
  rep(i,m){
    cin >> c;
    b.at(i+1) = b.at(i) + c;
  }
  ll ans = 0, j = m;
  rep(i, n+1){
    if(a.at(i) > k) break;
    while(b.at(j) > k - a.at(i)) j--;
    ans = max(ans, i+j);
  }
  cout << ans << endl;

}

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

using namespace std;

int dp[1010][1010];
char field[1010][1010];

int main(void) {
    int n;
    while (cin >> n, n) {
        memset(dp, 0, sizeof(dp));
        memset(field, '*', sizeof(field));

        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++) {
                cin >> field[i][j];
                if (field[i][j] != '*') dp[i][j] = 1;
            }

        int ans = 0;
        for (int i = 1; i < n; i++)
            for (int j = 1; j < n; j++) {
                if (field[i][j] == '*') continue;
                dp[i][j] = min(dp[i][j - 1], min(dp[i - 1][j], dp[i - 1][j - 1])) + 1;
                ans = max(ans, dp[i][j]);
            }
        
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 8080
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<math.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef long double ld;
const long double pi = 3.14159265358979323846264338327950288;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	ll sum = 0;
	for (ll i = 0; i < 10000000; i++) {
		sum += a;
		if (sum < b)
			continue;
		if ((sum - c) % b == 0) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	cin >> a;
}

Measured memory_bytes: 256
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

char X,Y;
inline void solve(){
  IN2(X,Y);
  OUT(X<Y?'<':X>Y?'>':'=');
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define ulli unsigned long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
//#define lb lower_bound
//#define ub upper_bound
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define msp multiset < pair < long long , long long > > S;
#define pll pair<lli, lli>
#define mll map<lli, lli>
#define mvl map<lli, vl>
#define vt vector<pair<ll, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x)
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
int main()
{
 //	ios::sync_with_stdio(0);
 //   cin.tie(0);
 	lli k,a,b;
 	cin>>k>>a>>b;
 	lli ans=1;
 	if(b>a+1){
 		k=k-(a-1);
 		ans=a;
 		ans+=(b-a)*(k/2);
 		if(k%2==1)ans++;
 	}
 	else
 	ans+=k;
 	cout<<ans;
 
 
 	return 0;
}


Measured memory_bytes: 256
///Astalavista Code........~CodeSlayer007
#include <bits/stdc++.h>
using namespace std;
#include <vector>
#include <iterator>
typedef  long long int ll;
typedef  long double ld;
#define PT(x) cout << (#x) << " is " << (x) << endl;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
#define SPD_emergency ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int M = 1000000007;
#define int long long
void PV( vi v) { for(ll i=0 ; i<v.size() ; i++) cout<< v[i] << " "; cout<< endl;}
void PA( int v[] , int n ){ for(ll i=0 ; i<n ; i++)cout<< v[i] << " " ; cout<< endl;}

signed  main(){
     SPD_emergency
   //ll t; cin>> t; while(t--)
    {
        int n , a , b, c ,k, l;
        cin>> n >> a >> b;
        c=a+b;
        k=n/c;
        l=n%c;
        int ans=0;
        if(l>=a) ans=a;
        else ans=l;
        ans=ans+k*a;
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
n = gets.chop.to_i
a = []

n.times do
  a << gets.chop.to_i
end

sorted = a.sort.reverse

max_num = sorted[0]
sec_num = sorted[1]

if max_num == sec_num then
  n.times do
    p max_num
  end
else
  n.times do |index|
    if a[index] == max_num then
      p sec_num
    else
      p max_num
    end
  end
end


Measured memory_bytes: 8168
#include<bits/stdc++.h>
using namespace std;
char s[1001000];int n,P,suf[1001000];
int main()
{
	scanf("%s",s+1);n=strlen(s+1);
	for(int i=1,now=0;i<=n;i++)
	{
		if(s[i]=='1') now++;else now--;
		P=max(P,now);
	}
	for(int i=n;i;i--)
	{
		suf[i]=suf[i+1];
		if(s[i]=='1') suf[i]++;else suf[i]--;
		suf[i]=max(suf[i],0);
	}
	int ans=n;
	for(int wzp=P;wzp<=P+1;wzp++)
	{
		int res=0,now=0;
		for(int i=1;i<=n;i++)
		{
			if(s[i]=='1') now++;
			if(s[i]=='0') now--;
			if(s[i]=='?')
			{
				if(suf[i+1]+now+1<=wzp) now++;
				else now--;
			}
			res=min(res,now);
		}
		ans=min(ans,wzp-res);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 8648