akhauriyash/Code-Regression huggingface dataset:
/** @Date    : 2017-07-09 21:15:04
  * @FileName: D 树上删边 NIM 博弈.cpp
  * @Platform: Windows
  * @Author  : Lweleth (SoungEarlf@gmail.com)
  * @Link    : https://github.com/
  * @Version : $Id$
  */
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack>
#include <queue>
//#include <bits/stdc++.h>
#define LL long long
#define PII pair<int ,int>
#define MP(x, y) make_pair((x),(y))
#define fi first
#define se second
#define PB(x) push_back((x))
#define MMG(x) memset((x), -1,sizeof(x))
#define MMF(x) memset((x),0,sizeof(x))
#define MMI(x) memset((x), INF, sizeof(x))
using namespace std;

const int INF = 0x3f3f3f3f;
const int N = 1e5+20;
const double eps = 1e-8;

vector<int>edg[N]; 
int get_sg(int x,int pre)
{ 
    int ret=0; 
    for(auto i:edg[x])
    { 
        if(i!=pre) 
            ret^=(1 + get_sg(i, x)); 
    } 
    return ret; 
} 
int main()
{ 
 	int n;
    while(~scanf("%d", &n)) 
    {
        for(int i = 1; i <= n; i++) 
            edg[i].clear(); 
        for(int i=1; i<n; i++){ 
            int x,y; 
            scanf("%d%d",&x, &y); 
            edg[x].PB(y); 
            edg[y].PB(x); 
        } 
        if(get_sg(1,-1)) 
            puts("Alice"); 
        else 
            puts("Bob"); 
    } 
    return 0; 
} 


Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ll a,b,c;
    cin >> a >> b >> c;
    if (c-a-b >= 0){
        if (4*a*b < (c-a-b)*(c-a-b)) {

            cout << "Yes" << endl;
        }
        else cout << "No" << endl;
    }
    else {
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // TODO 自動生成されメソッド・スタブ
        Scanner scan = new Scanner(System.in);


        while(true){
            int a = scan.nextInt();
            String op = scan.next();
            int b = scan.nextInt();
            int answer=0;

            if(op.equals("?")){
                break;
            }
            switch(op){
            case "+":
                answer= a+b;
                break;
            case "-":
                answer= a-b;
                break;
            case "*":
                answer = a*b;
                break;
            case "/":
                answer = a/b;
                break;
            }
            System.out.printf("%d\n",answer);
        }

    }

}



Measured memory_bytes: 26352
import math
X = int(input())


def isprime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    i = 3
    while i < math.sqrt(n)+1:
        if n % i == 0:
            return False
        i += 2

    return True


def calc(x):
    while not isprime(x):
        x += 1
    return x


print(calc(X))


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>
#include <map>

using namespace std;
typedef long long int ll;

int main(){

    string S;
    cin >> S;
    
    if(S == "Sunny"){
        cout << "Cloudy" << endl;
    }else if(S == "Cloudy"){
        cout << "Rainy" << endl;
    }else if(S == "Rainy"){
        cout << "Sunny" << endl;
    }

    

} 

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;
const int M = 2e3 + 10;
int dp[M << 1][M << 1];
int target[M << 1][M << 1];
int F[9000];

int64 power_mod(int64 a, int n) {
  int64 ret = 1;
  for (; n; n >>= 1) {
    if (n & 1) ret = ret * a % MOD;
    a = a * a % MOD;
  }
  return ret;
}

int64 inv_mod(int64 a) {
  return power_mod(a, MOD - 2);
}

int comb(int n, int m) {
  return (int64)F[n] * inv_mod(F[m]) % MOD * inv_mod(F[n - m]) % MOD;
}

int main() {
  F[0] = 1;
  for (int i = 1; i < 9000; ++i) {
    F[i] = (int64)F[i - 1] * i % MOD;
  }
  int n, ret = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    dp[M - x][M - y] += 1;
    target[M + x][M + y] += 1;
    // trace(comb((x + y) << 1, x << 1));
    ret = (ret + MOD - comb((x + y) << 1, x << 1)) % MOD;
  }
  // trace(ret);
  for (int i = 0; i < (M << 1); ++i) {
    for (int j = 0; j < (M << 1); ++j) {
      if (i - 1 >= 0) {
        dp[i][j] = (dp[i][j] + dp[i - 1][j]) % MOD;
      }
      if (j - 1 >= 0) {
        dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
      }
      if (target[i][j]) {
        ret = (ret + (int64)target[i][j] * dp[i][j]) % MOD;
      }
    }
  }
  printf("%lld\n", ret * inv_mod(2) % MOD);
  return 0;
}


