akhauriyash/Code-Regression huggingface dataset:
using System;
class Example
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        Console.Write(n + ":");
        while(n % 2 ==0)
        {
            Console.Write(" 2");
            n = n / 2;
        }

        for(int i = 3; i <= n; i = i + 2)
        {
            while( n % i ==0)
            {
                Console.Write(" " +i);
                n = n / i;
            }
        }
        Console.WriteLine();
    }
}

Measured memory_bytes: 9200
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














ll X;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> X;

	ll x = 100;
	int ans = 0;
	while (x < X) {
		x = x + x / 100;
		ans++;
	}
	cout << ans << endl;
}







Measured memory_bytes: 3648
#include<stdio.h>
int main()
{
    double n, m, d;
    scanf("%lf %lf %lf", &n, &m, &d);
    double ans;
    ans = m - 1;
    if (d > 0)
        ans *= (2 * (n - d)) / (n*n);
    else
        ans /= n;
    printf("%.20lf\n", ans);
    return 0;
}

Measured memory_bytes: 128
n = int(input())
listA = list(map(int, input().split()))

sumL = []
totalSum = sum(listA)
for a in listA:
    totalSum-=a
    sumL.append(totalSum)

ans = 0
for i in range(len(listA)):
    ans += listA[i]*sumL[i]%(10**9 + 7)
    ans %= (10**9 + 7)
print(ans)

Measured memory_bytes: 31608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  ll n, m, k, ans = 0, cnt = 0;
  cin >> n >> m >> k;
  vector<ll> a(n), b(m), ra(n + 1), rb(m + 1);

  REP(i, n) { cin >> a[i]; }
  REP(i, m) { cin >> b[i]; }
  ra[0] = 0;
  rb[0] = 0;
  for (ll i = 1; i <= n; i++) {
    ra[i] = ra[i - 1] + a[i - 1];
  }
  for (ll i = 1; i <= m; i++) {
    rb[i] = rb[i - 1] + b[i - 1];
  }

  ll next_b = m;
  REP(i, n+1) {
    for (ll j = next_b; j >= 0; j--) {
        if(ra[i]+rb[j]<=k){
          ans = max(ans, i + j);
          next_b = j;
          break;
        }
    }
  }
//  DEBUGS(ra);
//  DEBUGS(rb);
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 9488
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 




////////////////////////////////////////////////////////


ll kaizyou(ll n){
    ll re = 1;
    while(n != 1){
        re *= n;
        n--;
        re %= MOD;
    }
    return re;
}

int main() {
    ll n, m; cin >> n >> m;
    if(abs(n-m) >= 2){
        co(0);
        return 0;
    }

    ll a = 1, b = 1;
    a = kaizyou(n);
    b = kaizyou(m);
    if(n == m){
        co(((2*a)%MOD)*b%MOD);
    }else{
        co((a*b)%MOD);
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int n, a, b;
      int A = 0, B = 0;
      cin >> n >> a >> b;
      A = n * a;
      B = b;
      if (A > B) {
       cout << B << endl; 
      }
      else if (A < B){
        cout << A << endl;
      }
      else {
        cout << B << endl;
      }
    }

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    int min1 = a.at(0);
    int max1 = a.at(n - 1);
    long long ans = 1000000000000;
    long long count = 0;
    for (int i = min1; i <= max1; i++)
    {
        count = 0;
        for (int j = 0; j < n; j++)
        {
            count += (a.at(j) - i) * (a.at(j) - i);
        }
        ans = min(count, ans);
    }

    cout << ans << endl;
}

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

using namespace std;

typedef unsigned long long ll;
typedef vector<ll> vll;
typedef vector<bool> vb;



const ll INF=1e+16;

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

struct edge{ll to,cost;};
typedef pair<ll,ll> P;
const ll MAXV=100005;
vector<vector<edge>> G(MAXV);
vector<ll> d(MAXV,INF);

void dijkstra(ll s){
priority_queue<P,vector<P>,greater<P>> que;
d[s]=0;
que.push(P(0,s));
while(!que.empty()){
 P p=que.top(); que.pop();
ll v=p.second;
if(d[v]<p.first) continue;
for(int i=0;i<G[v].size();i++){
 edge e=G[v][i];

if(d[e.to]>d[v]+e.cost){
d[e.to]=d[v]+e.cost;
que.push(P(d[e.to],e.to));
}
}
}
}

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

  ll n,m;
  cin >> n >> m;
 
  rep(i,0,n-1) G[i+1].push_back(edge{i,0LL});
  rep(i,0,m){
   ll l,r,c;
    cin >> l >> r >> c;
    l--;
    r--;
    G[l].push_back(edge{r,c});
  }
  dijkstra(0);
  if(d[n-1]!=INF) cout << d[n-1] << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 10232
N, X = map(int, input().split())
Xs = list(map(int, input().split()))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

from functools import reduce

# X との差
y = [abs(x - X) for x in Xs]
print(reduce(gcd, y))

