akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <tuple>
#include <climits>
#include <sstream>
using namespace std;

static const unsigned long long int MOD = 1000000007LL;

int main()
{
    long long unsigned int l, r, res = 2019;
    static const unsigned long long int mod = 2019LL;

    cin >> l >> r;

    for (long long int i = l; i <= l + 2019 && i <= r; i++)
    {
        for (long long int j = i + 1; j <= i + 2019 && j <= r; j++)
        {
            res = min(res, (i * j) % mod);
        }
    }

    cout << res;

    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int[] group = new int[]{0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0};
            int x = in.nextInt(), y = in.nextInt();
            if (group[x - 1] == group[y - 1]) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }
}



Measured memory_bytes: 22608
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int n,k,i,l,sum,sum1,j;
    scanf("%lld%lld",&n,&k);
    long long int a[n+5];
    for(i=0;i<n;i++)
        scanf("%lld",&a[i]);
    sort(a,a+n);
    sum=a[k-1]-a[0];
    for(i=1;i<n;i++)
    {
        sum1=a[k+i-1]-a[i];
        if(sum1<sum)sum=sum1;
    if(k+i-1==n-1)break;

    }
   printf("%lld\n",sum);
   return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n, res = 0;
  cin >> n;
  std::vector<int> h;
  for (int i = 0; i < n; i++) {
    int m1;
    cin >> m1;
    h.push_back(m1);
  }
  h.push_back(0);
  h.push_back(0);
  int left = 0, right = 0;
  while (left < n && right < n) {
    int rangemin = 100;
    while (h[left] == 0 && left < n) left++;
    right = left;
    while (h[right + 1] != 0 && right < n) {
      right++;
    }
    cerr << left << "\t" << right << endl;
    for (int i = left; i <= right; i++) {
      if (h[i] < rangemin) rangemin = h[i];
    }
    for (int i = left; i <= right; i++) {
      h[i] -= rangemin;
    }
    res += rangemin;
    cerr << rangemin << endl;
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong n, k;
llong a[200005];
llong f[200005];

bool check(llong k, llong t) {
    for (int i = 0; i < n; i++) {
        if (a[i] * f[i] > t) {
            k -= (a[i] * f[i] - t + f[i] - 1) / f[i];
        }
    }

    return k >= 0;
}

int main() {

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

    sort(a, a + n);
    sort(f, f + n, greater<>());

    llong valid = 1ll << 40ll;
    llong invalid = -1;

    while (valid - invalid > 1) {
        llong mid = (valid + invalid) / 2;

        if (check(k, mid)) {
            valid = mid;
        }
        else {
            invalid = mid;
        }
    }

    cout << valid;

    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	ll ans=0;
	for(ll i=sqrt(n);i>=1;i--){
		if(n%i==0){
			ll now=n/i;
			while(now!=0){
				ans++;
				now/=10;
			}
			break;
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <numeric>
#include <string>
#include <bitset>

/*----------------------------------------------------------------*/

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

/*----------------------------------------------------------------*/

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }
template<typename T> T rpow(T a, ll n) {
    if (n == 0) return 1;
    T k = 1;
    for (; n > 1; n >>= 1) {
        if (n & 1) k *= a;
        a *= a;
    }
    return k * a;
}

/*----------------------------------------------------------------*/

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

/*----------------------------------------------------------------*/

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; rpow(i, 2) <= n; i++)
        if (n % i == 0) return false;
    return true;
}

/*----------------------------------------------------------------*/

struct edge {
    ll to, cost;

    edge(ll x, ll y) {
        to = x, cost = y;
    }
};
void solve();

/*----------------------------------------------------------------*/

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

    solve();
}

void solve() {
    ll v, e;
    std::cin >> v >> e;

    std::vector<std::vector<edge>> graph(v);

    auto prim = [&]() {
        ll res = 0;
        vll dist(v, 1e9); dist[0] = 0;
        std::priority_queue<pll, vpll, std::greater<pll>> que;
        que.push({ 0, 0 });

        while (!que.empty()) {
            pll p = que.top(); que.pop();
            ll cost = p.first, v = p.second;
            if (dist[v] < cost) continue;
            res += cost, dist[v] = -1e9;
            for (edge e : graph[v])
                if (chmin(e.cost, dist[e.to]))
                    que.push({ dist[e.to], e.to });
        }

        return res;
    };

    for (ll i = 0; i < e; i++) {
        ll s, t, w; std::cin >> s >> t >> w;
        graph[s].push_back(edge(t, w));
        graph[t].push_back(edge(s, w));
    }

    std::cout << prim() << '\n';
}