Measured memory_bytes: 95872
#include<iostream>
using namespace std;
int a[100050];
int b[100050];
int main(){
int n,k;
cin>>n>>k;
for(int i=1;i<=k;i++){
    cin>>b[i];
}
int flag=0;
for(int i=2;i<=k;i++){
    if(b[i-1]+1==b[i]){flag=1;}
}
if(flag==1){cout<<'0'<<endl;}
else {
    int q=1;
    if(b[q]==1){a[1]=0;a[2]=1;q++;}
    else if(b[q]==2){a[1]=1;a[2]=0;q++;}
    else {
       a[1]=1;
       a[2]=2;
    }
    for(int i=3;i<=n;i++){
        if(b[q]==i){a[i]=0;q++;}
        else {
            a[i]=a[i-1]+a[i-2];
            a[i]=a[i]%1000000007;
        }
    }
  //  for(int i=1;i<=n;i++){
  //      cout<<a[i]<<endl;
  //  }
    cout<<a[n]<<endl;
}
return 0;
}

Measured memory_bytes: 896
using System;

namespace A
{
    class Program
    {
        static int f(int n)
        {
            if (n == 2)
                return 1;
            else
                return n / 2 + f(n - 1);
        }

        static void Main()
        {
            int k = int.Parse(Console.ReadLine());
            Console.WriteLine(f(k));
        }
    }
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll A,B,X;

void solve() {
	int i,j,k,l,r,x,y; string s;
	cin>>A>>B>>X;
	if(B==0) cout<<1<<endl;
	else if(A==0) cout<<(B/X)+1<<endl;
	else cout<<(B/X)-(A-1)/X<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 256
l,r=map(int,input().split())
if l//2019 < r//2019:
    print(0)
else:
    l%=2019
    r%=2019
    ans = 2019
    for i in range(l,r):
        for j in range(i+1,r+1):
            ans = min(ans,(i*j)%2019)
    print(ans)

Measured memory_bytes: 3060
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
// }}}

string K;
int D;
ll dp[100001][2][100];

void init()
{
}

void solve()
{
    int nDigits = K.size();
    dp[0][0][0] = 1;
    REP(i, nDigits){
        int d = K[i] - '0';
        REP(j, 2){
            REP(k, D){
                int x = (j == 1 ? 10 : d+1);
                FOR(l, (i == 0 ? 0 : 0), x){
                    dp[i+1][(j == 1 || l < d ? 1 : 0)][(k+l)%D] += dp[i][j][k];
                    dp[i+1][(j == 1 || l < d ? 1 : 0)][(k+l)%D] %= MOD;
                }
            }
        }
    }
    ll ans = (dp[nDigits][0][0] + dp[nDigits][1][0]) % MOD;
    ans--;
    if(ans < 0) ans += MOD;
    cout << ans << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> K >> D;
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 16640
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int max = 0;
		Map<String, Integer> voteMap = new TreeMap<String, Integer>();

		for (int i = 0; i < N; i++) {
			String item = sc.next();

			if (voteMap.containsKey(item)) {
				voteMap.put(item, voteMap.get(item) + 1);
				if (max < voteMap.get(item)) {
					max = voteMap.get(item);
				}
			}else {
				voteMap.put(item, 0);
			}
		}

		for (String string : voteMap.keySet()) {
			if (voteMap.get(string) == max) {
				System.out.println(string);
			}
		}
	}
}

Measured memory_bytes: 80944
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <tuple>
#include <vector>
using namespace std;

#define MAX 100005

#define rep(i, n) for (int i = 0; i < int(n); i++)

// 素集合データ構造
struct UnionFind {
    // par[i]：データiが属する木の親の番号。i ==
    // par[i]のとき、データiは木の根ノードである
    vector< int > par;
    // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
    vector< int > sizes;

    UnionFind(int n) : par(n), sizes(n, 1) {
        // 最初は全てのデータiがグループiに存在するものとして初期化
        rep(i, n) par[i] = i;
    }

    // データxが属する木の根を得る
    int find(int x) {
        if (x == par[x]) return x;
        return par[x] =
                   find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
    }

    // 2つのデータx, yが属する木をマージする
    void unite(int x, int y) {
        // データの根ノードを得る
        x = find(x);
        y = find(y);

        // 既に同じ木に属しているならマージしない
        if (x == y) return;

        // xの木がyの木より大きくなるようにする
        if (sizes[x] < sizes[y]) swap(x, y);

        // xがyの親になるように連結する
        par[y] = x;
        sizes[x] += sizes[y];
        // sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい
    }

    // 2つのデータx, yが属する木が同じならtrueを返す
    bool same(int x, int y) { return find(x) == find(y); }

    // データxが含まれる木の大きさを返す
    int size(int x) { return sizes[find(x)]; }
};

bool used_node[MAX];

int main() {
    int N, M;

    cin >> N >> M;
    // 連結成分の個数：N - M

    UnionFind uf(N);
    vector< pair< int, int > > cost(N);
    vector< vector< int > > group_cost(N);
    vector< int > root_set;

    for (int i = 0; i < N; i++) {
        cin >> cost[i].first;
        cost[i].second = i;
        used_node[i] = false;
    }

    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        uf.unite(x, y);
    }

    if (M == N - 1) {
        cout << 0 << endl;
        return 0;
    }

    if (N < 2 * (N - M - 1)) {
        cout << "Impossible" << endl;
        return 0;
    }

    long long int ans = 0;
    int select_num = 2 * (N - M - 1);

