akhauriyash/Code-Regression huggingface dataset:
N = int(input())
ss = [input() for _ in range(N)]

M = int(input())
ts = [input() for _ in range(M)]

count = {}

for s in ss:
  if s in count:
    count[s] += 1
  else:
    count[s] = 1

for t in ts:
  if t in count:
    count[t] -= 1
  else:
    count[t] = -1
    
print(max(max(count.values()), 0))

Measured memory_bytes: 3064
#define MAX 100
#include <iostream>

using namespace std;
int a[MAX];
int n;
int count;

void show(){
	int i;
	for(i=0;i<n;i++){
		if(i)cout<<" ";
		cout<<a[i];
	}
	cout<<endl;
	cout<<count<<endl;
}

void selectionSort(int* a,int n){
	int i,j;
	int min;
	int flag;

	for(i=0;i<n-1;i++){
		flag=0;
		min=i;
		for(j=i;j<n;j++){
			if(a[min]>a[j]){
				min=j;
				flag=1;
			}
		}
		swap(a[min],a[i]);
		if(i!=min)++count;
	}
	return;
}

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

	selectionSort(a,n);
	show();

	return 0;
}

Measured memory_bytes: 1160
#define _USE_MATH_DEFINES
#include <array>
#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>
#include <functional>
#include <random>
#include <ctime>

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 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int main() {
  int n;
  scanf("%d", &n);
  vector<int64> pre(n + 1);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    pre[i + 1] = pre[i] + x;
  }
  int64 all = pre[n], ret = 1LL << 60;
  for (int i = 0; i <= n; ++i) {
    int64 cur = abs(all - pre[i] - pre[i]);
    ret = min(ret, cur);
  }
  printf("%lld\n", ret);
  return 0;
}


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

int main() {
    
    int K;
    string S;
    cin >> K >> S; 

    int S_len = S.size();
    
    
    if (S_len <= K) {
        cout << S << endl;
    }
    
    else {cout << S.substr(0,K) << "..." << endl;
         }
    
}



Measured memory_bytes: 3584
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = min(a) + min(b)

for i in range(M):
    x, y, c = map(int, input().split())
    ans = min(ans, a[x - 1] + b[y - 1] - c)

print(ans)


Measured memory_bytes: 18612
#include<bits/stdc++.h>
#define randome_generate srand(std::chrono::high_resolution_clock::now().time_since_epoch().count())
using namespace std;
struct queuepii{//模拟一个BFS队列 
	pair<int,int> dat[640100];
	int h,t;
	void init(){
		h=1;
		t=0;
	}
	void push(pair<int,int> x){
		t++;
		dat[t]=x;
	}
	pair<int,int> front(){
		return dat[h];
	}
	void pop(){
		h++;
	}
	int size(){
		return t-h+1;
	}
	bool empty(){
		return size()>0;
	}
};
queuepii q;
int n,m,k,x,y,nx,ny;
char grid[1000][1000];
int dist[1000][1000];
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	q.init();
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin>>grid[i][j];
			dist[i][j]=1e9;
			if(grid[i][j]=='S'){
				dist[i][j]=0;
				q.push(make_pair(i,j));
			}
		}
	}
	int tmp=1e9,ans;
	while(q.size()){
		x=q.front().first;
		y=q.front().second;
		q.pop();
		tmp=min(tmp,min(min(x-1,n-x),min(y-1,m-y)));
		for(int i=0;i<4;i++){
			nx=x+dx[i];
			ny=y+dy[i];
			if(nx>=1&&nx<=n&&ny>=1&&ny<=m&&grid[nx][ny]=='.'){
				if(dist[nx][ny]>dist[x][y]+1){
					dist[nx][ny]=dist[x][y]+1;
					if(dist[nx][ny]<=k){
						q.push(make_pair(nx,ny));
					}
				}
			}
		}
	}
	ans=(tmp+k-1)/k+1;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 10112
def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))

import math
a,b,h,m = mp()
hkaku = h*30+m*0.5
mkaku = m*6
cos = math.cos((mkaku-hkaku)*math.pi/180)
u = a**2+b**2-2*a*b*cos
print(math.sqrt(u))


Measured memory_bytes: 62360
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}


int main() {
    string s;
    cin >> s;
    vector<char> ss;
    rep(i,s.size()) {
        if (s[i]=='C' || s[i]=='F') ss.pb(s[i]);
    }
    for(int i=1; i<ss.size(); ++i) {
    if (ss[i-1]=='C' && ss[i]=='F') {
        cout << "Yes" << "\n";
        return 0;
    }
    }
        cout << "No" << "\n";
}


Measured memory_bytes: 256
using System.Collections.Generic;
using System.Linq;
using System;
using static System.Console;

class Program
{
  static void Main() => new Program().solve();

