akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <random>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
//#define ll __int128
//#define int ll
//#define int ll
//#define char ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(4) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}


void smain() {

    ll s;
    cin >> s;
    ll x1, y1, x2, y2;

    ll s2 = sqrt(s);
    while (s2 * s2 > s)
        s2--;
    while (s2 * s2 < s)
        s2++;

    x1 = s2, y2 = s2;
    y1 = sqr(s2) - s;
    x2 = 1;
    cout << "0 0 " << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2;
}

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

void solve()
{
	int n, m;
	cin >> n >> m;
	
	int sum = 0;
	for(int i = 0; i < m; ++i)
	{
		int a;
		cin >> a;
		sum += a;
	}
	cout << max(n - sum, -1) << endl;
}

int main()
{
	solve();

	return 0;
}

Measured memory_bytes: 3640
n = gets.to_i
digits = n.to_s.length
ans = 0
(3..digits).each do |d|
  c = [3,5,7].repeated_permutation(d).count do |i|
    i.join.to_i <= n && i.include?(3) && i.include?(5) && i.include?(7)
  end
  ans += c
end

puts ans


Measured memory_bytes: 1916
n, k = map(int, input().split())
a = [-1] + list(map(int, input().split()))

visited = [0] * (1 + n)
curr = 1
while k:
    if visited[curr]:
        break
    else:
        visited[curr] = k
        curr = a[curr]
        k -= 1
        if k == 0:
            print(curr)
            exit()
repeat = visited[curr] - k
k = k % repeat
while k:
    curr = a[curr]
    k -= 1
print(curr)

Measured memory_bytes: 32372
import math

a, b, x_3 = map(int, input().split())

x = x_3 / (a*a)

if x >= b / 2:
    print(math.degrees(math.atan((b-x)/(a/2))))
else:
    h = x_3 / a * 2 / b
    print(math.degrees(math.atan(b/h)))

Measured memory_bytes: 38384
N = int(input())
arr = list(map(int, input().split()))
arr.sort()
ma = max(arr)
check = [True]*(ma+1)
cnt = [0]*(ma+1)
for i in arr:
    cnt[i] += 1
ans = 0
for i in arr:
    if not check[i]:
        continue
    for k in range(i,ma+1,i):
        check[k] = False
    if cnt[i] <= 1:
        ans += 1
print(ans)

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

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define print(v) for(auto it=(v).begin();it!=(v).end();it++) {cout<<*it<<" ";}
#define ll long long
#define w(t) ll t;cin>>t;while(t--)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
using namespace std;

int main()
{
    ll a,b,c,k,ans=0;
    cin>>a>>b>>c>>k;
    ans+=min(k,a);
    k-=min(k,a);
    k-=min(k,b);
    ans-=min(k,c);
    k-=min(k,c);
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 3588
import scala.io.StdIn.{readInt, readLine};

object Main {
    def main(args: Array[String]): Unit = {
        val n = readInt
        val matrix = Array.ofDim[Int](n + 1, n + 1);
        for (i <- (1 to n)) {
            val line = readLine.split(" ").map(_.toInt);
            line.slice(2, line.length).foreach { j => matrix(i)(j) = 1}
        }
        val ret = dfs(matrix, 1);
        (1 to n).foreach { i =>
            println("%d %d %d".format(i, ret(i)(0), ret(i)(1)));
        }
    }
    
    def dfs(matrix: Array[Array[Int]], start: Int): Array[Array[Int]] = {
        val len = matrix.length;
        val status = Array.ofDim[Int](len, 2);
        def go(curr: Int, now: Int): Int = {
            status(curr)(0) = now;
            val next = (1 until len).foldLeft(now + 1) { (t, i) => 
                    if (status(i)(0) == 0 && matrix(curr)(i) == 1) go(i, t) else t
                }
            status(curr)(1) = next;
            next + 1;
        }
        (1 until len).foldLeft(1) { (t, i) =>
            if (status(i)(0) == 0) go(i, t) else t;
        }
        status;
    }
}


Measured memory_bytes: 44820
#include<stdio.h>
int main(void){
        char b;
        scanf("%c",&b);
        switch(b){
        case 0x41: printf("T"); break;
        case 0x54: printf("A"); break;
        case 0x47: printf("C"); break;
        case 0x43: printf("G"); break;
        }
        return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
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;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

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

    cout << (n+999)/1000*1000 - n << endl;
}

Measured memory_bytes: 3160
//Atcoder
import java.io.*;
import java.util.*;

public class Main {

	static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e){e.printStackTrace();}
        }

        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {st = new StringTokenizer(br.readLine());}
            catch (Exception e) {e.printStackTrace();}
            return st.nextToken();
        }

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

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

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

        public String nextLine() {
            String line = "";
            if(st.hasMoreTokens()) line = st.nextToken();
            else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
            while(st.hasMoreTokens()) line += " "+st.nextToken();
            return line;
        }
    }

    static class Pair {
        long val;
        int multi;
        public Pair(long val, int multi) {
            this.val = val;
            this.multi = multi;
        }
    }

	public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);

        int n = sc.nextInt(), m = sc.nextInt();
        ArrayList<Pair> a = new ArrayList<Pair>();

        for(int i=0;i<n;i++) {
            a.add(new Pair(sc.nextLong(), 1));
        }
        for(int i=0;i<m;i++) {
            int b = sc.nextInt();
            long c = sc.nextLong();
            a.add(new Pair(c, b));
        }

        a.sort((cur, other) -> {return (int)(other.val - cur.val);});

        long cnt = 0;
        long sum = 0;
        for(int i=0;;i++) {
            int amount = a.get(i).multi;
            cnt += amount;
            sum += a.get(i).val * amount;
            if(cnt >= n) {
                sum -= a.get(i).val * (cnt - n);
                break;
            }
        }

        pw.println(sum);
        pw.close();
    }
}