Measured memory_bytes: 9004
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;


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

    static class TaskT {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            
        	int N = in.nextInt();
        	//int[] squares = new int[N+!];
        	int count = 0;
        	for(int i = 1; i <= N; i++){
        		int num = in.nextInt();
        		if(num %2 == 1 && i %2 == 1)
        			count ++;
        	}
        	out.print(count);
        }

    }

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

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

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

        public int nextInt() {
            return Integer.parseInt(next());
        }
        
        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 32912
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>

using namespace std;

int main(){
    int d, g, cnt_min=1e9;
    cin >> d >> g;
    vector<int> val(d);
    vector<int> cnt(d);
    for(int i=1; i<=d; i++){
        int c, p;
        cin >> p >> c;
        val[i-1] = (i*100*p + c);
        cnt[i-1] = p;
    }

    for(int i=0; i<(1 << d); i++){
        int cnt_tmp = 0;
        int rest_max = 0;
        int s = 0;
        for(int j=0; j<d; j++){
            if(i & (1 << j)){
               s += val[j];
               cnt_tmp += cnt[j];
            }else{
               rest_max = j;
            }
        }
        if(s < g){
            int s1 = 100*(rest_max + 1);
            int need = (g - s + s1 - 1)/s1;
            if(need >= cnt[rest_max]){
               continue;
            }
            cnt_tmp += need;
        }
        cnt_min = min(cnt_min, cnt_tmp);
    }
    cout << cnt_min << endl;
}


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

int main() {
  int A, B, K;
  cin >> A >> B >> K;

  vector<int> divisors;

  int min_ab = min(A, B);
  for (int i = min_ab; i > 0; i--) {
    if (A % i == 0 && B % i == 0) {
      divisors.push_back(i);
    }

    if (divisors.size() == K) {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int n, a, b, c, d, ma, mb;

	scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);
	ma = ((n-1)/a+1)*b;
	mb = ((n-1)/c+1)*d;
	if (ma > mb) ma = mb;
	printf("%d\n", ma);
	return 0;
}



Measured memory_bytes: 2120
#include<bits/stdc++.h>
using namespace std;
#define mod 998244353
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int N,M;
    cin>>N>>M;
    cout<<(N*(N-1)+M*(M-1))/2;
}

Measured memory_bytes: 256
N, T = map(int, input().split())
ct = []
for i in range(N):
  c, t = map(int, input().split())
  ct.append([c, t])

def kitaku(l):
  l.sort()
  for i in range(N):
    if l[i][1] <= T:
      return l[i][0]
    if i == N - 1:
      return "TLE"

print(kitaku(ct))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
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 INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  string s; cin >> s;
  map<string,string> m = { { "Sunny", "Cloudy"}, {"Cloudy", "Rainy"}, {"Rainy", "Sunny"} };
  COUT(m[s]);
  return 0;
}

Measured memory_bytes: 256
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let _n: usize = read();
    let s: String = read();
    let (b, r) = s.chars().fold((0, 0), |(b, r), x| match x {
        'B' => (b + 1, r),
        'R' => (b, r + 1),
        _ => unreachable!(),
    });

    let ans = if r > b {
        "Yes"
    }else {
        "No"
    };

    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4476
while True:
    a,b=map(int,raw_input().split(" "))
    if 0<=a<=10000 or 0<=b<=10000:
        if a<b:
            print a,b
        elif a>b:
            print b,a
        elif a==0 and b==0:
            break
        elif True:
            print a,b

Measured memory_bytes: 6208
#include<iostream>
#include<fstream>
#include<string>
#include<cmath>
#include<queue>
using namespace std;


int main(){
	
	string A,B;
	int numA,numB,dA,dB;
	int i;
	
	cin >> A;
	cin >> B;
	
	numA=A.length();
	numB=B.length();
	
	if (numA>numB){
		cout<<"GREATER"<<endl;
	}
	else if(numA<numB){
		cout<<"LESS"<<endl;
	}
	else{
		for(i=0;i<=numA-1;i++){
			if(A[i]>B[i]){
				cout<<"GREATER"<<endl;
				break;
			}
			else if(A[i]<B[i]){
				cout<<"LESS"<<endl;
				break;
			}
			else{
				if(i==0){
					cout<<"EQUAL"<<endl;
					break;
				}
			}
		}
	}


return 0;
};

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