  void solve()
  {
    var HW = ReadLine().Split(' ').Select(int.Parse).ToArray();
    var H = HW[0];
    var W = HW[1];
    var yx = ReadLine().Split(' ').Select(int.Parse).ToArray();
    var y = yx[0];
    var x = yx[1];

    var ans = H * W - (y * W + x * H - y * x);
    WriteLine(ans);
  }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define pb emplace_back
#define mp make_pair
#define int long long

using namespace std;

int32_t main()
{
	ios::sync_with_stdio(false); cin.tie(NULL); cout.precision(10);
	int a; cin >> a;
	int b; cin >> b;
	int c; cin >> c;
	int d; cin >> d;
	int l = (c * d) / __gcd(c, d);
	int cc = b / c - (a - 1ll) / c;
	int dd = b / d - (a - 1ll) / d;
	int ee = b / l - (a - 1ll) / l;
	cout << ((b - a + 1) - (cc + dd - ee));
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    ll x, k, d; cin >> x >> k >> d;
    x = abs(x);
    
    ll ans;
    ll cnt = x / d;

    if(cnt > k) ans = x - d * k;
    else if(cnt % 2 == k % 2){
        ans = x % d;
    }else{
        ans = x % d - d;
    }

    cout << abs(ans) << endl;
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n,m;
  cin >> n >> m;
  vector<int> p(m,0);
  rep(i,n){
    int k;
    cin >> k;
    rep(i,k){
      int a;
      cin >> a;
      a--;
      p.at(a)++;
    }
  }
  int ans = 0;
  rep(i,m){
    if(p.at(i)==n){
      ans++;
    }
  }
  cout << ans << endl;
}


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

int main(){
  int n,m;
  int a[51] = {};
  cin >> n >> m;
  for (int i=0; i<m; i++){
    int s,t;
    cin >> s >> t;
    a[s]++;
    a[t]++;
  }
  for (int i=1; i <=n; i++){
    cout << a[i] << endl;
  }
}

Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
import java.util.Deque;
import java.util.ArrayDeque;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        char[] input = br.readLine().toCharArray();
        Deque<Integer> stack = new ArrayDeque<Integer>();
        ArrayList<int[]> puddles = new ArrayList<int[]>();

        for (int i = 0; i < input.length; i++) {
            if (input[i] == '\\') {
                stack.push(i);
            } else if (input[i] == '/' && !stack.isEmpty()) {
                puddles.add(new int[] {stack.pop(), i});
            }
        }

        ArrayList<Integer> areas = new ArrayList<Integer>();
        int area;
        int totalArea = 0;
        for (int i = 0; i < input.length; i++) {
            for (int[] puddle: puddles) {
                if (puddle[0] == i) {
                    area = puddle[1] - puddle[0] + calcArea(puddle[0] + 1, puddle[1] - 1, puddles);
                    areas.add(area);
                    totalArea += area;
                    i = puddle[1] + 1;
                }
            }
        }

        StringBuilder sb = new StringBuilder();
        sb.append(totalArea).append("\n").append(areas.size());
        if (areas.size() > 0) {
            sb.append(" ").append(areas.remove(0));
            for (int a: areas) {
                sb.append(" ").append(a);
            }
        }

        System.out.println(sb.toString());
    }

    public static int calcArea(int first, int last, ArrayList<int[]> puddles) {
        int area = 0;
        for (int i = first; i < last; i++) {
            for (int[] puddle: puddles) {
                if (puddle[0] == i) {
                    area += puddle[1] - puddle[0] + calcArea(puddle[0] + 1, puddle[1] - 1, puddles);
                    i = puddle[1] + 1;
                }
            }
        }
        return area;
    }
}

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

#define LL long long
#define RG register