Measured memory_bytes: 55900
#include <bits/stdc++.h>
 #define rep(i,a,b) for (int i=a;i<b;i++)
 #define rep2(i,a,b) for (int i=a;i>=b;i--)
 #define mod 1000000007
 #define INF  1e9+5
 #define f first
 #define se second
 #define endl '\n'
 #define ll long long
 #define ii pair <int,int>
 #define pll pair <ll,ll>
 #define vi vector <int>
 #define vl vector <ll>
 #define vvi vector < vi >
 #define vii vector < ii >
 #define vvii vector < vii >
 #define vll vector < ll >
 #define mi map<int,int>
 #define mll map<ll,ll>
 #define mci map<char,int>
 #define msi map<string,int>
 #define vb  vector <bool>
 #define pb push_back
 #define mk make_pair
 #define sz(a) a.size()
 #define all(a) a.begin(),a.end()
 #define rall(a) a.rbegin(),a.rend()
 #define Senky_Bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;
vector<int>v;
ll dp[110][2][110];
string s;
ll k;
int solve(int idx,int flag,int sum)
{ 
    if(idx>=v.size() and flag==1)
    {
        if(sum==k)
            return 1;
        else
            return 0;
    }
    if(idx>=v.size()) return 0;
    if(dp[idx][flag][sum]!=-1)
        return dp[idx][flag][sum];
    ll ans=0;
    if(flag==1)
    {   
        for(int i=0;i<10;i++)
        {
            int x;
            if(i!=0)
            x = solve(idx+1,1,sum+1);
        else
            x = solve(idx+1,1,sum);
            //if(x.se==1)
            ans=(ans+x);
            //else ans+=x.f;
        }
    }
    else
    {
        for(int i=0;i<10;i++)
        {
            if(v[idx]>i)
            {
                int x;
                if(i!=0)
            x = solve(idx+1,1,sum+1);
        else
            x = solve(idx+1,1,sum);
            //if(x.se==1)
            ans=(ans+x);
                //else ans+=x.f;
            }
            else if(v[idx]==i)
            {
                int x;
                if(i!=0)
            x = solve(idx+1,0,sum+1);
           else
            x = solve(idx+1,0,sum);
            //if(x.se==1)
            ans=(ans+x);
            }
            else break;
        }
    }
    return dp[idx][flag][sum]=ans;
}
 signed main()
 {
    Senky_Bansal
    IIIT_ALLAHABAD
     
    
            cin>>s;
            cin>>k;
            memset(dp,-1,sizeof dp);
            v.clear();
            for(int i=0;i<s.size();i++)
            {
                int p1 = int(s[i])-48;
                v.pb(p1);
            }
            ll z=0;
          //  cout<<"Se"<<endl;
            if(v.size()!=0)
            z=solve(0,0,0);
            //cout<<"se"<<endl;
           ll count=0;
           for(int i=0;i<s.size();i++)
           {
             int p1 = int(s[i])-48;
             if(p1!=0) count++;
           }
           if(count==k) z++;
            cout<<z<<endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <array>
#include <string.h>
using namespace std;
// 202004250312

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

    return 0;
}


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

#define rep(i,n) for (int i = 0; i< (n); ++i)
#define vvec(m,n) vector<vector<int>> (int(m), vector<int>(n))
#define ALL(a) (a).begin(), (a).end()

using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> add(n);
    rep(i, n-1){
        cin >> a.at(i+1);
    }
    a.at(0) = 0;
    for(int i=1;i<n;i++){
       add.at(a.at(i) - 1)++;
    }
    rep(i,n){
        printf("%d\n", add.at(i));
    }
}

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

using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
int mod = 998244353;

long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}

/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  

double eps = .000000001;

