akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

import java.io.*;

public class Main {
	private static void solve(){
	//Implement solution here.
		int n = ni();
		long[] a = new long[n];
		long[] b = new long[n];
		long[] c = new long[n];
		long result = 0L;
		long bsum = 0L;
		for(int i = 0; i < n; i++) {
			a[i] = nl();
			b[i] = nl();
			c[i] = a[i] + b[i];
			bsum += b[i];
		}
		Arrays.sort(c);
		for(int i = n - 1; i >= 0; i -= 2) {
			result += c[i];
		}
		result -= bsum;
		System.out.println(result);
	}

    //Switch input source (stdin/file)
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
        String debugDataPath = System.getenv("DD_PATH");        
        if(debugDataPath != null){
            try{
            	br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
            }catch(Exception e){
                throw new RuntimeException(e);
            }
        }
        solve();
	}

    //Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
    //Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
    //Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
    //Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
    //Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
    //Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}


Measured memory_bytes: 45040
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(){
    int a[100];
    int N;
    cin >> N;
    REP(i, N) cin >> a[i];

    int ans = 1e9;
    for(int i = -100; i <= 100; i++) {
        int t_min = 0;
        REP(j, N) {
            t_min += (i - a[j]) * (i - a[j]);
        }
        ans = min(t_min, ans);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  int m,n,w[101],l,r,mid,cnt,dan,ans;
  while(scanf("%d %d",&m,&n),m!=0||n!=0){
    l = 0;
    r = 0;
    for(int i=0;i<n;i++){
      scanf("%d",&w[i]);
      l = max(l,w[i]);
      r += w[i];
    }
    ans = r;
    while(l <= r){
      mid = (l+r)/2;
      cnt = 0;
      dan = 1;
      for(int i=0;i<n;i++){
	if(cnt+w[i] > mid){
	  cnt = 0;
	  dan++;
	}
	cnt += w[i];
      }
      
      if(dan <= m){
	ans = mid;
	r = mid-1;
      }
      else{
	l = mid+1;
      }
      
    }
    printf("%d\n",ans);
  }
  return(0);
}



Measured memory_bytes: 2556
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] a = new int[n];
		HashMap<Integer, Integer> map = new HashMap<>();
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			if (map.containsKey(a[i]) == true) {
				map.put(a[i], map.get(a[i])+1);
			} else {
				map.put(a[i], 1);
			}
		}
		long tmp = map.size() - k;
		ArrayList<Integer> array = new ArrayList<>();
		for (int key : map.keySet()) {
			array.add(map.get(key));
		}
		Collections.sort(array);
		long ans = 0;
		for (int i = 0; i < tmp; i++) {
			ans += array.get(i);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 103072
def f(s):
  m = len(s)//2
  flag = True
  for i in range(m):
    flag = flag and s[i]==s[-i-1]
  return flag

s = input()
n = (len(s)-1)//2

s1 = s[:n]
s2 = s[n+1:]

if s1==s2 and f(s1):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

const int mod = 1000000007;
int add(int a, int b) { return (a += b) < mod? a : a - mod; }
int sub(int a, int b) { return (a -= b) >=  0? a : a + mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
void adds(int& a, int b) { a = add(a, b); }
void subs(int& a, int b) { a = sub(a, b); }
void muls(int& a, int b) { a = mul(a, b); }
void maxs(int& a, int b) { a = max(a, b); }
void mins(int& a, int b) { a = min(a, b); }
int pwr(int a, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mul(a, pwr(a, p - 1));
    return pwr(mul(a, a), p / 2);
}
int inv(int a) { return pwr(a, mod - 2); }

int dp[100][5][5][5], n;

bool test(int* v)
{
    int bad[4] = {0, 2, 1};
    for (int i = 0; i < 2; ++i)
    {
        int cnt = 0;
        for (int j = 0; j < 3; ++j)
            if (v[i + j] == bad[j])
                cnt++;
        if (cnt == 3)
            return true;
    }
    return false;
}

int f(int k, int a, int b, int c)
{
    if (k == n) return 1;
    if (dp[k][a][b][c] != -1) return dp[k][a][b][c];
    int sol = 0;
    for (int i = 0; i < 4; ++i)
    {
        int v[4] = {a, b, c, i};
        bool bad = test(v);
        for (int i = 0; i < 3; ++i)
        {
            swap(v[i], v[i + 1]);
            if (test(v))
                bad = true;
            swap(v[i], v[i + 1]);
        }
        if (!bad)
            adds(sol, f(k + 1, b, c, i));
    }
    return dp[k][a][b][c] = sol;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    memset(dp, -1, sizeof dp);
    cout << f(0, 4, 4, 4);
}


Measured memory_bytes: 256
n, m = map(int, input().split())
mod = 10**9 + 7
if abs(n - m) <= 1:
    ans = 1
    for i in range(1, n + 1):
        ans *= i
        ans %= mod
    for i in range(1, m + 1):
        ans *= i
        ans %= mod
    if abs(n-m) == 1:
        print(ans)
    else:
        print(ans * 2 % mod)
else:
    print(0)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

#define REP(i, n) for(int i=0; i<n; i++)
typedef vector<int> VI;

int N, x, y;
VI vx, vy;

double triangle(int x0, int y0, int x1, int y1, int x2, int y2)
{
	double l0 = sqrt((double)((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
	double l1 = sqrt((double)((x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1)));
	double l2 = sqrt((double)((x0 - x2) * (x0 - x2) + (y0 - y2) * (y0 - y2)));
	double theta = acos((l1*l1 + l2*l2 - l0*l0) / (2.0 * l1 * l2));
	return 0.5 * l1 * l2 * sin(theta);
}

double ccw(int x0, int y0, int x1, int y1, int x2, int y2)
{
	int sgn = (x1 - x0) * (y2 - y0) - (x2 - x0) * (y1 - y0);
	if(sgn < 0)
		return 1.0;
	else
		return -1.0;
}

int main()
{
	int count = 0;
	while( 1 )
	{
		count++;
		cin >> N;
		
		if(N==0)
			break;
		
		vx.clear();
		vy.clear();
		REP(n, N)
		{
			cin >> x;
			cin >> y;
			vx.push_back(x);
			vy.push_back(y);
		}
	
		int x0 = vx[0];
		int y0 = vy[0];
		double S = 0.0;
		for(int k=1; k<vx.size()-1; k++)
		{
			int x1 = vx[k];
			int y1 = vy[k];
			int x2 = vx[k+1];
			int y2 = vy[k+1];
			S += ccw(x0, y0, x1, y1, x2, y2) * triangle(x0, y0, x1, y1, x2, y2);
		}
		printf("%d %.1f\n", count, S);
	}
}

Measured memory_bytes: 0
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::*;
use smallvec::alloc::collections::VecDeque;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    input! {
         h:usize,
         w:usize,
         s:[String;h],

    }

    let s = s.iter().map(|c| c.chars().collect_vec()).collect_vec();
    let mut dp = vec![vec![U_INF; w]; h];
    let mut queue = VecDeque::new();

    for i in 0..h {
        for j in 0..w {
            if s[i][j] == '#' {
                queue.push_back((i, j));
                dp[i][j] = 0;
            }
        }
    }

    while let Some((i, j)) = queue.pop_front() {
        let (i, j) = (i as isize, j as isize);
        for &(ii, jj) in &[(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)] {
            if !((0..h as isize).contains(&ii) && (0..w as isize).contains(&jj)) {
                continue;
            }

            let (ii, jj) = (ii as usize, jj as usize);

            if dp[ii][jj] == U_INF {
                dp[ii][jj] = dp[i as usize][j as usize] + 1;
                queue.push_back((ii, jj))
            }
        }
    }

    println!("{}", dp.iter().flat_map(|v| v.into_iter()).max().unwrap());
}


Measured memory_bytes: 31516
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};



signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	int n;
	cin >> n;
	n /= 200;
	cout << 10 - n << endl;
	return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm> 
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <list>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x&&x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS*max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x*x + y*y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;



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

	vector <int> a(N), b(N), c(N);

	for (int i = 0; i < N; ++i)
	{
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < N; ++i)
	{
		scanf("%d", &b[i]);
	}
	for (int i = 0; i < N; ++i)
	{
		scanf("%d", &c[i]);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	sort(c.begin(),c.end());

	ll ans = 0;
	for (int i=0;i<N;i++)
	{

		ll x =	lower_bound(a.begin(), a.end(), b[i]) - a.begin();
		ll y = upper_bound(c.begin(),c.end(),b[i])-c.begin();

		ans += x*(N-y);
	}

	cout << ans << endl;












	return 0;
}



Measured memory_bytes: 1408
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    double L;
    cin >> L;

    cout << fixed << setprecision(10) << L * L * L / 27.0 << "\n";
    return 0;
}

Measured memory_bytes: 888
#include<iostream>
using namespace std;
int main(){
  long num=0;
  long a,b,x;
  std::cin >> a>>b>>x;
  if(a!=0)num=(a-1)/x;
  else num=-1;
  num=b/x-num;
  std::cout << num << '\n';
return 0;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;
#define INF (1 <<29)
int N, M, R;
int d[201][201];
int r[9];
int A, B, C;
int res;
bool used[9];

void dfs(int c, int las, int dist)
{
	if (c == R + 1)
	{
		if (res > dist) res = dist;
		return;
	}
	for (int i = 1; i <= R; i++) if (!used[i])
	{
		used[i] = true;
		if (las == -1) dfs(c + 1, i, 0);
		else dfs(c + 1, i, dist + d[r[las]][r[i]]);
		used[i] = false;
	}
}
int main()
{
	scanf("%d %d %d", &N, &M, &R);
	for (int i = 1; i <= N; i++) for (int j = 1; j <= N; j++) if (i != j) d[i][j] = INF;
	for (int i = 1; i <= R; i++) scanf("%d", &r[i]);
	for (int i = 1; i <= M; i++)
	{
		scanf("%d %d %d", &A, &B, &C);
		if (d[A][B] > C) d[A][B] = d[B][A] = C;
	}
	for (int k = 1; k <= N; k++)
		for (int i = 1; i <= N; i++)
			for (int j = 1; j <= N; j++)
				if (d[i][j] > d[i][k] + d[k][j])
					d[i][j] = d[i][k] + d[k][j];
	res = INF;
	dfs(1, -1, 0);
	printf("%d\n", res);
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    long long n, i;
    scanf("%lld", &n);
    long long a[n];
    for (i = 0; i < n; i++)
        scanf("%lld", &a[i]);
    long long b[200001] = {0};

    for(i = 0; i < n; i++) {
        b[a[i]]++;
    }

    long long sum = 0, t;

    for (i = 1; i <= 200000; i++) {
        sum += (b[i] * (b[i] - 1)/2);
    }

    for (i = 0; i < n; i++) {
        t = b[a[i]] * (b[a[i]] - 1) /2 - (b[a[i]]-1) *(b[a[i]]-2)/2;
        printf("%lld\n", sum - t);
    }

    
      
	return 0;
}

Measured memory_bytes: 5632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v) v.begin(),v.end()
#define endll "\n"

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    if(s[0]=='7' || s[1]=='7' || s[2]=='7'){
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }

    return 0;
}



Measured memory_bytes: 3608
N = int(input())
nodes = [set() for _ in range(N)]
for _ in range(N - 1):
    u, v, w = map(int, input().split())
    u, v = (u - 1, v - 1)
    nodes[u].add((v, w))
    nodes[v].add((u, w))


ans = [-1] * N
q = [(0, 0, -1)]

while q:
    v, dist, parent = q.pop()

    if dist % 2 == 0:
        ans[v] = 0
    else:
        ans[v] = 1

    for u, w in nodes[v]:
        if u == parent:
            continue

        q.append((u, dist + w, v))

print("\n".join(map(str, ans)))


Measured memory_bytes: 56020
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second > b.second; }

