akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int N,buf;
	cin >> N;
	int min=1000000001,max=-1;
	for (int i = 0; i < N; ++i) {
		cin >> buf;
		if(buf > max) max = buf;
		if(buf < min) min = buf;
	}
	println(max-min);
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

#define BASE	(100000007ULL)

#define MAX_W	(1000)
#define MAX_H	(1000)
#define MAX_P	(100)

#define MAX_HW	(MAX_H * MAX_W)
#define MAX_PP	(MAX_P * MAX_P)

/* typedef */

typedef unsigned long long ull;

/* global variables */

ull bases[MAX_PP];

int w, h, p, pp;

char imgs[MAX_H][MAX_W], pat[8][MAX_P][MAX_P];
ull phash[8];

/* subroutines */

int decode(char ch) {
  if (ch >= 'A' && ch <= 'Z') return ch - 'A';
  if (ch >= 'a' && ch <= 'z') return ch - 'a' + 26;
  if (ch >= '0' && ch <= '9') return ch - '0' + 52;
  if (ch == '+') return 62;
  if (ch == '/') return 63;
  return -1;
}

/* main */

int main() {
  bases[0] = 1;
  for (int i = 1; i < MAX_PP; i++)
    bases[i] = bases[i - 1] * BASE;

  for (;;) {
    cin >> w >> h >> p;
    if ((w | h | p) == 0) break;

    pp = p * p;
    
    for (int y = 0; y < h; y++) {
      string line;
      cin >> line;
      for (int x = 0; x < w; x++)
	imgs[y][x] = (decode(line[x / 6]) >> (5 - x % 6)) & 1;
    }
    //p imgs

    for (int y = 0; y < p; y++) {
      string line;
      cin >> line;
      for (int x = 0; x < p; x++)
	pat[0][y][x] = (decode(line[x / 6]) >> (5 - x % 6)) & 1;
    }
    //p pat

    for (int i = 0; i < 3; i++)
      for (int y = 0; y < p; y++)
	for (int x = 0; x < p; x++)
	  pat[i + 1][x][p - 1 - y] = pat[i][y][x];

    for (int i = 0; i < 4; i++)
      for (int y = 0; y < p; y++)
	for (int x = 0; x < p; x++)
	  pat[i + 4][y][p - 1 - x] = pat[i][y][x];

    for (int i = 0; i < 8; i++) {
      phash[i] = 0;
      for (int y = 0; y < p; y++)
	for (int x = 0; x < p; x++)
	  phash[i] += bases[pp - 1 - (y * p + x)] * pat[i][y][x];
      //cout << phash[i] << endl;
    }

    int count = 0;

    for (int y = 0; y <= h - p; y++) {
      ull hash = 0;
      for (int dy = 0; dy < p; dy++)
	for (int dx = 0; dx < p; dx++)
	  hash += bases[pp - 1 - (dy * p + dx)] * imgs[y + dy][dx];

      for (int x = 0; x <= w - p; x++) {
	for (int i = 0; i < 8; i++)
	  if (hash == phash[i]) {
	    count++;
	    break;
	  }

	for (int dy = 0; dy < p; dy++)
	  hash -= bases[pp - 1 - dy * p] * imgs[y + dy][x];
	hash *= BASE;
	for (int dy = 0; dy < p; dy++)
	  hash += bases[pp - 1 - (dy * p + p - 1)] * imgs[y + dy][x + p];
      }
    }
    
    cout << count << endl;
  }

  return 0;
}

Measured memory_bytes: 2344
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
    int n; cin >> n;
    string s, t; cin >> s >> t;

    REP(i, n) {
        cout << s[i] << t[i];
    }

    return 0;
}


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

using namespace std;

int main() {
	string s;
	cin >> s;
	vector<int> f(2, 0);
	f[1] = 1;
	for (int i = 0; i < s.size(); i++) {
		int k = s[i] - '0';
		int l = 10 - k - 1;
		vector<int> nf(2, 0);
		nf[0] = min(f[0] + k, f[1] + l + 1);
		nf[1] = min(f[1] + l, f[0] + k + 1);
		// cout << nf[0] << " " << nf[1] << endl;
		f = nf;
	}
	cout << min(f[0], f[1] + 1) << endl;
	return 0;
}


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

using namespace std;
const int N = 2006;
bitset <N*N> b = 1;

int main()
{
    int n, a, sum = 0; cin >> n;
    for (int i = 0; i < n; i++) cin >> a, sum += a, b |= b<<a;
    for (int i = (sum+1)/2; i <= sum; i++) if (b[i]) return cout << i << "\n", 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  vl x(n);
  rep(i, n) cin >> x[i];
  ll ans = 0;
  rep(i, n - 1) ans += min((x[i + 1] - x[i]) * a, b);
  cout << ans << endl;
}

Measured memory_bytes: 1024
import sys
readline = sys.stdin.readline


def main():
    N = int(readline())
    A = list(map(int, readline().rstrip().split()))
    A.sort()

    M = A[-1]
    flg = [0] * (M + 1)
    res = 0

    for a in A:
        if flg[a] == 0:
            res += 1
        if flg[a] == 2:
            res -= 1
            flg[a] = 1
        if flg[a] > 0:
            continue
        flg[a] = 2
        for i in range(2, 10**6):
            if a * i > M:
                break
            flg[a*i] = 1
    
    print(res)


if __name__ == '__main__':
    main()

Measured memory_bytes: 32164
H, W = map(int,input().split())
a = []
for i in range(H):
    L = list(input())
    a.append(L)
