akhauriyash/Code-Regression huggingface dataset:
class Node():
    def __init__(self,id):
        self.id = id
        self.parent = -1
        self.child = []

    def addParent(self,parent):
        self.parent = parent

    def addChild(self,child):
        self.child = child

n = int(input())
nodes = {}

for i in range(n):
    line = list(input().split(" "))
    id = int(line[0])
    child = []
    for k in range(int(line[1])):
        childId = int(line[2+k])
        child.append(childId)
        if not childId in nodes:
            nodes[childId] = Node(childId)
        nodes[childId].addParent(id)

    if not id in nodes:
        nodes[id] = Node(id)
    nodes[id].addChild(child)

for i in sorted(nodes):
    node = nodes[i]
    depth = 0
    startNode = node
    while not startNode.parent == -1:
        startNode = nodes[startNode.parent]
        depth += 1

    if node.parent == -1:
        type = "root"
    elif not node.parent == -1 and not node.child == []:
        type = "internal node"
    elif not node.parent == -1 and node.child == []:
        type = "leaf"

    ans = ''
    ans += 'node ' + str(node.id) + ': '
    ans += 'parent = '
    ans += str(node.parent)
    ans += ', depth = ' + str(depth)
    ans += ', ' + type + ', '
    ans += str(node.child)

    print(ans)



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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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

int N;
int A[222222];

bool ex[222222];