int main(){
    vl a(2);
    rep(i,2)cin>>a[i];
    sort(a.begin(),a.end());
    if(a[1]>9){
        cout<<-1<<endl;
        return 0;
    }
    cout<<a[0]*a[1]<<endl;
}

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

using namespace std;

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> A;
  
  for (int i=0; i<N; i++){
    int a;
    cin >> a;
    A.push_back(a);
  }
  
  for (int i=0; i<N-K; i++){
    if (A[K+i]>A[i]){cout << "Yes\n";}
    else {cout << "No\n";}
  }
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 432;

char s[N][N];
bool bio[N][N];

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

void solve() {
  int h, w; scanf("%d%d", &h, &w);
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      scanf(" %c", s[i]+j);
    }
  }
  long long ans = 0;
  queue<pair<int, int>> q;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (bio[i][j]) continue;
      q.emplace(i, j);
      bio[i][j] = true;
      long long black = 0, white = 0;
      while (!q.empty()) {
	const auto &p = q.front();
	if (s[p.first][p.second] == '#') ++black;
	else ++white;
	for (int i = 0; i < 4; ++i) {
	  int y = p.first+dy[i], x = p.second+dx[i];
	  if (x < 0 || x >= w || y < 0 || y >= h) continue;
	  if (bio[y][x]) continue;
	  if (s[p.first][p.second] == s[y][x]) continue;
	  q.emplace(y, x);
	  bio[y][x] = true;
	}
	q.pop();
      }
      ans += black*white;
    }
  }
  printf("%lld", ans);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


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

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

	int N;
	cin >> N;
	string s;
	int res = 0;
	for (int i = 1; i <= N; i++)
	{
		s = to_string(i);
		if (s.size() % 2 == 1)
			res++;
	}

	cout << res << "\n";
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
max_x = max(x)
min_y = min(y)
for i in range(X + 1, Y):
    if i > max_x and i <= min_y:
        print("No War")
        exit()