Measured memory_bytes: 63640
#![allow(unused_imports)]
use std::io::{ self, Write };
use std::str::FromStr;
use std::cmp::{ min, max };
use std::collections::{ BinaryHeap, VecDeque, HashMap };

#[allow(unused_macros)]
macro_rules! trace {
    ($var:expr) => {
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($var), $var);
    };
    ($($args:expr),*) => {
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($($args),*), ($($args),*));
    };
}

const M: usize = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let mut ds = HashMap::new();
    for i in 0..n {
        let d: i32 = sc.cin();
        let b = if let Some(a) = ds.get(&d) { a + 1 } else { 1 };
        ds.insert(d, b);
    }
    // trace!(ds);

    let m: usize = sc.cin();
    let mut ts = HashMap::new();
    for i in 0..m {
        let t: i32 = sc.cin();
        let b = if let Some(a) = ts.get(&t) { a + 1 } else { 1 };
        ts.insert(t, b);
    }
    // trace!(ts);

    let mut ok = true;
    for (t, c) in ts.iter() {
        if let Some(a) = ds.get(&t) {
            if a < c { ok = false; }
        } else {
            ok = false;
        }
        if !ok { break }
    }
    println!("{}", if ok { "YES" } else { "NO"});

}

#[allow(dead_code)]
struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn reserve(&mut self) {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        self.reserve();
        match self.buffer.pop_front().unwrap().parse::<T>() {
            Ok(a) => a,
            Err(_) => panic!("parse err")
        }
    }
}


Measured memory_bytes: 21476
#include<bits/stdc++.h>
using namespace std;
int a[111];
int sum[111];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum[i]=sum[i-1]+a[i];
	}
	int ans=1e9;
	for(int i=0;i<=n;i++)
		ans=min(ans,max(sum[i],sum[n]-sum[i])-min(sum[i],sum[n]-sum[i]));
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 256
import kotlin.math.*

fun str() = readLine()!!
fun int() = str().toInt()
fun long() = str().toLong()

fun read(d: String = " ") = str().split(d)
fun <T> list(d: String = " ", f: String.() -> T) = read(d).map { f(it) }
fun list() = list { toInt() }

fun <T> MutableList<T>.removeLast() = this.removeAt(this.lastIndex)

const val mod = 1000000007L

fun modpow(n: Long, p: Long = mod - 2L): Long = when {
    p == 0L -> 1L
    p % 2 == 1L -> n * modpow(n, p - 1) % mod
    else -> {
        val d = modpow(n, p / 2)
        d * d % mod
    }
}

fun nCr(n: Long, r: Long): Long = ((n - r + 1L..n).asSequence() + (2L..r).asSequence().map { modpow(it) }).fold(1L) { a, b -> a * b % mod }

fun main() {
    abc000X()
}

fun abc000X() {
    val n = long()
    var r = 0L
    for (i in 1..n / 3) {
        //System.err.println(n - 3 * i to i - 1 to nCr(n - 3 * i, i - 1))
        r = (r + nCr(n + i - 1 - 3 * i, i - 1)) % mod
    }
    println(r)
}


