akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  int l[n];
  for(int i=0;i<n;++i){
    cin>>l[i];
  }
  int ans=0;
  for(int i=0;i<n;++i){
    ans+=min(l[i],k-l[i]);
  }
  cout<<ans*2;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;
typedef priority_queue<ll, vector<ll>, greater<ll>> PQ;


void connect(ll& ans, PQ& pq, ll& cnta, ll& cntb){
	ans += pq.top() * cntb;
	pq.pop();
	cnta--;
}

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

	int W, H;
	cin >> W >> H;

	PQ pq1;
	rep(i, W) {
		ll p;
		cin >> p;
		pq1.push(p);
	}

	PQ pq2;
	rep(i, H) {
		ll q;
		cin >> q;
		pq2.push(q);
	}

	ll cnt1 = W + 1;
	ll cnt2 = H + 1;

	ll ans = 0;
	while(!pq1.empty() || !pq2.empty()){
		if(pq1.empty()){
			connect(ans, pq2, cnt2, cnt1);
			// ans += pq2.top() * cnt1;
			// pq2.pop();
			// cnt2--;
			continue;
		}

		if(pq2.empty()){
			connect(ans, pq1, cnt1, cnt2);
			continue;
		}

		if(pq1.top() < pq2.top()){
			connect(ans, pq1, cnt1, cnt2);
			continue;
		}

		connect(ans, pq2, cnt2, cnt1);
	}

	cout << ans << endl;
}


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

int main(){
  string s;
  cin>>s;
  int n=s.length();
  int flag=0;
  if(s.at(0)==s.at(n-1)){
    if(n%2 ==0){
      flag=1;
    }
    else{
      flag=2;
    }
  }
  else{
    if(n%2 ==0){
      flag=2;
    }
    else{
      flag=1;
    }
  }
  if(flag==1){
    cout<<"First"<<endl;
    return 0;
  }
  else{
    cout<<"Second"<<endl;
    return 0;
  }
}


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

int main() {
  int N;
  cin >> N;
  vector<int> K(N);
  
  for(int i=0;i<N;i++){
     cin >>K[i]; 

  }
  sort(K.begin(),K.end());
  reverse(K.begin(),K.end());
  int A=0;
  int B=0;
  for(int i=0;i<N;i++){
     if(i%2==0){
       A +=K[i];
     }
     else{
       B +=K[i];
     }

  }
cout << A-B << endl;
  
  

}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <queue>
#include <list>
//#define LOCAL
using namespace std;
typedef long long ll;
const int mx=1e3+10;
vector<ll>num;
int main() {
#ifdef LOCAL
ifstream fin("1.txt");
streambuf*p;
p=cin.rdbuf(fin.rdbuf());
#endif // LOCAL
ll n;
cin>>n;
for(ll i=1;i<=n;i++){
    ll value;
    cin>>value;
    num.push_back(value);
}
ll qn;
cin>>qn;
for(ll j=1;j<=qn;j++){
    ll t, sub, e;
    cin>>t>>sub>>e;
    if(0==t){
        ll mmin=1e10+10;
        for(ll k=sub;k<e;k++) mmin=min(mmin, num[k]);
        printf("%lld\n", mmin);
    }else{
        ll mmax=-1e10-10;
        for(ll k=sub;k<e;k++) mmax=max(mmax, num[k]);
        printf("%lld\n", mmax);
    }

}

#ifdef LOCAL
fin.close();
#endif // LOCAL
}




Measured memory_bytes: 3264
#include <iostream>
    #include <vector>
    using namespace std;
     
    int main() {
    // your code goes here
    vector<int> stu(30,1);// stu[n-1] <=> 生徒nは未提出
    for(int i=0;i<30;i++){
    int temp;
    cin >> temp;
    stu.at(temp-1)=0;
    }
    for(int n=1;n<=30;n++){
    if(stu.at(n-1)==1)
    cout << n << endl;
    }
    return 0;
    }

Measured memory_bytes: 1192
#include<iostream>
using namespace std;
int main()
{
int N,X,i,D,B=1;
  cin>>N>>X;
int L[N];
  for(i=0;i<N;i++)
  {
    cin>>L[i];
  }
 
 for(i=0;i<N;i++)
 {
  D=D+L[i];
  if(D<=X)
    B++;
 }

cout<<B;
return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<pair<int, int>> siti(n);
	vector<int> tim(n);
	vector<int> sim(n);
	rep(i, n){
    	cin >> siti.at(i).second >> siti.at(i).first;
    }
	sort(siti.begin(), siti.end());
	int f = 0;
	ll time = 0;
	for(int i=0; i<n; i++){
    	time += siti.at(i).second;
    	if(time > siti.at(i).first){
        	f = 1;
        	break;
        }
    }
	if(f == 0){
    	cout << "Yes" << endl;
    }else{
    	cout << "No" << endl;
    }
}

Measured memory_bytes: 3328
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))
total = 0
ans = []
for a in A:
    total^=a
for a in A:
    ans.append(str(total^a))
print(' '.join(ans))