delH,delW = [],[]
for i in range(H):
    if all(a[i][j]=='.' for j in range(W)):
        delH.append(i)
for j in range(W):
    if all(a[i][j]=='.' for i in range(H)):
        delW.append(j)
for i in range(H):
    for j in range(W):
        if i not in delH and j not in delW:
            print(a[i][j], end="")
    if i not in delH:
        print()


Measured memory_bytes: 4596
// -*- coding:utf-8-unix -*-

#[macro_use]
extern crate lazy_static;
extern crate num_bigint; // 0.2.2
extern crate num_traits; // 0.2.8
use num_bigint::BigInt;
use num_bigint::ToBigInt;
use num_traits::{abs, pow, One, Pow, Zero};

// use proconio::derive_readable;
use proconio::fastout;
use proconio::input;
// use std::convert::TryInto;
// use ascii::Chars;
// use libm::*;
use proconio::marker::{Bytes, Chars};
use std::cmp::*;
use std::collections::{BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::*;
use std::ops::Range;
use std::str::FromStr;
use superslice::*;

use lazy_static::lazy_static;
use std::sync::Mutex;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

lazy_static! {
    // static ref PARENTS: Mutex<Vec<usize>> = Mutex::default();
    // static ref CHILDS: Mutex<Vec<Vec<usize>>> = Mutex::default();
    static ref ADJ: Mutex<Vec<Vec<usize>>> = Mutex::default();
}

// const MOD: usize = 9997063;
// const MOD: usize = 100_000_000_ + 7;

//abc112-D
// #[fastout]
fn main() {
    input![n: usize, m: usize];

    let mut ans = -1 as i64;
    for i in 1..((m as f64).sqrt() as usize + 1) {
        if m % i == 0 {
            let inv_i = m / i;
            if inv_i >= n {
                ans = max(ans, i as i64);
            }

            if i >= n {
                ans = max(ans, inv_i as i64);
            }
        }
    }

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

// let mut values = VALUES.lock().unwrap();
// values.extend_from_slice(&[1, 2, 3, 4]);
// assert_eq!(&*values, &[1, 2, 3, 4]);

// -100000000
//  1000000000


Measured memory_bytes: 2132
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	long long n, k; cin >> n >> k;
	if (k + k <= n + 1) {
		set<long long> s, ss;
		for (int i = n; i < n + n; i++) s.insert(k + i), ss.insert(k + i + n);
		int now = *s.rbegin();
		for (int i = n; i < n + k; i++) {
			cout << i << " " << now << " " << i + now << endl;
			s.erase(now);
			ss.erase(i + now);
			now -= 2;
		}
		for (int i = k; i < n; i++) {
			cout << i << " " << *s.rbegin() << " " << *ss.rbegin() << endl;
			ss.erase(*ss.rbegin());
			s.erase(*s.rbegin());
		}
	} else {
		cout << -1 << endl;
	}
	return 0;
}

Measured memory_bytes: 11648
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
    cin>>a>>b>>c;
    if(a==5&&b==5&&c==7)
	{
		cout<<"YES"<<endl;
		return 0;
	}
	if(a==5&&b==7&&c==5)
	{
		cout<<"YES"<<endl;
		return 0;
	}
	if(a==7&&b==5&&c==5)
	{
		cout<<"YES"<<endl;
		return 0;
	}
	else
	{
		cout<<"NO"<<endl;
	}
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int N,s[2]={0},a,q=0;
	multiset<int,greater<int> >C;
	scanf("%d",&N);
	for(int i=0;i<N;i++)
	{
		scanf("%d",&a);
		C.insert(a);
	}
	for(auto c:C)
	{
		s[q]+=c;
		q^=1;
	}
	printf("%d\n",s[0]-s[1]);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N,M;
  cin>>N>>M;
  vector<vector<ll>> vec(N,vector<ll>(0));
  ll ans=0;
  for(ll i=0;i<M;i++) {
ll A,B;
    cin>>A>>B;
    vec[A-1].push_back(B);
    vec[B-1].push_back(A);
  }
  
 
 vector<bool> note(N,false);
  for(ll i=0;i<N;i++) {
if(!note[i]) {
  ll count=1;
  queue<ll> S;
  S.push(i+1);
  note[i]=true;

  while(!S.empty()) {  
   ll index=S.front();
    S.pop();
    for(ll x:vec[index-1]) {
if(!note[x-1]) {
  count++;
  note[x-1]=true;
      S.push(x);
    }
  }
  }
  
  ans=max(ans,count);
}
  }
  
  
  cout<<ans<<endl;
}
    
    
  
  

  
  
  
  
  
  
  
  
  
  
  
  
  

Measured memory_bytes: 16724
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int i;
	char c;
	while(scanf("%c",&c)!=EOF)	{
		if(c>='A' && c<='Z')	{
			c+='a'-'A';
		}
		else if(c>='a' && c<='z')	{
			c-='a'-'A';
		}
		printf("%c",c);
	}
//	printf("\n");
	return 0;
}


Measured memory_bytes: 2596
#include <iostream>
 
using namespace std;
 
int main()
{
  int N;
  int M;
  int A;
  int b;
  cin >> N >> M;
  while(M>0)
  {
    cin >> A;
    b=b+A;
    M--;
  }
  if(N-b >= 0)
  cout <<N-b;
 else 
   cout <<"-1";
}

Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      
      while(sc.hasNext()) {
         int d = Integer.parseInt(sc.nextLine());
      
         int area = 0;
         for(int x = d; x < 600; x += d) {
            area += f(x) * d;
         }
      
         System.out.println(area);
      }
   }
   
   public static int f(int x) {
      return x * x;
   }
}