using namespace std;
template<class T> inline void read(T &x) {
	x = 0; RG char c = getchar(); bool f = 0;
	while (c != '-' && (c < '0' || c > '9')) c = getchar(); if (c == '-') c = getchar(), f = 1;
	while (c >= '0' && c <= '9') x = x*10+c-48, c = getchar();
	x = f ? -x : x;
	return ;
}
template<class T> inline void write(T x) {
	if (!x) {putchar(48);return ;}
	if (x < 0) x = -x, putchar('-');
	int len = -1, z[20]; while (x > 0) z[++len] = x%10, x /= 10;
	for (RG int i = len; i >= 0; i--) putchar(z[i]+48);return ;
}
const int N = 3e5 + 10;
struct node {
	int x, y;
	bool operator < (const node &z) const {
		return x < z.x;
	}
} a[N];
#define lson (o << 1)
#define rson (o << 1 | 1)
int T[N << 2], P[N << 2], n, W, H;
void pushdown(int o, int l, int r) {
	P[lson] += P[o]; P[rson] += P[o];
	T[lson] += P[o]; T[rson] += P[o];
	P[o] = 0;
}
void pushup(int o) { T[o] = max(T[lson], T[rson]); }
void Modify(int o, int l, int r, int L, int R, int k) {
	if (L <= l && r <= R) { P[o] += k, T[o] += k; return ; }
	pushdown(o, l, r); int mid = (l + r) >> 1;
	if (L <= mid) Modify(lson, l, mid, L, R, k);
	if (R > mid) Modify(rson, mid + 1, r, L, R, k);
	pushup(o);
}
int ans, Q1[N], Q2[N], top1, top2;
void solve() {
	sort(a + 2, a + n + 1);
	memset(T, 0, sizeof(T));
	memset(P, 0, sizeof(P));
	Modify(1, 1, n, 1, n, H);
	top1 = top2 = 0;
	Q1[top1] = Q2[top2] = 1;
	int h = H >> 1;
	for (int i = 2; i <= n; i++) {
		Modify(1, 1, n, 1, i - 1, a[i].x - a[i - 1].x);
		ans = max(ans, T[1]);
		if (a[i].y >= h) {
			Modify(1, 1, n, Q1[top1], i - 1, a[i].y - H);
			while (top1 && a[Q1[top1]].y > a[i].y) {
				Modify(1, 1, n, Q1[top1 - 1], Q1[top1] - 1, a[i].y - a[Q1[top1]].y);
				top1--;
			}
			Q1[++top1] = i;
		}
		else {
			Modify(1, 1, n, Q2[top2], i - 1, -a[i].y);
			while (top2 && a[Q2[top2]].y < a[i].y) {
				Modify(1, 1, n, Q2[top2 - 1], Q2[top2] - 1, a[Q2[top2]].y - a[i].y);
				top2--;
			}
			Q2[++top2] = i;
		}
	}
	return ;
}
int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	read(W), read(H), read(n); n++;
	for (int i = 2; i <= n; i++) read(a[i].x), read(a[i].y);
	a[++n] = (node) {W, H};
	solve();
	swap(W, H); for (int i = 1; i <= n; i++) swap(a[i].x, a[i].y);
	solve();
	printf("%d\n", ans << 1);
	return 0;
}


Measured memory_bytes: 12800
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int R;
    cin >> R;
    if (R < 1200) {
        cout << "ABC" << endl;
    } else if (R < 2800) {
        cout << "ARC" << endl;
    } else {
        cout << "AGC" << endl;
    }
    return 0;
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)      //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++)    //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int,int> PII;
template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

/* 円周率は M_PI を使おうね */
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;

/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(10);
    
    int n, m, a;
    vii AMIDA(101, vi(1001,0));
    vii amida;
    while(cin>>n>>m>>a) {
        if(n==0&&m==0&&a==0) break;
        
        amida = AMIDA;
        rep(_,m) {
            int h,p,q;
            cin >> h >> p >> q;
            amida[p][h] = q;
            amida[q][h] = p;
        }
        int ans = a;
        int h =1000;
        while(h > 0) {
            if(amida[ans][h] == 0) --h;
            else {
                ans = amida[ans][h];
                --h;
            }
        }
        cout << ans << '\n';
    }
}


Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
#include <functional>
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<string> VS;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<PII> VPI;
typedef vector<PLL> VPL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  int N;
  cin>>N;
  VL A(N),B(N);
  rep(i,N) cin>>A[i]>>B[i];
  sort(all(A));
  sort(all(B));
  if(N%2){
    cout<<B[N/2]-A[N/2]+1<<endl;
  }else{
    cout<<B[N/2-1]+B[N/2]-A[N/2-1]-A[N/2]+1<<endl;
  }
}

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

#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define MAX 1e9
#define MIN -1e9
#define mod 1000000007
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define mxn 300005
using namespace std;

int main()
{
	FLASH
	ll x,a;
	cin >> x;
	if(x <= 599)a = 8;
	else if(x <= 799)a = 7;
	else if(x <= 999)a = 6;
	else if(x <= 1199)a = 5;
	else if(x <= 1399)a = 4;
	else if(x <=1599)a =3;
	else if(x <= 1799)a = 2;
	else a = 1;
	cout << a;
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <regex>

int main() {
  std::regex re(R"(\d+\s\d+)");
  std::string s;
  while(std::getline(std::cin, s))
    if (!std::regex_match(s, re)) std::cout << s << "\n" << s << "\n";
}


Measured memory_bytes: 3160
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, H);
    IN(ll, W);
    ll ans;
    if (H == 1 or W == 1)
    {
        ans = 1;
    }
    else
    {
        ans = (H * W + 1) / 2;
    }
    OUT(ans);
}

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

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define int ll
#define endl "\n"
#define all( x ) x.begin(), x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);

typedef unsigned long long ull;

const int inf = 1e16 + 5;
const long double PI = 3.141592653589793;