Measured memory_bytes: 36696
#include <bits/stdc++.h>
using namespace std;
int main() {
  long int Y;
  cin >> Y;
  long int yen = 100;
  double k = 1.01;
  int num = 1;
  
  while(num < 10000) {
    yen = round(yen * k - 0.5);
//    if(num % 10 == 0) cout << yen << endl;
    
    if(yen >= Y) {
      cout << num << endl;
      return 0;
    }
    
    num++;
  }
  return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<string > vecstr;
int main()
{
  int h,a;
  cin >>h >>  a;
  int ans = h/a + (h%a != 0);
  cout << ans << endl;
}


Measured memory_bytes: 256
import math

n,d=map(int,input().split())

x=[]

for i in range(n):
    x1,y1=map(int,input().split())
    x.append([x1,y1])

num=0
for i in x:
    dis=(i[0]**2+i[1]**2)**(0.5)

    if(dis<=d):
        num+=1

print(num)


Measured memory_bytes: 39360
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
// aのn乗を求める。計算量はO(logn)
ll modpow(ll a, ll n) {
    if(n == 0) {
        return 1;
    }
    if(n%2 == 1) {
        return (a * modpow(a, n-1))%mod;
    }
    return (modpow(a, n/2) * modpow(a, n/2))%mod;
}
 
ll Comb(ll x, ll y) {
    if(y > x-y) {
        return Comb(x, x-y);
    }
    ll resMul = 1, resDiv = 1;
    rep(i, y) {
        resMul *= (x-i);
        resDiv *= (i+1);
        resMul %= mod;
        resDiv %= mod;
    }
    // resMul/resDivをresDivの逆元を使って求める
    ll res = resMul * modpow(resDiv, mod-2) % mod;
    return res; 
}
 
int main() {
    ll x, y;
    cin >> x >> y;
 
    if((x+y)%3 != 0) {
        out(0);
        re0;
    }
 
    ll n = (x+y)/3; 
    if(x < n || y < n) {
        out(0);
        re0;
    }
 
    out(Comb(n, x-n));
    re0;
}

Measured memory_bytes: 256
//***********************
//Author:kibi11
//Quarantine Days
//***********************

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define fr(i, n) for(int i = 0; i < n; i++)
#define fr1(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,k) for(int i=a;i>=k;i--)
#define same int t;cin>>t;while(t--)
#define check(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define f first
#define s second
#define XOX

//////////////////////////////////////////////////////////////////////////
/////////////////DEBUGING ZONE//////////////////////////////

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 XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
///////////////////////////////////////////////////////////////////////////
 
ll powermod(ll base, ll exp, ll mod) {
	ll result = 1;
	while (exp != 0) {
		if ((exp % 2) == 1) {
			result = (result * base) % mod;
		}
		base = (base * base) % mod;
		exp /= 2;
	}
	return result;
}

///////////////////////////////////////////////////////////////////////////
//Fuctions if any:





///////////////////////////////////////////////////////////////////////////
int main() 
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tt = clock();
//ios_base& scientific (ios_base& str);

int k;
string s;
cin>>k;
cin>>s;
if(s.size()<=k)
{
	cout<<s<<endl;
}
else{
	s=s.substr(0,k);
	s+="...";
	cout<<s<<endl;
}
cerr << "TIME = " << (double) 1.0 * (clock() - tt) / CLOCKS_PER_SEC << " seconds" << endl;
return 0;
}

Measured memory_bytes: 3840
#include<stdio.h>

#define vMAX 10001
#define nMAX 2000001
int n,A[nMAX],B[nMAX];

void CountingSort(void){
	int i,cnt[vMAX];
	for(i=0;i<vMAX;i++){
		cnt[i]=0;
	}

	for(i=0;i<n;i++){
		cnt[ A[i] ]++;
	}

	for(i=1;i<vMAX;i++){
		cnt[i]+=cnt[i-1];
	}

	for(i=0;i<n;i++){
		B[ cnt[A[i]] ]=A[i];	cnt[A[i]]--;
	}
}

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

	for(i=0;i<n;i++)scanf("%d",&A[i]);
	CountingSort();
	for(i=1;i<=n;i++){
		if(i>1)printf(" ");
		printf("%d",B[i]);
	}printf("\n");
	return 0;
}



Measured memory_bytes: 17404
import java.io.IOException;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) throws IOException {
		
		Scanner sc = new Scanner(System.in);
		int n =  Integer.parseInt(sc.next());
		int a = 0;
		int b = 0;
		
		a = n / 500;
		n = n % 500;
		b = n / 5;
		
		System.out.println((a*1000)+(b*5));
		
		}
}

Measured memory_bytes: 23508
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int k,x;
    cin >> k >> x;
    loop(i,x-k+1,x+k)cout << i << " \n"[i==x+k-1];
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

class Point {
	double EPS = 0.0000000001;
	double x; double y;
	public Point(double ax, double ay){x=ax;y=ay;}
	public Point sum(Point p) { return new Point(x+p.x,y+y); }
	public Point diff(Point p) { return new Point(x-p.x,y-p.y); }
	public Point mult(double k) { return new Point(x*k,y*k); }
	public Point div(double k) { return new Point(x*(1.0/k),y*(1.0/k)); }
	public boolean equals(Point p){return Math.abs(x-p.x)<EPS && Math.abs(y-p.y)<EPS;}
}
class Vector extends Point {
	public Vector(double ax, double ay) {super(ax,ay);}
	public Vector(Point p1, Point p2) {super(p1.x-p2.x,p2.x-p2.y);}
	public double norm() {return x*x+y*y;}
	public double abs() {return Math.sqrt(norm());}
	// TODO:
	public boolean isSmallerThan(Vector v) {return x!=v.x?x<v.x:y<v.y;}
	public double dotProduct(Vector v) {return x*v.x+y*v.y;}
	public double crossProduct(Vector v) {return x*v.y - y*v.x;}
}

