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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
typedef long long ll;

void solve() {
    ll H,W,M; cin >> H >> W >> M;

    set<pair<int,int>> poss;
    map<int,int> h_cnt,w_cnt;

    REP(_,M) {
        int h,w; cin >> h >> w;

        poss.insert(make_pair(h,w));

        if(!h_cnt.count(h)) h_cnt[h] = 1;
        else h_cnt[h]++;

        if(!w_cnt.count(w)) w_cnt[w] = 1;
        else w_cnt[w]++;
    }

    // find max
    ll max_h = 0,max_w = 0;
    for(const auto& it: h_cnt) chmax(max_h,(ll)it.second);
    for(const auto& it: w_cnt) chmax(max_w,(ll)it.second);

    // 最大値と一致する列、行の数を見つける。
    vector<int> avail_h,avail_w;
    for(const auto &it : h_cnt) if(it.second == max_h) avail_h.push_back(it.first);
    for(const auto &it : w_cnt) if(it.second == max_w) avail_w.push_back(it.first);

    ll sz = avail_w.size() * avail_h.size();
    // もし最大値を取りうるマス数がWよりも大きければ、必ず max_h+max_w となるマスがある。
    if( sz > M ) {
        cout << max_h + max_w << endl;
        return;
    }

    // W以下なら探索を開始する。
    for(const auto &h: avail_h) for(const auto &w: avail_w) {
        if(!poss.count(make_pair(h,w))) {
            cout << max_h + max_w << endl;
            return;
        }
    }
    cout << max_h + max_w -1 << endl;

}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 49636
#include <bits/stdc++.h>
       
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
class ModInt {
  static int MOD;
  long long x;

 public:
  static void mod(int m) { MOD = m; }

  ModInt(long long v = 0) : x(v % MOD) {
    if (x < 0) x += MOD;
  }

  ModInt& operator+=(const ModInt& r) {
    x += r.x;
    if (x >= MOD) x -= MOD;
    return *this;
  }

  ModInt& operator-=(const ModInt& r) {
    x -= r.x;
    if (x < 0) x += MOD;
    return *this;
  }
  ModInt& operator*=(const ModInt& r) {
    x = (x * r.x) % MOD;
    return *this;
  }
  ModInt& operator/=(const ModInt& r) {
    *this *= r.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt& r) const { return ModInt(*this) += r; }
  ModInt operator-(const ModInt& r) const { return ModInt(*this) -= r; }
  ModInt operator*(const ModInt& r) const { return ModInt(*this) *= r; }
  ModInt operator/(const ModInt& r) const { return ModInt(*this) /= r; }
  bool operator==(const ModInt& r) const { return x == r.x; }
  bool operator!=(const ModInt& r) const { return x != r.x; }

