akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<map>
#include<math.h>

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    int k, x;
    cin >> k >> x;
    
    int l = x - (k-1);
    l = max(-1000000, l);
    
    int r = x + (k-1);
    x = min(1000000, r);

    for(int i = l; i <= r; i++) {
        printf("%d ", i);
    }

    return 0;
} /*atcoder*/



Measured memory_bytes: 3744
#include<stdio.h>
#include<string.h>
int main()
{
	int n;
	char arr[3];
	scanf("%s",arr);
	n=strlen(arr);
	if(n==2)
		printf("%s",arr);
	else
		for(int i=2;i>=0;i--)
			printf("%c",arr[i]);
	return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>

using namespace std;

typedef long long int lli;

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

int lcm(int a, int b) {
	return a * b / gcd(a, b);
}

#define N_MAX 310
#define MOD 1000000007

void solv()
{
	int N; char S[100];
	scanf("%d%s", &N, S);
	int cnt = 0;
	for (int i = 0; i < N-2; i++) {
		if ('A' == S[i] && 'B' == S[i + 1] && 'C' == S[i + 2]) {
			cnt++;
		}
	}

	printf("%d", cnt);

	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}


Measured memory_bytes: 128
/*
	Created by : imay_10
	" It won't be EASY, but I'll make it "
*/

#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
const int mod = 1e9+7;
const ll inf = 1e18;
const double pi = 3.1415926535897932384626;

// Utility for fast exponentiation
ll mpow(ll a,ll b,ll m){
    ll res=1;
    //a%=m;
    while(b){
    	if(b%2) res=res*a%m;
		a=a*a%m;
		b/=2;
	}
	return res;
}

// Utility for modular inverse
ll inv(ll a,ll m){
	return mpow(a,m-2,m);
}

// Utility for GCD Calculation
ll gcd(ll a,ll b){
	if(b==0) return a;
	return gcd(b,a%b);
}

// Utility for binomial coefficient
ll ncr(ll n,ll k)
{
    if(n<k)
        return 0;
    ll C[n + 1][k + 1];
    ll i,j;
    for(i=0;i<=n;i++){
        for(j=0;j<=min(i,k);j++){
            if (j==0 || j==i)
                C[i][j]=1;
            else
                C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
        }
    }
    return C[n][k];
}

void solve(){
	//code
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++){
		if(s[i]=='1')
			s[i]='9';
		else if(s[i]=='9')
			s[i]='1';
	}
	cout<<s;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	solve();
 	return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
	fastio;
	
	ll a;
	cin>>a;
	cout<<a+(a*a)+(a*a*a);
	return 0;
}



Measured memory_bytes: 3700
num_of_500yen = int(input())
num_of_100yen = int(input())
num_of_50yen = int(input())
total = int(input())
selection = 0

for n500 in range(num_of_500yen + 1):
    for n100 in range(num_of_100yen + 1):
        for n50 in range(num_of_50yen + 1):
            tmp_total = n500 * 500 + n100 * 100 + n50 * 50
            if tmp_total == total:
                selection += 1

print(selection)


Measured memory_bytes: 3316
import java.util.*;


class Main {
    static ArrayList<Integer>[]g;
    static ArrayList<Integer>[]rev;
    static ArrayList<Integer>[]num;
    static int[][]p;
    static int dfs(int v,int pp){
        int t=1;
        for(int i=0;i<g[v].size();++i){
            int w=g[v].get(i);
            if(w==pp)continue;
            int s=dfs(w,v);
            p[v][i]=s;
            t+=s;
        }
        return t;
    }
    static void dfs2(int v,int pp,int c){
        for(int i=0;i<g[v].size();++i){
            int w=g[v].get(i);
            if(w==pp){
                p[v][i]=g.length-c;
                continue;
            }
            dfs2(w,v,p[v][i]);
        }
    }
    static long dfs3(int v,int pp,long[]s,int forb){
        long t=0;
        for(int i=0;i<g[v].size();++i){
            int w=g[v].get(i);
            if(w==pp)continue;
            t+=dfs3(w,v,s,forb);
            //System.err.println("v="+v+" i="+i+" p="+p[v][i]+" s="+s[num[v].get(i)]);
            if(forb!=num[v].get(i))
                t+=p[v][i]*s[num[v].get(i)];
        }
        //System.err.println("dfs3 " + v + " " + pp + " " + forb + " ->" + t);
        return t;
    }
    @SuppressWarnings("unchecked")
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n=Integer.parseInt(scan.next());
        g=new ArrayList[n];
        rev=new ArrayList[n];
        num=new ArrayList[n];
        Arrays.setAll(g,x->new ArrayList<Integer>());
        Arrays.setAll(rev,x->new ArrayList<Integer>());
        Arrays.setAll(num,x->new ArrayList<Integer>());
        int[]c=new int[n-1],d=new int[n-1];
        int[]ci=new int[n-1],di=new int[n-1];        
        for(int i=0;i<n-1;++i){
            int a=Integer.parseInt(scan.next())-1;
            int b=Integer.parseInt(scan.next())-1;
            ci[i]=g[a].size();
            di[i]=g[b].size();
            num[a].add(i);
            num[b].add(i);
            g[a].add(b);
            g[b].add(a);
            c[i]=a;
            d[i]=b;
        }
        long[]s=new long[n];
        for(int i=0;i<n;++i)s[i]=Long.parseLong(scan.next());
        p=new int[n][];
        for(int i=0;i<n;++i){
            p[i]=new int[g[i].size()];
        }
        dfs(0,-1);
        dfs2(0,-1,-1);
        int cent=-1;
        long[]ans=new long[n-1];
        for(int i=0;i<n-1;++i){
            int u=p[c[i]][ci[i]];
            int v=p[d[i]][di[i]];
            if(u!=v)
                ans[i]=(s[c[i]]-s[d[i]])/(u-v);
            else
                cent=i;
        }
        long[]w=new long[n];
        if(cent>=0)
            ans[cent]=(s[c[cent]]-dfs3(c[cent],-1,ans,cent))/(n/2);
        for(long a:ans)System.out.println(a);
    }
}