class Segment {
	Point p1; Point p2;
	public Segment(Point ap1, Point ap2){p1=ap1;p2=ap2;}
	public double dotProduct(Segment s) {return (p1.x-p2.x)*(s.p1.x-s.p2.x)+(p1.y-p2.y)*(s.p1.y-s.p2.y);}
	public double crossProduct(Segment s) {return (p1.x-p2.x)*(s.p1.y-s.p2.y) - (p1.y-p2.y)*(s.p1.x-s.p2.x);}
}
class Line extends Segment{public Line(Point ap1, Point ap2){super(ap1,ap2);}}


public class Main{

	static double EPS = 0.0000000001;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int q = scan.nextInt();
		for (int i=0;i<q;i++) {
			Line l1 = new Line(new Point(scan.nextDouble(),scan.nextDouble()), new Point(scan.nextDouble(),scan.nextDouble()));
			Line l2 = new Line(new Point(scan.nextDouble(),scan.nextDouble()), new Point(scan.nextDouble(),scan.nextDouble()));
			if (isOrthogonal(l1,l2)) {
				System.out.println(1);
			} else if (isParallel(l1,l2)) {
				System.out.println(2);
			} else {
				System.out.println(0);
			}
		}
		
	}
	static boolean equals(double d1, double d2){return Math.abs(d1-d2)<EPS;}
	boolean isOrthogonal(Vector v1, Vector v2) {return equals(v1.dotProduct(v2),0.0);}
	static boolean isOrthogonal(Segment s1, Segment s2) {return equals(s1.dotProduct(s2),0.0);}
	boolean isParallel(Vector v1, Vector v2) {return equals(v1.crossProduct(v2),0.0);}
	static boolean isParallel(Segment s1, Segment s2) {return equals(s1.crossProduct(s2),0.0);}
	
	class Circle {Point c;double r;Circle(Point ac, double ar){c=ac;ar=r;}}
	class Polygon extends ArrayList<Point>{}

}

Measured memory_bytes: 57728
long n,s;
f(long b)
{
	long sum=0;
	long _n=n;
	while(_n)
	{
		sum+=_n%b;
		_n/=b;
	}
	return sum==s;
}
main()
{
	scanf("%ld%ld",&n,&s);
	if(n==s)
	{
		printf("%ld\n",n+1);
		return 0;
	}
	for(long i=2;i*i<=n;i++)
		if(f(i))
		{
			printf("%ld\n",i);
			return 0;
		}
	long minb=n+1;
	for(long i=1;i*i<=n;i++)
	{
		long b=(n-s)/i+1;
		if(b>1&&f(b)&&minb>b)
		{
			minb=b;
		}
	}
	printf("%ld\n",minb==n+1?-1:minb);
}

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

using namespace std;

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl

int main(){
    string s;
    cin>>s;
    cin>>s;
    cout<<"A"<<s[0]<<"C"<<endl;
    return 0;
}

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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    ll x;
    cin>>x;
    if(x>=30) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!

Measured memory_bytes: 3616
#include<iostream>
using namespace std;
int main() {
	int a, b, c, d, e, f,ans;
	cin >> a >> b >> c >> d >> e>>f;
	ans = a + b * 5 + c * 10 + d * 50 + e * 100 + f * 500;
	if (ans <1000) {
		cout << "0" << endl;
	}
	else {
		cout << "1" << endl;
	}
}


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

namespace Vol0_24
{
    class Program
    {
        static void Main(string[] args)
        {
            string sInput = "";
            // ??\??????????????????
            do
            {
                sInput = Console.ReadLine();
                if (sInput != null && sInput != "")
                {
                    double dSpeed = double.Parse(sInput);

                    int N = getN(getY(getTime(dSpeed)));

                    Console.WriteLine("{0}",N);
                }
            } while (sInput != null && sInput != "");
        }

        // ??????????????§????§???°????±?????????????
        static double getTime(double dSpeed)
        {
            double t = dSpeed / 9.8;

            return t;
        }

        // ?????¢????±?????????????
        static double getY(double t)
        {
            double y = 4.9 * t * t;   // ?????¨?????\

            return y;
        }

        // ?????¢???????????°???????????????
        static int getN( double y )
        {
            int N = 0;
            double dtmp = (y + 5) / 5;
            N = (int)Math.Ceiling( dtmp );

            return N;
        }



    }
}

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


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

Measured memory_bytes: 1152
#include <stdio.h>

int main(){
  int n,t[100],m,p,x,i,j,result;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&t[i]);
  }
  
  scanf("%d",&m);

  for(i=0;i<m;i++){
    result=0;
    scanf("%d %d",&p,&x);
    for(j=0;j<n;j++){
      if(j!=(p-1)){
        result+=t[j];
      } else {
        result+=x;
      }
    }
    printf("%d\n",result);
  }
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args)throws IOException {
		// TODO ?????????????????????????????????????????????

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder builder = new StringBuilder();
        while(true){
            String data[] = reader.readLine().split(" ");
            int a= Integer.parseInt(data[0]);
            int b= Integer.parseInt(data[1]);
            if(a==0 && b==0)
                break;
             
            builder.append(Integer.toString(a<b?a:b)).append(" ").append(Integer.toString(a<b?b:a)).append("\n");
        }
        System.out.print(builder);
		
	}

}

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