int main ()
{
  prep();
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  bool l = true;
  if (s[0] == 'R'){
      l = false;
  }
  int parts = 1;
  int cnt = 1;
  int happy = 0;
  for (int i=1; i<n; i++){
      if (l){
          if (s[i] == 'L'){
              cnt++;
          }else{
              l = false;
              parts++;
              happy += cnt-1;
              cnt = 1;
              
          }
      }else{
          if (s[i] == 'R'){
              cnt++;
          }else{
              l = true;
              parts++;
              happy += cnt-1;
              cnt = 1;
          }
      }
  }
  if (parts == 1){
      cout << n-1;
      return 0;
  }
  happy += cnt-1;
  if (parts%2 == 0){
      int can = parts/2-1;
      int can1 = 1;
      if (can > k){
        happy += 2*k;  
      }else{
        happy += 2*can;
        k -= can;
        if (k > 0){
            happy += can1;
        }
      }
  }else{
      int can = parts/2;
      if (can > k){
        happy += 2*k;  
      }else{
        happy += 2*can;
      }
  }
  cout << happy;
  return 0; 
}

Measured memory_bytes: 512
#include <iostream>
#include <iterator>
#include <map>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    map<string, int> mp;

    vector<int> v;
    int num, num1, num2, vec;
    string str;
    scanf("%d", &num);

    for(int i = 0; i < num; i++){
        scanf("%d", &num1);
        if(num1 == 0){
            cin >> str >> num2;
            mp[str] = num2;
        }
        else if(num1 == 1){
            cin >> str;
            if(mp.find(str) == mp.end()){
                v.push_back(0);
            }
            else{
                vec = mp[str];
                v.push_back(vec);
            }

        }
        else if(num1 == 2){
            cin >> str;
            mp.erase(str);
        }
    }

    for (auto val : v){
            if(!v.empty()){
                cout << val<< "\n";
            }

    }

    return 0;
}



Measured memory_bytes: 27912
import math

a, b, x = map(float, raw_input().split())


if 2 * x / (b * a) <= a:
    y = 2 * x / (b * a)
    print(math.degrees(math.atan(b / y)))

else:
    h = (x - a * a * b / 2) / (a * a / 2)
    print(math.degrees(math.atan((b - h) / a)))

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

int main () {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  long long tot = 0;
  map<string, int> chk;
  for (int i = 0; i < n; i++) {
    string w;
    cin >> w;
    sort (w.begin(), w.end());
    tot += chk[w];
    chk[w]++;
  }
  cout << tot << '\n';
  return 0;
}

Measured memory_bytes: 11264
import java.util.ArrayDeque;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int n;
    int[] a;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.n = sc.nextInt();
        this.a = new int[n];
        for (int i=0; i<n; i++) {
        	a[i] = sc.nextInt();
        }
    }
    
    //解答処理
    private ArrayDeque<Integer> solve() {
    	ArrayDeque<Integer> b = new ArrayDeque<Integer>();
        
    	for (int i=0; i<n; i++) {
    		if ((i+1)%2!=0 && n%2!=0 || (i+1)%2==0 && n%2==0) {
    			b.addFirst(a[i]);
    		} else {
    			b.addLast(a[i]);
    		}
    	}
    	
        return b;
    }
    
    //出力
    public void show(ArrayDeque<Integer> answer) {
        for (int i=0; i<a.length; i++) {
        	System.out.print(answer.removeFirst());
        	System.out.print(" ");
        }
    }

}


Measured memory_bytes: 64432
#include<iostream>
#include<string.h>
using namespace std;

int main(){
    int n[60001];
    memset(n,0,sizeof(n));
    for(int i=2;i<30001;i++)
        for(int j=i;i*j<60001;j++)
            n[j*i]=1;
    int f,i;
    while(cin>>f){
        for(i=f-1;n[i];i--);cout<<i<<" ";
        for(i=f+1;n[i];i++);cout<<i<<endl;
    }
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll maxi = 0;
    rep(i, N - 1) {
        rep2(j, i + 1, N) maxi = max(maxi, abs(A[i] - A[j]));
    }
    cout << maxi << endl;
    return 0;
}


Measured memory_bytes: 3608
def gcd(x,y):
    while y:
        x,y = y , x % y 
    return x

a,b,c,d=map(int,input().split())
a -= 1
cd = c * d // gcd(c,d)
c_n = b // c - a // c
d_n = b // d - a // d
cd_n= b // cd - a // cd
print((b-a) - c_n - d_n + cd_n)

Measured memory_bytes: 3060
N, M = map(int, input().split())
ans = 0
#最後にNoneを消す。
roads_memo = [[None] for i in range(N)]

for _ in range(M):
    ai, bi = map(int, input().split())
    roads_memo[ai-1].append(bi)
    roads_memo[bi-1].append(ai)

for memo in roads_memo:
    del memo[0]
    print(len(memo))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define ll long long
#define pb push_back
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const double PI  =3.141592653589793238463;
long long MOD = 1000000007;

int stringToInteger(string x){
    int gg=0;
    stringstream geek(x);
    geek >> gg;
    return gg;
}

ll powmod(ll a,ll b,ll m)
{
    ll ans=1;
    while(b>0){ if(b%2)
        {ans*=a; ans%=m;}
         b/=2; a=a*a; a=a%m;
        }
        return ans%m;
}
ll gcd(ll a,ll b)
{

    return __gcd(a,b);
}
ll mulmod(ll a,ll b,ll m)
{  ll ans=0;
    a %=m;
    while (b>0)
    {       if(b&1) ans = (ans + a) % m;
        a = (a * 2)%m;
        b /= 2;
    }
    return ans % m;
}