Measured memory_bytes: 133484
n, a, b = map(int, input().split())

count = 0
for i in range(1, n+1):
    n_s = str(i)
    n_sum = 0
    for j in range(len(n_s)):
        n_sum += int(n_s[j])
    if a <= n_sum and n_sum <= b:
        count += i

print(count)


Measured memory_bytes: 2940
S = int(input())
if S<=10**9:
    print(0,0,0,1,S,0)
else:
    a = S%(10**9)
    x = 10**9
    y = 1
    if a==0:
        z = 0
    else:
        z = 10**9-a
    w = (S+y*z)//(10**9)
    print(0,0,x,y,z,w)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main(){

	int n;
	while(cin>>n&&n!=0){
		vector<pair<pair<int,int>,pair<int,char> > > v;
		for(int i = 0; i < n; i++){
			char ch;
			int w,l;
			w=l=0;
			cin>>ch;
			for(int j = 0; j < n-1; j++){
				int t;
				cin>>t;
				if(t==0)
					w++;
				else if(t==1)
					l++;
			}

			v.push_back(make_pair(make_pair(-w,l),make_pair(i,ch)));
		}
		sort(v.begin(),v.end());
		for(int i = 0; i < v.size(); i++){
			cout<<v[i].second.second<<endl;
		}
	}


	return 0;
}