int main()
{
	string str;
	getline(cin,str);

	for(int i=0; i<str.size()-4; i++)
	{
		if(str.substr(i,5)=="apple")
		{
			str.replace(i,5,"peach");
			continue;
		}
		if(str.substr(i,5)=="peach")
		{
			str.replace(i,5,"apple");
			continue;
		}
	}

	cout << str << endl;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;


const ll mod = 1000000007;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
// bool debug=false;

/*---------------------------------------------------*/

int main() {
  int H, W, K;
  char s[305][305];
  int ans[305][305];
  cin >> H >> W >> K;
  int idx = 1;
  
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      cin >> s[i][j];
      if(s[i][j] != '#') ans[i][j] = 0;
      else { ans[i][j] = idx; idx++; }
    }
  }

  for(int i = 0; i < H; i++) {
    for(int j = 1; j < W; j++) {
      if(ans[i][j] == 0 && ans[i][j - 1] != 0) {
	ans[i][j] = ans[i][j - 1];
      }
    }
  }
  
  for(int i = 0; i < H; i++) {
    for(int j = W - 2; j >= 0; j--) {
      if(ans[i][j] == 0 && ans[i][j + 1] != 0) {
	ans[i][j] = ans[i][j + 1];
      }
    }
  }

  for(int i = 1; i < H; i++) {
    for(int j = 0; j < W; j++) {
      if(ans[i][j] == 0 && ans[i - 1][j] != 0) {
	ans[i][j] = ans[i - 1][j];
      }
    }
   }

  for(int i = H - 2; i >= 0; i--) {
    for(int j = 0; j < W; j++) {
      if(ans[i][j] == 0 && ans[i + 1][j] != 0) {
	ans[i][j] = ans[i + 1][j];
      }
    }
  }

  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      if(j == 0) cout << ans[i][j];
      else cout << " " << ans[i][j];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 1152
while True:
    record=str(input())
    if record=="0":
        break
    A=0
    B=0
    for i in range(1,len(record)):
        if record[i]=="A":
            A+=1
        else:
            B+=1
    if A>B:
        A+=1
    else:
        B+=1
    print(A,B)


Measured memory_bytes: 5552
import itertools
n, m = map(int, input().split())
ab_list = [tuple(map(int, input().split())) for _ in range(m)]

path_list = sorted(iter for iter in itertools.permutations(range(2, n+1), n-1))

counter = 0

for path_i in path_list:
  path = (1, )+path_i
  
  result_list = [True for s_e in zip(path, path[1:]) if tuple(sorted(s_e)) in ab_list]
  
  if sum(result_list) == len(path)-1: counter += 1
    
print(counter)

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
    std::vector<long> a(1);
    std::cin >> a.at(0);

    bool flg = false;
    int val;
    while(!flg){
        val = a.at(a.size() - 1);

//        std::cout << "val: " << val << std::endl;

        if(0 == val % 2){
            val = val / 2;
        }else{
            val = 3 * val + 1;
        }

        a.push_back(val);

        if(2 == std::count(a.begin(), a.end(), val)){
            flg = true;
            break;
        }
    }

    std::cout << a.size() << std::endl;

    return 0;
}


Measured memory_bytes: 888
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, M, S = mapint()
graph = [{} for _ in range(N)]
for _ in range(M):
    u, v, a, t = mapint()
    graph[u-1][v-1] = (a, t)
    graph[v-1][u-1] = (a, t)

change = [list(mapint()) for _ in range(N)]
from heapq import heappop, heappush
# time, silver, vertex
Q = [(0, min(2500, S), 0)]
dist = [[10**18]*2501 for _ in range(N)]
dist[0][min(2500, S)] = 0

while Q:
    t, s, v = heappop(Q)
    rate, change_time = change[v]
    if s<2500 and dist[v][min(2500, s+rate)]>t+change_time:
        dist[v][min(2500, s+rate)] = t+change_time
        heappush(Q, (t+change_time, min(2500, s+rate), v))
    for nx in graph[v].keys():
        nx_s, nx_t = graph[v][nx]
        if nx_s<=s and dist[nx][s-nx_s]>t+nx_t:
            dist[nx][s-nx_s] = t+nx_t
            heappush(Q, (t+nx_t, s-nx_s, nx))
for i in range(1, N):
    print(min(dist[i]))