Measured memory_bytes: 56940
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	int res = 0;
	vector<int> A = { 10000,5000,1000,500 };
	bool f = true;
	while (f) {
		f = false;
		for (int i = 0; i < 4; i++) {
			if (N >= A[i]) {
				N -= A[i];
				res += A[i];
				f = true;
				break;
			}
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 3200
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;

int main(void){
  string s;
  getline(cin,s);
  for(int i = 0 ; i < s.size() ; i ++){
    printf("%c",toupper(s[i]));
	   }printf("\n");
    
}

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

int main() {
long long n,a,b;
cin >> n >> a >> b;
long long length=a+b;
long long ans= n/length*a;
long long amari=n%length;
if(amari>=a)amari=a;
cout << ans + amari;
}


Measured memory_bytes: 256
# coding: utf-8
from math import ceil
X = int(input())
if X <= 6:
    print(1)
else:
    mod = X % 11
    if mod >= 7:
        print(X // 11 * 2 + 2)
    elif mod == 0:
        print(X // 11 * 2)
    else:
        print(X // 11 * 2 + 1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  ulint h, w;
  cin >> h >> w;
  if(h == 1 || w == 1) cout << 1 << endl;
  else cout << (h*w+1)/2 << endl;
  return 0;
}

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

using namespace std;

const int N = 100005;

int n, k, a[N];

int main() {
  scanf("%d %d", &n, &k);
  int gcd;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    if (i > 1) {
      gcd = __gcd(gcd, a[i]);
    }
    else {
      gcd = a[i];
    }
  }
  sort(a + 1, a + n + 1);
  if (k > a[n]) {
    puts("IMPOSSIBLE");
  }
  else {
    if (k % gcd) {
      puts("IMPOSSIBLE");
    }
    else {
      puts("POSSIBLE");
    }
  }
  return 0;
}


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

int main(){
  int N;
  cin >> N;
  std::vector<int> A(N);
  rep(i,N) cin >> A[i];
  
  int max = *max_element(A.begin(), A.end());
  int min = *min_element(A.begin(), A.end());
  
  cout << max - min << endl;

 return 0; 
}


Measured memory_bytes: 256
macro_rules! scan_sub {
    ( $itr:ident, $t:ty ) => {
        let mut buf = String::new();
        let $itr = {
            while buf.trim().len() == 0 {
                buf = String::new();
                std::io::stdin().read_line(&mut buf).unwrap();
            }
            buf.split_whitespace().map(|n| n.parse::<$t>().unwrap())
        };
    };
}

macro_rules! scan {
    ( $x:ident; Vec<$t:ty> ) => {
        scan_sub!(itr, $t);
        let $x = itr.collect::<Vec<_>>();
    };
    ( $( $x:ident ),*; $t:ty ) => {
        scan_sub!(itr, $t);
        let mut itr = itr;
        $(
            let $x = itr.next().unwrap();
        )*
    };
}

fn find(x: usize, par: &mut Vec<usize>) -> usize {
    if par[x] == x {
        return x;
    }

    par[x] = find(par[x], par);
    par[x]
}

fn unite(x: usize, y: usize, par: &mut Vec<usize>, rank: &mut Vec<usize>) {
    let x = find(x, par);
    let y = find(y, par);
    if x == y {return;}

    if rank[x] < rank[y] {
        par[x] = y;
    } else {
        par[y] = x;
        if rank[x] == rank[y] {
            rank[x] += 1;
        }
    }
}

fn same(x: usize, y: usize, par: &mut Vec<usize>) -> bool {
    find(x, par) == find(y, par)
}

fn main() {
    scan!(n, m, k; usize);
    let mut friend_num = vec![0; n];
    let mut par = (0..n).collect::<Vec<_>>();
    let mut rank = vec![0; n];

    for _ in 0..m {
        scan!(a, b; usize);
        let (a, b) = (a-1, b-1);
        friend_num[a] += 1;
        friend_num[b] += 1;
        unite(a, b, &mut par, &mut rank);
    }

    let mut par_size = vec![0; n];
    for i in 0..n {
        par_size[find(i, &mut par)] += 1;
    }

    let mut block_num = vec![0; n];

    for _ in 0..k {
        scan!(c, d; usize);
        let (c, d) = (c-1, d-1);
        if same(c, d, &mut par) {
            block_num[c] += 1;
            block_num[d] += 1;
        }
    }

    for i in 0..n {
        let mut t = par_size[par[i]];
        t -= friend_num[i];
        t -= block_num[i];
        print!("{} ", t-1);
    }
    println!("");
}


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

int main() {
	int a,b;
  	cin >> a >> b;
  
  	int ans = a * b;
  
  	if(ans % 2 == 0) {
    	cout << "Even" << endl;
    }else {
      	cout << "Odd" << endl;
    }
}

Measured memory_bytes: 256
N=int(input())
def bi(num):
  ls_bi=[0 for _ in range(N+1)]
  for bi_i in range(N):
    if (2**bi_i)&num>0:
      ls_bi[bi_i]=1
      ls_bi[N]+=1
  return ls_bi

syogen=[[-1 for _  in range(N)] for _ in range(N)]

for i in range(N):
  Ai=int(input())
  for j in range(Ai):
    x,y=[int(s) for s in input().split()]
    syogen[i][x-1]=y
#print(syogen)
ans=[]
for n in range(2**N):
  ls=bi(n)
  flag=1
  for i in range(N):
    if ls[i]==1:
      for j in range(N):
        if ls[j]==syogen[i][j] or syogen[i][j]==-1:
          continue
        else:
     #     print(ls,i,j)
          flag=0
          break
    if flag==0:
      break
  else:
    ans.append(ls[N])
print(max(ans))
  
        
          
    


Measured memory_bytes: 46184
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<array>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;

static const int N=100;
static const int INF =(1<<21);
int n,M[N][N];
int d[N];


void dfs(int s){
    queue<int> q;
    q.push(s);
    rep(i,n)d[i]=INF;
    d[s]=0;
    int u;
    while(!q.empty()){
        u=q.front();q.pop();
        for(int i=0;i<n;i++){
            if(M[u][i]==0)continue;
            if(d[i]!=INF)continue;
            d[i]=d[u]+1;
            q.push(i);
        }
    }
    rep(i,n){
        cout<<i+1<<" "<<(d[i]==INF?(-1):d[i])<<endl;
    }
    
    
}




int main(){
    int u,k,v;
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            M[i][j]=0;
        }
    }
    
    for(int i=0;i<n;i++){
        cin>>u>>k;
        u--;
        for(int j=0;j<k;j++){
            cin>>v;
            v--;
            M[u][v]=1;
        }
    }
    
    dfs(0);
    
    
    

return 0;
}



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

const int mxN = 1e5 + 2;
int n, m, visited[mxN], dp[mxN];
vector<int> adj[mxN], radj[mxN], topo;

void dfs(int node)
{
    visited[node] = true;
    for (auto& v : adj[node])
    {
        if (!visited[v])
        {
            dfs(v);
        }
    }
    topo.push_back(node);
}

int main()
{
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int x, y;
        cin >> x >> y;
        x--; y--;
        adj[x].push_back(y);
        radj[y].push_back(x);
    }
    for (int i = 0; i < n; i++)
    {
        if (!visited[i])
            dfs(i);
    }
    reverse(topo.begin(), topo.end());
    // for (auto& num : topo)
    //     cout << num << " ";
    // cout << endl;

    int ret = 0;
    for (int i = 0; i < n; i++)
    {
        for (auto& v : radj[topo[i]])
        {
            dp[topo[i]] = max(dp[topo[i]], dp[v] + 1);
        }
        ret = max(ret, dp[topo[i]]);
    }
    cout << ret << endl;
}