Measured memory_bytes: 0
//package atcoder_edu_dp;
/*
stones numbered 1-n
ith stone has height hi
from ith stone can jump to i+1 or i+2 with cost |diff(stone j - stone i)|
find min cost to go from i to n

Approach =
state : dp[i] = min(dp[i-1]+(h[i]-h[i-1]) or dp[i-2]+(h[i]-h[i-2]))
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args)
    {
        FastReader sc=new FastReader();
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] h = new int[n];
        for(int i=0;i<n;i++){
            h[i] = sc.nextInt();
        }
        int[] dp = new int[n+1];
        Arrays.fill(dp,Integer.MAX_VALUE);
        dp[0] = 0;
        dp[1] = Math.abs(h[1]-h[0]);
        for(int i=2;i<n;i++){
            for(int j=1;j<=k;j++) {
                dp[i] = Math.min((j>i)? Integer.MAX_VALUE: dp[i - j] + Math.abs(h[i] - h[i - j]) , dp[i]);
            }
        }
        System.out.println(dp[n-1]);
    }
}


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

import sys
import copy

sys.setrecursionlimit(1000000)

# input = sys.stdin.readline

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

n = int(input())
p = list(map(int, input().split()))

ans = 0

for i in range(n-2):
    a = []
    for j in range(3):
        a.append(p[i + j])
    a.sort()
    if a[1] == p[i + 1]:
        ans += 1

print(ans)


Measured memory_bytes: 3444
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	a, b, c := nextInt(), nextInt(), nextInt()

	fmt.Println(a^b^c)
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
  string s,t;
  int a,b;
  cin >> s >> t;
  cin >> a >> b;
  string u;
  cin >> u;
  if(s==u){a--;}
  if(t==u){b--;}
  cout << a << " "<<b <<endl;
  return 0;
}

Measured memory_bytes: 256
let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});

process.stdin.on('end', () => {
  let [curAlpha, ...lines] = content.trim().split('\n');
  const results = [];
  for (let i = 1; i < lines.length; i++) {
    const h = parseInt(lines[i], 10);
    if (!isNaN(h)) {
      curAlpha = shuffle(curAlpha, h);
    } else {
      results.push(curAlpha);
      curAlpha = lines[i];
      i++;
    }
  }

  console.log(results.join('\n'));
});


const shuffle = (str, h) =>
  str.slice(h) + str.slice(0, h);




Measured memory_bytes: 15984
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
typedef long long ll;
typedef double db;
const int maxn = 45000 + 5;
const int mod = 1e9 + 7;

int main(){
    int n, k;
    cin >> n >> k;
    if((n + 1) / 2 >= k) printf("YES\n");
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class AChangingACharacter {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            String s = in.next();
            StringBuilder str = new StringBuilder();
            str.append(s.substring(0, k - 1));
            str.append(Character.toLowerCase(s.charAt(k - 1)));
            str.append(s.substring(k));
            out.println(str.toString());
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 23252
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    cout << min(c,b/a) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int cal(int r, int d, int x)
{
    return r * x - d;
}

int main(void)
{
    int ans = 0;

    int r, d, x;
    scanf("%d%d%d", &r, &d, &x);

    rep(i, 10)
    {
        int tmp = cal(r, d, x);
        printf("%d\n", tmp);
        x = tmp;
    }

    return 0;
}

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




 
int main(){
	int N, K;
	cin >> N >> K;
	vector<int> n(N);
	rep(i, N) cin >> n[i];
	sort(n.begin(), n.end());
	int ans = 0;
	rep(i, K) ans += n[i];
	cout << ans << endl;

}

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

string s[1000];
int n;

bool dfs(int x,int y){
  if(n<=y||s[y].size()<=x||isalpha(s[y][x]))return 0;
  if(s[y][x]=='+')return 1;
  bool res=dfs(x,y+1);
  if(res)s[y][x]='|';
  return res;
}

int main(){
  while(cin>>n,n){
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=0;i<n;i++)
      for(int j=0;j<s[i].size();j++)
	if(s[i][j]=='.'){
	  if(s[i][j+1]!='.')s[i][j]='+';
	  else s[i][j]=' ';
	}
    for(int i=0;i<n;i++)
      for(int j=0;j<s[i].size();j++)
	if(s[i][j]=='+')dfs(j,i+1);
    for(int i=0;i<n;i++)cout<<s[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10;
int p[N],q[N],r[N];
int x,y,a,b,c;
priority_queue<int,vector<int>,greater<int>> q1,q2;
bool cmp(int x,int y) {
	return x>y;
}
int main() {
	ll ans=0;
	int i,p0,p1;
	scanf("%d%d%d%d%d",&x,&y,&a,&b,&c);
	for (i=1;i<=a;i++) scanf("%d",&p[i]);
	for (i=1;i<=b;i++) scanf("%d",&q[i]);
	for (i=1;i<=c;i++) scanf("%d",&r[i]);
	sort(p+1,p+a+1,cmp);
	sort(q+1,q+b+1,cmp);
	sort(r+1,r+c+1,cmp);
	for (i=1;i<=x;i++) q1.push(p[i]),ans+=p[i];
	for (i=1;i<=y;i++) q2.push(q[i]),ans+=q[i];
	for (i=1;i<=c;i++) {
		p0=q1.top(); p1=q2.top();
		if (r[i]<=p0&&r[i]<=p1) break;
		if (p0<p1) {
			q1.pop(); q1.push(r[i]); ans+=r[i]-p0;
		}
		else {
			q2.pop(); q2.push(r[i]); ans+=r[i]-p1;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2552
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int cup[100],stat[100],sum[100],wat[200];
int N,SET;

/*
0:水がない
1:水がある
2:注ぎ終わった
*/

int search(int cc,int left,int look){
	int i;
	//printf("[%d %d %d]\n",cc,left,look);

	if(look<N)stat[look]=1;

	if(left==0){
		if(cc<N)stat[cc]=2;
		for(i=N-1;i>=0;i--){if(stat[i]==0)break;}
		if(i<0)return 1;
		for(i=N-1;i>=0;i--){
			if(stat[i]==0)break;
			if(stat[i]==1 && search(i,cup[i],99))return 1;
		}
		if(look<N)stat[look]=0;
		stat[cc]=1;
		return 0;
	}

	int ccc=(look<N) ? look:cc;

	for(i=ccc-1;i>=0;i--){
		if(left<cup[i])continue;
		if(sum[i]<left)break;
		if(stat[i]==0 && search(cc,left-cup[i],i))return 1;
		if(i==cc-1 && stat[i]==0)break;
	}

	if(look<N)stat[look]=0;

	return 0;
}