  ModInt inverse() const {
    long long a = x, b = MOD, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(long long n) const {
    ModInt ret(1), mul(x);
    while (n > 0) {
      if (n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream& operator<<(ostream& os, const ModInt& x) { return os << x.x; }

  friend istream& operator>>(istream& is, ModInt& x) { return is >> x.x; }

  int getMod() { return MOD; }

  long long val() { return x; }
};
int ModInt::MOD = 1000000007;

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

  vector<int> d;
  for (ll m = N; m != 0; m /= 2) {
    d.push_back(m % 2);
  }
  reverse((d).begin(), (d).end());

  const int D = d.size();
  vector<vector<ModInt>> dp(D + 1, vector<ModInt>(3, 0));
  dp[0][0] = 1;

  for (int i = 0; i < (int)(D); ++i) for (int j = 0; j < (int)(3); ++j) for (int ab = 0; ab < (int)(3); ++ab) {

    int delta = j * 2 + d[i] - ab;
    if (delta >= 0) dp[i + 1][min(2, delta)] += dp[i][j];
  }

  cout << accumulate((dp[D]).begin(), (dp[D]).end(), ModInt(0)) << endl;

  return 0;
}


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

int main(){
  int n, all=0, ans=0;
  cin >> n;
  int color[8] = {};
  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    if (a >= 3200){
      all++;
      continue;
    }
    a /= 400;
    if(color[a] == 0){
      color[a] = 1;
      ans++;
    }
  }
  if (ans == 0 && all > 0){
    ans = 1;
    all--;
  }
  cout << ans << " " << ans + all << endl;
  return 0; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define INF 1e15
using namespace std;
struct Po{int x,y;ll z;}v[85];
struct Qu{char ch;int x,y;}c[410];
struct Info{int nu,ne,qu;ll co;}a[500010];
int m,n,s,t,l[85],r[85],b[1010],num,li[500010],la[5010],zh[5010];
bool vi[5010];
ll nu,ansn,di[5010];
void jb(int x,int y,ll z){
	a[++num].nu=y;a[num].ne=b[x];b[x]=num;a[num].co=z;a[num].qu=1;
	a[++num].nu=x;a[num].ne=b[y];b[y]=num;a[num].co=-z;a[num].qu=0;
}
ll que(){
	for (int i=1;i<=t;i++) vi[i]=1,di[i]=INF,la[i]=0,zh[i]=0;
	di[s]=0;vi[s]=0;
	int l=1,r=1;li[l]=s;
	while (l<=r){
		for (int y=b[li[l]];y;y=a[y].ne){
			if (a[y].qu!=0&&di[a[y].nu]>di[li[l]]+a[y].co){
				di[a[y].nu]=di[li[l]]+a[y].co;
				la[a[y].nu]=li[l];zh[a[y].nu]=y;
				if (vi[a[y].nu]){li[++r]=a[y].nu;vi[a[y].nu]=0;}
			}
		}
		vi[li[l]]=1;
		l++;
	}
//	for (int i=1;i<=t;i++) cout<<i<<' '<<di[i]<<' '<<vi[i]<<' '<<la[i]<<' '<<zh[i]<<endl;
	if (di[t]==INF)return -INF;
	for (int i=t;i!=s;i=la[i]){a[zh[i]].qu=0;a[zh[i]^1].qu=1;}
	return INF-di[t];
}
int main(){
	cin>>n;
	for (int i=1;i<=n;i++)cin>>v[i].x>>v[i].y>>v[i].z;
	cin>>m;
	for (int i=1;i<=m;i++) cin>>c[i].ch>>c[i].x>>c[i].y;
	for (int k=1;k<=n;k++){
		memset(b,0,sizeof(b));num=1;nu=0;
		s=n+n+k+k+1;t=n+n+k+k+2;
		for (int i=1;i<=k;i++) jb(s,i,0),jb(i+k,t,0);
		for (int i=1;i<=k;i++) l[i]=1,r[i]=100;
		for (int i=1;i<=m;i++){
			if (c[i].ch=='L'&&c[i].y<k)l[c[i].y+1]=max(l[c[i].y+1],c[i].x+1);
			if (c[i].ch=='R'&&c[i].y<k)r[k-c[i].y]=min(r[k-c[i].y],c[i].x-1);
		}
		for (int i=2;i<=k;i++)l[i]=max(l[i],l[i-1]);
		for (int i=k-1;i>=1;i--)r[i]=min(r[i],r[i+1]);
		for (int i=1;i<=k;i++)
			for (int j=1;j<=n;j++)
				if (v[j].x>=l[i]&&v[j].x<=r[i])jb(i,j+k+k,0);
		for (int i=1;i<=k;i++) l[i]=1,r[i]=100;
		for (int i=1;i<=m;i++){
			if (c[i].ch=='D'&&c[i].y<k)l[c[i].y+1]=max(l[c[i].y+1],c[i].x+1);
			if (c[i].ch=='U'&&c[i].y<k)r[k-c[i].y]=min(r[k-c[i].y],c[i].x-1);
		}
		for (int i=2;i<=k;i++)l[i]=max(l[i],l[i-1]);
		for (int i=k-1;i>=1;i--)r[i]=min(r[i],r[i+1]);
		for (int i=1;i<=k;i++)
			for (int j=1;j<=n;j++)
				if (v[j].y>=l[i]&&v[j].y<=r[i])jb(j+k+k+n,i+k,0);
		for (int i=1;i<=n;i++)jb(i+k+k,i+k+k+n,INF-v[i].z);
		for (int i=1;i<=k;i++)nu+=que();
		ansn=max(ansn,nu);
	}
	cout<<ansn<<endl;
	return 0;
}

Measured memory_bytes: 2304
package main

import (
	"fmt"
	"io"
)

func main() {
	var c int
	var offset int = 'a' - 'A'
	for {
		_, err := fmt.Scanf("%c", &c)
		if err == io.EOF {
			break
		}
		switch {
		case 'a' <= c && c <= 'z':
			c -= offset
		case 'A' <= c && c <= 'Z':
			c += offset
		}
		fmt.Printf("%c", c)
	}
}



Measured memory_bytes: 1196
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();    
        int N, Y;
        {int[] a = r.ii(); N = a[0]; Y = a[1];}
        for(int ten = 0; ten <= N; ten++){
            for(int five = 0; five <= N-ten; five++){
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            }
        }
        System.out.printf("%d %d %d\n", -1, -1, -1);
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
}

Measured memory_bytes: 22228
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
      	String result = "";
		int battleCount = 0;

      	while(a > 0 && c > 0){
          battleCount += 1;
          if(battleCount % 2 == 0){
            a -= d;
          }
          else{
            c -= b;
          }
        }

		result = battleCount % 2 == 0 ? "No" : "Yes";
		System.out.println(result);
    }
}

Measured memory_bytes: 35792
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    string a;
    cin>>a;
    int n=a.length();
    int count=0;
    for (int i = 0; i < n; ++i) {
        if(a[i]-'0'==i%2)
            count++;
    }
    cout<<min(n-count,count);
}

Measured memory_bytes: 512
n = int(input())
b = [int(i) for i in input().split()]
a = []
for i in range(n):
	f = 1
	for j in range(len(b)-1, -1, -1):
		if b[j] == j+1:
			b = b[:j]+b[j+1:]
			a.append(j+1)
			f=0
			break
	if f == 1:
		print(-1)
		exit()