    sort(cost.begin(), cost.end());
    for (auto x : cost) {
        if (group_cost[uf.find(x.second)].empty()) {
            ans += x.first;
            used_node[x.second] = true;
            select_num--;
        }
        group_cost[uf.find(x.second)].push_back(x.first);
    }

    for (auto x : cost) {
        if (!(used_node[x.second]) && select_num > 0) {
            ans += x.first;
            select_num--;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 6016
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 1 << 21;
using pii = std::pair<int, int>;
#define SORT(v) std::sort(v.begin(), v.end())
std::vector<bool> IsPrime={true};
std::map<int, int> fact;
void sieve(int n) {
	if ((size_t)n + 1 > IsPrime.size()) {
		IsPrime.resize(n + 1, true);
	}
	IsPrime[0] = false;
	IsPrime[1] = false;

	for (int i = 2; i <= n; i++) {
		if (IsPrime[i]) {
			for (int j = 2; i*j <= n; j++) {
				IsPrime[i*j] = false;
			}
		}
	}
}
long long factrial(int n) {
	if (n == 0) return 1;
	else return n * factrial(n - 1);
}
void factfact(int m) {
	int temp = 0;
	for (int i = 2; i <= m; ++i) {
		for (int j = 2; j <=m; ++j) {
			if (IsPrime[j]) {
				temp = i;
				while (temp%j == 0 && temp != 0) {
					temp /= j;
					fact[j]++;
				}
			}
		}
	}
}

int main(void) {
	int N;
	long long sum=1;
	std::cin >> N;

	sieve(N);

	factfact(N);
	std::map<int,int>::iterator itr;
	for (itr = fact.begin(); itr != fact.end(); itr++) {
		//std::cout << itr->first << " "<< itr->second << std::endl;
		sum *= (itr->second + 1);
		sum %= (int)((1e+9) + 7);
	}
	std::cout << sum << std::endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int w = sc.nextInt();
			if(w == -1) break;
			int ret = 0;
			if( w > 30 ) {
				ret += 160 * (w-30);
				w = 30;
			}
			if( w > 20 ) {
				ret += 140 * (w-20);
				w = 20;
			}
			if( w > 10 ) {
				ret += 125 *(w-10);
			}
			System.out.println( 4280 - (ret+1150) );
		}
	}

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

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> res;
  ll sum = 0;
  int i = 1;
  while (sum < n) {
    sum += i;
    res.push_back(i);
    i++;
  }
  ll over = sum - n;
  if (over > 0) {
    res.erase(res.begin() + (over - 1));
  }
  rep(i, res.size()) {
    cout << res.at(i) << endl;
  }
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005


// long version
long long int GCD(long long int x, long long int y){
    if(x>y){
        long long int swap = x;
        x = y;
        y = swap;
    }
    while(true){
        if(y%x==0){
            return x;
        }else{
            long long int amari = y%x;
            y = x;
            x = amari;
        }
    }
}

int main() {
    ll n, m;
    cin >> n >> m;
    ll a[n];
    rep(i,n)cin >> a[i];
    int f[n] = {};
    rep(i,n){
        ll aa = a[i];
        while(aa % 2 == 0){
            aa /= 2;
            f[i]++;
        }
        if(i > 0 && f[i] != f[i-1]){
            cout << 0 << endl;
            return 0;
        }
    }
    ll ans = 0;

    ll now = 1;
    rep(i,n){
        now = now * a[i] / GCD(now, a[i]);
        if(m * 2 < now){
            cout << 0 << endl;
            return 0;
        }
    }

    ll tmp = now / 2;
    ans = 1;
    ans += (m - tmp) / now;

    cout << ans << endl;
}
 
 


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

namespace ABC156
{
	class B
	{
		static void Main(string[] args)
		{
			var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
			Console.WriteLine(GetExpo(input[0], input[1])+1);

		}

		private static int GetExpo(int n, int k)
		{
			int i = 0;
			while(k * Math.Pow(k, i) <= n)
			{
				i++;
			}
			return i;
		}
	}
}


Measured memory_bytes: 13268
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	final int _intMax = Integer.MAX_VALUE; // =2147483647>10^9
	final int _intMin = Integer.MIN_VALUE;
	final long _longMax = Long.MAX_VALUE; // =9223372036854775807L>10^18
	final long _longMin = Long.MIN_VALUE;
	static boolean bElapsed = false;

	void solve() {
		int[] ia = readNums();
		int x = ia[0];
		int y = ia[1];
		int z = ia[2];
		int ans = 0;
		if (x > y + 2 * z) {
			ans++;
			x -= y + 2 * z;
		}
		while (x >= y + z) {
			ans++;
			x -= y + z;
		}
		pln(ans);
	}

	int pint(String s) {
		return Integer.parseInt(s);
	}

	long plong(String s) {
		return Long.parseLong(s);
	}

	String readLine() {
		try {
			return _in.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int readNum() {
		String line = readLine();
		return pint(line);
	}

	String[] readFlds() {
		String line = readLine();
		return line.split(" ");
	}

	int[] readNums() {
		String[] flds = readFlds();
		int[] nums = new int[flds.length];
		for (int i = 0; i < flds.length; i++) {
			nums[i] = pint(flds[i]);
		}
		return nums;
	}

	void p(char c) {
		_out.print(c);
	}

	void pln(char c) {
		_out.println(c);
	}

	void p(double d) {
		_out.print(d);
	}

	void pln(double d) {
		_out.println(d);
	}

	void p(long l) {
		_out.print(l);
	}

	void pln(long l) {
		_out.println(l);
	}

	void p(String s) {
		_out.print(s);
	}

	void pln(String s) {
		_out.println(s);
	}

	static BufferedReader _in;
	static PrintWriter _out;

	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		_in = new BufferedReader(new InputStreamReader(System.in));
		_out = new PrintWriter(System.out);
		new Main().solve();
		_out.flush();
		long end = System.currentTimeMillis();
		if (bElapsed) {
			System.err.println((end - start) + "ms");
		}
	}
}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define Graph vector<vector<ll>>
#define INF (1ll<<40-1)
#define mod 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define pi 3.14159265358979323846

int main(){
    ll A,B,C,D,E,F;cin>>A>>B>>C>>D>>E>>F;

    ll dp[3010/*全質量*/];//全質量に対する割合が最も大きくなるような塩分量
    rep(i,3010) dp[i]=-1;
    dp[0]=0;

    rep(i,F+1){
        if(dp[i]==-1) continue;

        if(i+C<=3000 && (100+E)*(C+dp[i])<=E*(i+C)){//Cを加えても濃度E以下の時
            chmax(dp[i+C],dp[i]+C);
        }else{//濃度が超過する場合
            if(i+C+100*A<=3000 && (100+E)*(C+dp[i])<=E*(i+C+100*A)){//さらに100Aの水を加えるとき
                chmax(dp[i+C+100*A],dp[i]+C);
            }
            if(i+C+100*B<=3000 && (100+E)*(C+dp[i])<=E*(i+C+100*B)){//さらに100Bの水を加えるとき
                chmax(dp[i+C+100*B],dp[i]+C);
            }
        }

        if(i+D<=3000 && (100+E)*(D+dp[i])<=E*(i+D)){//Dを加えても濃度E以下の時
            chmax(dp[i+D],dp[i]+D);
        }else{//濃度が超過する場合
            if(i+D+100*A<=3000 && (100+E)*(D+dp[i])<=E*(i+D+100*A)){//さらに100Aの水を加えるとき
                chmax(dp[i+D+100*A],dp[i]+D);
            }
            if(i+D+100*B<=3000 && (100+E)*(D+dp[i])<=E*(i+D+100*B)){//さらに100Bの水を加えるとき
                chmax(dp[i+D+100*B],dp[i]+D);
            }
        }
    }

    ll water,salt;
    ll answater=min(100*A,100*B),anssalt=0;
    for(ll i=1;i<=F;i++){
        if(dp[i]==-1) continue;
        water=i;
        salt=dp[i];
        if(anssalt*water<salt*answater){
            answater=water;
            anssalt=salt;
        }
    }
    
    cout<<answater<<" "<<anssalt<<endl;

    return 0;
}

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

char ma[100][100];
bool visited[100][100];

int main() {
  int w,h;
  string s;
  while(cin>>w>>h, w|h) {
    for(int i=0; i<w; ++i) {
      cin>>s;
      for(int j=0; j<h; ++j) {
	ma[i][j] = s.at(j);
	visited[i][j] = false;
      }
    }

    int nx=0, ny=0;
    while(1) {
      if(visited[nx][ny]) {
	cout<<"LOOP"<<endl;
	break;
      }
      visited[nx][ny] = true;
      if(ma[nx][ny] == '.') {
	cout<<ny<<" "<<nx<<endl;
	break;
      }
      if(ma[nx][ny] == '>') ny++;
      if(ma[nx][ny] == '<') ny--;
      if(ma[nx][ny] == '^') nx--;
      if(ma[nx][ny] == 'v') nx++;
    }
  }
}

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

int main(){
	int n;
	cin >> n;
	int claim[20][20];
	rep(i,n) rep(j,n) claim[i][j] = -1;
	rep(i,n){
		int a; cin >> a;
		rep(j,a){
			int x,y;
			cin >> x >> y;
			x--;
			if(y == 1){
				claim[i][x] = 1;
			}else{
				claim[i][x] = 0;
			}
		}
	}
	
	int ans = 0;
	
	rep(bit, 1<<n){
		bool ok = true;
		vector<int> d(n,0);
		rep(i,n){
			if(bit & (1<<i)) d[i] = 1;
		}
		rep(i,n){
			if(d[i] == 0) continue;
			rep(j,n){
				if(claim[i][j] == -1) continue;
				if(claim[i][j] != d[j]) ok = false;
			}
		}
		if(ok){
			ans = max(ans, __builtin_popcount(bit));
		}
	}
	cout << ans << endl;
	
    return 0;
}



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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D ;
  
  if (A + B > C + D ) {
  cout << "Left" << endl;
  }
  
  else if(A + B == C + D ) {
  cout << "Balanced" << endl;
  }

  else {
  cout << "Right" << endl;
  }
  }
 

Measured memory_bytes: 256
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let v = read_vec::<usize>();
    let h = v[0];
    let _w = v[1];