int main(){
    int i,j,k;

    while(scanf("%d",&N)*N){
		SET++;

		for(i=0;i<=100;i++)wat[i]=0;
		for(i=0;i<N;i++){
			scanf("%d",&k);
			wat[k]++;
		}
		for(i=0,j=0,k=0;i<=100,j<N;i++){
			for(;wat[i]>0;wat[i]--){
				k+=i;
				cup[j]=i;
				stat[j]=0;
				sum[j]=k;
				j++;
			}
		}

		
		/*if(SET>30){
			for(i=0;i<N;i++)fprintf(stderr,"%3d",cup[i]);
			fprintf(stderr,"\n");
		}*/
		//for(i=0;i<N;i++)printf("%3d",sum[i]);
		//printf("\n");

		if(search(99,0,N-1))printf("YES\n"); else printf("NO\n");

    }
 
    return 0;
}

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

int main(){
  int N;
  cin>>N;
  
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec[i];
  }
  
  sort(vec.begin(),vec.end());
  
  int a=0;
   for(int i=0;i<N-1;i++){
     a+=vec[i];
   }
  
  if(vec[N-1]<a){
    cout<<"Yes"<<endl;
  }
  else{cout<<"No"<<endl;
      }
}
  
  
    


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

#define NUM 12

int main(){
  int x[NUM];

  for(int i=0;i<NUM;++i){
    cin >> x[i];
  }
  
  sort(x,x+NUM);

  for(int i = 0; i<3 ;++i){
    for(int k=i*4;k<i*4 + 4 - 1;++k){
      if(x[k] != x[k+1]){
	cout << "no" << endl;
	return 0;
      }
    }
  }

  cout << "yes" << endl;
  
  return 0;
}



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

using namespace std;

int main() {
  string s;
  cin >> s;
  int q;
  cin >> q;
  deque<char> ss;
  for (int i = 0; i < s.size(); ++i) {
    ss.push_back(s[i]);
  }
  
  bool is_r = false;
  while (q--) {
    int t;
    cin >> t;
    if (t == 1) {
      is_r = !is_r;
    } else {
      int f;
      char c;
      cin >> f >> c;
      if (f == 1) {
	if (!is_r) {
	  ss.push_front(c);
	} else {
	  ss.push_back(c);
	}
      } else {
	if (!is_r) {
	  ss.push_back(c);
	} else {
	  ss.push_front(c);
	}
      }
    }
  }

  if (!is_r) {
    for (int i = 0; i < ss.size(); ++i) {
      cout << ss[i];
    }
  } else {
    int n = ss.size();
    for (int i = n - 1; i >= 0; --i) {
      cout << ss[i];
    }
  }
  puts("");
  return 0;
}



Measured memory_bytes: 896
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    n,k = map(int,input().strip().split())
    print(min(n%k, abs(n%k - k)))


if __name__ == '__main__':
    main()

Measured memory_bytes: 6496
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}
void _main();
int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); return 0;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-5,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

void _main(){
  string s;
  cin >> s ;
  int N = s.size();
  bool ok = (s[0]=='1' && s[N-1]=='0');
  rep(i,N-1) ok &= (s[i]==s[N-2-i]);
  if(!ok){
    cout << "-1" << endl;
    return;
  }
  int now = 0;
  int prev = -1;
  vvi g(N);
  REP(i,1,N-1){
    if(s[i]=='0') continue;
    if(prev!=-1) g[i].pb(prev);
    REP(j,now,i){
      g[i].pb(j);
    }
    now = i+1;
    prev = i;
  }
  g[N-2].pb(N-1);
  dump(g);
  rep(i,g.size()) for(auto p:g[i]) cout << i+1 << " " << p+1 << endl;
}

Measured memory_bytes: 6992
package main

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

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

type pair struct {
	x int
	y int
}

func do(paper map[int]pair, ints []int) bool {
	v := map[int]int{1: 0, 2: 0, 3: 0}
	h := map[int]int{1: 0, 2: 0, 3: 0}
	d := map[int]int{1: 0, 2: 0} // 1 -> 右上から左下、2 -> 右下から左下

	for _, vv := range ints {
		if p, exist := paper[vv]; exist {
			v[p.x]++
			h[p.y]++
			if p.x == p.y { //右上から左下
				d[1]++
			}
			if p.x+p.y == 4 { //右下から左下
				d[2]++
			}
		}
	}
	if check(v) {
		return true
	}
	if check(h) {
		return true
	}
	if check(d) {
		return true
	}
	return false
}

func check(resuls map[int]int) bool {
	for _, v := range resuls {
		if v == 3 {
			return true
		}
	}
	return false
}

func main() {
	size := 3
	m := map[int]pair{}
	for i := 1; i <= size; i++ {
		for j := 1; j <= size; j++ {
			v := nextInt()
			m[v] = pair{i, j}
		}
	}

	n := nextInt()
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = nextInt()
	}
	var r string
	if do(m, ints) {
		r = "Yes"
	} else {
		r = "No"
	}
	fmt.Println(r)
}


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