int main(void) {
  int A, B;
  cin >> A >> B;
  
  int cnt = 0;
  int num = 1;
  
  for(;;) {
    if(num >= B) {
      cout << cnt;
      return 0;
    }
    num += A -1;
    cnt++;
    //cout << num << " ";
  }
  
  return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

//解説参考.
int main(){
	const llong inf=1e18;
	
	int n;
	cin>>n;
	
	vector<llong> a(n);
	REP(i,n) cin>>a[i];
	sort(ALL(a));
	
	if(a[0]==0){
		cout<<0<<endl;
		return 0;
	}
	
	llong ans=1;
	REP(i,n){
		if(ans>inf/a[i]){
			cout<<-1<<endl;
			return 0;
		}
		ans*=a[i];
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    string s;
    cin>>s;
    int count;
    if (s[0]=='1') count++;
    if (s[1]=='1') count++;
    if (s[2]=='1') count++;
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			998244353

ll mod_pow(ll a,ll b) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2);
}

void solve()
{
	char c;
	
	cin >> c;
	
	if(c >= 'A' && c <= 'Z'){
		cout << 'A';
	}
	else {
		cout <<'a';
	}
}

signed main() {
    fast;
    
    int t = 1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


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

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

    int as[n];
    for (int i = 0; i < n; i++)
        cin >> as[i];

    int count = 0;
    while (true)
    {
        for (int i = 0; i < n; i++)
        {
            if (as[i] % 2 != 0)
                goto RESULT;
            as[i] /= 2;
        }
        count++;
    }

RESULT:
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 504
/*
     “You just can’t beat the person who won’t give up.”
                                                            */
#include <bits/stdc++.h>
#define ll long long
#define oo 0x3f3f3f3f3f3f3f3fLL
#define lp(i,n) for(int i = 0;i < int(n);i++)
#define sz(s) (int)(s.size())
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
const int maxn=2e5+5;
const  double EPS = 1e-9;
const int mod = 1e9+7;

inline void File()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}
vector<int> is_prime(maxn, 1);
void sieve (){
  is_prime[0] = is_prime[1] = 0;
for (int i = 2; i * i <= maxn; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= maxn; j += i)
            is_prime[j] = 0;
    }
}
}
int main()
{
    ios_base::sync_with_stdio(0);
    File();
    sieve();
    int n;
    cin >> n;
    for(int i = n ; i<= maxn ;i++)
        if(is_prime[i])
         return cout<<i,0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  cout << a[a.size() - 1] - a[0] << endl;
  return 0;
}


Measured memory_bytes: 3628
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var s string
	fmt.Scan(&s)
	ans := "TBD"
	m, _ := strconv.Atoi(s[5:7])
	if m <= 4 {
		ans = "Heisei"
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        // 入力
        var n = long.Parse(Console.ReadLine());
        long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long[] b = Console.ReadLine().Split().Select(long.Parse).ToArray();

        long ans = 0;

        for (int i = 0; i < n; i++)
        {
            for (int j = i; j < i + 2; j++)
            {
                if (a[j] < b[i])
                {

                    b[i] = b[i] - a[j];
                    ans += a[j];
                    a[j] = 0;
                }
                else
                {
                    a[j] = a[j] - b[i];
                    ans += b[i];
                    b[i] = 0;
                }
            }
        }

        Console.WriteLine(ans);
    }
}


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

using namespace std;

#define ll 			long long
#define db			double
#define up(i,j,n)		for (int i = j; i <= n; i++)
#define down(i,j,n)	for (int i = j; i >= n; i--)
#define cadd(a,b)		a = add (a, b)
#define cpop(a,b)		a = pop (a, b)
#define cmul(a,b)		a = mul (a, b)
#define pr			pair<int, int>
#define fi			first
#define se			second
#define SZ(x)		(int)x.size()
#define bin(i)		(1 << (i))
#define Auto(i,node)	for (int i = LINK[node]; i; i = e[i].next)

template<typename T> inline bool cmax(T & x, T y){return y > x ? x = y, true : false;}
template<typename T> inline bool cmin(T & x, T y){return y < x ? x = y, true : false;}

const int MAXN = 55;

int N, a[MAXN], o = 1, cnt = 0;
pr ans[MAXN << 3];

int main(){
	scanf("%d", &N);
	up (i, 1, N) scanf("%d", &a[i]);
	up (i, 2, N) if (abs(a[i]) > abs(a[o])) o = i;
	up (i, 1, N) if (i != o) {
		a[i] += a[o];
		ans[++cnt] = make_pair(o, i);
	}
	if (a[1] >= 0) {
		up (i, 2, N) {
			ans[++cnt] = make_pair(i - 1, i);
		}
	}else {
		down (i, N - 1, 1) ans[++cnt] = make_pair(i + 1, i);
	}
	printf("%d\n", cnt);
	up (i, 1, cnt) printf("%d %d\n", ans[i].fi, ans[i].se);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<l_l> vpl;
typedef vector<string> vs;
typedef pair<ll,l_l> lll;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=1;i<=(n);i++)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
const ll dx[4]={1,-1,0,0};
const ll dy[4]={0,0,1,-1};
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;
}