Measured memory_bytes: 17504
#l = list(map(int, input().split(' ')))

#num = int(input())
#S = str(input())
# k = (X - Ai - Bj) / C
# C = 0
#
A=int(input())
B=int(input())
C=int(input())
X=int(input())
sum = 0

for i in range(0,A+1):
    for j in range(0,B+1):
        # Cが固定のパターン
        if C == 0:
            if i*500 + j*100 == X:
                sum+=1
                break
        # Cが不定のパターン
        else:
            k = ( X - i*500 - j*100 ) / 50
            #print (k)
            if k < 0:
                break
            if k<=C:
                sum+=1
        # for k in range(0,C+1):
        #     if(500*i+100*j+50*k==X):

print(sum)


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
using namespace std;


vector<int> divisorNum;

int main() {
	int N;
	cin >> N;
	divisorNum = vector<int>(N + 1, 0);
	for (int i = 1; i <= N; i++)
	{
		for (int j = i; j <= N; j += i)
		{
			divisorNum[j]++;
		}
	}
	
	int ans = 0;
	for (int i = 1; i <= N; i += 2)
	{
		if (divisorNum[i] == 8) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        if(n % 1000 == 0){
            System.out.println(0);
        } else {
            System.out.println(1000 - (n % 1000));
        }

    }

}




Measured memory_bytes: 35756
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MAXN 2000010
using namespace std;

int read(){
	char c;
	while((c=getchar())<'0' || c>'9');
	int res=c-'0';
	while((c=getchar())>='0' && c<='9') res=res*10+c-'0';
	return res;
}

int n,m,numq;
int p[MAXN][2];
int ans[MAXN];

namespace Fenwick{
	int c[MAXN];

	void add(int x,int v){
		x++;
		while(x<=n+1){
			c[x]+=v;
			x+=x&(-x);
		}
	}

	int sum(int x){
		x++;
		int res=0;
		while(x){
			res+=c[x];
			x-=x&(-x);
		}
		return res;
	}
}

struct Event{
	int x1,x2,y,id;
}q[MAXN];

bool cmp(Event x,Event y){
	if(x.y==y.y) return x.id<y.id;
	return x.y<y.y;
}

int main(){
#ifdef DEBUG
	freopen("E.in","r",stdin);
#endif
	m=read(); n=read();
	for(int i=1;i<=m;i++){
		p[i][0]=read(); p[i][1]=read();
		q[++numq]=(Event){p[i][0],p[i][1],p[i][1]+1,0};
	}
	for(int i=1;i<=n;i++)
		for(int j=i;j<=n;j+=i)
			q[++numq]=(Event){j,j,j+i,i};
	sort(q+1,q+numq+1,cmp);
	for(int i=1;i<=numq;i++)
		if(q[i].id) ans[q[i].id]+=Fenwick::sum(q[i].x1);
		else Fenwick::add(q[i].x1,1),Fenwick::add(q[i].x2+1,-1);
	for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
	return 0;
}


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

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

  if (D == 25) cout << "Christmas" << endl;
  else if (D == 24) cout << "Christmas Eve" << endl;
  else if (D == 23) cout << "Christmas Eve Eve" << endl;
  else if (D == 22) cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
typedef long long ll;
typedef unsigned long long ull;
const ll LINF = 1e18;
const int INF = 1e8;

using namespace std;


//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()ss		
#define debug system("pause")				//デバッグ用


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

	string s;
	cin >> s;
    string s1;
    string s2;
    s1.push_back(s[0]);
    s1.push_back(s[1]);
    s2.push_back(s[2]);
    s2.push_back(s[3]);

	if (s1<="12"&&s1>="01"&&s2<="12"&&s2>="01")
	{
		cout << "AMBIGUOUS";
	}
	else if (s1>="01"&&s1<="12")
	{
		cout << "MMYY";
	}
	else if (s2<="12"&&s2>="01")
	{
		cout << "YYMM";
	}
	else
	{
		cout << "NA";
	}

	cout << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{

    int S,h,m,s;

    scanf("%d", &S);

    h = S / 3600;
    m = (S - h * 3600) / 60;
    s = S % 60;

    printf("%d:%d:%d\n",h,m,s);

    return 0;
}