int main() {
  int N, a, b, c, d;
  cin >> N;
  a = N / 1000;
  b = (N - a * 1000) / 100;
  c = (N - a * 1000 - b * 100) / 10;
  d = N - a * 1000 - b * 100 - c * 10;
  //cout << a << "," << b << "," << c << "," << d << endl;
  if (a == b && b == c){
    cout << "Yes" << endl;
  }
  else if (b == c && c == d){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long ones[2000001];
int now;
void it(long long x){
    for(long long i=2;i*i<=x;i++){
        if(x%i==0){
            if(i*i!=x)
                ones[now++]=i,ones[now++]=x/i;
            else
                ones[now++]=i;
        }
    }
}
long long cnt;
int main(){
    long long n;
    cin>>n;
    it(n);
    ones[now++]=n;
    for(int i=0;i<now;i++)
        if(ones[i]-1!=0 && n%(ones[i]-1)==n/(ones[i]-1))
            cnt+=ones[i]-1;
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

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

        int max = a;
        if (max < b) max = b;
        if (max < c) max = c;

        System.out.println(a+b+c -max);
    }
}


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

int main() {
  int N, A;
  A = 0;
  cin >> N;
  vector<char> vec(N);
  for (int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  for (int i = 0; i < N; i++){
    if(vec.at(i) == 'Y'){
      A++;
    }
  }
  if(A == 0){
    cout << "Three" << endl;
  }
  else{
    cout << "Four" << endl;
  }
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n - 1);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < n; i++)
    cin >> b[i];
  for (int i = 0; i < n - 1; i++)
    cin >> c[i];
  int ans = 0;
  for (int i = 0; i < n; i++)
  {
    //cout << b[i] << endl;
    ans += b[i];
    if (a[i + 1] == a[i] + 1)
    {
      ans += c[a[i] - 1];
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59
using ld = long double;

int b[110];
int a[110];
int cnt[110];
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    //cout << fixed << setprecision(5);

    char c;
    cin >> c;
    if (c == 'A')
        cout << "T" << endl;
    else if (c == 'T')
        cout << "A" << endl;
    else if (c == 'G')
        cout << "C" << endl;
    else
        cout << "G" << endl;
    return 0;
}

Measured memory_bytes: 256
package main

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

var sc *bufio.Scanner

func nextString() string {
	sc.Scan()
	i := sc.Text()
	return i
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	a := nextString()
	// sc.Split(bufio.ScanWords)
	for i, s := range a {
		if 'a' <= a[i] && a[i] <= 'z' {
			fmt.Print(strings.ToUpper(string(s)))
		} else if 'A' <= s && s <= 'Z' {
			fmt.Print(strings.ToLower(string(s)))
		} else {
			fmt.Print(string(s))
		}
	}
	fmt.Print("\n")
}



Measured memory_bytes: 1144
/*
ABC151-D AC
幅優先探索 : 最短距離を求める
参考　: https://qiita.com/drken/items/6a95b57d2e374a3d3292#4-2-%E3%82%B0%E3%83%A9%E3%83%95%E4%B8%8A%E3%81%AE%E6%8E%A2%E7%B4%A2
*/

#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> Pii;

//4方向の移動を示す
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
  int H, W;
  cin>>H>>W;
  vector<string> S(H);
  for(int i=0; i<H; i++){
    cin>>S[i];
  }

  int ans = 0;

  for(int sx=0; sx<H; sx++)for(int sy=0; sy<W; sy++){
    //for(int gx=0; gx<H; gx++)for(int gy=0; gy<W; gy++){
      //スタートとゴールを探すループ
      if(S[sx][sy]=='.' /*&& S[gx][gy]=='.'*/){
        //スタートとゴールにできるとき
        //ここから一般的な最短距離探索
        vector<vector<int>> dist(H, vector<int>(W, -1)); //dist=-1のマスは未発見
        queue<Pii> unvisited; //発見したけど訪問していないマスの情報
        /*
        pushは後ろから入れる
        popは先頭から出す
        */

        dist[sx][sy] = 0; //スタートを発見
        unvisited.push(Pii(sx, sy)); //訪問はしてないのでスタートを入れる

        //探索開始
        while(!unvisited.empty()){
          //unvisitedが空になるまで
          pair<int, int> current = unvisited.front(); //先頭を読む
          unvisited.pop(); //先頭を捨てる
          int x = current.first;
          int y = current.second;

          for(int i=0; i<4; i++){
            //4方向にnextを探索
            int next_x = x + dx[i];
            int next_y = y + dy[i];
            if(next_x<0 || next_x>=H || next_y<0 || next_y>=W) continue;
            //外に出たらダメ
            if(S[next_x][next_y]=='#') continue;
            //壁はダメ

            if(dist[next_x][next_y] == -1){
              //未発見だったらこれで発見なので未訪問キューに入れる
              unvisited.push(Pii(next_x, next_y));
              dist[next_x][next_y] = dist[x][y] + 1; //nextのdistは現在地+1
              ans = max(ans, dist[next_x][next_y]);
            }
          }
        }//while(!unvisited.empty())
        
        //printf("(%d,%d)->(%d,%d) : %d\n", sx, sy, gx, gy, dist[gx][gy]);

        //ans = max(ans, dist[gx][gy]);

      }//if(S[sx][sy]=='.' && S[gx][gy]=='.')
    //}
  }

  cout<<ans<<endl;
}

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

template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;                     // to be set
    
    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }
    
    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }
    
    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