struct UnionFind{
vector<int> par,depth;
UnionFind(int n){
par.resize(n); depth.resize(n);
for(int i=0; i<n; i++){
par[i]=i;
depth[i]=0;
}
}
int find(int x){
if(par[x]==x){
return x;
}
else{
return par[x]=find(par[x]);
}
}
bool same(int x, int y){
return find(x)==find(y);
}
void unite(int x, int y){
x=find(x); y=find(y);
if(x==y) return;
if(depth[x]<depth[y]) swap(x,y);
if(depth[x]==depth[y]) depth[x]++;
par[y]=x;
}
};

int main(){
    ll v,e;cin>>v>>e;
    ll ans=0;
    vector<lll> d;
    rep(i,e){
        ll s,t,w;cin>>s>>t>>w;
        d.pb({w,{s,t}});
    }
    sort(d.begin(),d.end());
    UnionFind uf(v+1);
    rep(i,e){
        ll x=d[i].se.fi,y=d[i].se.se;
        if(!uf.same(x,y)){
            uf.unite(x,y);
            ans+=d[i].fi;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5976
#include <bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < n; i++)
#define REPR(i,n) for(int i = n; i >= 0; i--)
#define FOR(i,m, n) for(int i = m-1; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
//vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2, 初期値))
//vector<intなど> 変数名(要素数,初期値)
using namespace std;
typedef long long ll;
typedef long double ld;
const int MAX = 510000;
const int INF =2000000000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
//gcd,lcmセット
ll gcd(ll a, ll b){
   if (a%b == 0) return b;
   else return gcd(b, a%b);
}
ll lcm(ll a, ll b){	
   return a*b/gcd(a, b);
}
int pow_kai(int a, int n){//aのn乗を計算します。
  int x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a;
    }
    a = a*a;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}
// a^n mod を計算する
long long modPow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
// a^{-1} mod を計算する
ll modInv(ll a, ll mod) {
    return modPow(a, mod - 2, mod);
}

// combinationのテーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
 
bool isPrime(ll x){
    int i;
    if(x < 2)return false;
    else if(x == 2) return true;
    if(x%2 == 0) return false;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return false;
    return true;
}
//dfsではvector<vector<int>> g(n);で◎
int main(){
    string s;
    ll cnt=0;
    cin>>s;
    int n=s.length()-1;
    for(int i=0;i<(1<<n);i++){
        //cout<<"i="<<i<<endl;
        int k=0;
       REP(j,n+1){
            if(i&(1<<j-1)) k=0;
            ll num=s[n-j]-'0';
            //cout<<num<<endl;
            //cout<<"k:"<<k<<"*s["<<n-j<<"]:"<<s[n-j]<<"="<<num*pow(10,k)<<endl;
            cnt+=num*pow(10,k);
            //cout<<"cnt+="<<num*pow(10,k)<<endl;
            k++;
        }
    }
//答え出力パート
    cout<<cnt
    <<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, kk, qq, tmp;
	cin >> nn >> kk >> qq;
	int64 ans[nn + 1];
	for(int64 ii = 0;ii <= nn;ii++)
	{
		ans[ii] = 0;
	}
	for(int64 ii = 0;ii < qq;ii++)
	{
		cin >> tmp;
		ans[0]--;
		ans[tmp - 1]++;
		ans[tmp]--;
		ans[nn]++;
	}
	ans[0] += kk;
	for(int64 ii = 1;ii < nn;ii++)
	{
		ans[ii] += ans[ii - 1];
	}
	for(int64 ii = 0;ii < nn;ii++)
	{
		if(ans[ii] > 0)
		{
			puts("Yes");
		}
		else
		{
			puts("No");
		}
	}
	return 0;
}

Measured memory_bytes: 4356
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x=1,b=0;cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++)cin>>a.at(i);
  for(int j=0;j<n;j++){
    x=a.at(x-1);
    if(x==2){
      b=j+1;
      break;
    }
  }
  if(b>0)cout<<b<<endl;
  else cout<<-1<<endl;
}


Measured memory_bytes: 640
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cou = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500 * i + 100 * j + 50 * k == X:
                cou += 1
print(cou)

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

int main() {
  int n,T;
  cin >> n >> T;
  int x = 10000;
  rep(i,n){
    int c,t;
    cin >> c >> t;
    if(t <= T && c < x) x = c; 
  }
  if(x == 10000) cout << "TLE" << endl;
  else cout << x << endl;
 }


Measured memory_bytes: 256
from bisect import bisect_right,bisect_left
alphabet_small = [chr(i) for i in range(97, 97+26)]
s = input()
t = input()
m = len(s)
n = len(t)

alpha = [[] for i in range(26)]
for i,let in enumerate(s):
    for j,al in enumerate(alphabet_small):
        if let == al:
            alpha[j].append(i)

#alpha　はsのどこに文字があるか