ll f[2000001];



ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a;
 while(b > 0)
 	{
 		if(b%2 == 1)
 	{
 		x=(x*y);
 		if(x>MOD) x%=MOD;
 	}
 	y = (y*y);
 	if(y>MOD) y%=MOD;
 	b /= 2;
 	}
 return x;
}

/* Modular Multiplicative Inverse
 Using Euler's Theorem
 a^(phi(m)) = 1 (mod m)
 a^(-1) = a^(m-2) (mod m) */
ll InverseEuler(ll n, ll MOD)
{
 return pow(n,MOD-2,MOD);
}

bool prime[100005];
void seive()
{  memset(prime,true,sizeof(prime));
    for(int i=2;i*i<=100005;i++)
    {
         if(prime[i]==true) {
        for(int j=2*i;j<=(100005);j+=i)
           { prime[j]=false;}
           }

    }
}
bool in(float x1,float y1,float x,float y,float r )
{
    if(abs(x1-x)*abs(x1-x)+abs(y1-y)*abs(y1-y)<=r*r) return true;
    return false;


}


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

	ll T;
   T=1;
	while(T--)
	{
		long long x,y;
		cin>>x>>y;
		cout<<x+(y/2)<<endl;}
}


Measured memory_bytes: 256
a = int(input())
b = int(input())
if a == 1 and b == 2:
  print("3")
elif a == 1 and b == 3:
  print("2")
elif a == 2 and b == 3:
  print("1")
elif a == 2 and b == 1:
  print("3")
elif a == 3 and b == 1:
  print("2")
elif a == 3 and b == 2:
  print("1")



Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
#define queue_valtype pair

typedef struct {
	int x;
	int y;
	int v;
}pair;

typedef struct q_node_sub{
	queue_valtype data;
	struct q_node_sub *next;
}q_node;

typedef struct {
	q_node *fst;
	q_node *last;
	int num;
}queue;

queue *make_queue(){
	queue *q = (queue *)malloc(sizeof(queue));
	q->fst = NULL;
	q->last = NULL;
	q->num = 0;
	return q;
}

int element_num_q(queue *q){
	return q->num;
}

void add_data_q(queue_valtype val, queue *q){
	q_node *last = (q_node *)malloc(sizeof(q_node));
	last->data = val;
	last->next = NULL;
	if(element_num_q(q) == 0){
		q->fst = last;
	}
	else{
		q->last->next = last;
	}
	q->last = last;
	q->num++;
}

queue_valtype take_data_q(queue *q){
	if(q->num == 0){
		printf("no data in the queue\n");
	}
	queue_valtype ans = q->fst->data;
	q_node *fst = q->fst;
	if(q->num == 1){
		q->fst = NULL;
		q->last = NULL;
	}
	else{
		q->fst = fst->next;
	}
	free(fst);
	q->num--;
	return ans;
}

queue_valtype look_data_q(queue *q){
	if(q->num == 0){
		printf("no data in the queue\n");
	}
	else{
		return q->fst->data;
	}
}

int max(int a, int b){
	return a >= b ? a : b;
}