int main() {
    int N,Q; cin >> N>>Q;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];


    vector<int> lefts(Q), rights(Q), ids(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> lefts[i] >> rights[i];
        --lefts[i];
        ids[i] = i;
    }
    sort(ids.begin(), ids.end(), [&](int i, int j) {
            return rights[i] < rights[j];});

    BIT<int> bit(N+5);
    vector<int> prev(1100000, -1);
    vector<int> res(Q, 0);
    int r = 0;
    for (auto i : ids) {
        for (; r < rights[i]; ++r) {
            bit.add(prev[a[r]]+2, r+2, 1);
            prev[a[r]] = r;
        }
        int tmp = bit.sum(lefts[i]+1, lefts[i]+2);
        res[i] = max(res[i], tmp);
    }
    for (int i = 0; i < Q; ++i) cout << res[i] << "\n";
}

Measured memory_bytes: 21728
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n;
  cin>>n;
  map<string,int>mp;
  rep(i,n){
    string s;
    cin>>s;
    sort(all(s));
    mp[s]++;
  }
  ll ans=0;
  for(auto x:mp){
    ll a=x.sc;
    ans+=a*(a-1)/2;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define rep1(i, n) for (int i = 1; i < int(n); ++i)
#define repx(i, x, n) for (int i = int(x); i < int(n); ++i)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define ALL(n) begin(n), end(n)
#define IN(a, x, b) ((a) <= (x) && (x) < (b))
#define OUT(a, x, b) ((x) < (a) || (x) < (b))
typedef long long ll;
typedef long double ld;
const ll INF = 1e18;
const ll MOD = 1000000007;

int main()
{
    string s;
    cin >> s;

    bool ans = (s.size() % 2 == 0) ^ (s[0] == s[s.size() - 1]);
    if (ans)
        cout << "Second" << endl;
    else
        cout << "First" << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

using ll = long long;
const ll MOD = 1e9 + 7;
const long long INF = 1LL << 60;

int main()
{
    int h, n;
    cin >> h >> n;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a.at(i) >> b.at(i);

    vector<vector<ll>> dp(n + 1, vector<ll>(h + 1, INF));
    dp[0][0] = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <= h; j++)
        {
            chmin(dp[i + 1][j], dp[i][j]);
            chmin(dp[i + 1][min(j + a[i], h)], dp[i + 1][j] + b[i]);
        }
    }

    cout << dp[n][h] << endl;
}

Measured memory_bytes: 78592
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int n = sc.nextInt();
        Set<String> ts = new TreeSet<>();
        for(int i = 0;i<s.length();i++){
            ts.add(s.substring(i,i+1));
            if(i + 1 < s.length()){
                ts.add(s.substring(i,i+2));
            }
            if(i + 2 < s.length()){
                ts.add(s.substring(i,i+3));
            }
            if(i + 3 < s.length()){
                ts.add(s.substring(i,i+4));
            }
            if(i + 4 < s.length()){
                ts.add(s.substring(i,i+5));
            }
        }
        Iterator it = ts.iterator();
        for(int i = 0;i<5;i++){
            if(i+1 == n){
                System.out.println(it.next());
                break;
            }else{
                it.next();
            }
        }
    }
}

Measured memory_bytes: 26700
#include <bits/stdc++.h>
using namespace std;
#define int  long long int
#define mod 1000000000000007
#define pb push_back
#define mp make_pair
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define gcd __gcd
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(i) i.begin(),i.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define set_bit __builtin_popcount //gives number of set_bits
#define ff first
#define ss second
#define cases(t) int t;cin>>t; rep(casn,1,t+1)
#define el cout<<"\n";
#define deci(n) int n; scanf("%lld",&n);
#define decs(n) string n; cin>>n;
#define sz(v) v.size()
#define repit(m) for(auto it=m.begin();it!=m.end();it++)
// #define find(m,i) (m.find(i)!=m.end())
// #define find(m,i) (m.find(i)==m.end())
#define cYES cout<<"YES\n";
#define cNO cout<<"NO\n";
#define ins insert
#define imax 1000000000000000000
#define imin -1000000000000000000
// #define NP 50000
//  cerr << "\nTime : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
 
//  IIITA
//SUNEET KUMAR -->  ਸੁਨੀਤ
 