void solve(){
  int n, t, ans = 0;
  cin >> n >> t;
  vector<int> arr(n+1);
  for(int i = 0;i<n;i++)cin >> arr[i];
  arr[n] = inf;
  for(int i = 0; i <n; ++i){
    
    ans += min(t, arr[i+1] - arr[i]);
  }
  cout << ans << endl;
  return;
}  
signed main(){
  fast;
  int t;
  t = 1;
  //cin>>t;
  while(t--){
    solve();
  }
}



Measured memory_bytes: 4704
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        
        final int N = Integer.parseInt(sc.next());
        final int M = Integer.parseInt(sc.next());
        int[] ac = new int[N];
        int[] wa = new int[N];
        
        for (int i = 0; i < M; i++) {
            int p = Integer.parseInt(sc.next());
            String s = sc.next();
            p--;
            if (ac[p] == 1) {
            } else if (s.equals("AC")) {
                ac[p]++;
            } else {
                wa[p]++;
            }
        }
        int asum = 0;
        int wsum = 0;
        for (int i = 0; i < N; i++) {
            asum += ac[i];
            if (ac[i] == 1) wsum += wa[i];
        }
        
        out.println(asum + " " + wsum);
        
        out.flush();
    }
}

Measured memory_bytes: 51408
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    d=parseMap(split(readline()))
    m=parseInt(readline())
    t=parseMap(split(readline()))
    cnt=Dict{Int,Int}()
    for i in t
        if haskey(cnt,i)
            cnt[i]+=1
        else
            cnt[i]=1
        end
    end
    for i in d
        if haskey(cnt,i)
            cnt[i]-=1
        end
    end
    ans="YES"
    for i in values(cnt)
        if i>0
            ans="NO"
            break
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 150024
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>


typedef long long ll;
typedef long double ld;

using namespace std;

const int MAXN = 100100;
int n;
char s[MAXN];

int main() {
	scanf("%s", s);
	n = strlen(s);
	for (int i = 0; i < n; ++i)
		for (int j = i + 1; j <= i + 2 && j < n; ++j) {
			if (s[i] == s[j]) {
				cout << i + 1 << " " << j + 1 << "\n";
				return 0;
			}
		}
	cout << -1 << " " << -1 << "\n";
	return 0;
}




Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
  int A, B;

  cin >> A >> B;
  if(A <= 5){
   cout << 0 <<endl; 
  }else{
    if(A < 13){
      cout << B/2 <<endl;
    }else{
      cout << B <<endl;
    }
  }
  return 0;
}


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

int main(){
  int N,L;
  cin >> N >> L;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  bool a=false;
  int C;
  for(int i=0;i<N-1;i++){
    if(A.at(i)+A.at(i+1)>=L){
      C=i+1;
      a=true;
      break;
    }
  }
  if(!a){
    cout << "Impossible" << endl;
  }
  else{
    cout << "Possible" << endl;
    for(int i=1;i<C;i++){
      cout << i << endl;
    }
    for(int i=N-1;i>C;i--){
      cout << i << endl;
    }
    cout << C << endl;
  }
}

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

int main() {
    int N, K; cin >> N >> K;
    
    vector<int> score(N);
    for (int i = 0; i < N; i++) {
        cin >> score.at(i);
    }
    
    int j = 0;
    for (int i = K; i < N; i++) {
        if (score.at(j) < score.at(i)) cout << "Yes" << endl;
        else cout << "No" << endl;
        j++;
    }
    
}

Measured memory_bytes: 4048
using System;

class Program
{
  public struct Vector
  {
    public double x, y;
  }

  public struct Segment
  {
    public Vector p1, p2;
  }

  public static Vector project(Segment seg, Vector p)
  {
    Vector baseV, v, pro;
    baseV.x = seg.p2.x - seg.p1.x;
    baseV.y = seg.p2.y - seg.p1.y;

    v.x = p.x - seg.p1.x;
    v.y = p.y - seg.p1.y;

    double r = dot(v, baseV) / norm(baseV);

    pro.x = seg.p1.x + baseV.x*r;
    pro.y = seg.p1.y + baseV.y*r;
    return pro;
  }

  public static Vector reflect(Segment seg, Vector p)
  {
    Vector v;
    v.x = p.x + (project(seg, p).x - p.x ) * 2.0;
    v.y = p.y + (project(seg, p).y - p.y ) * 2.0;
    return v;
  }

  public static double norm(Vector v)
  {
    return v.x*v.x + v.y*v.y;
  }

  public static double dot(Vector v1, Vector v2)
  {
    return v1.x*v2.x + v1.y*v2.y;
  }