signed main(){
    cin>>N;
    rep(i,N)cin>>A[i];
    
    bool ok=true;
    if(A[0]!=0)ok=false;
    rep(i,N-1)if(A[i+1]-A[i]>1)ok=false;
    if(!ok){
        cout<<-1<<endl;
        return 0;
    }

    int ans=0;
    for(int i=N-1;i>=0;i--){
        if(ex[A[i]+N-1-i])continue;
        ex[A[i]+N-1-i]=true;
        ans+=A[i];
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

int main()
{
	string O, E;
	cin >> O >> E;

	string ans;
	for (size_t i = 0; i < O.size() || i < E.size(); ++i) {
		if (i < O.size()) {
			ans += O[i];
		}
		if (i < E.size()) {
			ans += E[i];
		}
	}
	cout << ans << endl;
}


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

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main() {
    string S; cin >> S;
    vector<bool> vc;

    // A-Zの登場フラグ．Aを0, Zを25とする
    rep(i, 26) vc.push_back(false);

    // 登場した文字のフラグを立てる
    rep(i, S.size()) vc[S[i] - 'a'] = true;
    
    rep(i, 26) {
        if (!vc[i]) {
            cout << (char)('a' + i) << endl;
            return 0;
        }
    }

    puts("None");
    return 0;
}


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

using namespace std;

#define INF 1010001000
#define EPS 1e-10
#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef pair<int, int> i_i;
typedef long long int llong;
typedef pair<llong, llong> ll_ll;
typedef struct edge {int f, t;}Edge;

vector<bool> num(21, false);

int search(int n, int k, int s);

int main()
{
    int n, k, s;
    while (cin >> n >> k >> s, k) {
        cout << search(n, k, s) << endl;
    }
    return 0;
}

int search(int n, int k, int s)
{
    int ret = 0;
    if (k > 1) {
        for (int i = n; i > 0; i--) {
            if (i < s) {
                ret += search(i-1, k-1, s-i);
            }
        }
    } else {
        if (0 <= s && s <= n) {
            return 1;
        } else {
            return 0;
        }
    }
    return ret;
}

Measured memory_bytes: 3008
s = input()

l = len(s)

if l % 2 == 0:
    s1 = s[0:l//2]
    s2 = s[l//2:]
else:
    s1 = s[0:l//2]
    s2 = s[l//2+1:]

s2 = s2[::-1]

cnt = 0
for x, y in zip(s1, s2):
    if x != y:
        cnt += 1

print(cnt)


Measured memory_bytes: 3060
import std.stdio ,std.conv , std.string;

void main(){
	auto input = readln();
	foreach( i,c ; input ){
		if(i%2==1){continue;}
		write(c);
	}
	writeln("");
}

unittest{
}
T[] readLine( T = size_t )(){
	T[] ret;
	foreach( val ; readln().chomp().split() ){
		ret ~= to!T(val);
	}
	return ret;
}


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

class Main{
  public static void main(String[] arigs) throws IOException{
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter out = new PrintWriter(System.out);
    String N = reader.readLine();
    if(N.contains("7")){
      out.println("Yes");
    }else{
      out.println("No");
    }
    reader.close();
    out.flush();
  }
}

Measured memory_bytes: 32444
use std::io::Read;
use std::str::SplitWhitespace;
use std::str::FromStr;

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

pub trait Parse<T> {
    fn parse(&mut self) -> T;
}

impl<'a, T> Parse<T> for SplitWhitespace<'a>
where
    T: FromStr,
{
    fn parse(&mut self) -> T {
        let word = self.next().unwrap();
        word.parse().ok().unwrap()
    }
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let s_: String = iter.parse();
    let s = s_.chars().collect::<Vec<_>>();
    let c0 = s.iter().filter(|&c| *c == '0').count();
    let c1 = s.iter().filter(|&c| *c == '1').count();
    let min = std::cmp::min(c0, c1);

    println!("{}", min * 2);
}

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

vector<int> z_algorithm (const string& s) {
    int n = (int)s.size();
    vector<int> z(n); z[0] = n;
    for (int i = 1, j = 0; i < n;) {
        while (i+j < n && s[j] == s[i+j]) j++;
        z[i] = j;
        if (j == 0) {
            i++;
            continue;
        }
        int k = 1;
        while (k < j && k+z[k] < j) {
            z[i+k] = z[k];
            k++;
        }
        i += k;
        j -= k;
    }
    return z;
}


int main() {
    int n;
    string s;
    cin >> n >> s;
    
    int ans = 0;
    for (int i = 0; i < n; i++) {
        vector<int> z = z_algorithm(s.substr(i, n));
        int sz = z.size();
        for (int j = 1; j < sz; j++) {
            int res = min(j, z[j]);
            ans = max(ans, res);
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    unused_imports,
    dead_code
)]
//use proconio::fastout;
use proconio::input;
use proconio::marker::*;
//use std::collections::HashSet;
// use std::cmp::*;
//use std::collections::VecDeque;

fn main() {
    input! {
       N:usize
    }
    // 約数の個数は素因数分解して、各素因数の個数+1をかけたもの。
    // Ex: 12= 2^2*3^1なので、(2+1)*(1+1)=6個。1,2,3,4,6,12
    // 75=(2+1)*(4+1)*(4+1);
    // 100以下の素数は97までの25個。
    // 素数a,b,cについて、a<b<cとする。
    // N < c*2なら、cは N! に高々1個しか含まれないので、不可。
    // 同様に、N < b*4 も成立しない。
    // cの可能性があるのはN/2以下、a,bの可能性があるのはN/4
    let p = getPrimes(N);
    let mut ans = 0;
    //    let ts = getNumbersInN(N);
    let mut ts = vec![0; N + 1];
    // jは2,3,4...と変化するが、j=2が終わった時点でcurは2の倍数ではなくなっている。
    // このため、j=4など、非素数の時に必ず cur%j != 0となる。
    for i in 2..=N {
        let mut cur = i;
        for j in 2..=i {
            while cur % j == 0 {
                ts[j] += 1;
                cur = cur / j;
            }
        }
    }
    let num = |m| {
        let mut s = 0;
        for &t in ts.iter() {
            if t >= m - 1 {
                s += 1;
            }
        }
        s
    };
    // 2個,4個,4個の場合
    // choose(num5,2) * (num3-num5) + 3*choose(num5,3)
    // = num5*(num5-1)*(num3-num5)/2 + num5*(num5-1)*(num5-2)/2
    // = num5*(num5-1)*(num3 -num5 +num5-2)/2
    // = num5*(num5-1)*(num3-2)/2
    ans += num(5) * (num(5) - 1) * (num(3) - 2) / 2;

    // 14,4の場合
    ans += num(15) * (num(5) - 1);

    // 24,2の場合
    ans += num(25) * (num(3) - 1);
    //print!("{} ", ans);
    // 74の場合
    ans += num(75);
    println!("{}", ans);
}
fn getPrimes(N: usize) -> Vec<usize> {
    let mut p = vec![true; N as usize + 1];
    let mut q = Vec::with_capacity(100);
    p[0] = false;
    p[1] = false;
    for i in 2..=N as usize {
        if p[i as usize] {
            q.push(i);
        }
        let mut j = 2;
        while i * j <= N {
            p[(i * j) as usize] = false;
            j += 1;
        }
    }
    q
}
// 75-1以上=1
// 25-1以上=3
// 15-1以上=4
// 5-1以上=9
// 3-1以上=15
// 1 + 4*48 + 6*23 + 24*23*47/2 = 1+192+138+12972
// 1 + 3*14 + 4*8 + 9*8*13/2 = 1+42+32+468=543

//[0, 97, 48, x32, 24,x18, 16, x13, x12, x11,
//  9,x8, 7,x7,x6,x6, 5,x5, 5, x5,
// x4,x4, 4,x4,x4,x3,x3,x3, 3,x3,
//  3,x3,x3,x2,x2,x2, 2,x2,x2,x2,
//  2,x2, 2,x2,x2,x2, 2,x2,x2,x2,
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
//  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
//  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]


Measured memory_bytes: 2192
#include<iostream>
#include<algorithm>
using namespace std;
using lint=int64_t;

int main()
{
	int N,K;
	int a[110]={};

	cin >> N >> K;
	for(int i=0;i<N;i++)
		cin >> a[i];

	
	bool dp[100010]={};
	for(int k=1;k<=K;k++)
	{
		for(int i=0;i<N;i++)
		{
			if(k-a[i]>=0 && dp[k-a[i]]==false)
				dp[k]=true;
		}
	}

	if(dp[K])
		cout << "First";
	else
		cout << "Second";
	cout << endl;
	return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int N = sc.nextInt();
		int[][] input = new int[N][2];
		for (int i = 0; i < N; i++) {
			input[i][0] = sc.nextInt();
			input[i][1] = sc.nextInt();
		}
		long[][] dp = new long[N + 1][H + 10];
		for (int j = 0; j < dp[0].length; j++) {
			dp[0][j] = Integer.MAX_VALUE;
		}
		for (int i = 1; i <= N; i++) {
			for (int j = 0; j < dp[0].length; j++) {
				if (j <= input[i - 1][0]) {
					dp[i][j] = Math.min(dp[i - 1][j], input[i - 1][1]);
				} else {
					dp[i][j] = Math.min(dp[i - 1][j], dp[i][j - input[i - 1][0]] + input[i - 1][1]);
					dp[i][j] = Math.min(dp[i][j], dp[i - 1][j - input[i - 1][0]] + input[i - 1][1]);
				}
			}
		}
		System.out.print(dp[N][H]);
	}
}

Measured memory_bytes: 128624
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*pi*/double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll i,fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=0,i=0;while(n/10>0){i++;d++;}return d;}
llfor;ll ans=0;////////////////////////////////////////////////////////////
int main(){
 ll n;
 sc(n);
 ll a[n+10];
 ll mx=0;
 rep(i,0,n){
  sc(a[i]);
  mx=max(mx,a[i]);
 }
 ll even[200000]={},odd[200000]={};
 ll mx_odd=0,sc_odd=0,mx_even=0,sc_even=0;
 ll memo1=0,memo2=0,memo3=0,memo4=0;
  
 rep(i,0,n){
  if((i+1)%2==1){
   odd[a[i]]++;
  }
  if((i+1)%2==0){
   even[a[i]]++;  
  }
 }
 vector<pair<ll,ll>>od,ev;
 rep(i,0,mx+10){
  if(odd[i]!=0)od.push_back(pair(odd[i],i));
  if(even[i]!=0)ev.push_back(pair(even[i],i));
 }
 sort(all(od));sort(all(ev));
 reverse(all(od));reverse(all(ev));
 mx_odd=od[0].first;memo1=od[0].second;
 if(distance(all(od))>1){
  sc_odd=od[1].first;memo2=od[1].second;
 }
 mx_even=ev[0].first;memo3=ev[0].second;
 if(distance(all(ev))>1){
  sc_even=ev[1].first;memo4=ev[1].second;
 } 
 
 if(memo1!=memo3)ans=n-(mx_odd+mx_even);
 else if(memo1!=memo4&&mx_odd+sc_even>=sc_odd+mx_even)ans=n-(mx_odd+sc_even);
 else if(memo2!=memo3&&mx_odd+sc_even<sc_odd+mx_even)ans=n-(sc_odd+mx_even);
 else if(memo2!=memo4)ans=n-(sc_odd+sc_even);
 pr(ans);
 return 0;}

Measured memory_bytes: 8864
#include<iostream>
using namespace std;
int main()
{
    long k,a,b,c,sum=0;
    cin>>a>>b>>c>>k;
    if(k>a+b) {c=k-a-b;}
    else if(k>a){c=0;}
    else if(k<=a){c=0;a=k;}
    cout<<a-c;
    return 0;
}


Measured memory_bytes: 3652
a,b,c,k = gets.chomp.split(" ").map{|i|i.to_i}
sum = 0
rest = k
if rest >= a
  rest -= a
  sum = a
  if rest >= b
    rest -= b
    if rest > 0
      sum += -1*rest
    end
  end
else
  sum += rest*1
end
puts sum
      

Measured memory_bytes: 14324
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef vector<int> vint;
typedef vector<float> vfloat;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vstr> vvstr;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n;
    cin >> n;
    int a, b;
    map<int, vint> mp;
    rep(i, n) {
        cin >> a >> b;
        mp[b].push_back(a);
    }

    int now = 0;
    for (auto x : mp) {
        rep(i, x.se.size()) {
            now += x.se[i];
        }
        if (now > x.fi) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 22144
#include <iostream>

int main()
{
    long long a, b, k, c = 0;
    std::cin >> k >> a >> b;
    for (long long i = a; i <= b; i++)
    {
        if (i % k == 0)
        {
            c = 1;
            break;
        }
    }
    if (c)
    {
        std::cout << "OK";
    }
    else
    {
        std::cout << "NG";
    }
}

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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353
#define Graph vector<vector<int>>

int main() {
    int A, B, C, D; cin >> A >> B >> C >> D;
    int train, bus;
    if (A > B) train = B;
    else train = A;
    if (C > D) bus = D;
    else bus = C;
    cout << train + bus << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
const int MAXN = 1005;
char inputa[MAXN], inputb[MAXN];
int f[MAXN][MAXN];
int main(void)
{
    int t, lengtha, lengthb;
    scanf("%d", &t);

    while(t--)
    {
        scanf("%s%s", inputa, inputb);
        memset(f, 0, sizeof(f));

        lengtha = strlen(inputa);
        lengthb = strlen(inputb);

        for(int i = 0; i <= lengtha; i++)
        {
            for(int j = 0; j <= lengthb; j++)
            {
                if(i == 0 || j == 0)
                    f[i][j] = 0;
                else if(inputa[i - 1] == inputb[j - 1])
                    f[i][j] = f[i - 1][j - 1] + 1;
                else
                    f[i][j] = max(f[i - 1][j], f[i][j - 1]);
            }
        }

        printf("%d\n", f[lengtha][lengthb]);
    }

    return 0;
}



Measured memory_bytes: 7148
#include <bits/stdc++.h>
using namespace std;
const int md = 1e9 + 7;
inline void add(int &a, int b) {
  a += b;
  if (a >= md) a -= md;
}
class binary_indexed_tree {
  public:
    binary_indexed_tree (int n) {
      this->n = n;
      tr.resize(n, 0);
    }
    int get_acm_plus1 (int i) {
      int ret = 1;
      for (; i >= 0; i &= i + 1, i--) add(ret, tr[i]);
      return ret;
    }
    void bit_add (int i, int x) {
      for (; i < n; i |= i + 1) add(tr[i], x);
    }
  private:
    int n;
    vector<int> tr;
};
int sz;
vector<int> cvt;
map<int, int> rvt;
inline int convert (int i) {
  assert(0 <= i && i < sz);
  return cvt[i];
}
inline int revert (int j) {
  auto it = rvt.find(j);
  assert(it != rvt.end());
  return it->second;
}
bool cmp (pair<int, int> x, pair<int, int> y) {
  if (x.first > y.first) return true;
  if (x.first < y.first) return false;
  if (x.second < y.second) return true;
  return false;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> x(n), y(m);
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int j = 0; j < m; j++) cin >> y[j];
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  vector<pair<int, int>> lr;
  int l, r;
  for (int crr : x) {
    auto lb = lower_bound(y.begin(), y.end(), crr) - y.begin();
    if (lb == 0 || lb == m) continue;
    lr.emplace_back(l = crr - y[lb - 1], r = y[lb] - crr);
    cvt.push_back(r);
  }
  sort(lr.begin(), lr.end(), cmp);
  lr.resize(unique(lr.begin(), lr.end()) - lr.begin());
  sort(cvt.begin(), cvt.end(), greater<int>());
  cvt.resize(sz = unique(cvt.begin(), cvt.end()) - cvt.begin());
  for (int i = 0; i < sz; i++) rvt[cvt[i]] = i;
  binary_indexed_tree bit(sz);
  for (auto const & p : lr) {
    int i = revert(p.second);
    bit.bit_add(i, bit.get_acm_plus1(i - 1));
  }
  cout << bit.get_acm_plus1(sz - 1) << endl;
  return 0;
}

Measured memory_bytes: 6776
#include <iostream>

int N;
int sum[1005];
int main(){
  std::cin>>N;
  
  int temp=0;
  for(int i=2;i<=N;++i){
    temp = i;
    for(int j=2;j<=N;++j){
      if(temp==0)
        break;
      while(temp%j==0){
        temp/=j;
        ++sum[j];
      }
    }
  }
  
  long long ans =1;
  for(int i=2;i<=N;++i)
    ans=ans*(sum[i]+1)%1000000007;
  
  std::cout<<ans<<std::endl;
}

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

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

    static class CVacation {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            in.nextLine();

            int[] a = new int[n];
            int[] b = new int[n];
            int[] c = new int[n];

            for (int i = 0; i < n; i++) {
                String s = in.nextLine();
                String[] token = s.split(" ");
                a[i] = Integer.parseInt(token[0]);
                b[i] = Integer.parseInt(token[1]);
                c[i] = Integer.parseInt(token[2]);
            }

            // dp[i][j] -> This holds the maximum happiness till ith day
            //                  and considering jth activity
            int[][] dp = new int[n][3];

            dp[0][0] = a[0];
            dp[0][1] = b[0];
            dp[0][2] = c[0];
            for (int i = 1; i < n; i++) {
                dp[i][0] = a[i] + Math.max(dp[i - 1][1], dp[i - 1][2]);
                dp[i][1] = b[i] + Math.max(dp[i - 1][0], dp[i - 1][2]);
                dp[i][2] = c[i] + Math.max(dp[i - 1][0], dp[i - 1][1]);
            }

            out.println(Math.max(dp[n - 1][0], Math.max(dp[n - 1][1], dp[n - 1][2])));
        }

    }
}



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

const int maxn = 2e5+10, maxlogn = 19;
int n, k;
int p[maxn];

namespace ST{
	int mn[maxn][maxlogn], mx[maxn][maxlogn], lg[maxn];
	void init() {
		lg[0] = -1;
		for (int i = 1; i <= n; ++i) {
			mn[i][0] = mx[i][0] = p[i];
			lg[i] = lg[i/2]+1;
		}
		mn[n+1][0] = -n-1;
		mx[n+1][0] = n+1;
		for (int j = 1; j < maxlogn; ++j)
			for (int i = 1; i+(1<<(j-1)) <= n; ++i) {
				mn[i][j] = min(mn[i][j-1], mn[i + (1<<(j-1))][j-1]);
				mx[i][j] = max(mx[i][j-1], mx[i + (1<<(j-1))][j-1]);
			}
	}
	int min(int l, int r) {
		int t = lg[r-l+1];
		return std::min(mn[l][t], mn[r-(1<<t)+1][t]);
	}
	int max(int l, int r) {
		int t = lg[r-l+1];
		return std::max(mx[l][t], mx[r-(1<<t)+1][t]);
	}
}

int solve() {
	ST::init();
	bool same = 0;
	int ans = 0, streak = 1;
	for (int i = 1; i < k; ++i)
		if (p[i] < p[i+1]) streak++;
		else streak = 1;
	for (int i = k; i <= n; ++i) {
		if (streak >= k) same = 1;
		else if (i > k && p[i-k] < ST::min(i-k+1, i-1) && ST::max(i-k+1, i-1) < p[i]);
		else ans++;
		if (p[i] < p[i+1]) streak++;
		else streak = 1;
	}
//	printf("%d %d %d\n", ans, streak, same);
	return ans+same;
}

int main() {
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; ++i)
		scanf("%d", p+i);
	printf("%d\n", solve());
}


Measured memory_bytes: 31488
#include<bits/stdc++.h>
#define int long long 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) a.begin(),a.end()
#define ld long double
using namespace std;
signed main(){
    fast;
    int n,k;
    cin>>n>>k;
    int ans = min(n%k, (k-(n%k)%k));
    cout<<ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
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 LL long long
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> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

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

	for (int i = 0; i < 100; i++)//4ドルケーキ
	{
		for (int j = 0; j < 100; j++){//7ドルケーキ
			if (4*i + 7*j == N) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
A, B, C, X, Y = map(int, input().split())

INF = float('inf')
min_cost = INF

k = 0
while X - k >= 0 or Y - k >= 0:
    cost = A * max(0, X-k) + B * max(0, Y-k) + 2 * C * k
    min_cost = min(min_cost, cost)
    k += 1

print(min_cost)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin>>n>>s;
    bool a[4][101010] = {{false,false},{false,true},{true,false},{true,true}};
    for(int i=2;i<n;i++){
        for(int j=0;j<4;j++){
            a[j][i] = a[j][i-1] ^ a[j][i-2] ^ (s[i-1]=='o');
        }
    }
    int k=-1;
    for(int i=0;i<4;i++){
        if((s[n-1]=='o')==(a[i][n-2]^a[i][n-1]^a[i][0]) && (s[0]=='o') == (a[i][n-1]^a[i][0]^a[i][1])){
            k=i;
            break;
        }
    }
    if(k==-1){
        cout<<-1<<endl;
    }
    else{
        for(int i=0;i<n;i++){
            cout<<"WS"[a[k][i]];
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
#define INF 1000000007
#define rep(i, N) for(ll i = 0; i < N; i++)
#define rep2(i, j, k) for(ll i = j; i < k; i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define print(x) cout << x << "\n"
#define print2(x, y) cout << x << " " << y << "\n"
#define printv(vec) rep(lp, vec.size()) cout << vec[lp] << " "; print(""); 
#define show(x) cerr << #x << " = " << x << "\n";
#define ALL(v) v.begin(), v.end()
#define SUM(v) accumulate(ALL(v), 0)
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
#define pb(x) push_back(x)
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
using namespace std;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;

const int mod = INF;
class mint {
public:
	ll x;
	mint(ll x = 0) : x((x % mod + mod) % mod) {}
	mint operator-() const { 
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}
	friend ostream& operator<<(ostream& os, const mint& m){
		os << m.x;
		return os;
	}
};

ll modpow(ll x, ll n, ll p = INF) {
	if (n == 0) return 1 % p;
	if (n % 2 == 0) return modpow(x * x % p, n / 2, p);
	else return x * modpow(x, n - 1, p) % p;
}

struct union_find{

	vl parent;
	vl sizes;

	void init(ll n) {
		rep(i, n) parent.push_back(i);
		rep(i, n) sizes.push_back(1);
	}

	ll root(ll n){
		if(parent[n] == n) return n;
		return parent[n] = root(parent[n]);
	}

	ll size(ll n) {
		return sizes[root(n)];
	}

	bool is_same(ll a, ll b){
		return root(a) == root(b);
	}

	void unite(ll a, ll b){
		if(is_same(a, b)) return;
		sizes[root(a)] += size(b);
		parent[root(b)] = root(a);
	}
	
	ll group_count(){
		ll ret = 0;
		rep(i, parent.size()) ret += (parent[i] == i);
		return ret;
	}
};

void Main(){

	ll N, M;
	cin >> N >> M;
	vvl v(M, vl(2));
	rep(i, M) cin >> v[i][0] >> v[i][1];
	
	union_find uf;
	uf.init(N);
	
	rep(i, M) uf.unite(v[i][0], v[i][1]);
	
	ll ans = uf.group_count() - 1;
	print(ans);
	
}

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll t = 1;
	//cin >> t;
	rep(i, t) Main();
	return 0;
	
}





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

#define st first
#define nd second
typedef long long LL;
typedef pair <int, int> PII;
typedef pair <LL, LL> PLL;

const int N = 2e5;
int A[N + 1];

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

    for (int i = 0; i < n; ++i)
        scanf("%d", &A[i]);

    LL result = 0LL;

    for (int i = 0; i < n; ++i)
    {
        LL counter = 0LL;
        if (A[i] == 0)
        {
            bool good = (i == 0) || (A[i - 1] != 0);

            while (i < n && A[i] == 0)
            {
                ++i;
                ++counter;
            }
            if (good)
                result += (counter + 1LL) * counter / 2LL;
        }

        if (i >= n)
            break;

        int s = 0, x = 0;
        for (int j = i; j < n && s == x; ++j)
        {
            s += A[j];
            x ^= A[j];
            if (s == x)
                result += (counter + 1LL);
        }
    }

    printf("%lld", result);

    return 0;
}

Measured memory_bytes: 1024
//
// Created on 2020/01/18.
//

//#include <bits/stdc++.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;
using gragh = vector<vector<int>>;

int main() {
    int w;
    int h;
    int n;
    cin>>h>>w>>n;

    int ans = 0;
    int now = 0;

    if (w>=h){
        for (int i = 1; i <= h; ++i) {
            ans ++;
            now +=  w;
            if (n <= now) {
                cout<<ans<<endl;
                return 0;
            }
        }
        for (int j = 1; j <= w; ++j){
            ans ++;
            now += (h -1);
            if(n <= now){
                cout<<ans<<endl;
                return 0;
            }
        }


    }
    else{
        for (int i = 1; i <= w; ++i) {
            ans ++;
            now +=  h;
            if (n <= now) {
                cout<<ans<<endl;
                return 0;
            }
        }
        for (int j = 1; j <= h; ++j){
            ans ++;
            now += (w -1);
            if(n<= now){
                cout<<ans<<endl;
                return 0;
            }
        }


    }

    cout<<ans<<endl;
}


Measured memory_bytes: 256
n,m = (int(i) for i in input().split())
s = input()
t = input()
def gcd(a,b):
	if a%b: return gcd(b,a%b)
	else: return b
g = gcd(n,m)
ng, mg = n//g, m//g
if all(s[i*ng] == t[i*mg] for i in range(g)) :
    print(n*m//g)
else :
    print(-1)

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

int main(){
  int n, k;
  cin >> n >> k;
  ll h[n];
  rep(i,n) cin >> h[i];
  sort(h,h+n,greater<ll>());
  int a = min(n,k);
  ll ans = 0;
  for(int i = a; i < n; i++) ans += h[i];
  cout << ans << endl; 
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

void show(vector<int> &v) {
	for (auto x: v) {
		printf("%3d ", x);
	}
	printf("\n");
}

void check(vector<int> a, vector<int> x, vector<int> y) {
	printf("check\n");
	printf("    ");
	show(a);

	for (int i = 0; i < x.size(); i++) {
		printf("%2d: ", i);
		a[y[i]] += a[x[i]];
		show(a);
	}
}

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

	vector<int> a(n, 0), x, y;
	int i1 = 0; // 最小
	int i2 = 0; // 最大
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] < a[i1]) { i1 = i;}
		if (a[i] > a[i2]) { i2 = i;}
	}

	if (abs(a[i2]) > abs(a[i1])) {
		for (int i = 0; i < n; i++) {
			if (i != i2) {
				x.emplace_back(i2);
				y.emplace_back(i);
			}
		}
		for (int i = 1; i < n; i++) {
				x.emplace_back(i-1);
				y.emplace_back(i);
		}
	} else {
		for (int i = 0; i < n; i++) {
			if (i != i1) {
				x.emplace_back(i1);
				y.emplace_back(i);
			}
		}
		for (int i = n - 1; i > 0; i--) {
				x.emplace_back(i);
				y.emplace_back(i-1);
		}
	}

	cout << x.size() << endl;
	for (int i = 0; i < x.size(); i++) {
		cout << x[i] + 1 << " " << y[i] + 1 << endl;
	}

	// check(a, x, y);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<functional>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X <<":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const ll INF = 9e14;
typedef std::pair<ll,ll> P;
struct edge{ int to,cost; };
#define VMAX 100000

ll N,M,X,K,Q;
double A,B,C,D;

ll ans;
bool F=false;
string S,T,U;
int main(){
    cin>>A>>B>>X;
    double s;
    if((double)X<=(double)A*A*B/2.0){
        s=atan2((2*X/(B*A)),(B));

    }else{
        s=atan2((A),2*(A*B-(X/A))/A);
    }
    printf("%.09lf\n",90-(s*180.0/3.14159265358979));
}

Measured memory_bytes: 256
ans=[0]*6
for i in range(int(input())):
  a=float(input())
  if a < 165.0:ans[0]+=1
  if a >= 165.0 and 170 > a :ans[1]+=1
  if a >= 170.0 and 175 > a :ans[2]+=1
  if a >= 175.0 and 180 > a :ans[3]+=1
  if a >= 180.0 and 185 > a :ans[4]+=1
  if a >= 185.0:ans[5]+=1
if __name__ == '__main__':
  for i in range(1,7):
    print "%d:%s"%(i,ans[i-1]*"*")

Measured memory_bytes: 5024
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
#define INF 1e18
#define int long long
typedef pair<int,int> P;
#define MP make_pair

  int n, m, k, s, p, q;
  int zonbi[100001];
  int dis[100001];
  int costco[100001];
  priority_queue <P, vector<P>, greater<P> > pq;
  vector <int> pairs[100001];
signed main(){

  for (int i = 0; i < 100001; i++){
    dis[i] = INF;
    costco[i] = INF;
  }

  cin >> n >> m >> k >> s >> p >> q;
  for (int i = 0; i < k; i++){
    cin >> zonbi[i];
  }
  for (int i = 0; i < m; i++){
    int x, y;
    cin >> x >> y;
    pairs[x].push_back(y);
    pairs[y].push_back(x);
  }

  for (int i = 0; i < k; i++){
    pq.push(MP(0, zonbi[i]));
    dis[zonbi[i]] = 0;
  }
while(!pq.empty()){
      int cost, start;
      cost = pq.top().first;
      start = pq.top().second;
      pq.pop();
      if(s == cost) continue;
      for(int j = 0; j < pairs[start].size(); j++){
        if (dis[pairs[start][j]] > cost + 1){
          dis[pairs[start][j]] = cost + 1;
          pq.push(MP(cost + 1, pairs[start][j]));
        } 
      }
    }
  pq.push(MP(0, 1));
  costco[1] = 0;
  while(!pq.empty()){
    int cost, start;
    cost = pq.top().first;
    start = pq.top().second;
    pq.pop();
    for (int i = 0; i < pairs[start].size(); i++){
      int hoge;
      if (dis[pairs[start][i]] == 0){
        continue;
      }else if (dis[pairs[start][i]] == INF){
        hoge = p;
      }else{
        hoge = q;
      }
      if (pairs[start][i] == n){
          hoge = 0;
      }
      if (costco[pairs[start][i]] > cost + hoge){
        costco[pairs[start][i]] =  cost + hoge;
        pq.push(MP(cost + hoge, pairs[start][i]));
      }
    }
  }
  cout << costco[n] << endl;
  return 0;
}

Measured memory_bytes: 13652
/* Author: Rennan Rocha
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define F first
#define S second
#define PB push_back
#define MP make_pair

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>
#define vpll vector<pll>

#define INF 1e18
#define MOD 1000000007

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//*find_by_order(); order_of_key();

int main() {
    ios_base::sync_with_stdio(false);

    int n;
    string s;
    cin >> n >> s;

    for(int i = 0; i < min(n, (int) s.size()); i++) {
        cout << s[i];
    }
    if(s.size() > n) cout << "...";
    cout << "\n";
}


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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define Nmax 300000 

typedef long long ll;

const ll mod = 1e9+7;
const double pi = acos(-1);

int n,i,j,k,t,m;

int main(){
	ll a,b,c,k;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &k);
	if(!(k&1))
		printf("%lld\n", a-b);
	else
		printf("%lld\n", b-a);
	return 0;
}

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

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		long[][] dist = new long[n][n];
		long[][] distWF = new long[n][n];
		int[][] edge = new int[n*(n-1)/2][3];
		long r = 0;
		for(int i = 0; i < n; i++){
		    for(int j = 0; j < n; j++){
		        dist[i][j] = sc.nextLong();
		        distWF[i][j] = dist[i][j];
		        r += dist[i][j];
		    }
		}
		
		// 計算
		long result = wf(distWF, r);
		if(!Arrays.deepEquals(dist, distWF)) result = -1;
		
		// 出力
		System.out.println(result);
		
	}
	
	static long wf(long[][] dist, long r) {
		int n = dist[0].length;
		long INF = 1001001001001001L;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				if(dist[i][j] == 0) dist[i][j] = INF;
				if(i == j) dist[i][j] = 0;
			}
		}
		
		boolean[][] visited = new boolean[n][n];
		for(int k = 0; k < n; k++){
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
				    if(dist[i][j] >= dist[i][k] + dist[k][j]){
				        if(!visited[i][j] && i != k && j != k){
				            r -= dist[i][j];
				            visited[i][j] = true;
				            //System.out.println("r:" + r + " i:" + i + " k:" + k + " j:" + j + " d:" + dist[i][j]);
				        }
				        dist[i][j] = dist[i][k] + dist[k][j];
				    }
				}
			}
		}
		
		return r/2;
	}
}


Measured memory_bytes: 63964
#include <stdio.h>
#define MAX 1299709

int isPrime[MAX+1];
int k;

void solve(){
	if(isPrime[k]){
		printf("0\n");
		return;
	}
	int smaller,larger,i;
	for(i=k;i>0;i--){
		if(isPrime[i]){
			smaller=i;
			break;
		}
	}
	for(i=k;i<MAX;i++){
		if(isPrime[i]){
			larger=i;
			break;
		}
	}
	printf("%d\n",larger-smaller);
	return;
}

int main(void){
	int i,j;
	for(i=2;i<=MAX;i++){
		isPrime[i]=1;
	}
	for(i=2;i<=MAX;i++){
		if(isPrime[i]){
			for(j=2;i*j<=MAX;j++){
				isPrime[i*j]=0;
			}
		}
	}
	while(scanf("%d",&k),k){
		solve();
	}

	return 0;
}

Measured memory_bytes: 5688
#include <iostream>
int main(){
        int A,B,K;
        std::cin>>A>>B>>K;
        int i=std::min(A,B),count=0;
        while(count!=K) {
                if(A%i==0&&B%i==0) count++;
                i--;
        }
        std::cout<<i+1;
        return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999

int data[20000];

int f(int tmp,int n){
    int pre = tmp;
    while(1){
        bool f=true;
        if(tmp<0)tmp+=n,f=false;
        if(tmp>(n-1)/2)tmp = n-tmp,f=false;
        if(f)break;
    }
    data[10000+pre] = tmp;
    return tmp;
}

int main(){
    int n;
    while(cin>>n&&n){
        rep(i,20000)data[i] = -1;
        set<int> a;
        for(int i=1;i<n;i++){
            a.insert( (i*i)%n );
        }
        
        vector<int> vec;
        for(int x : a) vec.pb(x);
        int b[10000]={};

        rep(i,vec.size()){
            rep(j,vec.size()){
                if(i==j)continue;
                int tmp = vec[i]-vec[j];
                if(data[10000+tmp]!=-1)tmp = data[10000+tmp];
                else tmp = f(tmp,n);
                b[tmp]++;
            }
        }
        int num = (n-1)/2;
        for(int i=1;i<=num;i++){
            printf("%d\n",b[i]);
        }
    }
}

Measured memory_bytes: 3432
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());

        int start = 1;
        while (start * 2 <= n){
                start *= 2;
        }

        System.out.println(start);
    }
}


Measured memory_bytes: 24532
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()


int main() {
	int n;
	cin >> n;
	vector<int>c(n - 1), s(n - 1), f(n - 1);
	rep(i, n - 1)cin >> c[i] >> s[i] >> f[i];
	vector<int> duration(n, 0);
	rep(i, n) {
		int t = 0;
		for (int j = i; j < n-1; j++) {
			if (t <= s[j]) {
				t = s[j];
			}
			else if (t%f[j]==0) {
				t = t;
			}
			else {
				t = t + f[j] - (t%f[j]);
			}
			t += c[j];
		}
		duration[i] = t;

	}
	rep(i, n)cout << duration[i] << endl;
	return 0;
}





Measured memory_bytes: 256
# -*- coding: utf-8 -*-


def main():
    a, b, k = map(int, input().split())
    takahashi = a
    aoki = b

    for i in range(k):
        if i % 2 == 0:
            if takahashi % 2 == 1:
                takahashi -= 1

            takahashi -= takahashi // 2
            aoki += takahashi
        else:
            if aoki % 2 == 1:
                aoki -= 1

            aoki -= aoki // 2
            takahashi += aoki

    print(takahashi, aoki)


if __name__ == '__main__':
    main()


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, x;
	cin >> n >> x;
	int ans = 1;
	int d = 0;
	rep(i,n){
		int l;
		cin >> l;
		d += l;
		if(d <= x) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int n, k, count=0;
    cin >> n >> k;
    vector <int> h(n);
    for(int i=0;i<n;i++){
        cin >> h[i];
        if(h[i]>=k) count++;
    }
    cout << count << '\n';
}

Measured memory_bytes: 640
# -*- coding: utf-8 -*-
import sys
import os

if __name__ == "__main__":
    # input
    N, K = map(int, input().split())

    if N % 2 == 0:
        if K <= N / 2:
            print("YES")

        else:
            print("NO")
    else:
        if K <= (N + 1) / 2:
            print("YES")
        else:
            print("NO")


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

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (auto& a : A) cin >> a;
  ll ans = 0;
  for (int k = 0; k < 63; k++) {
    ll m = 1ll << k, c = 0;
    for (auto a : A)
      if (a & m) c++;
    ans += m % MOD * c % MOD * (N - c) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2688
N, M = map(int, input().split())
left=0
right=N

for i in range(M):
    L, R = map(int, input().split())
    if L > left:
        left = L
    if R < right:
        right = R

if left <= right:
    print(right-left+1)
else:
    print(0)

Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>

int main(int argc, char** argv)
{
    std::string S;
    std::cin >> S;
    const char*c= S.c_str();
    bool ret=true;
    for(int i=0;i<3;i++)
    {
        if(c[i]==c[i+1]){ret=false;}
    }

    if(ret){std::cout <<"Good";}
    else{std::cout <<"Bad";}
    
    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
odds=0
count_2=0
count_4=0
for u in a:
    if u%2==1:
        odds+=1
    elif u%4==0:
        count_4+=1
    else:
        count_2+=1
if count_2==0:
    if count_4>=odds-1:
        print("Yes")
    else:
        print("No")
else:
    if count_4>=odds:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 14252
//Yattazo! Watashiha-Yosen-tsuukashita! It's 460points/600points! OHO!!!!!
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int x[64000][256],n,m,y[64000],z[64000],d,minx;
int main(){
	while(true){
		minx=2000000000;
		for(int i=0;i<64000;i++){for(int j=0;j<256;j++){x[i][j]=2000000000;}}
		cin>>n>>m;if(!n){break;}
		for(int i=0;i<m;i++){cin>>y[i];}
		for(int i=1;i<=n;i++){cin>>z[i];}
		x[0][128]=0;
		for(int i=1;i<=n;i++){
			for(int j=0;j<256;j++){
				if(x[i-1][j]<1000000000){
					for(int k=0;k<m;k++){
						d=y[k]+j;
						if(d<0){d=0;}
						if(d>255){d=255;}
						x[i][d]=min(x[i][d],x[i-1][j]+(int)pow(1.0*(z[i]-d),2));
					}
				}
			}
		}
		for(int i=0;i<256;i++){minx=min(minx,x[n][i]);}
		cout<<minx<<endl;
	}
}

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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

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



int main(void)
{
  ll x, a, b;
  cin >> x >> a >> b;
  cout << ((x - a) % b) << endl;
}


Measured memory_bytes: 256