Measured memory_bytes: 97040
#include<stdio.h>
int main(){
    int D;
    scanf("%d",&D);
    if(D==25){
        printf("Christmas\n");
    }
     if(D==24){
        printf("Christmas Eve\n");
    }
     if(D==23){
        printf("Christmas Eve Eve\n");
    }
     if(D==22){
        printf("Christmas Eve Eve Eve\n");
    }
    return 0;
}


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

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

  ll N; cin >> N;
  vector<ll> A(N, 0);
  ll ans = 0;
  for (ll i = 0; i < N; i++) {
    cin >> A[i];
    ans ^= A[i];
  }

  cout << (ans ^ A[0]);
  for (ll i = 1; i < N; i++) {
    cout << " " << (ans ^ A[i]);
  }
  return 0;
}

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

using namespace std;

int64_t solve(const std::string& s) {
  int const n = s.size();
  int64_t ret = 0;
  for (int i = 0; i < (1 << (n - 1)); i++) {
    auto itr = s.begin();
    int64_t item = 0;
    for (int j = 1; itr != s.end(); j <<= 1) {
      item = item * 10 + (*itr - '0');
      if (i & j) {
        ret += item;
        item = 0;
      }
      itr++;
    }
    if (item) {
      ret += item;
    }
  }
  return ret;
}