print("War")

Measured memory_bytes: 3064
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int n;
	string s, t;
	cin >> n >> s >> t;
	
	for (int i = 0; i < n; i++) {
		if (s.substr(i, n - i) == t.substr(0, n - i)) {
			cout << n + i << endl;
			return 0;
		}
	}
	cout << 2 * n << endl;

	return 0;
}

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function (chunk) {
    const n = chunk.toString();
    const r = n.split("\n").filter(x => x != 0);
    r.forEach(x => sp(x));
});

function sp(rep){
    const x = rep.split("").map(x => Number(x));
    var acc = 0;
    if(x.length===1){
        return console.log(x[0]);
    }

    for(var i=0; i<x.length; i++){
        acc += x[i];
    }
    console.log(acc);
}


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

using namespace std;

long long ans = 1;
int cnt;
int n;
int dp[20] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31};
int d;
bool a[1005];
int b[1005];
int c[1005];

int main()
{
    a[1] = true;
    for(int i = 0; i < 11; i++)
    {
        for(int j = dp[i] * dp[i]; j <= 1000; j += dp[i])
        {
            a[j] = true;
        }
    }
    for(int i = 1; i <= 1000; i++)
    {
        if(!a[i]) b[cnt++] = i;
    }
    scanf("%d", &n);
    for(int i = 1; i <= n; i++)
    {
        int x = i;
        for(int j = 0; j < cnt; j++)
        {
            if(x == 1)break;
            if(x % b[j] == 0)
            {
                while(x % b[j] == 0)
                {
                    x /= b[j];
                    c[b[j]]++;
                }
            }
        }
    }
    for(int i = 0; i <= 1000; i++)
    {
        ans *= (c[i] + 1);
        ans %= 1000000007;
    }
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 256
class Dice():
    def __init__(self, labels):
        self.top = labels[0]
        self.front = labels[1]
        self.right = labels[2]
        self.left = labels[3]
        self.back = labels[4]
        self.bottom = labels[5]

    def roll(self, axis, count=1):
        while count < 0:
            count += 4
        if axis == "X":
            for _ in range(count):
                self.top, self.back, self.bottom, self.front = self.front, self.top, self.back, self.bottom
        elif axis == "Y":
            for _ in range(count):
                self.top, self.right, self.bottom, self.left = self.left, self.top, self.right, self.bottom
        elif axis == "Z":
            for _ in range(count):
                self.front, self.left, self.back, self.right = self.right, self.front, self.left, self.back
        elif axis == "N":
            self.roll("X", 1)
        elif axis == "W":
            self.roll("Y", -1)
        elif axis == "S":
            self.roll("X", -1)
        elif axis == "E":
            self.roll("Y", 1)


def solve(d1, d2):
    for _ in range(4):
        if d1.top == d2.top and d1.bottom == d2.bottom and d1.front == d2.front and d1.back == d2.back and d1.left == d2.left and d1.right == d2.right:
            return "Yes"
        d2.roll("Z")
    d2.roll("X")
    for _ in range(4):
        if d1.top == d2.top and d1.bottom == d2.bottom and d1.front == d2.front and d1.back == d2.back and d1.left == d2.left and d1.right == d2.right:
            return "Yes"
        d2.roll("Y")
    d2.roll("X")
    for _ in range(4):
        if d1.top == d2.top and d1.bottom == d2.bottom and d1.front == d2.front and d1.back == d2.back and d1.left == d2.left and d1.right == d2.right:
            return "Yes"
        d2.roll("Z")
    d2.roll("X")
    for _ in range(4):
        if d1.top == d2.top and d1.bottom == d2.bottom and d1.front == d2.front and d1.back == d2.back and d1.left == d2.left and d1.right == d2.right:
            return "Yes"
        d2.roll("Y")
    d2.roll("X")
    d2.roll("Y")
    for _ in range(4):
        if d1.top == d2.top and d1.bottom == d2.bottom and d1.front == d2.front and d1.back == d2.back and d1.left == d2.left and d1.right == d2.right:
            return "Yes"
        d2.roll("X")
    d2.roll("Y", 2)
    for _ in range(4):
        if d1.top == d2.top and d1.bottom == d2.bottom and d1.front == d2.front and d1.back == d2.back and d1.left == d2.left and d1.right == d2.right:
            return "Yes"
        d2.roll("X")
    return "No"


labels1 = [int(c) for c in input().split()]
labels2 = [int(c) for c in input().split()]
d1 = Dice(labels1)
d2 = Dice(labels2)
print(solve(d1, d2))



Measured memory_bytes: 5636
parseint(x) = parse(Int, x)
ints() = map(parseint, readline() |> split)

function main()
    n, m = ints()
    s = [ints()[2:end] for _ = 1:m]
    p = ints()
    a = 0
    for i = 0:(1<<n)-1
        set = filter(x -> (1<<(x-1)) & i != 0, [x for x = 1:n])
        b = true
        for j = 1:m
            c = 0
            for e in set
                (e in s[j]) && (c = 1 - c)
            end
            (c != p[j]) && (b = false)
        end
        b && (a += 1)
    end
    println(a)
end

main()

Measured memory_bytes: 119172
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<string>> a(h, vector<string>(w));
  for (int i=0; i<h; i++) for (int j=0; j<w; j++) cin >> a.at(i).at(j);
  for (int i=0; i<h; i++) for (int j=0; j<w; j++) if (a.at(i).at(j) == "snuke") cout << (char)('A' + j) << i+1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 100000

int main(){
  int A[N],n,A2[N],i,q,cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
        scanf("%d",&A2[i]);
    }
  //  binarySearch()
  for(i=0;i<q;i++){
  int  left = 0;
  int right = n;
  int key=A2[i];
  while(left < right){
  int mid = (left + right) / 2;
            if (A[mid] == key){
              cnt++;
              break;
            }
            else if (key < A[mid])
                right = mid;
            else
                left = mid + 1;
      }
    }
    printf("%d\n",cnt);
    return 0;
}