Measured memory_bytes: 26132
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
using namespace std;

typedef long long ll;



int main() {
	int n; cin >> n;
	vector<int> a(n);
	int ma = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		ma = max(ma, a[i]);
	}
	int r = 0;
	for (int i = 0; i < n; i++) {
		if (abs(a[i] - ma / 2) < abs(r - ma / 2)) r = a[i];
	}
	cout << ma << " " << r << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
#define lson l,mid,p<<1
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
using namespace std;
const int inf=1e9+10;
const int mod=1e9+7;
const int maxn=2e5+10;
int n;
ll k;
ll cnt=0;
vector<ll>a,b;
bool ck(ll x){
	ll pp=0;
	if(x<0){
		x=-x;
		for(ll y:b){
			ll ret=a.size()-(upper_bound(a.begin(), a.end(),x/y)-a.begin());
			pp+=ret;
		}
	}else if(x>0){
		pp+=1ll*a.size()*b.size();
		pp+=cnt*a.size()+cnt*b.size();
		vector<ll>aa;
		for(ll y:a){
			pp+=lower_bound(aa.begin(), aa.end(),(x+y-1)/y)-aa.begin();
			aa.pb(y);
		}
		aa.clear();
		for(ll y:b){
			pp+=lower_bound(aa.begin(), aa.end(),(x+y-1)/y)-aa.begin();
			aa.pb(y);
		}
        pp+=cnt*(cnt-1)/2;
	}else{
		pp+=1ll*a.size()*b.size();
	}
	return pp<k;
}
int main(){
	ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>n>>k;
	for (int i = 0; i < n; ++i)
	{
		int x;
		cin>>x;
		if(x>0) a.pb(x);
		else if(x<0) b.pb(-x);
		else ++cnt;
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	ll l=-1e18,r=1e18;
	while(l<=r){
		ll mid=l+r>>1;
		if(ck(mid)) l=mid+1;
		else r=mid-1;
	}
	cout<<r<<endl;
	return 0;
}


Measured memory_bytes: 5100
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <cstring>
#include <tuple>
#include <queue>

using namespace std;

#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)

int n,m;
int s,goal;

struct Edge {
    int src, dst, d, c;
    Edge(int a, int b, int d_, int c_)
        : src(a), dst(b), d(d_), c(c_)
    {}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

int main(){
    while(cin >> n >> m && n){
        cin >> s >> goal;
        Graph g(n+1);
        rep(i,m){
            int x,y,d,c;
            cin >> x >> y >> c >> d;
            g[x].emplace_back(x,y,c,d);
            g[y].emplace_back(y,x,c,d);
        }
        // elapsed/t, cur/v, prev/p, speed/s
        typedef tuple<double, int,int,int> State;
        priority_queue<State> q;
        // cur, prev, speed
        double dist[40][40][40];
        rep(i,40)rep(j,40)rep(k,40) dist[i][j][k] = 1e9;
        q.emplace(1e-30, s,0,0);
        dist[s][0][1] = 0;
        double ans = 1e20;
        while(q.size()){
            double t;
            int v, p, s;
            tie(t,v,p,s) = q.top(); q.pop();
            t *= -1;
            // printf("state : %d %d %d %lf : %lf\n", v,p,s,t, dist[v][p][s]);
            if(v == goal && s == 1){
                ans = t;
                break;
            }
            if(p != 0 && dist[v][p][s] < t) continue;
            dist[v][p][s] = t;
            for(auto & e : g[v]){
                // if(e.src == 1 && e.dst == 2){
                //     cout << e.d << endl;
                // }
                for(int ds : {-1,0,1}){
                    int ns = s + ds;
                    if(ns <= 0) continue;
                    if(e.c < ns) continue;
                    if(e.dst == p) continue;
                    double dt = 1. * e.d / ns;
                    double nt = t + dt;
                    int np = v;
                    int nv = e.dst;
                    if(dist[nv][np][ns] > nt){
                        dist[nv][np][ns] = nt;
                        // printf("nstate : %d %d %d %lf : %lf\n", nv,np,ns,nt, dist[nv][np][ns]);
                        q.emplace(-nt,nv,np,ns);
                    }
                }
            }
        }
        if(ans == 1e20) puts("unreachable");
        else printf("%.20lf\n",ans);
    }
}

Measured memory_bytes: 2208
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dl double long
#define rep(i, m, n) for(ll i = (ll)(m); i < (ll)(n); ++i)
#define rrep(i, m, n) for(ll i = (ll)(m); i > (ll)(n); --i)
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;

int Partition(int *a, int p, int r){
    int x = a[r];
    int i = p - 1;
    rep(j, p, r){
        if(a[j] <= x){
            i = i+1;
            swap(a[i], a[j]);
        }
    }
    swap(a[i+1], a[r]);
    return i+1;
}

int main(void){
    int n, a[100000];
    cin >> n;
    rep(i, 0, n) cin >> a[i];
    int q = Partition(a, 0, n-1);
    rep(i, 0, n){
        if(i) cout << ' ';
        if(i == q) cout << '[' << a[i] << ']';
        else cout << a[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3448
#include<stdio.h>

int main(void) {
	int n, i, min, max;
	int a[10000];
	long long sum;

	scanf("%d", &n);

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

	min = a[0];
	max = a[0];
	sum = 0;
	for (i = 1; i < n; i++) {
		if (a[i] < min)min = a[i];
		if (a[i] > max)max = a[i];
	}

	for (i = 0; i < n;i++)sum += a[i];

	printf("%d %d %lld\n", min, max, sum);

	return 0;
}


Measured memory_bytes: 2760
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod=1e9+7;
ll bin(ll a, ll b) {
	//a%=m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a; //mod
        a = a * a; //mod
        b >>= 1;
    }
    return res;
}

int gcd(int a, int b, int & x, int & y) {
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    int x1, y1;
    int d = gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}
ll fact(ll x)
{
  ll res=1;
  for(ll i=1;i<=x;i++)
    res=(res*i)%mod;

  return res;
}

ll bcof(ll x,ll y) //x choose y
{
  return fact(x)*bin(fact(x-y)*fact(y)%mod,mod-2)%mod;
}

ll lmod(string n,ll x)
{
	
	ll res=0;
	for(ll i=0;i<n.length();++i)
	{
		res=(res*10+(int)n[i]-'0')%x;
	}
	return res;
}
bool ispal(string s,int l,int r)
{
	string t=s;
	for(int i=l,j=r;i<=r;++i)
	{
		if(s[i]!=s[j])
			return false;
		else
			{
				--j;
			}
	}
	return true;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    int n=s.length();
    if(ispal(s,0,n-1) && ispal(s,0,(n-1)/2-1) && ispal(s,(n+3)/2-1,n-1))
   	 cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
	
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int a,b;
string op;

while(1){
cin>>a>>op>>b;
if(op=="?") break;
if(op=="+")
cout<<a+b<<endl;
if(op=="-")
cout<<a-b<<endl;
if(op=="/")
cout<<a/b<<endl;
if(op=="*")
cout<<a*b<<endl;

}
return 0;
}


Measured memory_bytes: 3128
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
static const int MAX_N = 30;
int dp[MAX_N+1];
int main() {
    int n;
    dp[0] = dp[1] = 1;
    dp[2] = 2;
    for(int i = 3; i <= 30; i++) dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
    for (;;) {
        scanf("%d", &n);
        if (n == 0) break;
        printf("%d\n", dp[n] / 3650 + 1);
    }
    return 0;
}



Measured memory_bytes: 2620
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
int main()
{
    int a[101][101], b[101][101];
    long long c[101][101], s;
    int i, j, k;
    int n, m, l;
 
    scanf("%d%d%d", &n, &m, &l);
    for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) scanf("%d", &a[i][j]);
    }
    for (i = 0; i < m; i++) {
        for (j = 0; j < l; j++) scanf("%d", &b[i][j]);
    }
 
    for (i = 0; i < n; i++) {
        for (j = 0; j < l; j++) {
            s = 0;
            for (k = 0; k < m; k++) {
                s += a[i][k] * b[k][j];
            }
            c[i][j] = s;
        }
    }
 
    for (i = 0; i < n; i++) {
        printf("%lld", c[i][0]);
        for (j = 1; j < l; j++) printf(" %lld", c[i][j]);
        putchar('\n');
    }
    return 0;
}


Measured memory_bytes: 2060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
   int n,k;
   cin >> n >> k ;
   char s[n];
   cin >> s;
   s[k-1] = s[k-1] +0x20;
   cout << s << endl ;
    return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using ld = long double;
using vvll = vector<ll, vector<ll> >;
using vll = vector<ll> ;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main() {
    fastio();

    int N, K;
    cin >> N >> K;
    int arr[N];
    for(int i = 0;i < N;i ++) {
        cin >> arr[i];
    }
    int DP[N];
    DP[0] = 0;
    if(N > 1) {
        DP[1] = abs(arr[1] - arr[0]);
    }
    for(int i = 2;i < N;i ++) {
        DP[i] = DP[i-1] + abs(arr[i] - arr[i-1]);
        for(int j = i-2;(j >= 0 && j >= i-K);j --){ 
            DP[i] = min(DP[i], DP[j] + abs(arr[j] - arr[i]));
        }
    }
    int ans = DP[N-1];
    cout << ans << "\n";
}

Measured memory_bytes: 1024
n = gets.to_i
s = gets.chars

lw = []
re = []

w = 0
n.times do |i|
  lw[i] = w
  w += 1 if s[i] == 'W'
end

e = 0
(0...n).reverse_each do |i|
  re[i] = e
  e += 1 if s[i] == 'E'
end

x = 300000
n.times do |i|
  x = [lw[i] + re[i], x].min
end
puts x

Measured memory_bytes: 34364
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <list>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define int64 long long
#define debug cout << __FILE__ << ":" << __LINE__ << endl;

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
    }
} init;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    for(int i = 0; i < (int) v.size(); i++) {
        ostr << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return ostr;
}

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