dp = [0 for i in range(n+1)] #i文字目までの最小
#求めるのはdp[n]
t_num = []
append = t_num.append
for let in t:
    for j,al in enumerate(alphabet_small):
        if let == al:
            t_num.append(j)

#t_num　はtの文字を数字に変換
now = -1
for i,let_num in enumerate(t_num):
    #print(i,let_num,alpha[let_num])
    if len(alpha[let_num]) == 0:
        print(-1)
        exit()
    else:
        q = bisect_right(alpha[let_num], now)
        #print(q)
        if q != len(alpha[let_num]):
            next = alpha[let_num][q]
            #print(now,next,1)
            if now == next:
                dp[i+1] += m
                #print(dp[i+1])
            dp[i+1] += dp[i] + next - now
        else:
            next = alpha[let_num][0]
            dp[i+1] += dp[i] + next - now + m
        now = next



print(dp[n])

Measured memory_bytes: 56924
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int a[2000];
ll dp[18][2000];
ll DP[2][2000];
ll sum[2000];

int main(){
    int n,m,T;cin>>n>>m>>T;
    memset(a,-1,sizeof(a));
    a[0]=0;
    rep(i,n){
        int b;scanf("%d",&b);
        a[b%T]=max(a[b%T],b);
    }
    memset(dp,-1,sizeof(dp));
    rep(i,T){
        dp[0][i]=a[i];
    }
    rep(i,18){
        rep(j,T){
            if(dp[i][j]==-1)continue;   
            rep(k,T){
                if(dp[i][k]==-1)continue;
                dp[i+1][(j+k)%T]=max(dp[i+1][(j+k)%T],dp[i][j]+dp[i][k]);
            }
        }
    }
    memset(DP,-1,sizeof(DP));
    DP[0][0]=0;
    rep(i,18){
        rep(j,T)DP[(i+1)%2][j]=max(DP[(i+1)%2][j],DP[i%2][j]);
        if(!(m>>i&1))continue;
        rep(j,T){
            rep(k,T){
                if(DP[i%2][j]==-1||dp[i][k]==-1)continue;
                DP[(i+1)%2][(j+k)%T]=max(DP[(i+1)%2][(j+k)%T],DP[i%2][j]+dp[i][k]);
            }
		}
	}
	sum[T]=-1;
    for(int i=T-1;i>=0;i--){
        sum[i]=max(DP[0][i],sum[i+1]);
    }
    int q;cin>>q;
    rep(i,q){
        int a,b;scanf("%d%d",&a,&b);
        if(sum[a]>=T*(ll)b){
            puts("yes");
        }
        else puts("no");
    }
}


Measured memory_bytes: 3456
use std::io::Read;

#[allow(non_snake_case)]
struct Input {
    D: usize,          // Days
    s: Vec<Vec<i64>>,  // score(day, contest)
    c: Vec<i64>        // cost(contest)
}

fn compute_score(input: &Input, out: &Vec<usize>) -> i64 {
    let mut score = 0;
    let mut last = vec![0; 26];
    for d in 0..out.len() {
        score += input.s[d][out[d]];
        last[out[d]] = d + 1;
        for i in 0..26 {
            score -= input.c[i] * (d + 1 - last[i]) as i64;
        }
    }
    score
}

#[allow(dead_code)]
fn solve_debug(input: &Input) -> Vec<usize> {
    let out = vec![0; input.D];
    out
}

fn solve(input: &Input) -> Vec<usize> {
    let mut out = vec![];
    for _ in 0..input.D {
        let mut max_score = i64::min_value();
        let mut best_i = 0;
        for i in 0..26 {
            out.push(i);
            let score = compute_score(&input, &out);
            if max_score < score {
                max_score = score;
                best_i = i;
            }
            out.pop();
        }
        out.push(best_i);
    }
    out
}

#[allow(non_snake_case)]
fn main() {
    let mut buffer = String::new();
    std::io::stdin().read_to_string(&mut buffer).unwrap();
    let mut iter = buffer.split_whitespace();

    let D: usize = iter.next().unwrap().parse().unwrap();
    let c: Vec<i64> = (0..26)
        .map(|_| iter.next().unwrap().parse().unwrap()).collect();
    let s: Vec<Vec<i64>> = (0..D)
        .map(|_| (0..26)
            .map(|_| iter.next().unwrap().parse().unwrap()).collect()
        )
        .collect();
    let input = Input{ D, s, c };

    let out = solve(&input);

    for i in 0..D {
        println!("{}", out[i] + 1);
    }
}


Measured memory_bytes: 2324
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int n; cin >> n;
	if(n<1200) cout << "ABC" << endl;
	else cout << "ARC" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iostream>