    let mut bs = Vec::new();
    for i in 0..h {
        let line = read::<String>();
        for (j, c) in line.chars().enumerate() {
            if c == 'B' {
                bs.push((i as i32, j as i32));
            }
        }
    }

    let blen = bs.len();
    let mut max = 0;
    for i in 0..blen - 1 {
        for j in i..blen {
            let dij = (bs[i].0 - bs[j].0).abs() + (bs[i].1 - bs[j].1).abs();
            max = std::cmp::max(max, dij);
        }
    }
    println!("{}", max);
}



Measured memory_bytes: 5036
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    s = INPUT()
    t = INPUT()

    s = [ord(i) for i in sorted(s)]
    t = [ord(i) for i in sorted(t)]
    t.reverse()

    cnt = 0
    for x in s:
        if x < t[cnt]:
            print("Yes")
            sys.exit()
        elif x > t[cnt]:
            print("No")
            sys.exit()
        else:
            cnt += 1
            if cnt == len(t):
                print("No")
                sys.exit()

    print("Yes" if len(s) < len(t) else "No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 9988
#include <iostream>

using namespace std;

typedef long long ll;

int main() {
	int N;
	ll A, B;
	cin >> N >> A >> B;
	ll P, X, ans = 0;
	cin >> P;
	for (int i = 1; i < N; i++) {
		cin >> X;
		ans += min(A * (X - P), B);
		P = X;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
const ll INFLL=LLONG_MAX;
const int INF=INT_MAX;
const ll MAXLL=0x3f3f3f3f3f3f3f3f;
const int MAX=0x3f3f3f3f;
#define eb emplace_back
#define emp emplace
#define mp(a,b) make_pair(a,b)
template<class T> using min_heap=priority_queue<T,vector<T>,greater<T> >;
template<class T>
void sort(vector<T>& v){
	sort(v.begin(),v.end());
}
template <class T, class U>
void sort(vector<T>& v,U func){
	sort(v.begin(),v.end(),func);
}
template <class T>
int lb_index(vector<T>& v,T k){
	return lower_bound(v.begin(),v.end(),k)-v.begin();
}
template <class T>
int ub_index(vector<T>& v,T k){
	return upper_bound(v.begin(),v.end(),k)-v.begin();
}
struct flow{
	int n,s,t;
	const long long MAXVAL=0x3f3f3f3f3f3f3f3f;
	struct edge{
		int from,to;
		long long cap,cost;
		edge(int u,int v,long long c,long long w):from(u),to(v),cap(c),cost(w){}
		edge(int u,int v,long long c):from(u),to(v),cap(c){
			cost=0;
		}
	};
	vector<edge>e;
	vector<vector<int> >adj;
	vector<long long>dist;
	vector<int>par;
	vector<bool>inq;
	void spfa(){
		fill(dist.begin(),dist.end(),MAXVAL);
		fill(inq.begin(),inq.end(),0);
		fill(par.begin(),par.end(),0);
		queue<int>q;
		dist[s]=0;
		q.emplace(s);
		while(!q.empty()){
			int u=q.front();
			q.pop();
			inq[u]=0;
			for(auto i:adj[u]){
				if(e[i].cap<=0)continue;
				int v=e[i].to;
				long long l=e[i].cost;
				if(dist[u]+l<dist[v]){
					dist[v]=dist[u]+l;
					par[v]=i;
					if(!inq[v])q.emplace(v),inq[v]=1;
				}
			}
		}
	}
	long long augcost(){
		long long curflow=MAXVAL;
		for(int u=t;u!=s;u=e[par[u]].from){
			curflow=min(curflow,e[par[u]].cap);
		}
		for(int u=t;u!=s;u=e[par[u]].from){
			e[par[u]].cap-=curflow;
			e[par[u]^1].cap+=curflow;
		}
		return curflow;
	}
	flow(int n,int s,int t):n(n),s(s),t(t),dist(n),inq(n),par(n),adj(n){}
	void addedge(int u,int v,long long c,long long w){
		adj[u].emplace_back(e.size());
		e.emplace_back(u,v,c,w);
		adj[v].emplace_back(e.size());
		e.emplace_back(v,u,0,-w);
	}
	void addedge(int u,int v,long long c){
		adj[u].emplace_back(e.size());
		e.emplace_back(u,v,c);
		adj[v].emplace_back(e.size());
		e.emplace_back(v,u,0);
	}
	void setflow(long long k){
		int ns=n++;
		adj.resize(n);
		dist.resize(n);
		inq.resize(n);
		par.resize(n);
		addedge(ns,s,k,0);
		s=ns;
	}
	pair<long long,long long> getflow(){
		long long maxflow=0,cost=0;
		for(;;){
			spfa();
			if(dist[t]==MAXVAL)break;
			long long f=augcost();
			maxflow+=f;
			cost+=dist[t]*f;
		}
		return {maxflow,cost};
	}
};
int main(){
	int n,m,mf;
	cin>>n>>m>>mf;
	flow f(n,0,n-1);
	for(int i=0;i<m;i++){
		int u,v;
		ll c,w;
		cin>>u>>v>>c>>w;
		f.addedge(u,v,c,w);
	}
	f.setflow(mf);
	pll ans=f.getflow();
	if(ans.fi<mf){
		cout<<"-1\n";
	}
	else cout<<ans.se<<"\n";
}



Measured memory_bytes: 3268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(a+b==c+d) cout << "Balanced" << endl;
    else if(a+b>c+d) cout << "Left" << endl;
    else cout << "Right" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define int long long
#define double long double
#define all(a) a.begin(), a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

const int use = 1000000000;

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

    int s; cin >> s;
    int y2=(s+use-1)/use;
    int x2=y2*use-s;
    assert(use*y2-x2==s);
    assert(x2>=0 and y2>=0 and x2<=use and y2<=use);
    cout<<0<<' '<<0<<' '<<use<<' '<<1<<' '<<x2<<' '<<y2<<endl;

}

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

using namespace std;

int main()
{
	int M, T, P, R;

	while (scanf("%d %d %d %d", &M, &T, &P, &R), M){
		int m, t, p, j;
		//score, penalty, team
		vector<pair<int, pair<int, int> > > table(T);
		int wa[64][16] = {0};

		for (int i = 0; i < T; i++){
			table[i].second.second = i + 1;
		}

		for (int i = 0; i < R; i++){
			scanf("%d %d %d %d", &m, &t, &p, &j);

			if (j){
				wa[t - 1][p] += 20;
			}
			else {
				table[t - 1].first++;
				table[t - 1].second.first -= wa[t - 1][p];
				table[t - 1].second.first -= m;
			}
		}

		sort(table.begin(), table.end(), greater<pair<int, pair<int, int> > >());

		for (int i = 0; i < table.size(); i++){
			cout << table[i].second.second;

			if (table[i].second.first == table[i + 1].second.first && i < T - 1){
				cout << '=';
			}
			else if (i < T - 1){
				cout << ',';
			}
			else {
				cout << endl;
			}
		}
	}


	return (0);
}

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

using namespace std;

int main(){
	int n, sol = 0;
	cin >> n;
	unordered_set<string> st;
	for(int i = 0; i < n; i++){
		string cur;
		cin >> cur;
		st.insert(cur);
	}
	cout << st.size() << '\n';
}


Measured memory_bytes: 17728
from sys import exit
H, W, m = map(int, input().split())
b_h = [[0, i] for i in range(H)]
b_w = [[0, i] for i in range(W)]
bs = set()
for _ in range(m):
	h, w = map(int, input().split())
	b_h[h-1][0] += 1
	b_w[w-1][0] += 1
	bs.add((h-1, w-1))

b_h.sort(reverse=True)
b_w.sort(reverse=True)
I = 0
while I < H-1 and b_h[I+1][0] == b_h[0][0]:
	I += 1

J = 0
while J < W-1 and b_w[J+1][0] == b_w[0][0]:
	J += 1

for i in range(I+1):
	for j in range(J+1):
		if (b_h[i][1], b_w[j][1]) not in bs:
			print(b_h[0][0] + b_w[0][0])
			exit()
print(b_h[0][0] + b_w[0][0] - 1)

Measured memory_bytes: 175504
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

//　重み付きUnionFind
struct WeightedUnionFind {
    vector<ll> par;
    vector<ll> siz;
    vector<ll> diff_weight;

    WeightedUnionFind(ll N) : par(N), siz(N, 1LL), diff_weight(N, 0) {
        for(int i = 0; i < N; i++) {
            par[i] = i;
        }
    }

    ll weight(int x) {
        root(x);
        return diff_weight[x];
    }

    ll diff(int x, int y) { return weight(y) - weight(x); }

    int root(int x) {
        if(par[x] == x)
            return x;
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }
    void unite(int x, int y, ll w) {
        w += weight(x), w -= weight(y);
        int rx = root(x);
        int ry = root(y);
        if(rx == ry)
            return;
        if(siz[rx] < siz[ry])
            swap(rx, ry), w = -w;
        siz[rx] += siz[ry];
        par[ry] = rx;
        diff_weight[ry] = w;
    }
    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    ll size(ll x) { return siz[root(x)]; }
};

int main() {
    int N, M;
    cin >> N >> M;
    WeightedUnionFind Wuf(N);
    rep(i, M) {
        ll l, r, d;
        cin >> l >> r >> d;
        l--;
        r--;
        if(Wuf.same(l, r)) {
            if(Wuf.diff(l, r) != d) {
                cout << "No" << endl;
                return 0;
            }
        } else {
            Wuf.unite(l, r, d);
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
int main(void) {
int A,B,C,K;
scanf("%d%d%d%d",&A,&B,&C,&K);
if(0<=A-K){
	printf("%d\n",K);
}else if(0>A-K&&0<=A+B-K){
	printf("%d\n",A);
}else{
	printf("%d\n",A-(K-(A+B)));
}
	return 0;
}


Measured memory_bytes: 1708
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  int b;
  int c;
  int d;
  cin >> a >> b >> c >> d;
  if (a + b > c + d){
    cout << "Left";
  }else if (a + b < c + d){
    cout << "Right";
  }else{
    cout << "Balanced";
  }
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    // failed to analyze input format
    // TODO: edit here
    int a,b,c,d,e;
    cin >> a >> b>>c>>d>>e;

    if (a != 1) p(1);
    if (b != 2) p(2);
    if (c != 3) p(3);
    if (d != 4) p(4);
    if (e != 5) p(5);

    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc170/abc170_a && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc170/abc170_a && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc170/abc170_a && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <map>

#define MAX_A 100000
#define MAX_B 100000

int main() {
    int A, B, M;
    std::cin >> A >> B >> M;

    std::vector<int> a(A);
    int min_a = 300000;
    for (int i = 0; i < A; i++) {
        std::cin >> a[i];
        if (a[i] < min_a) {
            min_a = a[i];
        }
    }

    std::vector<int> b(B);
    int min_b = 300000;
    for (int i = 0; i < B; i++) {
        std::cin >> b[i];
        if (b[i] < min_b) {
            min_b = b[i];
        }
    }

    int min = min_a + min_b;

    for (int i = 0; i < M; i++) {
        int x, y, c;
        std::cin >> x >> y >> c;

        int sum = a[x - 1] + b[y - 1] - c;
        if (sum < min) {
            min = sum;
        }
    }

    std::cout << min << std::endl;
    
    return 0;
}

Measured memory_bytes: 4044
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

ll mod = 1e9 + 7;

int main(void){
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    FOR(x,k,n+1){
        ll d = ((n + 1 - x) * x) % mod;
        ans = (ans + d + 1) % mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
N = gets.to_i
A = gets.split(' ').map(&:to_i)

num = A.select(&:negative?).size

if A.include?(0) || num.even?
  t = A.inject(0) do |sum, a|
    sum + a.abs
  end
  puts t
else
  abs_value = A[0].abs
  A.each_with_index do |a, _index|
    abs_value = a.abs if a.abs < abs_value
  end
  t = A.inject(0) do |sum, a|
    sum + a.abs
  end
  puts t - 2 * abs_value
end


Measured memory_bytes: 9356
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    ll N,K;cin>>N>>K;
    ll ans=0;
    for(ll i=1;i<=N;i++)ans+=(N/i)*max((ll)0,i-K)+max((ll)0,N-N/i*i-K+1);
    if(K==0)ans-=N;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <set>

using namespace std;

int main() {
    char x[3];
    set<char> se;
    scanf("%c%c%c", &x[0], &x[1], &x[2]);
    for (int i = 0; i < 3; i++) {
        se.insert(x[i]);
    }
    if (se.size() == 3) {
        printf("Yes\n");
    }else {
        printf("No\n");
    }
    return 0;
}


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

const int SQRT = int(1e9);

int main() {
	long long s;
	scanf("%lld", &s);
	int x = s / SQRT + (s % SQRT != 0);
	int b = s / x + (s % x != 0);
	int y = 1LL * x * b - s;
	printf("0 0 %d %d 1 %d\n", x, y, b);
}

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

int N;
int T[210], V[210];
double dp[210][210];

void solve() {
	cin >> N;
	rep(i, 0, N) cin >> T[i];
	rep(i, 0, N) cin >> V[i];
	rep(i, 0, N + 1) {
		rep(j, 0, 201) {
			dp[i][j] = -linf;
		}
	}
	dp[0][0] = 0;
	rep(i, 0, N) {
		int v1 = V[i], v2 = V[i + 1], t = T[i];
		rep(j, 0, 201) {
			if(dp[i][j] == -inf) continue;
			rep(k, 0, min(v1, v2) + 1) {
				double at = (t + k - j) / 2.0;
				if(at > t || at < 0) continue;
				double y = at + j;
				if(y <= V[i]) {
					MAX(dp[i + 1][k], dp[i][j] + (j + y) * at / 2 + (y + k) * (t - at) / 2);
				}
				else {
					double at1 = v1 - j, at2 = t - (v1 - k);
					MAX(dp[i + 1][k], dp[i][j] + (j + v1) * at1 / 2 + v1 * (at2 - at1) + (v1 + k) * (t - at2) / 2);
				}
			}
		}
	}
	cout << dp[N][0] << "\n";
}

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



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
double pi = acos(-1.0);
const double EPS=1e-9;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define t() ll t;cin>>t;while(t--) 

int main()
{ 
    fastio;
    ll i,n,j,k,w;
    cin>>n>>w;
    vector<vector<ll>>dp(n,vector<ll>(w+1,-1));
    vector<ll>wei(n),val(n);
    for(i=0;i<n;i++) cin>>wei[i]>>val[i];
    dp[0][0]=0;
    dp[0][wei[0]]=val[0];
    for(i=1;i<n;i++)
    {
        dp[i][0]=0;
        for(j=1;j<=w;j++)
        {
            dp[i][j]=dp[i-1][j];
            if(j>=wei[i] &&dp[i-1][j-wei[i]] != -1)
                dp[i][j]=max(dp[i][j],dp[i-1][j-wei[i]]+val[i]);
        }
    }
    ll ans=0;
    for(i=1;i<=w;i++)
        ans=max(dp[n-1][i],ans);
    cout<<ans;

    
       
}

Measured memory_bytes: 79488
n,m=map(int,input().split())
a=[0]*m
b=[0]*m
for i in range(m):
  a[i],b[i]=map(int,input().split())
c=[0]*max(n,m)
for i in range(m):
  if a[i]==1:
    c[b[i]-1] |= 1
  if b[i]==n:
    c[a[i]-1] |= 2
print("POSSIBLE" if max(c)==3 else "IMPOSSIBLE")


Measured memory_bytes: 20340
/*raghav0307 - Raghav Gupta*/

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

#define ff first
#define ss second
#define pb push_back
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int ll

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;

signed main(){
	fast_io();
	int a, b;
	cin >> a >> b;
	cout << max(a+b, max(a-b, a*b));
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<list>
#include<cmath>
using namespace std;
using ll = long long;
int main() {
	string S;
	ll K;
	cin >> S >> K;
	int x = min((ll)S.size(), K);
	for (int i = 0; i < x; ++i) {
		if (S[i] != '1') {
			cout << S[i] << endl;
			return 0;
		}
	}
	cout << 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int a[3000],b[3000];
	int i=0;
	while(1){
		scanf("%d %d", &a[i], &b[i]);
		if(a[i]==0 && b[i]==0)break;
		if(b[i] < a[i]){
			int tmp = a[i];
			a[i] = b[i];
			b[i] = tmp;
		}
		if(a[i] < b[i]){
			printf("%d %d\n", a[i], b[i]);
		}else{
			printf("%d %d\n", b[i], a[i]);
		}
		
		i = i + 1;
	}
	return 0;
}

Measured memory_bytes: 2696
N,M=map(int,input().split())
xyz=[list(map(int,input().split())) for _ in range(N)]

MAX=0

for bit in range(2**3):
    sign=[]
    SUM=[]

    for g in range(3):
        if (bit>>g)&1:
            sign.append(1)
        else:
            sign.append(-1)
    
    for g in range(N):
        SUM.append(sign[0]*xyz[g][0]+sign[1]*xyz[g][1]+sign[2]*xyz[g][2])

    SUM.sort(reverse=True)
    MAX=max(MAX,sum(SUM[:M]))

print(MAX)

Measured memory_bytes: 40304
using System;
using System.IO;
using System.Linq;
class E { static void Main() => new K(); }
class K
{
	int F => int.Parse(Console.ReadLine());
	static char[] sep = new char[] { ' ', '/' };
	int[] G => Console.ReadLine().Split(sep).Select(_ => int.Parse(_)).ToArray();
	int P(char c) => (('z' - c) + 1) % 26;
	int D(int a) => M(a % 26);
	int M(int a) => a < 0 ? a + 26 : a;
	char Q(int a) => R(D(a));
	char R(int a) => a == 0 ? 'a' : (char)('z' - a + 1);
	public K()
	{
		Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
		var S = Console.ReadLine();
		int K = F, N = S.Length;
		var a = new int[N];
		for (var i = 0; i < N; i++) a[i] = P(S[i]);
		for (var i = 0; i < N && K > 0; i++) if (a[i] <= K) { K -= a[i]; a[i] = 0; }
		if (K > 0) a[N - 1] = D(a[N - 1] - K);
		for (var i = 0; i < N; i++) Console.Write(R(a[i]));
		Console.WriteLine();
		Console.Out.Flush();
	}
}

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

int main(){
    int n;
    int c;
    int graph[11];
    while (~scanf("%d", &n)) {
        if (!n) break;
        fill(graph, graph + 11, 0);
        REP(i, n) {
            scanf("%d", &c);
            graph[c]++;
        }
        FOR(i, 0, 10) {
            if (!graph[i]) printf("-\n");
            else {
                REP(j, graph[i]) printf("*");
                puts("");
            }
        }
    }
    return 0;
}




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

int main(){
    int N; cin >> N;
    vector<int> A(N-1), cnt(N, 0);
    for(int &x : A){
        cin >> x;
        cnt[x-1]++;
    }
    for(int i=0; i<N; i++) cout << cnt[i] << endl;
    return 0;
}

Measured memory_bytes: 4788
#include <bits/stdc++.h>
#define fr first
#define sc second
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pi>
#define vpl vector<pl>
#define pb push_back
#define rc(s) return cout<<s,0
#define INF 1000000005
#define LINF 1000000000000000005
#define h n
#define w m
using namespace std;
int h, w, a, b;
int main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> h >> w >> a >> b;
    for(int i=1; i<=n; ++i){
        for(int j=1; j<=m; j++){
            if((j<=a && i<=b) || (j>a && i>b) ) cout<<1;
            else cout<<0;
        }
        cout<<"\n";
    }

}



Measured memory_bytes: 1280