int N, W;
vector<string> M(8);

void dfs(int i, int j) {
    if (i + 1 < N && M[i+1][j] == '#') {
        M[i+1][j] = '.';
        dfs(i+1, j);
    } else if (j + 1 < W && M[i][j+1] == '#') {
        M[i][j+1] = '.';
        dfs(i, j+1);
    }
}

int main() {
    cin >> N >> W;
    rep(i, N) cin >> M[i];
    M[0][0] = '.';
    dfs(0, 0);
    rep(i, N) {
        rep(j, W) {
            if (M[i][j] == '#') {
                cout << "Impossible" << endl;
                exit(0);
            }
        }
    }
    cout << "Possible" << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize "trapv"
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define ld long double
#define mp make_pair
#define pii pair<int,int>
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define repp(i,a,n) for(int i=a;i<n;i++)
#define all(v) v.begin(),v.end()
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
int main()
{
    fio;
    int t=1;;
    //cin>>t;
    while(t--)
    {
        string n;
        cin>>n;
        ll s=n.length();
        ll sum=0;
        rep(i,s)
        {
            sum=sum+(n[i]-'0');
        }
        if(sum%9==0)
        cout<<"Yes"<<endl;
        else
        cout<<"No"<<endl;
    }
}

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

using namespace std;

int main(){
    int t;
    cin >> t;
    while(t--){
        int n, k, x;
        cin >> n >> k;
        vector<int> pos;
        for(int i = n; i > 0; --i){
            cin >> x;
            pos.push_back(x);
        }
        if(n == 1){
            cout << "0" << endl;
        }else{
            sort(pos.begin(), pos.end());
            int len = pos[pos.size() - 1] - pos[0];
            vector<int> diff;
            for(int i = 1; i < pos.size(); ++i){
                diff.push_back(pos[i] - pos[i - 1]);
            }
            sort(diff.begin(), diff.end(), greater<int>());
            for(int i = min(k - 2, (int)diff.size() - 1); i >= 0; --i){
                len -= diff[i];
            }
            cout << len << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1716
import sys
sys.stdin.readline

def main():
    m = int(input())
    a = [list(map(int, input().split())) for _ in range(m)]
    wa = 0
    length = 0
    for i,j in a:
        wa += i*j
        length += j
    #print(wa,length)
    print(length-1+(wa-1)//9)
    
    
if __name__=="__main__":
    main()


Measured memory_bytes: 45364
#include<stdio.h>
#include<string.h>
int main()
{
    char a[4];
    gets (a);
    if(strcmp(a,"SUN")==0)
    printf("7");
    else if(strcmp(a,"MON")==0)
    printf("6");
      else if(strcmp(a,"TUE")==0)
    printf("5");
        else if(strcmp(a,"WED")==0)
    printf("4");
        else if(strcmp(a,"THU")==0)
    printf("3");
       else if(strcmp(a,"FRI")==0)
    printf("2");
        else if(strcmp(a,"SAT")==0)
    printf("1");
}
    
    

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	double l;cin >> l;
	l /= 3;
	cout << Decimal << l * l * l << endl;

	return 0;
}


Measured memory_bytes: 256
n=list(map(int,input().split()))
count=0
while not n[0]==n[1]==n[2]:
    if max(n)-min(n)>=2:
        n[n.index(min(n))] +=2
        count +=1
    elif max(n)-min(n)==1:
        point=[0,1,2]
        point.remove(n.index(min(n)))
        point.remove(n.index(max(n)))
        n[point[0]] +=1
        n[n.index(min(n))] +=1
        count +=1
print(count)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
struct node{
    int next,d,c;
};
const int maxn=10005;
int n,m;
int d[maxn],c[maxn];
bool vis[maxn];
void init()
{
    for(int i=0;i<maxn;i++)
        d[i]=c[i]=1e9,vis[i]=0;
}
int main()
{
    while(~scanf("%d%d",&n,&m))
    {
        if(n==0&&m==0) return 0;
        init();vector<node> v[maxn];
        for(int i=0;i<m;i++)
        {
            int x,y,d,c;
            scanf("%d%d%d%d",&x,&y,&d,&c);
            v[x].push_back(node{y,d,c});
            v[y].push_back(node{x,d,c});
        }
        queue<int> q;
        q.push(1);
        d[1]=c[1]=0;vis[1]=1;
        while(!q.empty())
        {
            int u=q.front();q.pop();vis[u]=0;
            for(int i=0;i<v[u].size();i++)
            {
                int nx=v[u][i].next;
                if(d[nx]==d[u]+v[u][i].d&&c[nx]>v[u][i].c){
                        c[nx]=v[u][i].c;
                }
                if(d[nx]>d[u]+v[u][i].d)
                {
                    d[nx]=d[u]+v[u][i].d;
                    c[nx]=v[u][i].c;
                    if(vis[nx]) continue;
                    vis[nx]=1;
                    q.push(nx);
                }
            }
        }
        int ans=0;
        for(int i=2;i<=n;i++) ans+=c[i];
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 4284
/*
    Author : Nishant Gupta 2.0
*/
#include<bits/stdc++.h>

#define LL long long int
#define getcx getchar_unlocked
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define MAX 100005
#define LOG_MAX 20
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL (LL(1e18))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define MSV(A,a) memset(A, a, sizeof(A))
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)

using namespace std;

inline void inp( int &n ) { 
	n=0;    int ch=getcx();int sign=1;   
	while( ch < '0' || ch > '9' ){if(ch=='-')sign=-1; ch=getcx();} 
	while(  ch >= '0' && ch <= '9' )    
	n = (n<<3)+(n<<1) + ch-'0', ch=getcx();
	n=n*sign;
}

inline void inp1( LL &n ) { 
	n=0;    LL ch=getcx();LL sign=1;   
	while( ch < '0' || ch > '9' ){if(ch=='-')sign=-1; ch=getcx();} 
	while(  ch >= '0' && ch <= '9' )    
	n = (n<<3)+(n<<1) + ch-'0', ch=getcx();
	n=n*sign;
}

void solve() {
	LL n;
	cin>>n;
	if(n == 2) {cout<<1<<endl;return;}
	
	LL ans = 2; //for n and n-1 itself
	LL i;
	for(i = 2; i*i < n;i++) {
		LL copy = n;
		if(copy%i!=0) continue;
		
		while(copy % i == 0) {
			copy /= i;
		}
		if(copy % i == 1) ans++;
	}
	
	if(i*i == n) ans++;
	n--;
	for(i = 2; i*i <= n;i++) {
		if(n % i == 0) {ans++;}
		if(n % i == 0 && n/i != i) {ans++;}
	}
	cout<<ans<<endl;
}

int main() {
	int t = 1;
	
	//~cin>>t;
	while(t--) {
		solve();
	}
    return 0;
}


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

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



Measured memory_bytes: 3680
#include<stdio.h>
int main(void) 
{
  int a,b;
  scanf("%d%d",&a,&b);
  
  if( a > b)
    printf("a > b\n");
 
  else if( a < b)
    printf("a < b\n");
 
  else
    printf("a == b\n");
 
  return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {        
    string a, b;
    cin >> a >> b;
    if (a.size() > b.size()) {
        cout << "GREATER" << endl;
    } else if (a.size() < b.size()) {
        cout << "LESS" << endl;
    } else {
        for (int i = 0; i < a.size(); i++) {
            if (a[i] > b[i]) {
                cout << "GREATER" << endl;
                return 0;
            }
            if (a[i] < b[i]) {
                cout << "LESS" << endl;
                return 0;
            }
        }
        cout << "EQUAL" << endl;
    }
}


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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int n, i;
    cin >> n >> i;

    // 処理
    // 出力
    cout << n - i + 1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#define int long long
using namespace std;

int n;
int a[200000];

signed main() {
	int i, j;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> a[i];
	if (a[0] != 0) { cout << -1 << endl; return 0; }
	for (i = 1; i < n; i++) if (a[i] - a[i - 1] >= 2) { cout << -1 << endl; return 0; }
	
	int ans = 0;
	for (i = n - 1; i >= 0; ) {
		if (a[i] == 0) { i--; continue; }
		ans += a[i];
		for (j = 1; j <= i; j++) {
			if (a[i - j] > a[i] - j) {
				break;
			}
		}
		i = i - j;
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
 int a,b,c;
 cin>>a>>b>>c;

  if(((a+b)==c)||((a+c)==b)||((c+b)==a)){
   cout<<"Yes"<<endl;
   }
   else{
   cout<<"No"<<endl;
   }

}


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

using namespace std;

int main() {
  string str;
  cin >> str;
  for(int i = 0; i < str.size(); i++) {
    if(str[i] == ',') {
      cout << ' ' ;
    }else {
      cout << str[i];
    }
  }
  cout << endl;
}


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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  int n;cin>>n;
  vector<int>num(n);
  if(n%2==0){
  for(int i=0;i<n;i++)cin>>num[i];
  for(int i=0;i<n;i+=2){
    cout<<num[n-i-1]<<" ";
  }
  for(int i=0;i<n;i+=2){
    cout<<num[i];
    if(i!=n-1||i!=n-2)cout<<" ";
  }
  cout<<endl;
  }else{
    for(int i=0;i<n;i++)cin>>num[i];
    for(int i=0;i<n;i+=2){
      cout<<num[n-i-1]<<" ";
    }
    for(int i=1;i<n;i+=2){
      cout<<num[i];
      if(i!=n-1||i!=n-2)cout<<" ";
    }
    cout<<endl;
  }
  return 0;
}


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

using namespace std;

int map[1001][1000], dp[1001][1000], dp2[1001][1000], sosu[1000001];
int y[] = { 0, -1, 0, 1 }, x[] = { 1, 0, -1, 0 }, maxh, maxw, minh, minw, ansH, ansW;
int m, n;

void hantei(int h, int w) {
	maxh = max(maxh, h);
	maxw = max(maxw, w);
	minh = min(minh, h);
	minw = min(minw, w);
}

void setMap() {
	int h = 500, w = 500, muki = 0;
	map[h][w] = 1;
	for (int i = 2; i <= m; i++) {
		if (map[h + y[muki]][w+x[muki]] <= 0) {
			hantei(h+y[muki], w+x[muki]);
			map[h + y[muki]][w+x[muki]] = i;//????????£????????????
			h += y[muki];
			w += x[muki];
			if (map[h][w] == n) {
				ansH = h;
				ansW = w;
			}
			muki = (muki + 1) % 4;
		}
		else {
			if (muki - 1 >= 0) {
				map[h + y[muki-1]][w + x[muki-1]] = i;//
				h += y[muki - 1];
				w += x[muki - 1];
				if (map[h][w] == n) {
					ansH = h;
					ansW = w;
				}
			}
			else {
				map[h + y[3]][w + x[3]] = i;//
				h += y[3];
				w += x[3];
				if (map[h][w] == n) {
					ansH = h;
					ansW = w;
				}
			}
		}
	}
}

void eratosthenes() {
	sosu[0] = 1;
	sosu[1] = 1;
	for (int i = 2; i <= 1000000; i++) {
		if (sosu[i] == 0) {
			for (int j = 2; j*i <= 1000000; j++) {
				sosu[j*i]++;
			}
		}
	}
}

void DP() {
	for (int i = maxh; i >= minh; i--) {
		for (int j = maxw; j >= minw; j--) {
			for (int k = -1; k <= 1; k++) {
				if (minw <= j + k && maxw >= j + k) {
					if (dp[i][j] < dp[i + 1][j + k]) {
						dp[i][j] = dp[i + 1][j + k];
						dp2[i][j] = dp2[i + 1][j + k];
						//printf("a1\t");
					}
					else if (dp[i][j] == dp[i + 1][j + k] && dp2[i][j] < dp2[i + 1][j + k]) {
						dp2[i][j] = dp2[i + 1][j + k];
						//printf("a2\t");
					}
				}
			}
			if (sosu[map[i][j]] == 0) {//???????¶??????????????????¨?????????????????£????????????????????????
				//printf("a3\t");
				dp[i][j]++;
				if (dp[i][j] == 1) {
					dp2[i][j] = map[i][j];
				}
			}
		}
	}
}

int main() {
	vector<int>v,v2;
	eratosthenes();

	while (cin >> m >> n, m || n) {
		maxh = 0, maxw = 0, minh = 9999999, minw = 9999999;
		for (int i = 0; i < 1001;i++) {
			for (int j = 0; j < 1000;j++) {
				map[i][j] = 0;
				dp[i][j] = 0;
				dp2[i][j] = 0;
			}
		}
		setMap();
		DP();
		if (n == 1) {
			ansH = 500, ansW = 500;
		}
		v.push_back(dp[ansH][ansW]);
		v2.push_back(dp2[ansH][ansW]);
		
	}

	for (int i = 0; i < v.size(); i++) {
		cout << v.at(i) << " " << v2.at(i) << endl;
	}
}

Measured memory_bytes: 18792
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		
		if (M <= N) {
		    System.out.println("0");
		    return;
		}
		
		int[] X = new int[M];
        for (int i = 0; i < M; i++) {
            X[i] = sc.nextInt();
        }
        Arrays.sort(X);
        
        int[] diff = new int[M-1];
        for (int i = 0; i < M - 1; i++) {
            diff[i] = X[i+1] - X[i];
        }
        Arrays.sort(diff);
        
        int diffSum = 0;
        for (int i = 0; i < N - 1; i++) {
            diffSum += diff[M - 2 - i];
        }
        
        System.out.println(X[M-1] - X[0] - diffSum);
	}
}

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

using namespace std;

#define deb(x) cout << #x << " " << x << endl;

typedef long long ll;
const ll mod = 1000000007;

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

int main(){
    
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  //  freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    ll n;
    ll a,b,i;
    cin>>n>>a>>b;
    if(a==0)
        cout<<"0";
    else{
        cout<<(n/(a+b))*a+min(n%(a+b),a);
    }


    

    cerr << "\n\nTime elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}

Measured memory_bytes: 256
import itertools,math

N = int(input())
xy = []
for _ in range(N):
    X, Y = map(int, input().split())
    xy.append((X,Y))

perm = list(itertools.permutations(xy,N))
length = len(perm)
total = 0.00000

for i in range(length):
    for j in range(len(perm[0])-1):
        total += math.sqrt((perm[i][j][0] - perm[i][j+1][0]) ** 2 + (perm[i][j][1] - perm[i][j+1][1]) ** 2)

print(total / length)

Measured memory_bytes: 46960
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <set>
using namespace std;
int main(void){
    int a;
    string s;
    cin>>a>>s;
    if(a>=3200){
        cout << s<<endl;
    }else{
        cout<<"red"<<endl;
    }
}


Measured memory_bytes: 256
import java.util.*;


public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		
				// 出力
		System.out.println((a+b)*h/2);
    }
}


Measured memory_bytes: 9808
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;
const int mod = 1000000007;

int main(){
    int n;
    int a=0;
    long long sum=1;
    cin>>n;
    vector<int>bunkai(n+1);
    for(int i=1;i<=n;i++){
    a=i;
    for(int j=2;j<=n;j++){
        while(a%j==0){
        bunkai.at(j)++;
        a=a/j;
        }
    }
    }
    for(int i=2;i<bunkai.size();i++){
        if(bunkai.at(i)>0){
            sum*=bunkai.at(i)+1%mod;
            sum=sum%mod;
    }
    }
    cout<<sum<<endl;
}









Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());

  auto ok = [&](int idx) {
    queue<int> que;
    rep(i,n) {
      if (i == idx) continue;
      que.push(a[i]);
    }
    ll s = a[idx];
    while (!que.empty()){
      int t = que.front(); que.pop();
      if (t > 2 * s) return false;
      s += t;
    }
    return true;
  };
  
  if (ok(0)) {
    cout << n << endl;
    return 0;
  }

  int l = 0, r = n;
  while (r - l > 1){
    int mid = (l + r) / 2;
    if (ok(mid)) r = mid;
    else l = mid;
  }
  cout << n - r << endl;
  return 0;
} 

Measured memory_bytes: 1096
N = int(input())

#??????????????????????????????
FL =[]
for i in range(13):
 FL.append("S " + str(i+1))
for i in range(13):
 FL.append("H " + str(i+1))
for i in range(13):
 FL.append("C " + str(i+1))
for i in range(13):
 FL.append("D " + str(i+1))

for i in range(N):
 D = str(input())
 FL.remove(D)

for i in range(52 - N):
 print(FL[i])

Measured memory_bytes: 7704
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	//	"strings"
)