#define ios   ios_base::sync_with_stdio(false);  cin.tie(0);    cout.tie(0);
typedef long long int ll;
using namespace std;
const int M=1e9+7;
ll bm[300005],bM[300005],cm[300005],cM[300005];
int main() {
    ios;
    string s;
    cin>>s;
    for(ll i=0;i<s.length();++i)
      cout<<"x";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define INF 0x3f3f3f3f
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
const ll mod=1000000007;
const double PI = acos(-1.0);
const double epsilon = PI / 180.0;//角度转弧度 
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N = 1e5+10;
int num[N], a[N];
int main() {
	int n;
	cin>>n;
	ll sum = 0;
	rep(i, 1, n + 1) scanf("%d", &a[i]), num[a[i]]++, sum += a[i];
	int q;
	cin>>q;
	while(q--) {
		int b, c;
		scanf("%d %d", &b, &c);
		sum -= (ll)b * num[b];
		sum += (ll)c * num[b];
		num[c] += num[b];
		num[b] = 0;
		cout<<sum<<"\n";
	}
	return 0;
}

Measured memory_bytes: 4432
#include <stdio.h>
#include <string.h>

void BubbleSort(x,y);
void Answer(void);
int A[15000]={0};
double B[100]={0};
int main(void) {

	int i,n,l;
	double m;
	char str[100];

	for(i=0;i<24;i++){
		fgets(str,sizeof(str),stdin);
		sscanf(str,"%d %lf",&n,&m);
		l=m*100; A[l]=n; B[i]=m;
	}
	for(i=0;i<=16;i+=8)
		BubbleSort(i,i+8);
	Answer();
	return 0;
}

void BubbleSort(x,y){
	int i,j,l;
	double tmp;
	for(i=x;i<y-1;i++){
		for(j=y-1;j>i;j--){	
			if(B[j] < B[j-1]){
				tmp = B[j-1];
				B[j-1] = B[j];
				B[j] = tmp;
			}
		}
	}
	l=B[x]*100;
	printf("%d %.2f\n",A[l],B[x]);
	l=B[x+1]*100;
	printf("%d %.2f\n",A[l],B[x+1]);
	B[x]=105; B[x+1]=105;
}
void Answer(void){
	int i,j,l;
	double tmp;
	for(i=0;i<23;i++){
		for(j=23;j>i;j--){	
			if(B[j] < B[j-1]){
				tmp = B[j-1];
				B[j-1] = B[j];
				B[j] = tmp;
			}
		}
	}
	l=B[0]*100;
	printf("%d %.2f\n",A[l],B[0]);
	l=B[1]*100;
	printf("%d %.2f\n",A[l],B[1]);
}

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

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

  int n;
  cin >> n;

  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;

    if (a % 2 == 0) {
      if (a % 3 && a % 5) {
        cout << "DENIED\n";
        return (0);
      }
    }
  }

  cout << "APPROVED\n";

  return (0);
}


Measured memory_bytes: 3620
/*||>>>> Praveen Ojha <<<<>>>> 22 June 2019 <<<<>>>> 17:28:10 <<<<||*/
// #pragma GCC optimize("Ofast") //(Very Fast but Inaccurate)
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //(Small operations in many loops)
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
//Read Problems Carefully & Check for corner cases N=0,1 ?
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