// scanning numbers extremely fast/////////
void fs(int &number)
{
    bool negative = false;
    register int c;
    number = 0;
    c = getchar();
    if (c=='-')
    {
        negative = true;
        c = getchar();
    }
    for (; (c>47 && c<58); c=getchar())
        number = number *10 + c - 48;
    if (negative)
        number *= -1;
}
// ========================================
int power(int a,int x)
{
        a%=mod;
    int res=1;
    while(x>0)
    {
        if(x&1)
        res=res*a%mod;
        a=a*a%mod;
        x>>=1;
    }
    return res;
}
int max(int a,int b)
{
    if(a>b)
    {
        return a;
    }
    else
    {
        return b;
    }
}
int min(int a,int b)
{
    if(a>b)
    {
        return b;
    }
    else
    {
        return a;
    }
}
int madd(int a,int b)
{
    int ans;
    ans=(a%mod+b%mod)%mod;
    return ans;
}
int mmult(int a,int b)
{
    int ans=1;
    ans=((a%mod)*(b%mod))%mod;
    return ans%mod;
}
int modinverse(int a)
{
    return power(a,mod-2);
}
void nhi_degi()
{
    int n;cin>>n;
    int W;cin>>W;
    int weight[n+3],val[n+4];
    int sum=0;

    for(int i=1;i<=n;i++)
    {
        cin>>weight[i]>>val[i];
        sum+=val[i];
    }

    int dp[sum+2],dp1[sum+2];
    for(int i=0;i<=sum+1;i++)
    {
        dp[i]=imax;
        dp1[i]=imax;
    }
    dp[0]=imax;
    dp1[0]=0;

    for(int j=1;j<=n;j++)
    {
        for(int i=1;i<=sum;i++)
        {
            dp1[i]=dp[i];
        }
        for(int i=1;i<=sum;i++)
        {
            if(val[j]<=i)
            {
                dp[i]=min(weight[j]+dp1[i-val[j]],dp1[i]);
            }
            // dp[i]=min(dp[i],dp[i-1]);
            // dp[i]=dp1[i]
        }
    }
    int bsdk=-1;
    for(int i=1;i<=sum;i++)
    {
        if(dp[i]<=W)
        {
            bsdk=i;
        }
    }
   
    cout<<bsdk;el
}
signed main()
{
    nhi_degi();
}

Measured memory_bytes: 1792
#include<iostream>

int main(){
    while(1){
        int h, w;
        std::cin >> h >> w;
        
        if(h == 0 && w == 0) break;
        
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                std::cout <<'#';
            }
            std::cout << "" << std::endl;
        }
        std::cout << "" << std::endl;
    }
    return 0;
}


Measured memory_bytes: 3080
// D - 756

// DFS + メモ化による解法

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

const int UNCONF = -1;

vector<pair<ll, ll>> prime_factorize(ll n) {
	vector<pair<ll, ll> > result;
	for (ll p=2; p*p<=n; p++) {
		if (n % p != 0) continue;
		ll num = 0;
		while (n % p == 0) {
			num++;
			n /= p;
		}
		result.push_back(make_pair(p, num));
    }
    if (n != 1) {
    	result.push_back(make_pair(n, 1));
    }
    return result;
}

vector<pair<int, int>> prime_cnt;
int memo[100][100];

int dfs(int i, int cnt) {
	if (cnt > 75) return 0;
	if (memo[i][cnt] != UNCONF) return memo[i][cnt];

	if (i == prime_cnt.size() - 1) {
		if (cnt == 75) {
			memo[i][cnt] = 1;
			return 1;
		} else {
			memo[i][cnt] = 0;
			return 0;
		}
	}

	int result = 0;
	for (int j=0; j<=prime_cnt[i].second; j++) {
		result += dfs(i+1, cnt * (j+1));
	}

	memo[i][cnt] = result;
	return result;
}

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

	if (N == 1) {
		cout << 0 << endl;
		return 0;
	}

	map<int, int> primes;

	for (int i=2; i<=N; i++) {
		vector<pair<ll, ll>> pf = prime_factorize(i);

		for (auto p: pf) {
			primes[p.first] += p.second;
		}
	}

	for (auto itr : primes) {
		int prime = itr.first;
		int cnt = itr.second;
		//cout << itr.first << " " << itr.second << endl; // **** debug ****
		prime_cnt.push_back(make_pair(prime, cnt));
	}

	for (int i=0; i<100; i++) {
		for (int j=0; j<100; j++) {
			memo[i][j] = UNCONF;
		}
	}

	int ans = dfs(0, 1);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3620
#include<iostream>

using namespace std;

int main() {
	int N, K;
	int q = 0;
	cin >> N >> K;

	for (int i = 0; i < N; i++) {
		int h;
		cin >> h;
		if (h >= K) {
			q++;
		}
	}

	cout << q << endl;

	return 0;
}