  public static void Main()
  {
    string[] s = Console.ReadLine().Split(' ');
    Vector v1, v2;
    v1.x = int.Parse(s[0]);
    v1.y = int.Parse(s[1]);
    v2.x = int.Parse(s[2]);
    v2.y = int.Parse(s[3]);

    Segment seg;
    seg.p1 = v1;
    seg.p2 = v2;

    int n = int.Parse(Console.ReadLine());
    for(int i=0; i<n; i++)
      {
	string [] s2 = Console.ReadLine().Split(' ');
	Vector v;
	v.x = int.Parse(s2[0]);
	v.y = int.Parse(s2[1]);

	Vector ans = reflect(seg, v);
	Console.WriteLine("{0:f10} {1:f10}", ans.x, ans.y);
      }
  }
}

Measured memory_bytes: 9288
#include <bits/stdc++.h>
using namespace std;
#define REP(i, m, n) for(int i = m; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define dup(x, y) (((x) + (y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template <class T> inline void chmax(T &a, T b) {
    if(a < b) {
        a = b;
    }
}
template <class T> inline void chmin(T &a, T b) {
    if(a > b) {
        a = b;
    }
}
template <class T> inline T gcd(T x, T y) {
    if(y == 0) {
        return x;
    } else if(x == 0) {
        return y;
    }
    return gcd(y, x % y);
}
template <class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template <class T> inline void print_vector(vector<T> vec) {
    for(int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    cout << endl;
}
const LL MOD = 1e9 + 7;
const LL LLINF = 1LL << 60;
const int INF = 1 << 30;

int main(void) {
    int N, K;
    cin >> N >> K;

    vector<int> converted_num;
    while(N != 0) {
        converted_num.push_back(N % K);
        N /= K;
    }

    cout << converted_num.size() << endl;
    return 0;
}

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

#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;


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

    string s;
    cin >> s;
    int n = s.size();
    ll t = 0;
    bool B = false;
    ll rez = 0;
    for(int i = 0; i < n; i++)
    {
        if(s[i] == 'A')
        {
            if(B)
            {
                B = false;
                t = 1;
            }
            else t++;
        }
        else
        {
            if(s[i] == 'B')
            {
                if(B)
                {
                    t = 0;
                    B = false;
                }
                else B = true;
            }
            if(s[i] == 'C')
            {
                if(!B) t = 0;
                else
                {
                    rez += t;
                    B = false;
                }
            }
        }
    }
    cout << rez;

    return 0;
}


Measured memory_bytes: 720
#include <iostream>

using namespace std;

int main(){
  int A, B;
  cin >> A; cin >> B;
  int n = 1;
  int count = 0;
  
  if(B == 1)
    cout << "0" << endl;
  else{
    count++;
    while((n = n-1+A) < B)
      count++;
    cout << count << endl;
  }
  /*  if(B == 1)
    cout << "0" << endl;
  else if(B%A == 0)
    cout << B/A;
  else if(A != B)
    cout << B/A+1 << endl;
  else
    cout << "1" << endl;
  */
  return 0;
}


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

using namespace std;

int main() {
    long long n, k;
    scanf("%lld %lld", &n, &k);

    vector<long long> h(n);
    for (auto&& i : h) {
        scanf("%lld", &i);
    }

    sort(h.begin(), h.end(), greater<long long>());

    long long count = 0;

    for (auto&& i : h) {
        if (k > 0) {
            k--;
            i = 0;
        }
        else {
            count += i;
            i = 0;
        }
    }

    printf("%lld\n", count);

    return 0;
}

Measured memory_bytes: 1792
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <iostream>  // cout, endl, cin
#include <vector>    // vector

using namespace std;

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

typedef long long ll;

typedef vector<ll> vll;
typedef vector<bool> vb;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
}

void Main()
{
  ll n, m; cin >> n >> m;
  vb flag(n, true);
  vll a(m); rep(i, m) { cin >> a[i]; flag[a[i]] = false;}
  vll dp(n + 1, 0);
  dp[0] = 1;
  if(flag[1]) dp[1] = 1;
  for(ll i = 2;i <= n;i++)
  {
    if(flag[i]) dp[i] += dp[i - 2] + dp[i - 1];
    dp[i] %= MOD;
    //cout << i << " " << dp[i] << endl;
  }
  fin(dp[n]);
}