int32_t main(){__
	int n,m;
	cin>>n>>m;
	vi a(n+1);
	int cnt=0,cntp=0;
	vpii vv;
	for(int i=1;i<=n;i++){
		a[i]=m+i-1;
		if(a[i]<0)
			{
				vv.push_back({-a[i],a[i]});
				cnt++;
			}
		else
			{
				vv.push_back({a[i],a[i]});
				cntp++;
			}
	}
	sort(all(vv));
	// debug()<< imie(a);
	int sumi=0;
	for(int i=1;i<n;i++)
		sumi+=vv[i].S;
	cout<<sumi<<"\n";

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

#define MAXN 100000

typedef long long ll;

using namespace std;

ll A[MAXN];

int main()
{
  int N;
  int ans = 0;
  int cnt = 0;
  ll pre;

  cin >> N;
  for ( int i = 0; i < N; ++i ) cin >> A[i];

  sort ( A,A+N);

  pre = A[0];
  for ( int i = 0; i < N; ++i ) {
    if ( A[i] == pre ) {
      ++cnt;
    } else {
      if ( cnt % 2 == 1 ) ++ans;
      pre = A[i];
      cnt = 1;
    }
  }
  if ( cnt % 2 == 1 ) ++ans;

  cout << ans << "\n";
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int read();

int n, s, t;
int p[200005], q[200005];
int id[2][200005], idcnt;



int hd[200005], nx[1000006], to[1000006], c[1000006], cnt;
void add(int f, int t, int cap) {
    nx[++cnt] = hd[f], hd[f] = cnt, to[cnt] = t, c[cnt] = cap;
}
void fadd(int f, int t, int c) { add(f, t, c), add(t, f, 0); }
struct Flow {
    int dep[200005];
    queue<int> q;
    bool bfs() {
        for (int i = 1; i <= t; ++i) dep[i] = 0;
        dep[s] = 1, q.push(s);
        while (!q.empty()) {
            int u = q.front();
            q.pop();
            for (int i = hd[u], v; i; i = nx[i]) {
                if (!c[i] || dep[v = to[i]]) continue;
                dep[v] = dep[u] + 1, q.push(v);
            }
        }
        return dep[t];
    }

    int iter[200005];
    int dfs(int u, int dist) {
        if (u == t) return dist;
        for (int &i = iter[u], v, d; i; i = nx[i]) {
            if (!c[i] || dep[v = to[i]] != dep[u] + 1) continue;
            if (d = dfs(v, min(dist, c[i]))) return c[i] -= d, c[i ^ 1] += d, d;
        }
        return 0;
    }
    int Dinic() {
        int rt = 0, d;
        while (bfs()) {
            for (int i = 1; i <= t; ++i) iter[i] = hd[i];
            while (d = dfs(s, 10000000)) rt += d;
        }
        return rt;
    }
} flow;
void work(int u, int* nx, int* id) {
    if (id[u]) return;
    id[u] = idcnt, work(nx[u], nx, id);
}
int main() {
    n = read(), cnt = 1;
    for (int i = 1; i <= n; ++i) p[i] = read() + 1;
    for (int i = 1; i <= n; ++i) q[i] = read() + 1;
    int res = n;
    for (int i = 1; i <= n; ++i)
        if (!id[0][i]) ++idcnt, work(i, p, id[0]);
    for (int i = 1; i <= n; ++i)
        if (!id[1][i]) ++idcnt, work(i, q, id[1]);

    s = ++idcnt, t = ++idcnt;
    for (int i = 1; i <= n; ++i)
        if (p[i] == i && q[i] == i) --res;
        else if (p[i] == i) fadd(id[1][i], t, 1);
        else if (q[i] == i) fadd(s, id[0][i], 1);
        else if (p[i] != q[i]) fadd(id[1][i], id[0][i], 1);
        else fadd(id[1][i], id[0][i], 1), fadd(id[0][i], id[1][i], 1);
    printf("%d\n", res - flow.Dinic());
    return 0;
}
const int _SIZE = 1 << 22;
char ibuf[_SIZE], *iS = ibuf, *iT = ibuf;
#define gc                                                         \
    (iS == iT ? iT = ((iS = ibuf) + fread(ibuf, 1, _SIZE, stdin)), \
     (iS == iT ? EOF : *iS++) : *iS++)
int read() {
    int x = 0, f = 1;
    char c = gc;
    while (!isdigit(c)) f = (c == '-') ? -1 : f, c = gc;
    while (isdigit(c)) x = x * 10 + c - '0', c = gc;
    return x * f;
}

Measured memory_bytes: 19200
#include<iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
int n, M[MAX][MAX];


int prim() {
	int u, minv;
	int d[MAX], p[MAX], color[MAX];

	for (int i = 0; i < n; i++) {
		d[i] = INFTY;
		p[i] = -1;
		color[i] = WHITE;
	}

	d[0] = 0;

	while (1) {
		minv = INFTY;
		u = -1;
		for (int i = 0; i < n; i++) {
			if (minv > d[i] && color[i] != BLACK) {
				u = i;
				minv = d[i];
			}
		}
		if (u == -1) break;
		color[u] = BLACK;
		for (int v = 0; v < n; v++) {
			if (color[v] != BLACK&&M[u][v] != INFTY) {
				if (d[v] > M[u][v]) {
					d[v] = M[u][v];
					p[v] = u;
					color[v] = GRAY;
				}
			}
		}
	}
	int sum = 0;
	for (int i = 0; i< n; i++) {
		if (p[i] != -1) sum += M[i][p[i]];
	}
	return sum;
}

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			int e; cin >> e;
			M[i][j] = (e == -1) ? INFTY : e;
		}
	}
	cout << prim() << endl;
    return 0;
}

Measured memory_bytes: 3116
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int[] l = new int[n];
		for(int i = 0; i < n; i++){
		    l[i] = sc.nextInt();
		}

		// 計算
	    int result = 0;
	    Arrays.sort(l);
	    for(int i = 0; i < n; i++){
		    for(int j = i + 1; j < n; j++){
		        int k = j + 1;
		        while(k < n && l[i] + l[j] > l[k]) k++;
		        result += k - (j + 1);
		    }
		}

		// 出力
		System.out.println(result);
        
	}
}


Measured memory_bytes: 27796
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
	
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int[] ara = new int[n];
		int[] t = new int[n];
		for(int i = 0;i<ara.length;i++) {
			ara[i] = in.nextInt();
			t[i] = ara[i];
		}
		Arrays.sort(t);
		
		int c= 0;
		for(int i = 0;i<ara.length;i++) {
			if(t[i] != ara[i]) {
				c++;
			}
		}
	
		
		if(c<3) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
		

	}

}


Measured memory_bytes: 27060
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int H = sc.nextInt();
        int W = sc.nextInt();
        
        int h = sc.nextInt();
        int w = sc.nextInt();
        
        System.out.println((H-h)*(W-w));
    }
}


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

int main()
{
    ////////////////////////////
    //入力
    int n,k;
    cin >> n >> k;

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

    //計算
    int cnt[200000]={};
    int types = 0;

    for (int i=0; i<n; i++){
	//もしi番目のボールの数字が初登場なら種類数を1増やす
	if (cnt[a[i]] == 0){
	    types++;
	}
	//「i番目のボールに書かれていた数字」の登場回数メモを1増やす
	cnt[a[i]]++;
    }
    
    //既にk種類以下の場合、書き換える数は0なので出力して終了する
    if (types <= k){
	cout << 0 << endl;
	return 0;
    }
    int ans = 0;
    for (int f=1; f<200000; f++){
        for (int j=0; j<200000; j++){
	    //登場回数が1回の数字から書き換えて行く
	    if (cnt[j] == f){
	        types--;
		ans += f;
		if (types <= k){
		    cout << ans << endl;
		    return 0;
		}
	    }
	}
    }
    ////////////////////////////
    return 0;
}

Measured memory_bytes: 1792