int main() {
  std::string s;
  std::cin >> s;
  std::cout << solve(s) << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#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 revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int A, B, K, max_v; cin >> A >> B >> K;
    max_v = max(A, B);
    vector<int> ans;
    rrep (i, 1, max_v) {
        if (A % i == 0 and B % i == 0) ans.push_back(i);
    }
    reverse(ans.begin(), ans.end());
    cout << ans[K-1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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

int main () {
  int N; cin >> N;
  vector<tuple<string,int,int>> data;

  REP(i,N) {
    string S; int P;
    cin >> S >> P;
    data.emplace_back(S,-P,i+1);
  }

  SORT(data);

  REP(i,N) {
    cout << get<2>(data[i]) << endl;
  }  
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
	int k;
	cin >> k;
	cout << (k/2) * (k - k /2) << endl;
	return 0;
}


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

int n,k,mod=1e9+7,ans=0;
int a[100005];

int quick_power(int a,int b)
{
	int res=1;
	for (;b;b=b>>1,a=(a*a)%mod)
	{
		if (b&1)  res=(res*a)%mod;
	}
	return res;
}

signed main()
{
	cin>>n>>k;
	for (int i=k;i>=1;i--)
	{
		a[i]=quick_power(k/i,n)%mod;
		for (int j=2*i;j<=k;j+=i)  a[i]=((a[i]-a[j])%mod+mod)%mod;
	}
	for (int i=1;i<=k;i++)  ans=(ans+a[i]*i)%mod;
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 4360
a = [0,1,2,3,4,5,6,7,8,9]
b = [0,1,2,3,4,5,6,7,8,9]
c = [0,1,2,3,4,5,6,7,8,9]
d = [0,1,2,3,4,5,6,7,8,9]
nn = gets
until nn.nil?
n = nn.to_i
arry =  a.product(b,c,d)
s = 0
arry.each do |x,y,z,w|
    num =  x + y + z + w
    if num == n
        s += 1
    end
end
puts s
nn = gets
end



Measured memory_bytes: 11352
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <queue>
#include <iostream>
#include <cmath>

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
typedef long long ll;

using namespace std;

const string YES = "Yes";
const string NO = "No";

void solve(long long K, long long X){
    if(K* 500 >= X) {
        cout << YES << endl;
        return;
    }else { 
        cout << NO << endl;
        return;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long K;
    scanf("%lld",&K);
    long long X;
    scanf("%lld",&X);
    solve(K, X);
    return 0;
}


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

typedef vector<int> vi;
#define ll long long
#define loop(i,n) for(int i=0; i<n; i++)
#define loop1(i,n) for(int i=1; i<=n; i++)
#define loopi(i,s,e) for(int i=s; i < e; i++)
#define loopiRev(i,s,e) for(int i=s; i >= e; i--)
#define PI 3.14159265359
#define x first
#define y second
#define point pair<double,double>
#define len(s)   (int)s.length()
#define sz(v)    (int)v.size()
#define all(a)   a.begin(),a.end()
#define clr(x, val)	memset((x), (val), sizeof(x))

void initialize(vector<int> &F, int n){
    F = vector<int> (n+1, 0);

    for(int i=2; i*i  <= n; i++){
        if(F[i] == 0)
            for(int k=i*i; k <=n ; k+= i)
                if(F[k] == 0) F[k] = i;
    }
}

//you don't know math, unless you can do math!
int l,n;
vector<int> cuts;
ll dp[1100][1100];

ll solve(int i, int j){
    ll &ret= dp[i][j];
    if(ret != -1)
        return ret;

    int cur= lower_bound(cuts.begin(), cuts.end(), i+1) - cuts.begin();
    if(cur == cuts.size() || cuts[cur] >= j)
        return ret= 0;



    ret= 10000000;
    while(cur < n && cuts[cur] < j){
        ret = min(ret, solve(i, cuts[cur]) + solve(cuts[cur], j) + j - i);
        cur++;
    }

    return ret;
}
int main() {
    //freopen("input.txt" , "r" , stdin) ;
    //freopen("output.txt" , "w" , stdout) ;

    cin.tie(0);
    cin.sync_with_stdio(0);


    int a,b,c; cin>>a>>b>>c;
    if(c >= a && c <= b)
        cout<<"Yes";
    else
        cout<<"No";

}


Measured memory_bytes: 256
/* AtCoder Beginner Contest abc139
 * Problem A
 * Au: SJoshua
 */
#include <bits/stdc++.h>

using namespace std;

int main(void) {
	string S, T;
	cin >> S >> T;
	int ans = 0;
	for (int i = 0; i < 3; i++) {
		ans += S[i] == T[i];
	}		
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007;



int main() {
    int A,B,C,K,ans;
    cin>>A>>B>>C>>K;
    if(K<=A){ans=K;}
    else if(K<=A+B){ans=A;}
    else{ans=A-K+A+B;}
    cout<<ans<<endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());//昇順ソート
#define usort(a) sort(a.rbegin(),a.rend());//降順ソート

using namespace::std;

int jo(ll int a, ll int b){//累乗
    ll int num=1;
    rep(i,0,b) num=num*a;
    return num;
}
char tobig(char s){//char大文字化
  return (s-0x20);
}
char tolow(char s){//char小文字化
  return (s+0x20);
}
int ctoi(char a){//char->int
  if('0'<=a&&a<='9') return (a-'0');
  return -1;
}

int gcd(ll int a,ll int b) {//最大公約数
  if(a<b) return gcd(b,a);
  int c;
  while ((c=a%b)) {
    a=b;
    b=c;
  }
  return b;
}
int lcm(ll int a,ll int b){//最小公倍数
 return (a*b)/gcd(a,b);
}


int main(){
  vector<int> a(3);
  rep(i,0,3) cin>>a[i];
  int C=a[2];
  asort(a);
  if(C==a[1]) cout<<"Yes";
  else cout<<"No";

}


// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示

//  vector<pair<int,int>> data(N);  //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
int cmp3(T lhs, T rhs) { return (lhs == rhs) ? 0 : (lhs > rhs) ? 1 : -1; }

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

using namespace std;

int main() {
  // cout << fixed << setprecision(10);

  int A, B, C, D;
  cin >> A >> B >> C >> D;
  for (int i = 0; A > 0 && C > 0; ++i) {
    ((i&1)? A : C) -= (i&1)? D : B;
  }
  cout << (C <= 0 ? "Yes":"No") << endl;
  return 0;
}


Measured memory_bytes: 3636
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 tmp = c; 
    int ans = 0;
    for(int i = 0;i < 10;i++){
      ans = a * tmp - b;
      System.out.println(ans);
      tmp = ans;
    } 
  }
}

Measured memory_bytes: 21332
// {{{
#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;
// }}}

int N, C;
int d[30][30];
int c[500][500];
ll cost[3][30];

void init()
{
}

void solve()
{
    REP(i, N){
        REP(j, N){
            REP(k, C){
                int idx = (i+j+2)%3;
                cost[idx][k] += d[c[i][j]][k];
            }
        }
    }
    ll ans = LINF;
    REP(i, C){
        REP(j, C){
            if(j == i) continue;
            REP(k, C){
                if(k == i || k == j) continue;
                ans = min(ans, cost[0][i]+cost[1][j]+cost[2][k]);
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> C;
    REP(i, C) REP(j, C) cin >> d[i][j];
    REP(i, N){
        REP(j, N){
            cin >> c[i][j];
            c[i][j]--;
        }
    }
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 1280
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define mod 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
int main(){
	string S;
	cin>>S;
	for(int i=0;i<3;i++)
		cout<<(S[i]=='1'?9:1);
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i=0; i<n; i++)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
using namespace std;
using ll = long long;
using Graph = vector<vector<ll>>;

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

int main() {
    int N;
    cin >> N;
    string S[N];
    for (int i = 0; i < N; i++)
    {
        cin >> S[i];
    }
    sort(S, S+N);
    int cnt = 1;
    int maxcnt = 0;
    for (int i = 0; i < N; i++)
    {
         chmax(maxcnt, cnt);
      	if(i==i-1)break;
        if(S[i]==S[i+1]){
            cnt++;
        }else{
            cnt = 1;
        }

    }
    for (int i = 0; i < N; i++)
    {
        if(maxcnt==cnt)cout << S[i] << endl;
      	if(i==i-1)break;
        if(S[i]==S[i+1]){
            cnt++;
        }else{
            cnt = 1;
        }

    }  
}

Measured memory_bytes: 9872
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N= sc.nextInt();
		int a[] = new int[N];
		for (int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		int b[] = new int[1000000];
		for (int i=0;i<N;i++) {
			b[a[i]]++;
		}
		BigDecimal sum = new BigDecimal(0);
		for (int i=0;i<b.length;i++) {
			BigDecimal big = new BigDecimal(b[i]);
			BigDecimal minusone = big.add(new BigDecimal("-1"));
			big= big.multiply(minusone);
			big = big.divide(new BigDecimal(2));
			sum = sum.add(big);
		}
		for (int i=0;i<N;i++) {
			BigDecimal temp= sum;
			BigDecimal big = new BigDecimal(b[a[i]]);
			BigDecimal minusone = big.add(new BigDecimal("-1"));
			big = big.multiply(minusone);
			big = big.divide(new BigDecimal(2));
			temp = temp.add(big.multiply(new BigDecimal("-1")));
			big = new BigDecimal(b[a[i]]);
			big = big.add(new BigDecimal("-2"));
			big = big.multiply(minusone);
			big = big.divide(new BigDecimal(2));
			temp = temp.add(big);
			System.out.println(temp);
		}
	}
}

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

typedef long long ll;

int main(){
  int A, B;
  cin >> A >> B;
  int ans=0;
  if (A>B){
    ans+=A;
    A--;
  }else{
    ans+=B;
    B--;
  }
  if (A>B){
    ans+=A;
    A--;
  }else{
    ans+=B;
    B--;
  }
  cout << ans << endl;
}


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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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

struct Pos{
    int x,y;
    Pos(int x,int y):x(x),y(y){}
};

int H,W;
int Ch,Cw;
int Dh,Dw;
string field[1005];
int d[1005][1005];
int s[1005][1005];
bool visited1[1005][1005];
bool visited2[1005][1005];
int id;

void init(){
    id=0;
    for(int i=0;i<1003;++i){
        for(int j=0;j<1003;++j){
            d[i][j]=INF;
            s[i][j]=-1;
            visited1[i][j]=false;
            visited2[i][j]=false;
        }
    }
}

void bfs1(int sx,int sy){
    queue<Pos> que;
    que.push(Pos(sx,sy));
    s[sy][sx]=id;
    while(que.size()){
        Pos p=que.front();
        que.pop();
        visited1[p.y][p.x]=true;
        for(int i=0;i<4;++i){
            int nx=p.x+dx[i],ny=p.y+dy[i];
            if(nx<0||nx>=W||ny<0||ny>=H)continue;
            if(visited1[ny][nx])continue;
            if(s[ny][nx]!=-1)continue;
            if(field[ny][nx]=='#')continue;
            que.push(Pos(nx,ny));
            s[ny][nx]=id;
        }
    }
    id++;
}

void bfs2(int sx,int sy){
    deque<Pos> que;
    que.emplace_back(Pos(sx,sy));
    d[sy][sx]=0;
    while(que.size()){
        Pos p=que.front();
        que.pop_front();
        visited2[p.y][p.x]=true;
        for(int i=0;i<4;++i){
            int nx=p.x+dx[i],ny=p.y+dy[i];
            if(nx<0||nx>=W||ny<0||ny>=H)continue;
            if(field[ny][nx]=='#')continue;
            if(visited2[ny][nx])continue;
            que.emplace_front(Pos(nx,ny));
            d[ny][nx]=d[p.y][p.x];
        }
        for(int i=-2;i<=2;++i){
            for(int j=-2;j<=2;++j){
                int nx=p.x+i,ny=p.y+j;
                if(nx<0||nx>=W||ny<0||ny>=H)continue;
                if(s[ny][nx]==s[p.y][p.x])continue;
                if(field[ny][nx]=='#')continue;
                if(visited2[ny][nx])continue;
                if(d[ny][nx]<=d[p.y][p.x]+1)continue;
                que.emplace_back(Pos(nx,ny));
                d[ny][nx]=d[p.y][p.x]+1;
            }
        }
    }
}

signed main(){
    init();
    cin>>H>>W;
    cin>>Ch>>Cw;
    cin>>Dh>>Dw;
    Ch--,Cw--;
    Dh--,Dw--;
    for(int i=0;i<H;++i)cin>>field[i];
    for(int y=0;y<H;++y){
        for(int x=0;x<W;++x){
            if(field[y][x]=='#')continue;
            if(s[y][x]!=-1)continue;
            bfs1(x,y);
        }
    }
    bfs2(Cw,Ch);
    if(d[Dh][Dw]==INF)cout<<-1<<endl;
    else cout<<d[Dh][Dw]<<endl;
}

Measured memory_bytes: 23216
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <limits>
#include <numeric>
#include <cmath>

using namespace std;

template<class T>
class Input {
public:
    auto operator()() const {
        T v;
        cin >> v;
        return v;
    }
};

template<class L, class R>
class Input<pair<L, R>> {
public:
    auto operator()() const {
        L l;
        R r;
        cin >> l >> r;
        return make_pair(l, r);
    }
};

template<class U>
class Input<vector<U>> {
public:
    auto operator()() const {
        Input<size_t> in{};
        auto n = in();
        return (*this)(n);
    }
    auto operator()(size_t n) const {
        vector<U> v;
        v.reserve(n);
        Input<U> in{};
        for (size_t i = 0; i < n; ++i) {
            auto u = in();
            v.emplace_back(move(u));
        }
        return v;
    }
};

template<class U>
class Input<vector<vector<U>>> {
public:
    auto operator()() const {
        Input<size_t> in{};
        auto n = in();
        auto m = in();
        return (*this)(n, m);
    }
    auto operator()(size_t n, size_t m) const {
        vector<vector<U>> v;
        v.reserve(n);
        Input<vector<U>> in{};
        for (size_t i = 0; i < n; ++i) {
            auto u = in(m);
            v.emplace_back(move(u));
        }
        return v;
    }
};

class InputType
{
public:
    template<class T>
    operator T() const {
        Input<T> i{};
        return i();
    }
};

auto input() {
    return InputType();
}

size_t bitcount(size_t n) {
    size_t c = 0;
    while (n) {
        if (n & 1ull)
            ++c;
        n >>= 1;
    }
    return c;
}

auto make_order(size_t n) {
    vector<size_t> a(n, 0);
    iota(begin(a), end(a), 0);
    return a;
}

template<class T>
auto next_permutation(T&& x) {
    using std::begin;
    using std::end;
    return next_permutation(begin(x), end(x));
}

using ll = long long;
using ull = unsigned long long;

int main() {
    size_t n = input();
    vector<size_t> p(n, 0);
    for (size_t i = 0; i < n; ++i) {
        p[i] = input();
        --p[i];
    }
    vector<size_t> q(n, 0);
    for (size_t i = 0; i < n; ++i) {
        q[i] = input();
        --q[i];
    }
    vector<vector<size_t>> orders;
    orders.reserve(40320);
    auto order = make_order(n);
    do{
        orders.emplace_back(order);
    }while(next_permutation(order));
    sort(begin(orders), end(orders));
    auto it1 = lower_bound(begin(orders), end(orders), p);
    auto it2 = lower_bound(begin(orders), end(orders), q);
    auto a = ll(it1 - begin(orders) + 1);
    auto b = ll(it2 - begin(orders) + 1);
    cout << abs(a - b) << endl;
    return 0;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    ll d = c - (a + b);
    if(d > 0) {
        if(4 * a * b < d * d) cout << "Yes" << endl;
        else cout << "No" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
S = list(input())
min = 1000
for i in range(len(S)-2):
    if abs(753-(100*int(S[i]) + 10*int(S[i+1]) + int(S[i+2]))) <= min:
        min = abs(753-(100*int(S[i]) + 10*int(S[i+1]) + int(S[i+2])))
print(min)

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

int main() {
	ll h, w, ans = 0;
	cin >> h >> w;
	ans = (h * w) >> 1;
	if (h == 1 || w == 1) {
		cout << "1" << endl;	return 0;
	}
	if ((h & 1) && (w & 1))		ans++;
	cout << ans << endl;
	return 0;
}

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

public class Main {
	public static void main (String[] args) throws IOException
	{
		BufferedReader input = new BufferedReader (new InputStreamReader (System.in));

		int[] alphabet = new int[26];

		char moji;

		char MOJI;

		//配列の初期化
		for(int num = 0; num < alphabet.length; num++)
		{
			alphabet[num] = 0;
		}

		//何行読み取るか
		while(true)
		{
			String str = input.readLine();

			if(str == null || str.length() == 0)
				break;

			//文字列のアルファベットの数を数える
			for(int num = 0; num < str.length(); num++)
			{
				moji = 'a';

				MOJI = 'A';

				for(int kazu = 0; kazu < alphabet.length; kazu++, moji++, MOJI++)
				{
					if(str.charAt(num) ==  moji || str.charAt(num) ==  MOJI)
					{
						alphabet[kazu]++;

					break;
					}
				}
			}
		}

		moji = 'a';

		//結果を表示する
		for(int num = 0; num < alphabet.length; num++, moji++)
		{
			System.out.println(moji + " : " + alphabet[num]);
		}

	}
}



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

int main() {
    int N;
    cin >> N;
    map<ll, ll> A;
    rep(i, N) {
        ll tmp;
        cin >> tmp;
        A[tmp]++;
    }

    vl st;
    for (auto x : A) {
        int y = x.second;
        while (y >= 2) {
            y -= 2;
            st.push_back(x.first);
        }
    }

    if (st.size() < 2) {
        cout << 0 << endl;
    } else {
        sort(st.begin(), st.end());
        reverse(st.begin(), st.end());

        ll ans = st[0] * st[1];

        cout << ans << endl;
    }
}

Measured memory_bytes: 9684
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF LLONG_MAX/10
#define rep(i,n) for(int i=0;i<n;i++)
#define krep(i,k,n,m) for(int i=k;i<n;i+=m)
#define erep(i,k,n) for(int i=k;i<n;i++)
#define mod 1000000007
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}

signed main(){
    int n,m;
    cin>>n>>m;
    int a[n],b[n];
    rep(i,n){
        cin>>a[i];
    }
    rep(i,n){
        b[i]=0;
    }
    int x=0,wkey=0;
    while(1){
        wkey++;
        m--;
        if(m==0){
            cout<<a[x]<<endl;
            return 0;
        }
        if(b[x]!=0){
            wkey=wkey-b[x];
            break;
        }
        else{
            b[x]=wkey;
        }
        x=a[x]-1;
    }
    m=m%wkey;
    rep(i,m+1){
        x=a[x]-1;
    }
    cout<<x+1<<endl;
}


Measured memory_bytes: 6768
# 2019-11-12 22:40:44(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    *antennas, k = [int(x) for x in sys.stdin.read().split()]
    if antennas[-1] - antennas[0] > k:
            print(':(')
            sys.exit()
    print('Yay!')

if __name__ == "__main__":
    main()


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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;

void solve() {
  int X[] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
             1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  cout << X[K - 1] << endl;
}

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

  solve();

  return 0;
}


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

vector<int> t(200000);
vector<int> x(200000);
vector<int> y(200000);
int N;

bool solve()
{
	for (int i = 1; i < N+1; ++i)
	{
		int dist = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]);
		int time = t[i] - t[i-1];
		if (time < dist) return false;
		if (dist % 2 != time % 2) return false;
	}
	return true;
}


int main(int argc, char **argv)
{
	cin >> N;
	t[0] = x[0] = y[0] = 0;
	for (int i = 0; i < N; ++i)
		cin >> t[i+1] >> x[i+1] >> y[i+1];
	std::cout << (solve() ? "Yes" : "No") << std::endl;

}


Measured memory_bytes: 2560
<?php
$line = explode(' ', trim(fgets(STDIN)));
$res = array();
foreach ($line as $val) {
    if (array_key_exists($val, $res)) { $res[$val]++; }
    else { $res[$val] = 1; }
}
$mastr; $maxstr;
$ma = $maxlen = 0;
foreach ($res as $key => $val) {
    if (strlen($key) > $maxlen) { $maxlen = strlen($key); $maxstr = $key; }
    if ($val > $ma) {$mastr = $key; $ma = $val; }
}
echo $mastr . ' ' . $maxstr . PHP_EOL;

?>


Measured memory_bytes: 9248
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	int res=0;
	int mx=0;
	for(int i=0;i<3;i++){
		if(s[i]=='R')res++;
		else {
			mx=max(mx,res);
			res=0;
		}
	}
	cout << max(res,mx) << endl;
}

Measured memory_bytes: 3640