//前処理
int main()
{
  Main();
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
typedef long long int ll;
#define x first
#define y second
#define codec ios_base::sync_with_stdio(false);cin.tie(NULL);
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef pair<int, int> pi;
int main()
{
  codec;
  int d,t,s;
  cin>>d>>t>>s;
  float sp=float(d)/t;
  if(s>=sp)
    cout<<"Yes";
  else
    cout<<"No";
  
}

Measured memory_bytes: 3648
import Control.Applicative

rotate :: Int -> Char -> Char
rotate i c
  | fromEnum c == 46 = c  -- c == '.'
--  | fromEnum c == 10 = c  -- c == '\n'
  | otherwise        = toEnum $ (fromEnum c - 97 + i) `mod` 26 + 97

caesar :: [String] -> Int -> [String]
caesar [] _ = []
caesar (x:xs) i = map (rotate i) x : caesar xs i



decode' :: Int -> [String] -> [String]
decode' _ [] = []
decode' 0  _ = []
decode' n xs =
  let cand = caesar xs n
      ans1 = "this" `elem` cand
      ans2 = "that" `elem` cand
      ans3 = "the"  `elem` cand
  in
      if ans1 || ans2 || ans3 then cand
      else decode' (n-1) xs

solver :: [[String]] -> [[String]]
solver = map (decode' 26)

main :: IO()
main = do
  inputs <- lines <$> getContents
  let inp' = map words inputs
  mapM_ (putStrLn . unwords)  (solver inp')

Measured memory_bytes: 3956
#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define f			first
#define sz(a)       ((int)(a).size())
#define s			second
#define all(v)		v.begin(),v.end()
#define pii 		pair<int,int>
#define vpii 		vector<pii>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)		for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define vi			vector<int>
#define deb(x)		cout << #x << " " << x << endl

using namespace std;
using ll  = long long;
using lld = long double;

const int oo = 0x3f3f3f3f;
const ll MOD = 1000000007;

const int N = 105;
const int W = 1e5 + 10;

void relax(ll & a , ll b){
    a = max(a , b);
}

ll dp[N][W];
ll v[N] , w[N];
signed main(){

#ifndef ONLINE_JUDGE
	//freopen("in.txt" , "r" , stdin);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);

    int n , cap;
    cin >> n >> cap;
    fo(i , n) cin >> w[i] >> v[i];
    
    dp[0][0] = 0;
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j <= cap ; j++){
            if(j + w[i] <= cap)
                relax(dp[i + 1][j + w[i]] , v[i] + dp[i][j]);
            relax(dp[i + 1][j] , dp[i][j]);
        }

    cout << dp[n][cap] << '\n';

    return 0;
}



Measured memory_bytes: 81764
import statistics as s

n = int(input())

minn = []
maxx = []

for i in range(0,n):
    temp = [int(x) for x in input().split()]

    minn.append(temp[0])
    maxx.append(temp[1])

a = s.median(minn)
b = s.median(maxx)

if n%2 == 1:
    print(int(b-a+1))
else:
    print(int(((b-a)/0.5)+1))


Measured memory_bytes: 28856
#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
	char seg[10][7] = {
		{0, 1, 1, 1, 1, 1, 1},
	   	{0, 0, 0, 0, 1, 1, 0}, 
		{1, 0, 1, 1, 0, 1, 1},
	   	{1, 0, 0, 1, 1, 1, 1}, 
		{1, 1, 0, 0, 1, 1, 0},
	   	{1, 1, 0, 1, 1, 0, 1}, 
		{1, 1, 1, 1, 1, 0, 1},
	   	{0, 1, 0, 0, 1, 1, 1}, 
		{1, 1, 1, 1, 1, 1, 1},
	   	{1, 1, 0, 1, 1, 1, 1}
	};
	int n, m;
	char dis[7];

	while (1){
		scanf("%d", &n);
		if (n == -1){
			break;
		}

		for (int i = 0; i < 7; i++){
			dis[i] = 0;
		}

		for (int i = 0; i < n; i++){
			scanf("%d", &m);
			for (int j = 0; j < 7; j++){
				if (dis[j] != seg[m][j]){
					dis[j] = seg[m][j];
					printf("1");
				}
				else {
					printf("0");
				}
			}
			printf("\n");
		}
	}

	return (0);
}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;

class Main {
	public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			String[] inputList = br.readLine().split(" ");
			int n = Integer.parseInt(inputList[0]);
			int m = Integer.parseInt(inputList[1]);
			int l = Integer.parseInt(inputList[2]);
			int[][] a = new int[n][m];
			int[][] b = new int[m][l];
			BigInteger[][] c = new BigInteger[n][l];
			int i, j, k;
			for (i = 0; i < n; i++) {
				inputList = br.readLine().split(" ");
				for (j = 0; j < m; j++) {
					a[i][j] = Integer.parseInt(inputList[j]);
				}
			}
			for (i = 0; i < m; i++) {
				inputList = br.readLine().split(" ");
				for (j = 0; j < l; j++) {
					b[i][j] = Integer.parseInt(inputList[j]);
				}
			}

			for (i = 0; i < c.length; i++) {
				for (j = 0; j < c[i].length; j++) {
					c[i][j] = BigInteger.ZERO;
				}
			}

			String text = "";
			for (i = 0; i < n; i++) {
				for (j = 0; j < m; j++) {
					for (k = 0; k < l; k++) {
						c[i][k] = c[i][k].add(BigInteger.valueOf(a[i][j]).multiply(BigInteger.valueOf(b[j][k])));
					}
				}

				text = "";
				for (k = 0; k < l; k++) {
					text = text + c[i][k] + " ";
				}
				System.out.println(text.substring(0, text.length() - 1));
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 158420
;; -*- coding:utf-8 -*-

(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter O3 '(optimize (speed 3) (safety 0) (debug 0)))
  (defparameter O2 '(optimize (speed 3) (safety 1))))

(defmacro print-line (obj &optional (stream '*standard-output*))
  `(prog1 (princ ,obj ,stream) (terpri ,stream)))


;; Hauptteil

(defmacro split-and-bind (arg-lst string &body body)
  (let ((pos1 (gensym "POS"))
	(pos2 (gensym "POS"))
	(str-evaled (gensym "STR")))
    (labels ((expand (arg-lst &optional (init-pos1 t))
	       (if (null arg-lst)
		   `(progn ,@body)
		   `(let* ((,pos1 ,(if init-pos1 0 `(1+ ,pos2)))
			   (,pos2 (position #\space ,str-evaled :start ,pos1 :test #'char=))
			   (,(car arg-lst) (parse-integer ,str-evaled :start ,pos1 :end ,pos2)))
		      ,(expand (cdr arg-lst) nil)))))
      `(let ((,str-evaled ,string))
	 ,(expand arg-lst)))))

(deftype unum () '(integer 0 1000000000))
(defun main ()
  (declare #.O3)
  (let* ((n (read))
	 (init-hp (read))
	 (arr-a (make-array n :element-type 'unum))
	 (arr-b (make-array n :element-type 'unum)))
    (dotimes (idx n)
      (split-and-bind (a b) (the string (read-line))
	(setf (aref arr-a idx) a
	      (aref arr-b idx) b)))
    (let* ((max-a (loop for idx from 0 below n maximize (aref arr-a idx)))
	   (arr-b (sort arr-b #'>=))
	   (end-idx (loop for idx from 0
		       do (cond ((= idx n) (return n))
				((> max-a (aref arr-b idx))
				 (return idx))))))
      (print-line
       (loop for idx of-type unum from 0 below end-idx
	  and hp of-type fixnum = init-hp then (- hp (aref arr-b idx))
	  until (<= hp 0)
	  finally (return (+ idx
			     (ceiling (max hp 0) max-a))))))))

#-swank(main)


;; Für Test
(defun get-clipbrd ()
  (with-output-to-string (out)
    (run-program "C:/msys64/usr/bin/cat.exe" '("/dev/clipboard") :output out)))

(defun test ()
  (with-input-from-string (*standard-input* (delete #\return (get-clipbrd)))
    (main)))


;; Für Benchmark
(defparameter *file-path* *load-pathname*)
(defparameter *dir-path* (pathname (directory-namestring *file-path*)))
(defparameter *dat-path* (merge-pathnames "test.dat" *dir-path*))

#+swank
(with-open-file (out *dat-path*
		     :direction :output :if-exists :supersede)
  )

(defun bench ()
  (let ((*standard-output* (make-broadcast-stream)))
    (with-open-file (*standard-input* *dat-path*)
      (time (main)))))


Measured memory_bytes: 49636
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
const int MOD = 1e9 + 7;
const int INF = 1e9;
const double EPS = 1e-9;
const double pi = acos(-1);
const int N = 2e5;

long long tot = 0;
long long sisa = 0;
int n;

vector<pii> vbeda;
vector<int> vsama;


bool CF(const pii &a , const pii &b){
  int sela = a.fi - a.se;
  int selb = b.fi - b.se;
  if(sela != selb) return sela < selb;
  return a.fi > b.fi;
}
int main(){
  scanf("%d", &n);
  for(int i = 0;i < n; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    if(a < b){
      tot += a;
      sisa += b - a;
    }
    else if(a == b){
      vsama.push_back(a);
    }
    else{
      vbeda.push_back(mp(a, b));
    }
  }
  if(vsama.size() == n){
    puts("0");
    return 0;
  }
  for(int i = 0;i < (int) vsama.size(); ++i) tot += vsama[i];
  sort(vbeda.begin(), vbeda.end(), CF);
  if(vbeda.size()){
    for(int i = 0;i < (int) vbeda.size(); ++i) tot += vbeda[i].fi;
    int mins = INF;
    for(int i = 0;i < (int) vbeda.size(); ++i) mins = min(mins, vbeda[i].se);
    tot -= mins;
  }
  
  printf("%lld\n", tot);
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(void){
  int d,g,i,j,p[11],c[11],t,r,ans=1e9;
  cin >> d >> g;
  for (i=0;i<d;i++) cin >> p[i] >> c[i];
  for (i=0;i<(1<<d);i++){
    t=0;
    r=g;
    for (j=0;j<d;j++) if ((i>>j)%2==1){
      r-=(j+1)*100*p[j]+c[j];
      t+=p[j];
    }
    for (j=d-1;j>=0 && r>0;j--){
      if ((i>>j)%2==1) continue;
      if (r>=(j+1)*100*(p[j]-1)){
        r-=(j+1)*100*(p[j]-1);
        t+=p[j]-1;
      }else{
        t+=(r+(j+1)*100-1)/((j+1)*100);
        r=-100;
      }
      if (r<=0) break;
    }
    if (r<=0 && ans>t) ans=t;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

ll N;

constexpr ll max_n = 1000006;
bool prime[max_n];

void solve(){
    int cnt=0;
    for(int i=2;i<=N;i++) if(prime[i]) cnt++;
    cout << cnt << endl;
}

int main(){
    rep(i,max_n) prime[i]=true;
    for(int i=2;i<max_n;i++){
        if(!prime[i]) continue;
        for(int j=2;i*j<max_n;j++) prime[i*j] = false;
    }

    while(cin>>N){
        solve();
    }
}

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

using ll = long long;
const ll mod = 1e9+7;

int main() {
    ll n, k, ans = 0;
    cin >> n >> k;

    vector<ll> arr(n+1, 0);
    arr[0] = 0;
    arr[1] = 1;
    for (int i = 2; i <= n; i++) {
        arr[i] = (arr[i-1] + i) % mod;
    }

    // for (auto x : arr) cout << x << " "; cout << endl;

    for (int i = k; i <= n; i++) {
        ll sm = arr[i-1], lr = (((arr[n] - arr[n-i])%mod) + mod) % mod;
        // cout << "i " << i << " sm " << sm << " lr " << lr << endl;
        ans = (ans + ((lr - sm) % mod + 1) % mod) % mod;
    }
    cout << ((ans+1) % mod + mod) % mod << endl;
}

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

int main(){

  double x1,x2,y1,y2;

  cin >> x1 >> y1 >> x2 >> y2;

  printf("%.8lf\n",sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) ) );

  return 0;
}

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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  ll x, a, b;
  cin >> x >> a >> b;

  cout << (x - a) % b << "\n";
}

Measured memory_bytes: 384
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner in=new Scanner(System.in);
        // int t=in.nextInt();
        // while(--t>=0){
             int n=in.nextInt();
             int x=in.nextInt();
             int t=in.nextInt();

             System.out.println((int)Math.ceil(1.0*n/x)*t);
        // }
    }
}
class scan
{
    public static BufferedReader reader;
    public static StringTokenizer token;

    scan(InputStream str)
    {
        reader=new BufferedReader(new InputStreamReader(str));
        token=null;
    }

    static int nextInt()
    {
        while(token==null||!token.hasMoreTokens())
        {
            try { token=new StringTokenizer(reader.readLine());   }
            catch(IOException e){  throw new RuntimeException(e); }
        }
        return Integer.parseInt(token.nextToken());
    }

    static long nextLong()
    {
        while(token==null||!token.hasMoreTokens())
        {
            try { token=new StringTokenizer(reader.readLine());   }
            catch(IOException e){  throw new RuntimeException(e); }
        }
        return Long.parseLong(token.nextToken());
    }

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

}

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

namespace MyProgram{
    public class Program
    {	
        public static void Main(string[] args)
    	{
           string s = Console.ReadLine();
           
           int min = 99999999;
           int n = 0;
           string ss = "";
           for(int i = 0 ; i < s.Length -2 ; i++)
           {
               ss = s.Substring(i,3);
               n = Math.Abs(753 - int.Parse(ss));
               min = Math.Min(n, min);
           }
           Console.WriteLine(min);
    	}
    }
}

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

int main () {
  int N;
  cin >> N;
  vector<long> a(3*N);
  for (int i = 0; i < 3*N; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += a.at(3*N-2-2*i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define IOS cin.tie(0); ios::sync_with_stdio(false)
using namespace std;

main() {
    int N; cin >> N;
    if(N%2==0) cout << 0.5 << endl;
    else cout << (double) ((N/2)+1)/N << endl;
    return 0;
}

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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n, sum = 0; cin >> n;
    vector<vector<ll>> g(n);
    vector<ll> c(n), ans(n);
    
    rep(i, n-1) {
        ll a, b; cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    rep(i, n) cin >> c[i];
    sort(ALL(c));
    rep(i, n-1) sum += c[i];

    queue<ll> que;
    vector<bool> used(n, false);
    que.push(0);
    used[0] = true;
    ans[0] = c[n-1];

    ll num = 1;
    while(!que.empty()) {
        ll t = que.front();
        que.pop();

        rep(i, g[t].size()) {
            ll next = g[t][i];
            if(!used[next]) {
                que.push(next);
                used[next] = true;
                ans[next] = c[n-1-num];
                num++;
            }
        }
    }

    cout << sum << endl;
    rep(i, n) cout << ans[i] << " ";
    cout << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 4296