Measured memory_bytes: 2740
#include <bits/stdc++.h> 
 
#define INF (1<<31)//INT_MAX/2
#define MOD 1000000007
 
using ll  = long long;
using ull = unsigned long long;
 
int main(int argc, char *argv[])
{
    int X;
    std::cin >> X;

    std::vector<int> a;

    for (int b = 1; b < 33; b++) {
        for (int p = 2; p < 10; p++) {
            if (std::pow(b, p) <= X) {
                a.push_back(std::pow(b, p));
            }
        }
    }

    int max = 0;
    for (int i = 0; i < a.size(); i++) {
        if (max < a[i]) {
            max = a[i];
        }
    }

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

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


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;

lli mod197 = 1000000007LL;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {
	lli N, A, B;
	cin >> N >> A >> B;

	COUT(min(N * A,B));

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, m, n) for (int i = m; i < n; i++)
#define repr(i, m, n) for (int i = m; i >= n; i--)
#define db(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD   998244353
#define PI (acos(-1))
#define EPS 1e(-9);
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
//--GLOBAL---------------------------------

ll ct[100010];
ll num[100010];
ll ans[100010];
ll K;
struct edge{ll to; ll ii;};
struct graph{
    ll N; //ノードの個数
    vector<vector<edge> > G;
    vector<ll> d;
    vector<bool> used;

    graph(ll n){
        N = n;
        G.resize(N);
        d.resize(N); //保持したいなにか
        used.resize(N); //行ったか
        rep(i,N){d[i] = INF;}
        rep(i,N){used[i] = false;}
    }
    void add_edge(ll s, ll t, ll ii){
        G[s].emplace_back((edge){t,ii});
        G[t].emplace_back((edge){s,ii});
    }

    void dfs(ll v=0, ll hen=-1){
        if(v!=0){
            num[v]=ans[hen];
        }
        used[v]=true;
        for(auto E : G[v]){
            if(used[E.to] == false){ //まだ行ってないなら
                if(ct[v]==num[v]) ++ct[v];
                ans[E.ii]=ct[v];
                maxi(K,ct[v]);
                ++ct[v];
                dfs(E.to ,E.ii);
            }
        }
    }
};


//--MAIN-----------------------------------
void Main() {
    int N; cin>>N;
    int a[N],b[N];
    graph g(N);
    rep(i,N-1){
        cin>>a[i]>>b[i]; --a[i]; --b[i];
        g.add_edge(a[i],b[i],i);
    }
    num[0]=-1;
    g.dfs();
    cout<< K+1 <<"\n";
    rep(i,N-1){
        cout<< ans[i]+1 <<"\n";
    }

}

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


Measured memory_bytes: 11904
//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>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
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;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
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)
#define fore(i,a) for(auto &i:a)

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

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

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}


int main(){
    int N,M;
    cin >> N >> M;
    long long a[N],b[N],c[M],d[M];
    REP(i,N) cin >> a[i] >> b[i];
    REP(i,M) cin >> c[i] >> d[i];
    long long pos_x=0,pos_y=0;
    long long ans=(int) pow(10,9);
    for(int i=0;i<N;++i){
        pos_x=0;
        pos_y=0;
        ans=(int) pow(10,9);
        for(int j=0;j<M;++j){
            if(ans>abs(a[i]-c[j])+abs(b[i]-d[j])){
                ans=min(ans,abs(a[i]-c[j])+abs(b[i]-d[j]));
                pos_x=j+1;
                pos_y=j+1;
            }
        }
        cout << pos_x << endl;
    }
}

Measured memory_bytes: 256
N=int(input())
S=[input() for i in range(2)]
P=1
mod=10**9+7
B=True
if S[0][0]==S[1][0]:
  P=3
else:
  P=6
  B=False
for i in range(1,N):
  if B:
    if S[0][i]==S[1][i]:
      if S[0][i-1]==S[1][i-1]:
        P=P*2%mod
    else:
      B=False
      if S[0][i-1]==S[1][i-1]:
        P=P*2%mod
      else:
        P=P*3%mod
  else:
    B=True
print(P)