int main(){
	int H, W, i, j, k;
	scanf("%d%d", &H, &W);
	char **A = (char **)malloc(sizeof(char *) * H);
	queue *q = make_queue();
	for(i = 0; i < H; i++){
		A[i] = (char *)malloc(sizeof(char) * (W + 1));
		scanf("%s", A[i]);
		for(j = 0; j < W; j++){
			if(A[i][j] == '#'){
				add_data_q((pair){i, j, 0}, q);
			}
		}
	}
	int **B = (int **)malloc(sizeof(int *) * H);
	for(i = 0; i < H; i++){
		B[i] = (int *)malloc(sizeof(int) * W);
		for(j = 0; j < W; j++){
			B[i][j] = -1;
		}
	}
	int dx[4] = {0, 1, 0, -1};
	int dy[4] = {1, 0, -1, 0};
	while(element_num_q(q) > 0){
		pair p = take_data_q(q);
		if(p.x < 0 || H <= p.x || p.y < 0 || W <= p.y || B[p.x][p.y] != -1){
			continue;
		}
		B[p.x][p.y] = p.v;
		for(k = 0; k < 4; k++){
			i = p.x + dx[k];
			j = p.y + dy[k];
			add_data_q((pair){i, j, p.v + 1}, q);
		}
	}
	int ans = 0;
	for(i = 0; i < H; i++){
		for(j = 0; j < W; j++){
			ans = max(ans, B[i][j]);
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 130048
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
typedef long long ll;
const ll longinf=1LL<<60;
using namespace std;
int n;
int h[200];

int main()
{
    cin>>n;
    for (int i=1; i<=n; ++i)
        cin>>h[i];
    int ans=0;
    for (int i=1; i<=n; ++i)
    {
        int flag=1;
        for (int j=0; j<i; ++j)
            if (h[j]>h[i]) flag=0;
        ans+=flag;
    }
    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

vector<vi> e;
int rec(int c, int p, int B){
	vi u;
	for(int i : e[c]) if(i != p) u.pb(rec(i, c, B));
	sort(all(u));
	if(u.size() && u.back() > B) return inf;
	
	auto calc = [&](){
		assert(u.size() % 2);
		int lo = -1, hi = u.size(), mid;
		while(lo + 1 < hi){
			mid = (lo + hi) / 2;
			bool ok = 1;
			for(int i = 0, j = u.size() - 1; i < j; ){
				if(i == mid) i++;
				if(j == mid) j--;
				if(i < j && u[i] + u[j] > B){
					ok = 0;
					break;
				}
				i++; j--;
			}
			if(ok) hi = mid;
			else lo = mid;
		}
		return hi < u.size() ? u[hi] + 1 : inf;
	};
	
	if(u.size() % 2) return calc();
	
	bool ok = 1;
	rep(i, u.size() / 2) if(u[i] + u[u.size() - 1 - i] > B) ok = 0;
	if(ok) return 1;
	
	u.pop_back();
	return calc();
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	e.resize(n);
	rep(i, n - 1){
		int a, b; cin >> a >> b; a--; b--;
		e[a].pb(b);
		e[b].pb(a);
	}
	int A = 0, r = -1;
	rep(i, n){
		if(e[i].size() % 2) A++;
		if(e[i].size() == 1) r = i;
	}
	A /= 2;
	
	int lo = 0, hi = n, mid;
	while(lo + 1 < hi){
		mid = (lo + hi) / 2;
		if(rec(r, r, mid) <= mid + 1) hi = mid;
		else lo = mid;
	}
	cout << A << " " << hi << endl;
	return 0;
}

Measured memory_bytes: 15104
import java.util.*;
class Main{
	public static void main(String[] args){
		int a , b;
		Scanner input = new Scanner(System.in);
		a = input.nextInt();
		b = input.nextInt();
		if((a+b)%2 == 0)
			System.out.println((a+b)/2);
		else
			System.out.println("IMPOSSIBLE");

	}
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int dp[200000][3];
int a[3];
int main(){
	int n;scanf("%d",&n);
	rep(i,n){
		rep(j,3)scanf("%d",&a[j]);
		rep(j,3){
			rep(k,3){
				if(j==k)continue;
				dp[i+1][k]=max(dp[i+1][k],dp[i][j]+a[k]);
			}
		}
	}
	cout<<max({dp[n][0],dp[n][1],dp[n][2]})<<endl;
}

Measured memory_bytes: 1408
import math

s = input().split(" ")
n = int(s[0])
d = int(s[1])
list = []
count = 0
for i in range(n):
  list.append([float(a) for a in input().split(" ")])
for i1 in range(n):
  for i2 in range(i1, n):
    if i1 != i2:
      dist = 0.0
      for j in range(d):
        dist += (list[i1][j] - list[i2][j]) * (list[i1][j] - list[i2][j])
      sqrt = math.sqrt(dist)
      if sqrt.is_integer():
        count += 1
print(count)

Measured memory_bytes: 3064
N = int(input())
A = list(map(int,input().split()))

ans = 1
up = dn = False
for a,b in zip(A,A[1:]):
    if a < b:
        if up: continue
        up = True
        if dn:
            ans += 1
            up = dn = False
    elif a > b:
        if dn: continue
        dn = True
        if up:
            ans += 1
            up = dn = False
print(ans)

Measured memory_bytes: 14224
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
    for (T& x: vec) { is >> x; }
    return is;
}

int main() {
	ll ans = 0;
	ll tmp;
	ll n, d;
	cin >> n >> d;
	ll x, y;
	REP(i, n ){
		cin >> x >> y;
		if(x*x+y*y <= d*d) ans ++;
	}
	cout << ans << endl;
}

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

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

    printf("%.10f\n", 2 * R * acos(-1));

    return 0;
}

Measured memory_bytes: 3764
import java.util.Scanner;

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

		int a = N/100;
		int b = (N-a*100)/10;
		int c = N-a*100-b*10;
		if (a==1) {
			a=9;
		} else if(a==9) {
			a=1;
		}
		if (b==1) {
			b=9;
		} else if(b==9) {
			b=1;
		}
		if (c==1) {
			c=9;
		} else if(c==9) {
			c=1;
		}
		System.out.println(a*100 + b*10 + c);
	}
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
using namespace std;

typedef long long ll;
ll INF = 1LL << 60;
ll MAX = 100010;

int
main() 
{
  int N; cin >> N;
  vector<int> arr(N);
  vector<int> arr2(N);
  rep(i, 0, N) cin >> arr[i], arr2[i] = arr[i] - (i + 1);

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

  int med_index = N / 2;
  int med = arr2[med_index];
  ll ans = 0;
  rep(i, 0, N){
    ans += abs(arr[i] - (med + i + 1));
  }

  cout << ans << endl;

}



Measured memory_bytes: 1792
#include <iostream>
using namespace std;
 
#define MAX_W 100
#define MAX_H 100
char farm[MAX_W][MAX_H];
int W, H;
const int direction[4][2] = {
	{ -1, 0 },
	{ 1, 0 },
	{ 0, -1 },
	{ 0, 1 },
};
 
void dfs(const int& x, const int& y, const char tree)
{
	farm[x][y] = 'x';
	for (int i = 0; i < 4; ++i)
	{
		int nx = x + direction[i][0];
		int ny = y + direction[i][1];
		if (nx >= 0 && nx < W && ny >= 0 && ny < H && farm[nx][ny] == tree)
		{
			dfs(nx, ny, tree);
		}
	}
}
 
///////////////////////////SubMain//////////////////////////////////
int main(int argc, char *argv[])
{
 
	while (cin >> H >> W, W > 0)
	{
		int res = 0;
		int x, y;
		for (y = 0; y < H; ++y)
		{
			for (x = 0; x < W; ++x)
			{
				cin >> farm[x][y];
			}
		}
 
		for (y = 0; y < H; ++y)
		{
			for (x = 0; x < W; ++x)
			{
				if (farm[x][y] != 'x')
				{
					dfs(x, y, farm[x][y]);
					++res;
				}
			}
		}
		cout << res << endl;
	}
 
	return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>

int main()
{
    int a,b,m;
    scanf("%d %d",&a,&b);
    if(1<=a && a<=9 && 1<=b && b<=9)
    {
       m=a+b;
       if(m<=9) printf("%d",m);
       else printf("error");
    }

    return 0;
}

Measured memory_bytes: 1688
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;i++)
#define per(i,b,a) for(int i=(b),i##_st=(a);i>=i##_st;i--)
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define Es(x,i) for(Edge *i=G[x];i;i=i->nex)
typedef pair<int,int> pii;
typedef long long ll;
const int inf=~0u>>1,MOD=1e9+7;/*
char *TT,*mo,but[(1<<15)+2];
#define getchar() ((TT==mo&&(mo=((TT=but)+fread(but,1,1<<15,stdin)),TT==mo))?-1:*TT++)//*/
inline int rd() {
	int x=0,c=0,f=1;
	for(; c<'0'||c>'9'; c=getchar())f=c!='-';
	for(; c>='0'&&c<='9'; c=getchar())x=x*10+c-'0';
	return f?x:-x;
}
char s[1651];
int main(){
	int n;
	scanf("%s",s+1);
	n=strlen(s+1);
	bool flag=1;
	if(n<4){
		flag=0;
	}if(flag){
		if(s[1]!='Y'||s[2]!='A'||s[3]!='K'||s[4]!='I')flag=0;
	}
	puts(flag?"Yes":"No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const long long INF = 1LL << 60;
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 s,w;
    cin>>s>>w;
    if(s>w) cout<<"safe"<<endl;
    else cout<<"unsafe"<<endl;
}


Measured memory_bytes: 3636
#include <iostream>
using namespace std;
/*
  1
4 2 3 5
  6
*/
class Dice {
private:
  int s[6];
public:
  Dice();
  Dice(int t[6]);
  int get(int pos);
  void set(int pos, int x);
  void move(char dir);
};

Dice::Dice() {
  for (int i = 0; i < 6; i++) {
    s[i] = 0;
  }
}

Dice::Dice(int t[6]) {
  for (int i = 0; i < 6; i++) {
    s[i] = t[i];
  }
}

int Dice::get(int pos) {
  return s[pos];
}

void Dice::set(int pos, int x) {
  s[pos] = x;
}

void Dice::move(char dir) {
  int t;
  switch (dir) {
    case 'N': {
      t = s[0];
      s[0] = s[1];
      s[1] = s[5];
      s[5] = s[4];
      s[4] = t;
      break;
    }
    case 'E': {
      t = s[3];
      s[3] = s[5];
      s[5] = s[2];
      s[2] = s[0];
      s[0] = t;
      break;
    }
    case 'W': {
      t = s[0];
      s[0] = s[2];
      s[2] = s[5];
      s[5] = s[3];
      s[3] = t;
      break;
    }
    case 'S': {
      t = s[4];
      s[4] = s[5];
      s[5] = s[1];
      s[1] = s[0];
      s[0] = t;
      break;
    }
  }
}

int main() {
  int t[6];
  char c;
  Dice *d;

  for (int i = 0; i < 6; i++) {
    cin >> t[i];
  }
  d = new Dice(t);

  while (cin >> c) {
    d->move(c);
  }

  cout << d->get(0) << endl;

  return 0;
}

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

int main() {
  
  long long H, W;
  cin >> H >> W;
  
  long long count;
  
  if (W == 1 || H == 1) {
    count = 1;
  } else if (W*H % 2 == 0) {
    count = W * H / 2;
  } else {
    count = (W * H + 1)/2;
  }
  
  cout << count << endl;;
  
}

Measured memory_bytes: 256
H,W=map(int,input().split())


def Choco(H,W,ans):
    if H%3==0 or W%3==0:
        print("0")
        exit()
    else:
        for i in range(H):
            if i==0:
                pass
            else:
                a=W*i
                if (H-i)%2==0:
                    b=(H-i)*W//2
                    dif=abs(a-b)
                else:
                    w1=W//2
                    b=(H-i)*w1
                    c=(H-i)*(W-w1)
                    M=max(a,b,c)
                    m=min(a,b,c)
                    dif=M-m
                ans=min(dif,ans)
    return ans

ans=float("inf")
ans=Choco(H,W,ans)
ans=Choco(W,H,ans)

print(ans)






Measured memory_bytes: 3064
a, b = map(int, input().split())

a_str = str(a)
b_str = str(b)

for _ in range(1, b) :
    a_str = a_str + str(a)

for _ in range(1, a) :
    b_str = b_str + str(b)

if a_str < b_str :
    print(a_str)
else :
    print(b_str)


Measured memory_bytes: 2940
import java.math.*

val MaxMatch = 499500

val Edges = Array(MaxMatch, { mutableListOf<Int>() })
val RevEdges = Array(MaxMatch, {mutableListOf<Int>() })

fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    
    val A = Array(N, { readInputLine().split(" ").map { it.toInt() - 1 }.toIntArray() })
    
    val match = Array(N, { IntArray(N - 1, { -1 }) })
    
    val matchMemo = Array(N, { IntArray(N, { -1 })})
    
    var id = 0
    
    for (i in 0 until N) {
        for (j in 0 until N - 1) {
            if (matchMemo[i][A[i][j]] == -1) {
                match[i][j] = id
                matchMemo[i][A[i][j]] = id
                matchMemo[A[i][j]][i] = id
                if (j != 0) {
                    Edges[match[i][j - 1]].add(id)
                    RevEdges[id].add(match[i][j - 1])
                }
                id++
            } else {
                match[i][j] = matchMemo[i][A[i][j]]
                if (j != 0) {
                    Edges[match[i][j - 1]].add(match[i][j])
                    RevEdges[match[i][j]].add(match[i][j - 1])
                }
            }
        }
    }

    if (existsCycle()) {
        println(-1)
        return
    }

    var ans = 0

    for (i in 0 until N) {
        ans = Math.max(ans, pathLength(match[i][N - 2]))
    }

    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}

val NewState = 1
val ActiveState = 2
val FinishState = 3
val nodeStatus = IntArray(MaxMatch, { NewState })

fun existsCycle(): Boolean {
    for (v in 0 until MaxMatch) {
        if (nodeStatus[v] == NewState) {
            if (existsCycleSub(v)) {
                return true
            }
        }
    }

    return false
}

fun existsCycleSub(source: Int): Boolean {
    nodeStatus[source] = ActiveState
    
    for (e in Edges[source]) {
        if (nodeStatus[e] == ActiveState) {
            return true
        } else if (nodeStatus[e] == NewState) {
            if (existsCycleSub(e)) {
                return true
            }
        }
    }

    nodeStatus[source] = FinishState
    
    return false
}

val lengthMemo = IntArray(MaxMatch)

fun pathLength(id: Int): Int {
    if (lengthMemo[id] == 0) {
        var length = 1
        
        for (e in RevEdges[id]) {
            length = Math.max(length, pathLength(e) + 1)
        }
        
        lengthMemo[id] = length
    }

    return lengthMemo[id]
}


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

int main() {
  int A, B, sum;
  cin >> A >> B;
  sum = A + B;
  if (sum >= 10) {
    cout << "error" << endl;
  }
  else {
    cout << sum << endl;
  }
  return 0;
}

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

long sub(long n) {
  long sum = 0;
  while (n > 0) {
    sum += n / 5;
    n /= 5;
  }
  return sum;
}

int main() {
  long n;
  cin >> n;
  if (n % 2 == 0) {
    cout << sub(n / 2) << endl;
  } else {
    cout << 0 << endl;
  }
}

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

using namespace std;

const int maxn = 3*1e5+10;

int main(){
	int x,y,a,b,c,t1,t2;
	long long ans = 0;
	cin >> x >> y >> a >> b >> c;
	t1 = x,t2 = y;

	vector<pair<int,int>> v[2];

	for(int i=0;i<a;i++){
		int aux;
		cin >> aux;
		v[0].push_back({aux,1});
	}

	for(int i=a;i<a+b;i++){
		int aux;
		cin >> aux;
		v[0].push_back({aux,2});
	}

	for(int i=0;i<c;++i){
		int aux;
		cin >> aux;
		v[1].push_back({aux,3});
	}

	sort(v[0].rbegin(),v[0].rend());
	sort(v[1].rbegin(),v[1].rend());

	vector<int> apples;

	for(int i=0;i<a+b && (x || y);++i){
		if(x && v[0][i].second == 1){
			apples.push_back(v[0][i].first);
			x--;
		}
		else if(y && v[0][i].second == 2){
			apples.push_back(v[0][i].first);
			y--;
		}
	}

	for(int i=0;i<c;++i){
		apples.push_back(v[1][i].first);
	}

	sort(apples.rbegin(),apples.rend());

	for(int i=0;i<t1+t2;++i){
		ans+=apples[i];
	}

	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 5744
// ConsoleApplication1.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

int main()
{
	int h, m, s;
	cin >> s;
	h = s / 3600;
	s = s - 3600 * h;

	m = s / 60;
	s = s - 60 * m;

	cout << h << ":" << m << ":" << s <<endl;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します



Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define endl '\n'
#define Endl '\n'
#define fi first
#define ii pair<int,int>
#define iil pair<ll,ll>
#define se second
#define ld long double
#define mod 1000000007
#define popcount __builtin_popcountll
#define x0 zxcxzcsacasd
#define x1 ghfghujfgfg
#define y0 olkjhdnncvcv
#define y1 bhvgrewm345345435
#define debug(x) std::cerr<<#x<<": "<<(x)<<'\n'
#define all(x) x.begin(), x.end()
using namespace std;

int main(){
	int n;
	cin>>n;
	vector<int>a(n), b(n), amid(n);
	vector<int>cnt(n + 1, 0);
	for(auto &x:a)scanf("%d", &x), cnt[x]++;
	for(auto &x:b)scanf("%d", &x), cnt[x]++;
	for(int i = 1;i<=n;i++){
		if(cnt[i]>n){
			cout<<"No"<<endl;
			return 0;
		}
	}
	reverse(all(b));
	int l = 0, r = n-1;
	for(int i=0;i<n;i++){
		if(a[i]==b[i]){
			if(b[l]!=a[i] && a[l]!=b[i]){
				swap(b[l], b[i]);
				l++;
			}else{
				swap(b[r], b[i]);
				r--;
			}
		}
	}
	cout<<"Yes"<<endl;
	for(int i=0;i<n;i++){
		assert(a[i]!=b[i]);
		cout<<b[i]<<" ";
	}
}

Measured memory_bytes: 6408
// テ・ツ淞コテヲツ慊ャテ」ツδ?」ツδウテ」ツδ療」ツδャテ」ツδシテ」ツδ?(テァツクツョテ・ツーツ湘ァツ可?

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
typedef pair<int, int> pii;
typedef long long ll;
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int X, Y, S;

int calc(int x, int p) {
    return x * (100 + p) / 100;
}

signed main() {
    while(cin >> X >> Y >> S, S) {
        int ans = 0;
        rep(i,1,S) rep(j,1,S) {
            if(calc(i, X) + calc(j, X) != S) continue;
            int temp = calc(i, Y) + calc(j, Y);
            chmax(ans, temp);
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3080
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Twinkle Twinkle Little Star
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AFavoriteSound solver = new AFavoriteSound();
        solver.solve(1, in, out);
        out.close();
    }

    static class AFavoriteSound {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            int ans = b / a;
            if (ans > c)
                out.println(c);
            else
                out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}



Measured memory_bytes: 24788
#pragma region
#ifndef LOCAL_DEBUG
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif

#include <assert.h>
#include <math.h>

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>
#define pb push_back
#define f(i, a, b) for (int i = a; i < b; i++)
#define revf(i, b, a) for (int i = b; i >= a; i--)
#define all(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define revsrt(v) sort(v.rbegin(), v.rend())
#define sp << ' ' <<
#define en << '\n'
#define precision(x) cout << fixed << setprecision(x);
#define fio                \
  ios::sync_with_stdio(0); \
  cin.tie(0);              \
  cout.tie(0);

using namespace std;

template <typename T, typename U>
ostream &operator<<(ostream &os, vector<pair<T, U>> &v) {
  int n = v.size();
  for (int i = 0; i < n; i++)
    os << "{" << v[i].first << ", " << v[i].second << "}" en;
  return os;
}

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  int n = v.size();
  for (int i = 0; i < n; i++) os << v[i] << " ";
  os en;
  return os;
}

template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  int n = v.size();
  for (int i = 0; i < n; i++) is >> v[i];
  return is;
}

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;

#pragma endregion

ll mod = 1e9 + 7;  // 998244353;
const int MAX = 1e5 + 5;

void preprocessing() {}

void solvetestcase() {
  ll n;
  cin >> n;
  vll v(n);
  cin >> v;
  ll ans = 0, mx = v[0];
  f(i, 0, n) {
    ans += max(0LL, mx - v[i]);
    mx = max(v[i], mx);
  }
  cout << ans en;
}

int main() {
  fio;
  preprocessing();

  int t = 1;
  // UNCOMMENT FOR TESTCASES	\
	cin >> t;

  f(T, 1, t + 1) {
    // UNCOMMENT FOR CODEJAM,HACKERCUP	\
		cout << "Case #" << T << ": ";
    solvetestcase();
    cout.flush();
  }
};

/*
    AUTHOR:     KUNAL TAWATIA
    EDUCATION:  INDIAN INSTITUTE OF TECHNOLOGY, JODHPUR
*/

Measured memory_bytes: 4776