Measured memory_bytes: 2288
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define ppi pair<pii,int> 
#define ff first.first
#define fs first.second
using namespace std;
int n;
int a[100001],b[100001];
pii nod[100001];
ppi ch[200001];
int main(){
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int i=0;i<n;i++){
        ch[2*i]=mp(mp(a[i],i),0);
        ch[2*i+1]=mp(mp(b[i],i),1);
    }
    sort(ch,ch+2*n);
    ll ans=0;
    for(int i=0;i<n;i++){
        if(ch[i].se==0)
            nod[ch[i].fs].fi=1;
        else
            nod[ch[i].fs].se=1;
        ans+=(ll)ch[i].ff;
    }
    bool flag1=0,flag2=1,flag3=1;
    for(int i=0;i<n;i++)
        if(nod[i].fi && nod[i].se){
            flag1=1;break;
        }
    for(int i=0;i<n;i++)
        if(!(nod[i].fi && !nod[i].se)){
            flag2=0;break;
        }
    for(int i=0;i<n;i++)
        if(!(!nod[i].fi && nod[i].se)){
            flag3=0;break;
        }
    if(flag1 || flag2 || flag3){
        cout<<ans<<endl;
        return 0;
    }
    cout<<ans+((ch[n].fs==ch[n-1].fs)?min(ch[n].ff-ch[n-2].ff,ch[n+1].ff-ch[n-1].ff):ch[n].ff-ch[n-1].ff)<<endl;
    return 0;
}

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