a.reverse()
for i in a:
	print(i)

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

  vector<int64_t> a(n), b(n);
  for (auto i : irange(0L, n)) {
    cin >> a[i];
  }
  for (auto i : irange(0L, n)) {
    cin >> b[i];
  }

  int64_t ka = 0, kb = 0;
  for (auto i : irange(0L, n)) {
    if (a[i] < b[i]) {
      ka += (b[i] - a[i]) / 2;
      ka += (b[i] - a[i]) % 2;
      kb += (b[i] - a[i]) % 2;
    } else {
      kb += a[i] - b[i];
    }
  }

  cout << (ka >= kb ? "Yes" : "No") << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  double n, t, a;
  cin >> n >> t >> a;
  vector<double> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  int ans = 0;
  double temp = 1e9;
  for (int i = 0; i < n; i++) {
    double x = t - h[i] * 0.006;
    if (abs(a - x) < temp) {
      temp = abs(a - x);
      ans = i + 1;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
n,m=map(int,input().split())
a=list(map(int,input().split()))

def dividable_with_2(x):
  cnt=0
  while x%2==0:
    x//=2
    cnt+=1
  return cnt

eg=dividable_with_2(a[0])

for q in a:
  if dividable_with_2(q) != eg:
    print(0)
    exit()

def gcd(x,y):
  if y>x:
    y,x=x,y    
  while y!=0:
    x,y=y,x%y
  return x

def lcm(x,y):
  return x*y//gcd(x,y)

d=[i//2 for i in a]
L=d[0]
for i in range(n):
  L=lcm(L,d[i])

ans=(m//L+1)//2

print(ans)
  
  

Measured memory_bytes: 14244
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


int T, n, m, to[10101], f[404];
vector<int> v[404];
vector<P> G[404];
vector<vector<int>> dist(404, vector<int>(404, INF));
vector<int> route[404][404];
int now_t = 0;
int now = 1, next_t = 0;
int have[404] = {0};

void floyd(){
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			for(int k = 1; k <= n; k++){
				if(dist[j][k] > dist[j][i] + dist[i][k]){
					//route[j][k] = route[j][i]+route[i][k];
					route[j][k] = route[j][i];
					route[j][k].insert(route[j][k].end(),route[i][k].begin(),route[i][k].end());
					dist[j][k] = dist[j][i] + dist[i][k];
				}
			}
		}
	}
}

void input(){
	int a,b,c;
	cin >> a;
	for(int i = 0; i < a; i++){
		cin >> b >> c;
		v[c].push_back(now_t);
		to[now_t] = c;
	}
	cin >> a;
	for(int i = 0; i < a; i++){
		cin >> b;
	}
	now_t++;
}

void result(){
	string s;
	int a,b;
	cin >> s;
	cin >> a;
	for(int i = 0; i < a; i++){
		cin >> b;
	}
}

P choice_next(int start, int t){
	i64 ma = -1, k = -1;
	for(int i = 2; i <= n; i++){
		if(!have[i]) continue;
		if(dist[start][i] >= T-t) continue;
		int cnt = 0;
		for(int j = 0; j < route[start][i].size(); j++){
			cnt += have[route[start][i][j]];
		}
		if(ma < cnt * 10000000 / (dist[start][i]*dist[start][i])){
			ma = cnt;
			k = i;
		}
	}
	return P(ma, k);
}

int Move(int start, int next_t){
	P choice = choice_next(start, next_t);
	int ma = choice.first, k = choice.second;
	if(ma >= 1){
		int npos = route[start][k][0];
		have[npos] = 0;
		for(int i = 0; i < dist[now][npos]; i++){
			if(next_t >= T) break;
			next_t++;
			cout << npos << endl;
			result();
			if(next_t != T) input();
		}
		now = npos;
		next_t = Move(now, next_t);
		
		return next_t;
	}
	for(int i = route[1][now].size()-2; i >= -1; i = route[1][now].size()-2){
		int npos;
		if(i == -1) npos = 1;
		else npos = route[1][now][i];
		for(int j = 0; j < dist[now][npos]; j++){
			if(next_t >= T) break;
			next_t++;
			cout << npos << endl;
			result();
			if(next_t != T) input();
		}
		now = npos;
	}
	return next_t;
}

int main(){
	cin >> n >> m;
	for(int i = 0; i <= n; i++){
		dist[i][i] = 0;
	}
	for(int i = 0; i < m; i++){
		int a,b,c;
		cin >> a >> b >> c;
		G[a].push_back(P(b,c));
		G[b].push_back(P(a,c));
		dist[a][b] = c;
		dist[b][a] = c;
		route[a][b].push_back(b);
		route[b][a].push_back(a);
	}
	for(int i = 1; i <= n; i++){
		cin >> f[i];
	}
	cin >> T;
	
	floyd();
	
	input();
	
	
	for(int t = 0; t < T; t++){
		if(now == 1) have[to[t]]++;
		if(next_t > t) continue;
		next_t = Move(1, t);
		if(next_t == t){
			cout << -1 << endl;
			result();
			if(t != T-1) input();
		}
	}
	
	return 0;
}

Measured memory_bytes: 30672
#include <bits/stdc++.h>
using namespace std;
map<int,bool> mp;
int main(){
	int x,n;
	cin>>x>>n;
	for(int i=1;i<=n;++i){
		int a;
		cin>>a;
		mp[a]=1;
	}
	int ans=0;
	for(int i=0;;++i){
		int a=x-i,b=x+i;
		if(mp[a]==0){
			ans=a;
			break;
		}
		if(mp[b]==0){
			ans=b;
			break;
		}
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 3664
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define print(x) cout<<x<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

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

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}
void judgement(int a){
  if(a){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  if(a){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}

int main(){
  ll i,A,B,C,ans;
  cin>>A>>B>>C>>ans;
  if(abs(A-C)<=ans||(abs(A-B)<=ans&&abs(B-C)<=ans))printyes;
  else printno;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int W[] = new int[10];
		int K[] = new int[10];
		for (int i = 0; i < 10; i++)
			W[i] = sc.nextInt();
		for (int i = 0; i < 10; i++)
			K[i] = sc.nextInt();
		Arrays.sort(W);
		Arrays.sort(K);
		int totalW = 0, totalK = 0;
		for (int i = 7; i < 10; i++)
			totalW += W[i];
		for (int i = 7; i < 10; i++)
			totalK += K[i];
		System.out.printf("%d %d\n", totalW, totalK);
	}
}

Measured memory_bytes: 12000
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
  ll n, a;
  cin>>n>>a;
  if(n==1){
    cout<<1<<endl;
    return 0;
  }
  ll ans=n;
  ll m=(ll)(log((double)n)/log(2.0));
  for(ll k=2; k<=m+1; k++){
    ll ans1=(k-1)*a;
    ll t=(ll)pow((double)n, 1.0/(double)k);
    ll x1=0, x2=k;
    while(x1!=x2){
      ll x=(x1+x2+1)/2;
      if(pow((double)t, (double)x)*pow((double)(t+1), (double)(k-x))>=(double)n){
        x1=x;
      }else{
        x2=x-1;
      }
    }
    ans1+=(t*x1+(t+1)*(k-x1));
    ans=min(ans, ans1);
  }
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)

L = []
for i, a in enumerate(A):
  for j, b in enumerate(B):
    if i * j > K:
      continue
    else:
      L.append(a + b)

L.sort(reverse = True)
ans = []
for i, l in enumerate(L):
  if i == K:
    break
  else:
    for c in C:
      ans.append(l + c)
ans.sort(reverse = True)
for i, a in enumerate(ans):
  if i == K:
    break
  else:
    print(a)


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

int main(){
    string s;
    cin >> s;
    map<string, int> mp;
    mp["SUN"] = 0;
    mp["SAT"] = 6;
    mp["FRI"] = 5;
    mp["THU"] = 4;
    mp["WED"] = 3;
    mp["TUE"] = 2;
    mp["MON"] = 1;

    int inputNum = mp[s];
    cout << 7-inputNum << endl;
    return 0;
}

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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define PI (acos(-1.0))
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    string a,b;
    cin >> a;
    cin >> b;

    int asize = a.size();
    int bsize = b.size();

    if(asize > bsize){
        cout << "GREATER" << endl;
    }else if(asize < bsize){
        cout << "LESS" << endl;
    }else{

        bool finish = false;

        rep(i, asize){
            if(a[i] > b[i]){
                finish = true;
                cout << "GREATER" << endl;
                break;
            }else if(a[i] < b[i]){
                finish = true;
                cout << "LESS" << endl;
                break;
            }
        }

        if(!finish){
            cout << "EQUAL" << endl;
        }

    }
    return 0;
}


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

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int[] c = new int[m];
        for(int i = 0; i < m; i++){
            c[i] = Integer.parseInt(sc.next());
        }
        
        int[] t = new int[n+1];
        Arrays.fill(t, Integer.MAX_VALUE /2);
        t[0] = 0;
        
        for(int i = 0; i < m; i++){
            for(int j = c[i]; j <= n; j++){
                t[j] = Math.min(t[j], t[j - c[i]] +1);
            }
        }
        
        System.out.println(t[n]);
    }
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long 
#define F(n) for(int i = 0; i < n; ++i)
#define Debug cout<<endl<<"I AM IRONMAN"<<endl

int main ()
{
    fastio;
    vector<ll> v;
    ll sum=0;
    int n;
    cin >> n;
    for(int i=0;i<n*3;i++)
    {
        int t;
        cin >> t;
        v.push_back(t);
    }
    sort(v.begin(),v.end(),greater<int>());
    int j=1;
    for(auto i: v)
    {
        if(j%2==0)
        {
            sum+=i;
        }
        if(j==(n*2))
        {
            break;
        }
        j++;
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 7332
#include <bits/stdc++.h>
using namespace std;
string s,t;
int ans;
int main()
{
	cin>>s>>t;
	int n=s.size(),m=t.size();
	int cnt=0; 
	for(int i=0;i<m;i++)
		if (s[i]!=t[i])
			cnt++;
	ans=cnt;
	for(int l=0;l+m<n;l++)
	{
		for(int j=0;j<m;j++)
			cnt=cnt-(s[l+j]!=t[j])+(s[l+j+1]!=t[j]);
		ans=min(ans,cnt);
	} 
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
	string s;
	cin >> s;
	int x[4];
	for (int i = 0; i < 4; ++i) {
		x[i] = s[i] - '0';
	}

	for (int mask = 0; mask < (1 << 3); ++mask) {
		int ans = x[0];
		for (int i = 0; i < 3; ++i) {
			if (mask & (1 << i)) {
				ans += x[i + 1];
			}
			else {
				ans -= x[i + 1];
			}
		}
		if (ans == 7) {
			cout << x[0];
			for (int i = 0; i < 3; ++i) {
				if (mask & (1 << i)) {
					cout << '+';
				}
				else {
					cout << '-';
				}
				cout << x[i + 1];
			}
			cout << "=" << ans << endl;
			return 0;
		}
	}
}


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORD(i,b,a) for (int i = (int)(b) - 1; i >= a; --i)
#define REP(i,N) FOR(i,0,N)
#define st first
#define nd second
#define pb push_back

typedef pair<int, int> PII;
typedef long long LL;

int A[111111];

int main() {
  int N;
  scanf("%d", &N);
  REP(i,N) {
    scanf("%d", &A[i]);
  }
  sort(A, A+N);
  if (A[0] + 1 < A[N-1]) {
    printf("No\n");
    return 0;
  }
  int K = 0;
  while (K < N && A[0] == A[K]) ++K;
  if (K == N) {
    bool ok = (A[0] == N-1 || 2 * A[0] <= N);
    printf(ok ? "Yes\n" : "No\n");
    return 0;
  }

  int single = K;
  int colors = A[0] + 1;
  bool ok = (colors >= single + 1) && (colors <= single + (N - single)/2);
  printf(ok ? "Yes\n" : "No\n");
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC170
{
    class Program
    {
        static void Main(string[] args)
        {
            a();
        }

        public static void a()
        {
            int[] x = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int a = 0;
            for(int i = 0; i < 5; i++)
            {
                if(x[i] == 0)
                {
                    a = i + 1;
                }
            }
            Console.WriteLine(a);
        }
    }
}


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

int main() {
  long n,ans=0;
  cin >> n;
  for(long i=1;i<=n;i++) {
    for(long j=1;j<=n;j++) {
      long a=gcd(i,j);
      for(long k=1;k<=n;k++) {
        ans+=gcd(a,k);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
import java.lang.*;
import java.io.*;
import java.util.*;


public class Main {
	
	public static void main(String[] args) throws java.lang.Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(in, out);
		out.close();
	}
}


class TaskA {
	
	public void solve(InputReader in, PrintWriter out) {
		final int mod = (int)(1e9+7);
		int n = in.nextInt();
		int m = in.nextInt();
		int mx = Math.max(n, m);
		long fact = 1;
		long fn = 1, fm = 1;
		
		for (int i=1; i<=mx; ++i) {
			fact = fact * i % mod;
			if (i == n) fn = fact;
			if (i == m) fm = fact;
		}
		
		// out.println(fn + " " + fm);
		long ans = 0;
		
		if (n == m) {
			ans = (2*fn%mod)*fm%mod;
		} else if (n==m+1 || n+1==m) {
			ans = fn*fm%mod;
		}
		
		out.println(ans);
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;
	
	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());
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}



Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
int n, a, b, c, l[9], minv = 1000000000;
#define NIL -1

void calc(vector<int> v){
  int mp = 0;
  int sum[4], cnt[4];
  sum[0] = sum[1] = sum[2] =  0;
  cnt[0] = cnt[1] = cnt[2] =  0;

  for ( int i = 0; i < n; i++){
    if ( v[i] == 3)continue;
    cnt[v[i]] += 1;
    if ( cnt[v[i]] > 1){ mp += 10; }
    sum[v[i]] += l[i];
  }

  if ( cnt[0] == 0 || cnt[1] == 0 || cnt[2] == 0 )return;

  mp += abs(sum[0] - a) + abs(sum[1] - b) + abs(sum[2] - c);
  minv = min(minv, mp);
}

void dfs(int depth, vector<int> v){
  if ( depth == n) {
    calc(v);
    return;
  }

  for ( int i = 0; i < 4; i++){
    v[depth] = i;
    dfs(depth+1, v);
  }
}

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

  vector<int> v(n, 0);
  dfs(0, v);

  cout << minv << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int n, w, h;

int limit( int p, int llimit, int hlimit ) {
	if( p < llimit ) return llimit;
	if( p > hlimit ) return hlimit;
	return p;
}

bool isCovered( vector<int> *x,  vector<int> *y ) {
	bool b = true;
	for( int i = 0; i < w; i++ ) {
		b &= ( x->at( i ) > 0 );
	}
	for( int j = 0; j < h; j++ ) {
		if( b == false && y->at( j ) <= 0 ) return false;
	}
	return true;
}

int main(void){

	string s[] = {"No","Yes"};
	cin >> n >> w >> h;
	vector< int > xlist( w + 1, 0 );
	vector< int > ylist( h + 1, 0 );

	for( int i = 0; i < n; i++ ) {
		int x_i, y_i, w_i;
		cin >> x_i >> y_i >> w_i;
		xlist[ limit( x_i - w_i, 0, w ) ] ++;
		xlist[ limit( x_i + w_i , 0, w ) ] --;
		ylist[ limit( y_i - w_i, 0, h ) ] ++;
		ylist[ limit( y_i + w_i , 0, h ) ] --;
	}

	for(int i = 1; i <= w ; i++ )
		xlist[i] += xlist[i-1];
	for(int i = 1; i <= h ; i++ )
		ylist[i] += ylist[i-1];

	cout << s[isCovered( &xlist, &ylist )] << endl;

    return 0;
}

Measured memory_bytes: 1800
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  string res = "";
  rep(i,tx-sx){
    res += 'R';
  }
  rep(i,ty-sy){
    res += 'U';
  }
  rep(i,tx-sx){
    res += 'L';
  }
  rep(i,ty-sy){
    res += 'D';
  }  
  res += 'D';
  rep(i,tx-sx+1){
    res += 'R';
  }
  rep(i,ty-sy+1){
    res += 'U';
  }
  res += 'L';
  res += 'U';
  rep(i,tx-sx+1){
    res += 'L';
  }
  rep(i,ty-sy+1){
    res += 'D';
  }  
  res += 'R';
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 256
/*
sleep..sleep....sleep
*/
#include <bits/stdc++.h>
using namespace std;
 
typedef pair<int,int > pp;
typedef long long ll;
 
#define sz(x) (int)x.size() 
int const N=3e5+10,oo=1e9;
ll const OO=2e18;
double const eps=1e-8,PI=acos(-1);
int mod=oo+7;

int n,m,dsu[N],sz[N];
ll an[N];
vector<pp > v;
int find(int u){
    if(u==dsu[u])return u;
    return dsu[u]=find(dsu[u]);
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        v.push_back({a,b});
    }
    for(int i=1;i<=n;i++)dsu[i]=i,sz[i]=1;
    an[m-1]=n*1LL*(n-1)/2;
    for(int i=m-2;i>-1;i--){
        int a=v[i+1].first,b=v[i+1].second;
        an[i]=an[i+1];
        if(find(a)==find(b))continue;
        
        an[i]-=sz[find(a)]*1LL*sz[find(b)];
        sz[find(b)]+=sz[find(a)];
        dsu[find(a)]=find(b);
    }
    for(int i=0;i<m;i++)cout<<an[i]<<'\n';
    return 0;
}



Measured memory_bytes: 5108
//#pragma region ALL(include define etc)
#include <iostream>   // swap(a, b)
#include <string>
#include <cmath>      // abs(絶対値) sin cos tan(角度 / 180.0 * 3.141592)
#include <vector>     // vec.push_back(a) vec.pop_back()
#include <algorithm>  // max(a, b) min(a, b) reverse() sort()
#include <functional> // sort(a, a + N, greater<型>());
#include <limits>
#include <math.h>
#include <iomanip>
#define int long long
//#define int unsigned long long
#define ll long long
#define double long double
using namespace std;
//#pragma endregion

signed main()
{
	// 10^18 = 1000000000000000000

	//int h1, h2, m1, m2, k;
	//int box, box1,box2;

	//int N;
	int n;
	//char n;
	//int a, b, c;
	//int m;
	int h, w;
	int k;
	int d;
	string s;
	//string t;
	//int m1, m2;
	//int a, b, c, k;
	//int x, y;
	int na = 7;

	//string s[111111];
	//string s[100000];
	//string c[7];
	//int a[100000];
	//int b[200000];
	//int a[2000000] = { 0 };
	//int b[2000000] = { 0 };
	//int a[20000] = { 0 };
	//int b[20000] = { 0 };
	//vector<int>a(2000000);
	//vector<int>b(2000000);

	//int aaa = 0;
	//int bbb = 0;

	int box[20000] = { 0 };
	//int box = 0;
	//int box[7][7] = { 0 };
	//int box2;
	//int p[1111];
	int x[2000], y[2000];/////////////////////////////////////////

	//long double aaa;

	int count = 0;
	//int k, d;
	//int a = 0;
	int all = 0;
	//double all;
	//double a, b;
	//double h, m;
	//int a[30000] = { 0 };
	//double c, d, e;

	//double mbox, hbox;
	//double box, box2;

	bool flag = true;
	//bool flag = false;

	//string str;

	//cin >> h1 >> m1 >> h2 >> m2 >> k;
	//cin >> n;
	//cin >> a >> b >> c;
	cin >> s;
	//cin >> h >> w >> k;
	//cin >> x;
	/*for (int i = 0; i < n; i++)
	{
		cin >> x[i] >> y[i];
	}*/

	/*if (k % 2 == 1)
	{
		for (int i=0;i<9000000000000000000;i++)
		{
			if (na % k == 0)
			{
				all++;
				break;
			}
			all++;
			na = (na * 10) + 7;
		}
		cout << all << "\n";
	}
	else
	{
		cout << "-1\n";
	}*/

	//for (int i = 0; i < (n - k + 1); i++)
	//{
	//	for (int j = 0; j < k; j++)
	//	{
	//		box[i] = box[i] * a[i + j];
	//	}
	//	//cout << box[i] << "\n";
	//	if (i != 0 && box[i] <= box[i - 1])
	//	{
	//		cout << "No\n";
	//	}
	//	else if (i != 0 && box[i] > box[i - 1])
	//	{
	//		cout << "Yes\n";
	//	}
	//}
	for (int i = 0; i < 3; i++)
	{
		if (s[0] == 'R' && s[1] == 'S' && s[2] == 'R')
		{
			all = 1;
			break;
		}
		if (s[i] == 'R')
			all++;
	}

	//n = s.length();

	//sort(p, p + n);
	//n = n - 'Z';

	//for (int i = 0; i < 1000; i++)
	//{
	//	if (n < 1000)
	//	{
	//		all = 1000 - n;
	//		break;
	//	}
	//	n -= 1000;
	//	if (n == 0)
	//	{
	//		all = 0;
	//		break;
	//	}
	//}

	//box = n % 26;

	//for (int i = 0; i < k; i++)
	//{
	//	all += p[i];
	//}

	//all = n + (n * n) + (n * n * n);

	/*if (n > 0)
	{
		cout << "a\n";
	}
	else
	{
		cout << "A\n";
	}*/
	//n = t.length();

	/*cout << "AC x " << ac << "\n";
	cout << "WA x " << wa << "\n";
	cout << "TLE x " << tle << "\n";
	cout << "RE x " << re << "\n";*/

	cout << all << "\n";
	//cout << box << "\n";
	//cout << a << b << c << "\n";

	/*if (flag == true)
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}*/

	//cout << fixed << setprecision(111) << all;
	//return 0;
}


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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);

    ll X, Y, Z;
    cin >> X >> Y >> Z;

    cout << Z << " " << X << " " << Y << endl;
}


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

int main(){
 	int n,sum=0,x=1;
  	cin>>n;
  	for(int i=0;i<8;i++){
      	sum+=n/x%10;
      	if(n/x==0)
          break;
      	x*=10;
    }
  	if(n%sum==0)
      cout<<"Yes"<<endl;
  	else
      cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define vs (v.begin(),v.end())
#define MOD 1000000007
/*Recursion
ll LCS(string a,string b,ll i,ll j)
{
  if(i>=a.size()||j>=b.size())
    return 0;
  else if(a[i]==b[j])
    return 1+LCS(a,b,i+1,j+1);
  else
    return max(LCS(a,b,i+1,j),LCS(a,b,i,j+1));
}*/

int main()
{  
  
    string a,b;
    cin>>a>>b;
    ll dp[(ll)a.size()+1][(ll)b.size()+1];
    for(ll i=0;i<=(ll)a.size();i++)
    {
      for(ll j=0;j<=(ll)b.size();j++)
           dp[i][j]=0;
    }
   


    for(ll i=1;i<=(ll)a.size();i++)
      for(ll j=1;j<=(ll)b.size();j++)
      {
        if(a[i-1]==b[j-1])
          dp[i][j]=1+dp[i-1][j-1];
        else
          dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
      }
      
    ll src=(ll)b.size();
    vector<char>v;
    for(ll i=(ll)a.size();i>=1;i--)
    {
        
        
        if(dp[i][src]==max(dp[i-1][src],dp[i][src-1]))
        {
          if(dp[i][src]==dp[i-1][src])
          {
            continue;
          }
          else
          {
             i++;
             src=src-1;
          }

        }
        else if(dp[i][src]==dp[i-1][src-1]+1)
        {
          v.pb(a[i-1]);
          src=src-1;
        }
    }
    
    for(ll i=(ll)v.size()-1;i>=0;i--)
    {
      cout<<v[i];
    }
    cout<<endl;
         
}



  
   


  
              
              

  

  
  
          
      
    







  
 

Measured memory_bytes: 70656
#include <chrono>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pldll;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<ld> vld;
#define newl '\n'
const ll M = 1e9 + 7;
const ll N = 1e2;
const ll INF = LONG_MAX;
#define REP(i, a, b) for (int i = a; i < b; i++)
#define LOG_TWO_N 10
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);

ll gcd(ll a,ll b)
{
    if(a==0)
    {
        return b;
    }
    else
    {
        return gcd(b%a,a);   
    }
}
ll lcm(ll a,ll b)
{
    return a*b/gcd(a,b);
}
int f(char c)
{
    return (int)c-96;
}

template <class T>
void print(vector<T> &vec, int inc = 0, bool lb = true)
{
    for (auto v : vec)
        cout << v + inc << " ";
    if (lb)
        cout << newl;
}

void solve(ll t)
{
    int n,x,T; cin >> n >> x >> T;
    int p = n/x;
    if(n%x) p++;
    cout << p*T << newl;
}

int main()
{
    fast;

    ll t = 1;
    //cin >> t;
    while (t--)
    {
        solve(t);
    }

    return 0;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  ll T1, T2, A1, A2, B1, B2;
  cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;

  // 早い方をAとする
  if(B1 >= A1){
    swap(A1, B1);
    swap(A2, B2);
  }

  if((A1 * T1 + A2 * T2) == (B1 * T1 + B2 * T2)){
    cout << "infinity" << endl;
  }else{
    ll ans = 0;

    if((A1 * T1 + A2 * T2) > (B1 * T1 + B2 * T2)){
      ans = 0;
    }else{
      ll Lsub1 = (A1 - B1) * T1;
      ll Lsub2 = (B1 * T1 + B2 * T2) - (A1 * T1 + A2 * T2);
      ll cnt = Lsub1 / Lsub2;
      if(Lsub1 % Lsub2 == 0){
        ans += 2*cnt;
      }else{
        ans += 2*cnt + 1;
      }

    }

    cout << ans << endl;

  }
  return 0;
}


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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES\n")
#define Yes puts("Yes\n")
#define NO  puts("NO\n")
#define No  puts("No\n")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }




signed main() {

	int a, b, c;
	cin >> a >> b >> c;
	if (b - a == c - b) YES;
	else NO;


	return 0;
}

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

int main(void)
{
    int n;
    long long a[100]={0}, b[100]={0};
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        a[i] = a[i-1]+a[i];
    }
    for (int i = 1; i <= n; i++)
    {
        cin >> b[i];
        b[i] = b[i-1]+b[i];
    }
    
    long long ans = 0;
    for (int i = 1; i <= n; i++)
    {
        ans = max(ans, a[i] + (b[n] - b[i - 1]));
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

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

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

ll A[100005];
ll B[100005];
int main()
{
	int N;
	cin >> N;
	REP(i, N)
	{
		cin >> A[i];
		B[i] = A[i];
	}
	sort(A, A + N);
	sort(B, B + N, [](ll a, ll b) {return a > b; });

	int ai = 1, bi = 0;
	ll l = A[0], r = A[0];
	ll ans = 0;
	while (ai + bi < N)
	{
		ll a = A[ai];
		ll b = B[bi];
		ll ad = std::max(abs(l - a), abs(r - a));
		ll bd = std::max(abs(l - b), abs(r - b));
		if (ad > bd)
		{
			if (abs(l - a) < abs(r - a))
			{
				r = a;
			}
			else
			{
				l = a;
			}
			ai++;
		}
		else
		{
			if (abs(l - b) < abs(r - b))
			{
				r = b;
			}
			else
			{
				l = b;
			}
			bi++;
		}
		ans += std::max(ad, bd);

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


Measured memory_bytes: 1792
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

D = i()
c = l()
C = sorted(c)
C.reverse()
rank = [0]*26
ans = [0]*D
for i in range(D):
    s = l()
    ans[i] = s.index(max(s))+1
for i in range(26):
    rank[i] = C.index(c[i])+1
for i in range(26):
    d = D//rank[i]
    if d == 1:
        d = 3
    elif d == 2:
        d = 4
    elif d == 3:
        d = 5
    elif d == 4:
        d = 5
    for j in range(i,D,d):
        ans[j] = i+1
for i in ans:
    print(i)

Measured memory_bytes: 72976
import java.lang.reflect.Array;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int i;
        ArrayList <Integer> num = new ArrayList<Integer>();
        num.add(1);
        num.add(2);
        num.add(3);

        for (i=0;i<=num.size()-1;i++) {
            int x = sc.nextInt();
            num.removeIf(n -> (n == x));
            int y = sc.nextInt();
            num.removeIf(n -> (n == y));
            System.out.println(num.get(0));
        }
    }
}


Measured memory_bytes: 26836
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int W = sc.nextInt();
        int [] u = new int[N];
        int [] v = new int[N];
        
        for(int i=0;i<N;i++){
            u[i] = sc.nextInt();
            v[i] = sc.nextInt();
          }
          sc.close();
         long[] dp = new long[W+1];
         for(int i=0;i<N;i++){
            for (int j = W; j >= u[i]; j--) {
			  dp[j] = Math.max(dp[j], dp[j - u[i]] + v[i]);
			}
        }
        System.out.println(dp[W]);
    }
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;
const int MOD = 1000000007; // 計算してからmodで割る ans = (ans * a) % mod
#define int long long
template <typename T = long long > T in () { T x; cin >> x; return(x);}
// int a = in() のように使うlong long以外の型の時はstirng s = in<string>()のように型を指定する

// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

using mint = Fp<MOD>;

signed main(void){
    int n = in();
    vector<int> num(n + 1);
    for(int i = 2; i <= n; i++){
        int tmp = i;
        for(int j = 2; j <= i; j++){
            int cnt = 0;
            while(tmp % j == 0){
                cnt++;
                tmp /= j;
            }
            num[j] += cnt;
        }
    }
    mint ans = 1;
    REP(i, num.size()) ans *= num[i] + 1;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
 
int main(void){
  double x1,y1,x2,y2;
 
  scanf("%lf",&x1);
  scanf("%lf",&y1);
  scanf("%lf",&x2);
  scanf("%lf",&y2);
 
  printf("%f\n",sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
   
  return 0;
}

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

using namespace std;

typedef long long ll;

#define MOD (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()

ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}



int main()
{



bool dp[80][80][30000];

memset(dp,0,sizeof(dp));


ll h,w;
cin>>h>>w;

vector<vector<ll>>a(h,vl(w));

vector<vector<ll>>b(h,vl(w));


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

for(int i=0;i<h;i++)
{
  for(int j=0;j<w;j++)
    {
      cin>>b[i][j];
    }
}

dp[0][0][abs(a[0][0]-b[0][0])]=true;

for(int i=0;i<h;i++)
{
  for(int j=0;j<w;j++)
  {
    for(int k=0;k<30000;k++)
    {
      if(dp[i][j][k]==true)
      {
        if(i<h-1)
        {
        ll temp=abs(a[i+1][j]-b[i+1][j]);
          dp[i+1][j][abs(k+temp)]=true;
          dp[i+1][j][abs(k-temp)]=true;
        }

        if(j<w-1)
        {
        ll temp=abs(a[i][j+1]-b[i][j+1]);
          dp[i][j+1][abs(k+temp)]=true;
          dp[i][j+1][abs(k-temp)]=true;
        }
      }
    }
  }
}


for(int k=0;k<30000;k++)
{
  if(dp[h-1][w-1][k]==true)
  {
    cout<<k<<"\n";
    return 0;
  }
}



return 0;

}


Measured memory_bytes: 187904
// B - Papers, Please

/*
You are an immigration officer in the Kingdom of AtCoder. 
The document carried by an immigrant has some number of 
integers written on it, and you need to check whether they meet
certain criteria.

According to the regulation, the immigrant should be 
allowed entry to the kingdom if and only if the following
 condition is satisfied:

    All even numbers written on the document are divisible 
    by 3 or 5


If the immigrant should be allowed entry according 
to the regulation, output APPROVED; otherwise, print DENIED.
*/

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

string sol(vector<int> &a,int n){

	for(auto x:a){
		if(x%2 == 0){
			if(x%3 != 0 and x%5 != 0){
				return "DENIED";
			}
		}
	}
	return "APPROVED";
}

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

	cout<<sol(a,n);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long LL;
int main(int argc, char* argv[])
{
	int N,i;
	cin>>N;
	vector<LL> A(N);
	int Min=10e9;
	for (i=0;i<N;i++){
		cin>>A[i];
		if (Min>A[i]){
			Min=A[i];
		}
	}
	while(true){
		sort(A.begin(),A.end());
		for (i=0;i<N;i++){
			if (A[0]==0){
				A.erase(A.begin());
			}else{
				break;
			}
		}
		for (i=1;i<A.size();i++){
			if (A[i]%A[0]==0){
				A[i]=0;
			}else{
				A[i]%=A[0];
			}
		}
		if (A.size()==1){
			cout<<A[0]<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 1024