func main() {
	sc := NewScanner()

	n := sc.NextInt()
	if n == 1 {
		fmt.Printf("Hello World\n")
		return
	}
	n1 := sc.NextInt()
	n2 := sc.NextInt()
	fmt.Printf("%v\n", n1+n2)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>

typedef long long ll;
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<pair<string,int>> s(n);
    for (int i = 0; i < n; i++)
    {
        cin >> s[i].first;
        s[i].second=i;
    }
    for (int i = 0; i < n; i++){
        sort(s[i].first.begin(),s[i].first.end());
    }
    sort(s.begin(),s.end());

//    for (int i = 0; i < n; i++){
//        cout << s[i].first << " " << s[i].second << "\n";
//    }
    string ref=s[0].first;
    ll t=0;
    ll pt=1;

    for (int i = 1; i < n; i++){
        if(s[i].first != ref){
            if(pt!=1) t+=pt*(pt-1)/2;
            pt=1;
            ref = s[i].first;
        }
        else{
            pt++;
        }
        if(i==n-1&&pt!=1) t+=pt*(pt-1)/2;
    }
    cout << t << "\n";

}

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

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

int main() {
	
	ll n, m;
	cin >> n >> m;
	vector<ll> a(n), t(n);
	rep(i, n){
		ll tmp;
		cin >> tmp;
		a[i] = tmp / 2;
	}
	
	t = a;
	int precnt;
	rep(i, n){
		int cnt = 0;
		while(t[i]%2 == 0){
			t[i] /= 2;
			cnt++;
		}
		if(i>0){
			if(precnt != cnt){
				cout << "0" << endl;
				return 0;
			}
		}
		precnt = cnt;
	}
	
	ll lcm = a[0];
	for(int i = 1; i < n; i++){
		lcm = lcm / gcd(a[i], lcm) * a[i];
	}
	// cout << lcm << endl;
	cout << (m / lcm + 1LL) / 2 << endl;
	return 0;
}