#define ii pair<int, int>
#define lli long long int
#define ll pair<lli, lli>
#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

lli gcd(lli a, lli b) {
	return ((b == 0) ? a : gcd(b, a % b));
}

int main() {
	lli n, m, kpk = 1, a, cnt[100005], temp;
	scanf("%lld %lld", &n, &m);
	for (lli i = 0; i < n; i++) {
		scanf("%lld", &a);
		a /= 2;
		temp = a;
		cnt[i] = 0;
		while (temp % 2 == 0) {
			cnt[i]++;
			temp /= 2;
		}
		if (cnt[i] != cnt[0]) {
			puts("0");
			return 0;
		}
		kpk *= (a / gcd(a, kpk));
		if (kpk > m) {
			puts("0");
			return 0;
		}
	}
	m /= kpk;
	m = (m + 1) / 2;
	printf("%lld\n", m);
	return 0;
}

Measured memory_bytes: 1024
(set! *unchecked-math* true)

(defn get_H_W []
  (->> (clojure.string/split (read-line) #"\s")
    (map #(Integer/parseInt %))))

(defn set_Array [^"[[C" Array H W]
  (dotimes [h H]
    (->> (read-line)
      (char-array W)
      (aset Array h))))

(defn Minesweeper [^"[[C" Array H W]
  (doseq [x (range W)
          y (range H)
          :when (not= \# (aget ^"[C" (aget Array y) x))]
    (with-local-vars [counts (unchecked-int 0)]
      (doseq [d-y-x [[-1 -1] [-1 0] [-1 1] [0 -1] [0 1] [1 -1] [1 0] [1 1]]
              :let [[dy dx] (map unchecked-add-int (list y x) d-y-x)]
              :when (and
                      (<= 0 dx)
                      (< dx W)
                      (<= 0 dy)
                      (< dy H)
                      (= \# (aget ^"[C" (aget Array dy) dx)))]
        (var-set counts (unchecked-inc-int @counts)))
      (->> @counts
        (unchecked-add-int (unchecked-int \0))
        unchecked-char
        (aset ^"[C" (aget Array y) x)))))

(defn output [^"[[C" Array]
  (-> (areduce Array idx ret ""
        (str ret
          (apply str (aget Array idx))
          "\n"))
    print))

(let [[H W] (get_H_W)]
  (doto (make-array Character/TYPE H W)
    (set_Array H W)
    (Minesweeper H W)
    (output)))

Measured memory_bytes: 76452
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int data[200];
int sp=0;

void push(int x){
    data[sp++] = x;
}

int pop(){
    return data[--sp];
}

void stack_plus(){
    push( pop() + pop() );
}

void stack_minus(){
    int x = pop();
    push( pop() - x );
}

void stack_load(){
    push( pop() * pop() );
}

int main(){
    char ch[100];
    int x;
    while(scanf("%s",ch) != EOF){
        if(ch[0] == '+'){
            stack_plus();
        }else if(ch[0] == '-'){
            stack_minus();
        }else if(ch[0] == '*'){
            stack_load();
        }else{
            x = atoi(ch);
            push(x);
        }
        //printf("%d\n",data[0]);
    }
    printf("%d\n",data[0]);
    return 0;
}



Measured memory_bytes: 2040
import sys
# N,M = [int(n) for n in input().split()]
S = str(input())
# T = str(input())
if (not "B" in S) or (not "W" in S):
    print(0)
    sys.exit()

changecount = 0
for i in range(1,len(S)):
    if(S[i] != S[i-1]):
        changecount+=1
print(changecount)


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;
int n,v[maxn],c[maxn];

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

  cin>>n;
  for (int i=0; i<n; i++) cin>>v[i];
  for (int i=0; i<n; i++) cin>>c[i];
  int ans=0;
  for (int i=0; i<n; i++) ans +=max(0, v[i]-c[i]);
  cout<<ans;
  

  return 0;
}


Measured memory_bytes: 2304
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <list>
#include <string>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip> // setprecisionを使用するのに必要 cout << fixed << setprecision(15) << p でpを小数点以下15桁表示
using namespace std;
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)
#define DIV0 1000000007
typedef long long ll;
#define fin(ans) cout << (ans) << '\n'
/*

*/
int main()
{
    int S;
    cin >> S;
    ll A[2050];
    A[0] = 0;
    A[1] = 0;
    A[2] = 0;
    A[3] = 1;
    for(int i = 4; i <= S; i++){
        A[i] = A[i-1] + A[i-3];
        A[i] %= DIV0;
    }
    fin(A[S]);
    return 0;
}

Measured memory_bytes: 3208
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

a,b,c = iim()

if a <= c <= a+b:
    print('YES')
else:
    (print('NO'))

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

int main(){
	int N;
	cin >> N;
	vector<int> b(N);
	vector<int> ans(N);
	for(auto &k:b)cin >> k;
	
	for(int k=0;k<N;k++){
		
		for(int i=b.size()-1;i>=0;i--){
			if(b[i]>i+1){
			cout << "-1" << endl;
			return 0;
			}
			if(b[i]==i+1){
				ans[N-k-1]=i+1;
				b.erase(b.begin()+i);
				break;
			}
		}
	}
	for(auto a:ans)cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("Yes\n")
#define ptn printf("No\n")
//==========================Code here==========================
LL n, a, b, c, d;
char s[200000 + 5];
int main() {
	cin >> n >> a >> b >> c >> d;
	scanf("%s", s + 1);
	s[++n] = '#';
	
	for (LL i = b; i < d; ++i) {
		if (s[i] == '#' && s[i + 1] == '#') return ptn, 0;
	} 
	for (LL i = a; i < c; ++i) {
		if (s[i] == '#' && s[i + 1] == '#') return ptn, 0;
	}
	
	if (c < d) return pty, 0;
	
	/*for (LL i = b - 2; i <= d; ++i) {
		if (s[i] == s[i + 1] && s[i + 1] == s[i + 2] && s[i] == '.') return pty, 0;
	}
	
	return ptn, 0;*/
	
	LL maxi = 0, cnt=0;
	for(int i=b;i<=d+1;i++)
	{
		if(s[i]=='.') cnt++;
		else cnt=0;
		maxi=max(maxi,cnt);
	}
	if(s[b-1]=='.'&&s[b+1]=='.') maxi=3;
	if(maxi<=2)
		printf("No");
	else printf("Yes");
	
	return 0;
}
/*
11 5 9 9 11
..##..#..#.

9 4 6 9 8 
.##...#..
*/

Measured memory_bytes: 384
import           Data.List
main = do
    [n, x] <- map read.words <$> getLine
    xs <- map read.words <$> getLine
    print $ solve x xs

solve :: Int -> [Int] -> Int
solve x xs = go 0 x $ sort xs
  where
    go acc rest [x]
      | x == rest = acc + 1
      | otherwise = acc
    go acc rest (x:xs)
      | x <= rest = go (acc + 1) (rest - x) xs
      | otherwise = go acc rest xs


Measured memory_bytes: 1020
const int isDebugMode = 1;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long recgcd(T1 a, T2 b){return a % b ? recgcd(b , a % b) : b;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

int main(){
    string S; cin >> S;
    ll N = 0;
    rep(i, S.size()) N += S[i] - '0';
    pt(N % 9 ? "No" : "Yes");
    return 0;
}

Measured memory_bytes: 3752
#pragma GCC optimize("Ofast")
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

int main(){	
	
	long long k;
	cin >> k;
	long long n=7;
	long long cnt=0;
	for(int i=1;i<=k+5;i++){
		cnt++;
		if(n%k==0){
			cout << cnt << endl;
			return 0;
		}
		//cout << n%k << endl;
		n*=10;
		n%=k;
		n+=7;
		n%=k;
	}
	cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 3596
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	while (true) {
		int n;
		cin >> n;
		if (n == 0) return 0;
		vector<pair<int, int>> geko;
		geko.push_back(make_pair(0, 0));
		int xe[4] = { -1,0,1,0 };
		int ye[4] = { 0,1,0,-1 };
		REP(i, n - 1) {
			int a, b;
			cin >> a >> b;
			pair<int, int> gogo = geko[a];
			gogo.first += xe[b];
			gogo.second += ye[b];
			geko.push_back(gogo);
		}
		int a = 0, b = 0, c = 0, d = 0;
		for (int i = 0; i < geko.size(); ++i) {
			a = min(a, geko[i].first);
			b = max(b, geko[i].first);
			c = min(c, geko[i].second);
			d = max(d, geko[i].second);
		}
		cout << b - a + 1 << " " << d - c + 1 << endl;
	}
}



Measured memory_bytes: 3060
//10-C
/*
 n 人の学生を含むクラスでプログラミングの試験を行った。それぞれの得点をs1, s2 ... snとしたときの、標準偏差を求めるプログラムを作成せよ。

得点の平均値をｍとすれば、分散α2は以下の式で得られる：



分散の正の平方根が標準偏差αとなる。 
*/

import java.util.Scanner;

class Main {
    public static void main(String [] args){
         
        Scanner sc = new Scanner(System.in);
        
        while(true){
        	
        	int n = sc.nextInt();
        	
        	double[] db = new double[n];
        	
        	double sum = 0;//合計用
        	double m = 0;//平均
        	
        	if( n == 0 ){
        		break;
        	}
        	
        	//平均計算
        	for(int i = 0 ; i < n ; i++ ){
        		
        		double s = sc.nextDouble();
        		
        		db[i] = s;
        		
        		sum = sum + s;
        		
        	}
        	
        	m = sum / n;//平均値代入
        	
        	double sum2 = 0;
        	
        	for(int i = 0 ; i < db.length ; i++ ){
        		
        		db[i] = (db[i] - m) * (db[i] - m);
        		
        		sum2 = sum2 + db[i];
        		
        	}
        	
        	double a = Math.sqrt(sum2 / n);
        	
        	System.out.println(a);
        	
        }
    }
}

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

int main() {
  string s;
  cin >> s;
  string ans = "";
  rep(i, s.size()) { ans += "x"; }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

#define MAX 100

int isempty(void);
int isfull(void);
void push(int);
int pop(void);

int top = 0;
int stack[MAX];

int main()
{
  int x, a, b;
  char s[100];
  while(scanf("%s", s) != EOF) {
    if(s[0] == '+') {
      push(pop()+pop());
    }
    else if(s[0] == '-') {
      a = pop();
      b = pop();
      push(b-a);
    }
    else if(s[0] == '*') {
      push(pop()*pop());
    }
    else {
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n", pop());
  return 0;
}
  
int isempty(void)
{
  return top == 0;
}
  
int isfull(void)
{
  return top > MAX-1;
}

void push(int x)
{
  if(isfull()) {
    fprintf(stderr, "エラー（オーバーフロー）\n");
    exit(1);
  }
  top++;
  stack[top] = x;
}

int pop(void)
{
  if(isempty()) {
    fprintf(stderr, "エラー（アンダーフロー）\n");
    exit(2);
  }
  top--;
  return stack[top+1];
}

Measured memory_bytes: 548
import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector as V

main :: IO ()
main = getLine >> readLine >>= print . solve

solve :: [Int] -> Int
solve = sum . map (cmb2 . length) . group . sort . scanl (+) 0
    where
        cmb2 n = (n * (n - 1)) `div` 2

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

Measured memory_bytes: 38268
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (ql:quickload '(:cl-debug-print :fiveam))
  #-swank (set-dispatch-macro-character #\# #\> (lambda (s c p) (declare (ignore c p)) (read s nil (values) t))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)
#-swank (disable-debugger) ; for CS Academy

;; BEGIN_INSERTED_CONTENTS
(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (declare #.OPT)
  (let* ((n (read))
         (n-1 (- n 1))
         (a (read))
         (b (read))
         (c (read))
         (d (read)))
    (declare (uint31 a b c d n))
    (if (loop for k from 0 to n-1
              thereis (if (and (<= (+ a (* k c))
                                   (+ b (* (- n-1 k) d)))
                               (<= (+ b (* (- n-1 k) c))
                                   (+ a (* k d))))
                          t
                          nil))
        (write-line "YES")
        (write-line "NO"))))

#-swank (main)


Measured memory_bytes: 6632
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static void solve() {
		String o = in.next();
		String e = in.next();
		int n = o.length();
		int m = e.length();
		int p = 0, q = 0;
		for (int i=0; i<n+m; i++) {
			if (i%2 == 0) {
				out.print(o.charAt(p));
				p++;
			} else {
				out.print(e.charAt(q));
				q++;
			}
		}
		
		out.println();
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		solve();
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 22356
from bisect import bisect_left
import sys
sys.setrecursionlimit(10**7)

N = int(input())
a = list(map(int, input().split()))

G = [[] for i in range(N)]
for i in range(N-1):
    uv = list(map(lambda x: int(x)-1, input().split()))
    G[uv[0]].append(uv[1])
    G[uv[1]].append(uv[0])

dp = [10 ** 10 for _ in range(N+1)]
dp[0] = -1
ans = [-1] * N

def dfs(v, p, max_):
    i = bisect_left(dp, a[v])
    memo = (i, dp[i])
    dp[i] = a[v]

    if i > max_:
        max_ = i
    ans[v] = max_

    for nv in G[v]:
        if nv == p:
            continue
        dfs(nv, v, max_)
    dp[memo[0]] = memo[1]

dfs(0, -1, 0)

print(*ans, sep='\n')


Measured memory_bytes: 231188
import java.io.*;

class Main{
	public static void main(String[] args) throws IOException{

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
 	String str = br.readLine();
	String[] line = str.split(" ");

	int a = Integer.parseInt(line[0]);
	int b = Integer.parseInt(line[1]);
	int c = Integer.parseInt(line[2]);

	if( a < b && b < c){
		System.out.println("Yes");
	}
	
	else{
		System.out.println("No");
	}

}
}

Measured memory_bytes: 24368
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
typedef long long LL;

int main() {
	int n, a, b;

	std::cin >> n;

	if (n == 1) {
		std::cout << "Hello World" << std::endl;
		return 0;
	}
	
	std::cin >> a >> b;

	std::cout << a + b << std::endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (3e9)

using namespace std;
typedef long long int ll;
typedef priority_queue<int,vector<int>,greater<int> > PQSI;

priority_queue<int> que;
int N, M;
int a;
int main(void){
    cin >> N >> M;
    REP(i,N){
        scanf("%d",&a);
        que.push(a);
    }
    REP(i,M){
        int r = que.top();
        que.pop();
        que.push(r/2);
    }

    ll ans = 0;
    while(!que.empty()){
        ans += que.top();
        que.pop();
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <queue>

using namespace std;

int main(){
    int n, k; cin >> n >> k;
    vector<int> hs(n);
    for(int i=0; i<n; ++i){
        cin >> hs[i];
    }
    vector<int> dp(n);
    dp[0]=0;
    for(int i=1; i<n; ++i){
        int min_cost=1e9+100;
        for(int j=1; j<=min(k, i); ++j){
            min_cost=min(min_cost, dp[i-j]+abs(hs[i-j]-hs[i]));
        }
        dp[i]=min_cost;
    }
    cout << dp[n-1] << endl;
    return 0;
}



Measured memory_bytes: 1024