Measured memory_bytes: 62064
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

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

    int a, b;
    cin >> a >> b;
    if(a*b%2){
        puts("Odd");
    }else{
        puts("Even");
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3


def main():
    n = int(input())
    ans = n * (n + 1) - 1  # 1とk 自信

    i = 2
    while i * i <= n:
        num = n // i
        min_i = i * i
        max_i = i * num
        ans += (num - i + 1) * (min_i + max_i)  # 自分自身
        ans -= min_i
        i += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9172
from collections import deque
H, W = map(int, input().split())
maze = [list(input()) for _ in range(H)]
directions = [[0, 1], [1, 0], [0, -1], [-1, 0]]

ans = 0
for sh in range(H):
    for sw in range(W):
        if maze[sh][sw] == "#":
            continue
        dist = [[-1] * W for _ in range(H)]
        dist[sh][sw] = 0
        que = deque([[sh, sw]])

        while que:
            nh, nw = que.pop()
            for dh, dw in directions:
                tmp_h, tmp_w = nh + dh, nw + dw
                if not ((0 <= tmp_h < H) and (0 <= tmp_w < W)):
                    continue
                if maze[tmp_h][tmp_w] == "#":
                    continue
                if dist[tmp_h][tmp_w] != -1:
                    continue

                dist[tmp_h][tmp_w] = dist[nh][nw] + 1
                que.appendleft([tmp_h, tmp_w])

        ans = max(ans, max([max(d) for d in dist]))

print(ans)

Measured memory_bytes: 9476
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAXN 100005

int a, b;

int main()
{
    cin >> a >> b;
    if(a + b == 15){
        printf("+\n");
    }
    else if(a * b == 15){
        printf("*\n");
    }
    else {
        printf("x\n");
    }



    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
static const int mod = 1000000007;
 
string s;
int v[30];
 
signed main(){
    cin>>s;
    int all = s.size()*(s.size()-1)/2;
    for(int i=0;i<s.size();++i)v[s[i]-'a']++;
    for(int i=0;i<s.size();++i){
        v[s[i]-'a']--;
        all-=v[s[i]-'a'];
    }
    cout<<all+1<<endl;
}

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

const int64_t mod = 1000000007;

int64_t MOD(int64_t m, int64_t n) {
    int64_t result = 1;
    while (n > 0) {
        if (n & 1) {
            result *= m;
            result %= mod;
        }

        m *= m;
        m %= mod;
        n /= 2;
    }

    return result;
}

int main() {
    uint64_t m, n;
    cin >> m >> n;
    cout << MOD(m, n) << endl;
}


Measured memory_bytes: 3092
// author: tarang 
#include<bits/stdc++.h>
#define ll long long
#define endl  '\n'
#define fastio  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD=1000000007;
#define PI acos(-1)
using namespace std;
int vis[1000000+7];
int gcd(int x, int y)
{                     
        return (x==0)? y : gcd(y % x, x);
}
int main(){
	fastio ;
    int n ; cin >> n ;
    int a[n] ; cin >> a[0];
    int ans = a[0] ;
    for(int i = 1 ; i < n  ; i++){
    	  cin >> a[i];
    	  ans = gcd(ans,a[i]);
	}
	for(int i = 0 ; i < n ; i++){
		  int x = a[i];
		  for(int j = 2 ; j*j <= x ; j++){
		  	  if(x%j==0){
		  	  	while(x%j==0){
		  	  		   x/=j;
					}
					vis[j]++;
				}
		  }
		  if(x > 1){
		  	vis[x]++;
		  }
	}
	bool flag = 0;
	for(int i = 2 ; i <= 1000000 ; i++){
		 if(vis[i] > 1){
		 	flag = 1;
		 	break;
		 }
	}
	if( ans == 1){
		if(flag != 0){ 
		   cout << "setwise coprime " << endl;
		}
		else cout << "pairwise coprime " << endl;
	}
	else cout << "not coprime" << endl;
}

Measured memory_bytes: 11404
#include <bits/stdc++.h>
using namespace std;
int main() {
    int K, A, B;
    cin >> K >> A >> B;
    for(int i=A;i<=B;i++){
        if(i % K == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

Measured memory_bytes: 3532
N, M, P = map(int, input().split())

ABC = []
for _ in range(M):
    a, b, c = map(int, input().split())
    ABC.append((a - 1, b - 1, P - c))

inf = float("inf")
d = [inf] * N
d[0] = 0

# Bellman-Ford
for i in range(N):
    for a, b, c in ABC:
        if d[b] <= d[a] + c:
            continue
        d[b] = d[a] + c
ans = d[N - 1]
for i in range(N):
    for a, b, c in ABC:
        if d[b] <= d[a] + c:
            continue
        d[b] = d[a] + c
if ans != d[N - 1]:
    print(-1)
else:
    print(max(0, -d[N - 1]))


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

#define ll long long int

using namespace std;

int main() {
    ll n;
    cin >> n;
    map<string, ll> m;
    for (ll i = 0; i < n; ++i) {
        string s;
        cin >> s;
        m[s] = m[s] + 1;
    }
    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
    cout << "RE x " << m["RE"] << endl;
}


Measured memory_bytes: 3632
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"

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

const long long MOD = 1e9+7;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int main() {
    int q;
    cin >> q;
    ll sum_b = 0, sum_first_half = 0, sum_second_half = 0;
    priority_queue<ll> first_half;
    priority_queue<ll, vector<ll>, greater<ll>> second_half;
    rep(_q, q) {
        int kind;
        cin >> kind;
        if (kind == 1) {
            ll a, b;
            cin >> a >> b;

            sum_b += b;
            if (first_half.empty() || a <= first_half.top()) {
                first_half.push(a);
                sum_first_half += a;
                
                if ((int)first_half.size() > (int)second_half.size() + 1) {
                    ll tmp = first_half.top(); first_half.pop();
                    sum_first_half -= tmp;
                    second_half.push(tmp);
                    sum_second_half += tmp;
                }
            }
            else {
                second_half.push(a);
                sum_second_half += a;
                if (first_half.size() < second_half.size()) {
                    ll tmp = second_half.top(); second_half.pop();
                    sum_second_half -= tmp;
                    first_half.push(tmp);
                    sum_first_half += tmp;
                }
            }
        }
        else {
            ll m = first_half.top();
            ll res = (m * (ll)first_half.size() - sum_first_half) + (sum_second_half - m * (ll)second_half.size()) + sum_b;
            cout << m << " " << res << endl;
        }
    }
}

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

int main() {
  int n;
  cin >> n;
  int c[26], s[n][26];
  for (int i = 0; i < 26; ++i) cin >> c[i];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < 26; ++j) cin >> s[i][j];
  for (int i = 0; i < n; ++i)
    cout << distance(s[i], max_element(s[i], s[i] + 26)) + 1 << endl;
  return 0;
}

Measured memory_bytes: 3672
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int k = scan.nextInt();
		int n = scan.nextInt();

		List<Integer> a = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			a.add(scan.nextInt());
		}

		List<Integer> b = new ArrayList<>();
		b.add(k - a.get(n -1) + a.get(0));
		for(int i = 1; i < a.size(); i++) {
			b.add(a.get(i) - a.get(i -1));
		}

		System.out.println(k - Collections.max(b));
	}
}

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

int main()
{
	while (1)
	{
		int a, b;
		std::cin >> a >> b;
		if (a == 0 && b == 0)
			break;

		int n;
		std::cin >> n;

		std::vector<std::vector<int>> dp(a, std::vector<int>(b, 0));
		for (int i = 0; i != n; ++i)
		{
			int c, d;
			std::cin >> c >> d;
			dp[c - 1][d - 1] = -1;
		}

		for (int i = 0; i != a; ++i)
		{
			for (int j = 0; j != b; ++j)
			{
				if (i == 0 && j == 0)
					dp[i][j] = 1;
				else if (dp[i][j] != -1)
				{
					if (i != 0 && dp[i - 1][j] != -1){
						dp[i][j] += dp[i - 1][j];
					}
					if (j != 0 && dp[i][j - 1] != -1){
						dp[i][j] += dp[i][j - 1];
					}
				}
			}
		}

		std::cout << dp[a - 1][b - 1] << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1212
using System;
using System.Text;

namespace abc171
{
    class Program
    {
        static void Main()
        {
            var n = int.Parse(Console.ReadLine());
            var first = 0;
            var aList = ReadNumList(ref first);

            var sb = new StringBuilder(first.ToString());

            var current = first;
            for (var i = 1; i < aList.Length; ++i)
            {
                sb.Append(" ");
                current ^= aList[i] ^ aList[i - 1];
                sb.Append(current.ToString());
            }
            Console.WriteLine(sb.ToString());
        }
        static int[] ReadNumList(ref int first)
        {
            var line = Console.ReadLine().Split(' ');
            var numList = new int[line.Length];
            for (var i = 0; i < line.Length; ++i)
            {
                numList[i] = int.Parse(line[i]);
                if (i > 0)
                {
                    first ^= numList[i];
                }
            }
            return numList;
        }
    }
}


Measured memory_bytes: 65504
#include <bits/stdc++.h>
#include <cstring> 
using namespace std;
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define int long long int
#define F first
#define mem(a,b) memset(a,b,sizeof(a))
#define S second
#define MOD 1000000007
#define in_range(x, y, r, c) (x < r && y < c && x >= 0 && y >= 0)
#define MAXN 100008

signed main(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    #ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    int h, n, x, sum=0;
    cin>>h>>n;
    for(int i=0;i<n;i++){
    	cin>>x;
    	sum+=x;
    }
    if(h<=sum)
    	cout<<"Yes"<<endl;
    else
    	cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    long k = sc.nextLong();
    int[] t = new int[(int)n];
    int m = 0;
    for(long i = 0; i < n; i++) {
      int p = 0;
      long s = i + 1;
      for(int j = 0; j < 30; j++) {
        if(s >= k) break;
        s *= 2;
        p++;
      }
      t[(int)i] = p;
      m = Math.max(m, p);
    }
    long q1 = n * (long)Math.pow(2, m);
    long q2 = 0;
    for(int i = 0; i < n; i++) {
      q2 += ((long)Math.pow(2, m - t[i]));
    }
    double ans = (double)q2 / (double)q1;
    System.out.println(ans);
  }
}

Measured memory_bytes: 21972
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;

int main() {
	long long a, b, c, k;
	cin >> a >> b >> c >> k;
	if (k % 2 == 0) {
		cout << a-b << endl;
	}
	else {
		cout << b - a << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
bool a[101];
int main(){
	int x,  n, ans;
	int j;
	cin>>x>>n;
	for(int i = 0; i<n; i++){
		cin>>j;
		a[j] = true;
	}
	j = x;
	int i = x;
	while(a[j]==true){
		j--;
		if(j==0) break;
	}
	while(a[i]==true){
		i++;
		if(i==101) break;
	}
	
	if(abs(i-x)<abs(j-x)) cout<<i;
	else cout<<j;

}

Measured memory_bytes: 3676
N = int(input())
numstr = input().split()
arr = [int(num) for num in numstr]

def main():
    dic = {}
    m = max(arr)
    for num in arr:
        if num in dic:
            dic[num] += 1
        else:
            dic[num] = 1
    n = 0
    for key in dic.keys():
        if dic[key] > key:
            n += dic[key] - key
        if dic[key] < key:
            n += dic[key]
    return n

if __name__ == '__main__':
    print(main())



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

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		BigDecimal L = sc.nextBigDecimal();
		BigDecimal three = BigDecimal.valueOf(3);

		BigDecimal tmp =  L.divide(three, 10,BigDecimal.ROUND_HALF_EVEN);
		tmp = tmp.multiply(tmp).multiply(tmp);
		System.out.println(tmp);
	}
}

Measured memory_bytes: 23380
#include<vector>
#include<cstdio>
#include<algorithm>
using namespace std;

vector<int> adj[100005];
int vis[100005], dp[100005];

void dfs( int u ) {
	vis[u] = 1;
	for( int v : adj[u] )
	{
		if( vis[v] == 0 )
			dfs(v);
		dp[u] = max(dp[u], 1+dp[v]);
	}
}

int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	for( int i=0, u, v; i<m; ++i )
		scanf("%d%d", &u, &v), adj[u].push_back(v);
	int ans = -1;
	for( int i=1; i<=n; ++i ) {
		if( vis[i] == 0 )
			dfs(i);
		ans = max(ans, dp[i]);
	}
	printf("%d\n", ans);
}	


Measured memory_bytes: 8576
/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <unordered_map>

typedef unsigned long long ll;

typedef unsigned int ui;

using namespace std;

int main() {
    // your code goes here
   ll a;

   cin>>a;


   a =  a + a*a + a*a*a;

    cout<<a;

    return 0;
}


Measured memory_bytes: 3596
string = gets.chomp.split("").sort!
answer = "Yes"

if string.length.even?
  (0..string.length/2).each do |number|
    if string[number * 2] != string[number * 2 + 1]
      answer = "No"
    end
  end
else
  answer = "No"
end

puts answer


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n;
  cin>>n;
  vi s(n);
  vi v(n),c(n);
  rep(i,n){
    cin>>v[i];
  }
  rep(i,n){
    cin>>c[i];
  }
  rep(i,n){
    s[i]=v[i]-c[i];
  }

  sort(all(s));
  reverse(all(s));
  int ans=0;
  int sum=0;
  rep(i,n){
    sum+=s[i];
    ans=max(ans,sum);
  }
  cout<<ans<<endl;

}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n+1),b(n);
    for(int i=0; i<n+1; i++){
        cin >> a.at(i);
    }
    for(int i=0; i<n; i++){
        cin >> b.at(i);
    }

    long long int count=0;
    for(int i=0; i<n; i++){
        if(a.at(i)>=b.at(i)) count+=b.at(i);
        else{
            count+=a.at(i);
            b.at(i)-=a.at(i);
            if(a.at(i+1)>=b.at(i)){
                count+=b.at(i);
                a.at(i+1)-=b.at(i);
            }
            else{
                count+=a.at(i+1);
                a.at(i+1)=0;
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 4036
#include<stdio.h>
// 荷物の個数×1個当たりの最大重量
#define PMAX 1000000000


 int n,w[100000],k,wmax=0;

 int check(int p){
       int i,truck=1,max=p;
       if(p<wmax)return 0;

       for(i=0;i<n;i++){
               if(w[i]<=max){max=max-w[i];}
               else {
                     truck++;
                     max=p-w[i];
                     }
               }
       if(truck>k)return 0;
       else return 1;
       }

 int main(){
     int i,p;
     scanf("%d%d",&n,&k);
     for(i=0;i<n;i++){
              scanf("%d",&w[i]);
              if(w[i]>wmax)wmax=w[i];
              }

     int left=0,right=0,mid=0;
     right=PMAX;

     while(right-left>1){
          mid=(right+left)/2;
          if(check(mid))right=mid;
          else left=mid;
          }
     printf("%d\n",right);
     return 0;
     }


Measured memory_bytes: 2252
#include <stdio.h>

int main(void) {
    int l, r, d, n = 0;
    scanf ("%d %d %d", &l, &r, &d);
    for (; l <= r ; l++) {
        if (l % d == 0) n++;
    }
    printf ("%d\n", n);
    return 0;
}

Measured memory_bytes: 1736