Measured memory_bytes: 1792
n = gets.to_i
s = []
t = []
n.times do
  a, b = gets.split
  t << b.to_i
  s << a
end
# p s
# p t
x = gets.chomp
ans = 0
flag = false
s.each_with_index do |si, i|
  if si == x
    flag = true
  elsif flag
    ans += t[i]
  end
end

p ans

Measured memory_bytes: 1788
#include<iostream>
#include<cstring>
#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n,num[100000];
	cin>>n;
		int flag=0;	
	for(int i=0;i<n;i++)
	{
		cin>>num[i];
		if(num[i]%2==0)
		{
			if(num[i]%3==0 || num[i]%5==0)
			{
			}
			else
			{
				flag=1;
				break;
			}
		}
	}
	if(flag==1)
	{
		cout<<"DENIED";
	}
	else
	{
		cout<<"APPROVED";
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] str = sc.next().toCharArray();
		int q = sc.nextInt();
		String order;
		int a, b;
		char[] p;
		char tmp;
		for (int i = 0; i < q; i++) {
			order = sc.next();
			a = sc.nextInt();
			b = sc.nextInt();
			switch (order) {
			case "print":
				for (int j = a; j <= b; j++) {
					System.out.print(str[j]);
				}
				System.out.printf("%n");
				break;
			case "reverse":
				for (int j = a, k = b; j < (b - a + 1) / 2 + a; j++, k--) {
					tmp = str[j];
					str[j] = str[k];
					str[k] = tmp;
				}
				break;
			case "replace":
				p = sc.next().toCharArray();
				for (int j = a, k = 0; j <= b; j++, k++) {
					str[j] = p[k];
				}
				break;
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 34692
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
using namespace std;
#define ll long long
const int maxn = 1e5 + 5;
int a[maxn];
long long T, n, m, k, x;
void init()
{

}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int c = 1;
	
	for (int i = 0; i < 5; i++) { cin >> x; if (x == 0)c = i + 1; }
	cout << c << endl;

}

Measured memory_bytes: 3604
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fst . fromJust . BS.readInt

readIntList = map readInt . BS.words

getIntList = readIntList <$> BS.getLine

main = do
  [n, m] <- getIntList
  let n' = minimum [n, (m `div` 2)]
  let m' = m - n' * 2
  if m' < 4
    then print n'
    else do
      let n'' = m' `div` 4
      print $ n' + n''


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll; // [9,223,372,036,854,775,807 to -9.....808] 19 digits
typedef long double ld;
#define inc(i, a, b) for (long long int i = a; i <= b; i++)
#define dec(i, a, b) for (long long int i = a; i >= b; i--)
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(NULL);                \
    cout.tie(NULL);
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define lv vector<ll>
#define cv vector<char>
#define dv vector<ld>
#define rall(c) (c).rbegin(), (c).rend()
#define lpr pair<ll, ll>
#define mp make_pair
#define cin(c) \
    ll c;      \
    cin >> c;
#define lmap unordered_map<ll, ll>
#define vinp(a, n) \
    inc(i, 1, n)   \
    {              \
        cin(k);    \
        a.pb(k);   \
    }
#define LIM 1000000007
#define F first
#define S second
#define fr(i, n) inc(i, 0, n - 1)
#define fri(n, a) \
    inc(i, 0, n - 1) { cin >> a[i]; }
#define endl cout << "\n";
#define debug(p) cout << p;
#define umap unordered_map
#define uset unordered_set
#define fill(a, val, n) \
    inc(i, 0, n - 1) { a[i] = val; }
void i_love_Accepted()
{
    ll n;
    cin>>n;
    lmap arr;
    ll k;
    fr(i,n)
    {
        cin>>k;
        arr[k]++;
    }
    if(arr.find(1)!=arr.end())
    {
        if(arr[1]>1)
        cout<<0;
        else
        cout<<1;
        return;
    }
    ll ans=0;
    for(auto i=arr.begin();i!=arr.end();i++)
    {
        ll p=i->F;
        if(i->S > 1)
        continue;
        ll q=sqrt(p);
        bool g=true;
        inc(j,2,q)
        {
            if(p%j==0)
            {
                if(arr.find(j)!=arr.end() || arr.find(p/j)!=arr.end())
                {

                    g=false;
                    break;
                }
            }
        }
        if(g)
        ans++;
    }
    cout<<ans;
}
int main()
{
    fast;
    ll t = 1;
    //cin >> t;
    while (t--)
    {
        i_love_Accepted();
        endl;
    }
}


Measured memory_bytes: 11428