Measured memory_bytes: 256
n,k=map(int, input().split())
MOD=10**9+7

N=n*2
fac=[1]*(N+1)
for i in range(1,N+1):
    fac[i]=fac[i-1]*i%MOD
ifac=[pow(fac[N],MOD-2,MOD)]*(N+1)
for i in range(N,0,-1):
    ifac[i-1]=ifac[i]*i%MOD

ans=0
if k>=n-1:
    ans=fac[n+n-1]*ifac[n]*ifac[n-1]%MOD
else:
    for i in range(k+1):
        if i>n: break
        tmp=fac[n]*ifac[n-i]*ifac[i]%MOD
        tmp=tmp*fac[i+n-i-1]*ifac[n-i-1]*ifac[i]%MOD
        ans=(ans+tmp)%MOD

print(ans)

Measured memory_bytes: 47084
#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 <unordered_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>
using namespace std ;
#define endl '\n' 
 
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};
unordered_map<pair<int,int>,int,HASH>mp;
 
#ifdef _DEBUG
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif 

list < int > l ;

void showList(list <int> g) 
{ 
	int cnt = 0 ;
    list <int> :: iterator i ;  
    for(i = g.begin(); i != g.end(); ++i) { 
		if(i == g.begin()) cout << *i ;
		else cout << ' ' << *i ; 
    }
    cout << endl ;
} 

int main() 
{ 
	int T , n ;
	string s ;
	cin >> T ;
	
	while(T--){ 
		cin >> s ;
		if(s == "insert"){
			cin >> n ;
			l.push_front(n) ;
		}
		
		else if(s == "delete"){
			cin >> n ;
			list <int> :: iterator j ; 
			for(j = l.begin() ; j != l.end() ; j++){
				if(*j == n){
					l.erase(j) ;
					break ;
				}
			}
		}
			
		else if(s == "deleteFirst") l.pop_front() ;
		else l.pop_back() ;
	}
	
	showList(l) ;
	return 0 ;
}



Measured memory_bytes: 34324
#include<iostream>
#include<algorithm>
using namespace std;

typedef long long ll;

int N;
int s[100];

int main(){
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> s[i];
    }
    sort(s, s+N);
    int cum[N];
    cum[0] = s[0];
    for(int i=1; i<N; i++){
        cum[i] = cum[i-1] + s[i];
    }
    int ans = cum[N-1];
    for(int i=0; i<N; i++){
        if(ans%10==0){
            if(s[i]%10!=0){
                cout << ans - s[i] << endl;;
                return 0;
            }
        }else{
            cout << ans << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
    
}


Measured memory_bytes: 764
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 1000000002486618624LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int N, l, r, c = 0;

  std::cin >> N;

  for (int i = 0; i < N; i ++) {
    std::cin >> l >> r;

    c += r - l + 1;
  }

  std::cout << c << std::endl;

  return 0;
}


Measured memory_bytes: 256
//I Guds namn
#include <cstdio>

using namespace std;

const int MAXN = 5 * 10 + 13;

int d[MAXN];

int main()
{
	int N, M;
	scanf("%d%d", &N, &M);
	for(int i = 1;i <= M;i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		d[a]++, d[b]++;
	}
	for(int i = 1;i <= N;i++)
		printf("%d\n", d[i]);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner reader = new Scanner(System.in);

    int n = reader.nextInt();
    double[] x = new double[n];
    double[] y = new double[n];
    double manhattan = 0;
    double euclidean = 0;
    double minkowski = 0;
    double chebyshev = 0;

    for (int i = 0; i < n; i++) {
      x[i] = reader.nextDouble();
    }
    for (int i = 0; i < n; i++) {
      y[i] = reader.nextDouble();
    }

    for (int i = 0; i < n; i++) {
      double temp = Math.abs(x[i] - y[i]);
      manhattan += temp;
      euclidean += Math.pow(temp, 2);
      minkowski += Math.pow(temp, 3);
      if (chebyshev < temp)  chebyshev = temp;
    }
    System.out.println(manhattan + "\n" + Math.sqrt(euclidean) + "\n" + Math.cbrt(minkowski) + "\n" + chebyshev);
  }
}

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

int main()
{
    ll N;
    cin >> N;
    vector<ll> tmp;

    while (N != 0)
    {
        tmp.push_back(N % 26);
        N = (N - 1) / 26;
    }

    rep(i, tmp.size())
    {
        ll n = tmp[tmp.size() - 1 - i];
        if (n == 0)
            n = 26;
        cout << (char)('a' + n - 1);
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3628
// Author: Mohammad Faisal
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  set<int> s;
  for(int i=0;i<n;i++)
  {
    int x;
    cin >> x;
    s.insert(x);
  }
  cout<<s.size()<<endl;
  return 0;
}

Measured memory_bytes: 256