akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

using namespace std;

#define LL long long

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

LL mod(LL x, LL md) {
	return ((x % md) + md) % md;
}

class Mint {
public:
	static LL md;
	LL x;
	Mint(LL _x) {
		x = mod(_x, md);
	}
	Mint(const Mint &y) {
		x = mod(y.x, md);
	}
};

void MintMyExgcd(LL a, LL b, LL &x, LL &y) {
	// solve equation ax + by = 1 (mod m)
	LL md = Mint::md;
	if (b == 0) {
		y = 0;
		x = 1;
		return ;
	}
	MintMyExgcd(b, a % b, x, y);
	LL t = y;
	y = mod(x - (a / b) * y, md);
	x = t;
}

LL MintNY(LL x) {
	if (x == 0) {
		return 1;
	}
	LL md = Mint::md;
	LL a, b;
	MintMyExgcd(x, md, a, b);
	while (a < 0) {
		a += md;
	}
	return a;
}

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

Mint operator+(Mint a, Mint b) {
	return Mint(mod(a.x + b.x, Mint::md));
}
Mint operator-(Mint a, Mint b) {
	return Mint(mod(a.x - b.x, Mint::md));
}
Mint operator*(Mint a, Mint b) {
	return Mint(mod(a.x * b.x, Mint::md));
}
Mint operator/(Mint a, Mint b) {
	Mint c = Mint(MintNY(b.x));
	return Mint(mod(a.x * c.x, Mint::md));
}

Mint operator-(Mint a) {
	return Mint(-a.x);
}
bool operator==(Mint a, Mint b) {
	return a.x == b.x;
}
bool operator!=(Mint a, Mint b) {
	return a.x != b.x;
}
bool operator>(Mint a, Mint b) {
	return a.x > b.x;
}
bool operator<(Mint a, Mint b) {
	return a.x < b.x;
}
bool operator>=(Mint a, Mint b) {
	return a.x >= b.x;
}
bool operator<=(Mint a, Mint b) {
	return a.x <= b.x;
}

void operator+=(Mint &a, Mint b) {
	a = a + b;
}
void operator-=(Mint &a, Mint b) {
	a = a - b;
}
void operator*=(Mint &a, Mint b) {
	a = a * b;
}
void operator/=(Mint &a, Mint b) {
	a = a / b;
}

ostream& operator<<(ostream &out, Mint a) {
	out << a.x;
	return out;
}

istream& operator>>(istream &in, Mint &a) {
	in >> a.x;
	return in;
}

Mint factorial(LL n) {
	if (n == 0) {
		return Mint(1);
	}
	Mint res = 1;
	for (LL i = 1; i <= n; ++i) {
		res *= i;
	}
	return res;
}
Mint multiRange(LL s, LL t) {
	Mint res = 1;
	for (LL i = s; i <= t; ++i) {
		res *= i;
	}
	return res;
}

Mint getC(LL n, LL k) {
	if (n - k < k) {
		return getC(n, n - k);
	}
	return multiRange(n - k + 1, n) / factorial(k);
}

Mint getA(LL n, LL k) {
	return multiRange(n - k + 1, n);
}

Mint countNonNegativeDivision(LL n, LL k) {
	return getC(n + k - 1, k - 1);
}
Mint countPositiveDivision(LL n, LL k) {
	if (n < k) {
		return 0;
	}
	if (k <= 0) {
		return 0;
	}
	return getC(n - 1, k - 1);
}
Mint quickMod(Mint a, LL b) {
	Mint res = 1;
	while (b > 0) {
		if (b % 2) {
			res *= a;
		}
		a *= a;
		b /= 2;
	}
	return res;
}

LL Mint::md = 1000000007;

int n, m;
int x;
int main() {
	cin >> x;
	int ans = (x / 500) * 1000 + ((x % 500) / 5) * 5;
	cout << ans << endl;
	// cin >> n >> m;
	return 0;
}

Measured memory_bytes: 256
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, read().decode('utf8').split())
print('Yes' if 500*N>=K else 'No')


Measured memory_bytes: 2940
package main
import(
  "fmt"
)
func main(){
  var n, i, j int
  ans:=0
  temp:=0
  fmt.Scan(&n)
  for i=1;i<=n;i+=2{
    for j=1;j<=i;j++{
      if i%j==0{
        temp++
      }
    }
    if temp==8{
      ans++
    }
    temp=0
  }
  fmt.Println(ans)
}


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

int main() {
	int N, C, P, SUM = 0;
	cin >> N >> C;
	N++;
	for (int i = 0; i < C; i++) cin >> P, SUM += P;
	if (SUM % N == 0) cout << SUM / N << endl;
	else cout << SUM / N + 1 << endl;
}


Measured memory_bytes: 3108
#include <stdio.h>
int main(void)
{
    int n,x,ans;
    scanf("%d",&n);
    int a[n];
    for(int p=1;p<n+1;p++)
    {
        scanf("%d",&a[p]);
    }
    for(int q=1;q<n+1;q++)
    {
        for(int r=1;r<n+1;r++)
        {
            if(a[r]>a[q])
            {
                x=0;
                x=a[q];
                a[q]=a[r];
                a[r]=x;
            }
        }
    }
    ans=a[n]-a[1];
    printf("%d",ans);
}


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

using namespace std;

int frog (int n, int k, vector<int>& h) {
  vector<int> dp(n+1);
  dp[1] = 0;
  dp[2] = abs(h[1] - h[0]);
  for (int i = 3; i <= n; i++) {
    dp[i] = INT_MAX;
    for (int j = 1; j <= k; j++) {
      if (j > i-1) {
        // cout << "skip" << j << endl;
        continue;
      }
      dp[i] = min(dp[i], abs(h[i-1] - h[i-1-j]) + dp[i-j]);
    }
  }

  // for (int i = 1; i <= n; i++) {
  //   cout << dp[i] << " ";
  // }

  return dp[n];
  
}

int main() {
  int n;
  cin >> n;
  int k;
  cin >> k;
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  cout << frog(n, k, h);
}


Measured memory_bytes: 3992
#include <stdio.h>
int main()
{
  char x;
  char a[4];
  a[0]='A';
  a[1]='C';
  a[2]='G';
  a[3]='T';
  scanf("%s" ,&x);
 
  if(x==a[0])
    printf("T");
   if(x==a[1])
    printf("G");
   if(x==a[2])
    printf("C");
   if(x==a[3])
    printf("A");
  return 0;
}

Measured memory_bytes: 128
n = int(input())
ss = [input() for _ in range(n)]
ans = {}
ans['AC'] = 0
ans['WA'] = 0
ans['TLE'] = 0
ans['RE'] = 0
for s in ss:
    ans[s] += 1

print('AC x', ans['AC'])
print('WA x', ans['WA'])
print('TLE x', ans['TLE'])
print('RE x', ans['RE'])

Measured memory_bytes: 16164
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        myStack stk=new myStack();
        String[] data=in.nextLine().split(" ");
        for(int i=0;i<data.length;i++){
            String obj=data[i];
            
            if(obj.equals("+") || obj.equals("*") || obj.equals("-")){
                char odr=obj.charAt(0);
                if(odr==' ')continue;
                int a=stk.pop(),b=stk.pop();
                switch(odr){
                    case '+':
                    stk.push(b+a);
                    break;

                    case '-':
                    stk.push(b-a);
                    break;

                    case '*':
                    stk.push(b*a);
                    break;
                }
            }
            else{
                stk.push(Integer.parseInt(obj));
            }
            //stk.dump();
        }

        System.out.println(stk.peek());
    }
}

class myStack{
    int array[],top;

    myStack(){
        array=new int[1000];
        top=0;
    }

    boolean isEmpty(){
        if(top==0)return true;
        else return false;
    }

    int size(){
        return top;
    }

    void push(int x){
        top++;
        array[top]=x;
    }

    int peek(){
        return array[top];
    }

    int pop(){
        int res=array[top];
        top--;
        return res;
    }

    void dump(){
        for(int i=1;i<=top;i++){
            System.out.print(array[i]+" ");
        }
        System.out.println();
    }
}


Measured memory_bytes: 26300
from collections import deque

K = int(input())

tree = deque([[-1, i] for i in range(1, 10)])
i = 0
cnt = 9

while cnt <= K:
    n = tree[i][1]
    if n > 0:
        tree.append([i, n - 1])
        cnt += 1
    tree.append([i, n])
    cnt += 1
    if n < 9:
        tree.append([i, n + 1])
        cnt += 1
    i += 1

ans = ""
j = K - 1

while True:
    j, b = tree[j]
    ans = str(b) + ans
    if j == -1:
        break

print(ans)


Measured memory_bytes: 14704
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define PI 3.1415926536
#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 show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    double r;
    cin >> r;
    printf("%4.10f\n", 2*r*PI);

}



Measured memory_bytes: 3792
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const auto INF = (ll)1e9;
using v = vector<int>;
using vv = vector<v>;
auto a = vector<int>(50,0);
auto b = vector<int>(50,0);
auto mm = vector<v>(50,v(50,0));
auto used = vector<int>(50,0);
int n,m;
void dfs(int s){
    used[s] = 1;
    for (int i = 0; i < n; i++)
    {
        if(mm[s][i]!=1) continue;
        if(used[i]==1) continue;
        dfs(i);
    }
}

int main(){
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        cin >>a[i] >> b[i];
        a[i]--;
        b[i]--;
        mm[a[i]][b[i]]=mm[b[i]][a[i]]=1;
    }

    int sum =0;
    for (int i = 0; i < m; i++)
    {
        mm[a[i]][b[i]] = mm[b[i]][a[i]] = 0;
        generate(used.begin(),used.end(),[](){return 0;});
        dfs(0);
      	bool f = false;
        for(int u = 0;u<n;u++){
            if(used[u]==0){
                f= true;
              	break;
            }
        }
      	if(f) sum++;
        mm[a[i]][b[i]] = mm[b[i]][a[i]] = 1;
    }

    cout << sum;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define SIZE_OF_ARRAY(a) (sizeof(a)/sizeof(a[0]))

unsigned GetDigit(unsigned num){
    return std::to_string(num).length();
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int a[N];
    for(int i = 0; i < N;i++){
        cin >>a[i];
    }

    stable_sort(a, a + N);
    int count = 0;
    int small = 10000000;
    for(int i = N - 1; i >= 0;i--){
        if(a[i] < small){
            count++;
            small = a[i];
        }
    }
    cout << count << endl;
}




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

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

    static class abc154_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            for (int i = 0; i < S.length(); i++) {
                out.print("x");
            }
            out.println();
        }

    }
}



Measured memory_bytes: 23124
#include <iostream>
#include <string>
 
int main() {
    int K, A, B;
    std::cin >> K >> A >> B;

    std::string ret = "NG";
    for (int i = A; i <= B; ++i) {
        if (i % K == 0) {
            ret = "OK";
            break;
        }
    }
    std::cout << ret << std::endl;            
}


Measured memory_bytes: 3596
from re import match

S = input()

oddStep = r"R|U|D"
evenStep = r"L|U|D"

for st in S[0::2]:
	if not match(oddStep, st):
		print('No')
		exit()
for st in S[1::2]:
	if not match(evenStep, st):
		print('No')
		exit()
print('Yes')

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

#define ll long long
#define pq priority_queue
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;

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

Measured memory_bytes: 256
use std::io;

fn main() {
    let input = read_line();
    let ret = input.starts_with("YAKI");
    println!("{}", if ret {"Yes"} else {"No"})
}

fn read_line() -> String {
    let mut s = String::default();
    io::stdin().read_line(&mut s).ok().expect("read error in read_line");
    s
}

fn read_strings() -> Vec<String> {
    let s = read_line();
    s.split_whitespace().map(|x| x.to_string()).collect::<Vec<String>>()
}


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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  int n, max;
  cin >> n >> max;
  int boxes[n];
  REP(i,n) {
    cin >> boxes[i];
  }
  
  ll ans = 0;
  if(boxes[0] > max) {
    ans = boxes[0] - max;
    boxes[0] = max;
  }
  REPS(i,1,n) {
    int rest = max - boxes[i-1];
    if(rest < boxes[i]) {
      ans += boxes[i] - rest;
      boxes[i] = rest;
    }
  }
  cout << ans;
  
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
int main(void){
    long long A, B, C, D;
    cin >> A >> B >> C >> D;
    
    A = A - 1;
    
    long long a = B / C - A / C;
    long long b = B / D - A / D;
    
    long long x = C * D;
    long long e, d, tmp, y;
    if(C < D){
        tmp = e;
        e = d;
        d = tmp;
    }
    y = C % D;
    while(y != 0){
        C = D;
        D = y;
        y = C % D;
    }
    long long LCM = x / D;
    
    long long c = B / LCM -  A / LCM;
    long long total = B - A;
    long long ans = total - a - b + c;
    
    // cout << a << endl;
    
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		String[] strArray = new String[2];
		int a, b;

		while(true) {
	        strArray = br.readLine().split(" ");
	        a = Integer.parseInt(strArray[0]);
	        b = Integer.parseInt(strArray[1]);

	        if(a == 0 && b == 0) {
	        	break;
	        }

	        for(int i=0; i<a; i++) {
	        	for(int j=0; j<b; j++) {
	        		sb.append("#");
	        	}
	        	sb.append("\n");
	        }
	        sb.append("\n");
		}

        System.out.print(sb);
	}
}

Measured memory_bytes: 25656
import scala.collection.mutable.{HashSet => MSet}
object Main extends App {
  val in = new java.util.Scanner(System.in)
  val S = in.nextInt
  val set = new MSet[Int]()

  def next(i: Int, count: Int): Int =
    if (set.add(i)) next(if (i % 2 == 0) i / 2 else i * 3 + 1, count + 1)
    else count

  println(next(S, 1))
}

Measured memory_bytes: 27316
import java.util.*; 
import java.io.*;


// A1 * Sum(A2+...+An)
// +A2 * Sum(A3+...+An)
// +A3 * Sum(A4+...+An)
public class Main {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
    
    static long mod = (long)1e9 + 7;

    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        int N = nextInt();
   
        long ans = 0;
        int prev =  nextInt();
        // we get PreSum
        for (int i=2; i<=N; i++) {
            int next = nextInt();
            if(next<prev){
                ans += prev-next;
            }
            else{
                prev = next;
            }
        }

        System.out.println(ans);
    }

      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}

Measured memory_bytes: 54460
l,r = map(int,input().split())
dl = l % 2019
dr = r % 2019
lis = []
if r - l >= 2019 - dl or dl == 0:
    print(0)
else:
    for i in range(dl,dr):
        for j in range(i+1,dr+1):
            lis.append((i*j)%2019)
    print(min(lis))


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

int check(vector<int> A){

  int N = A.size();
  int S = 0;
    
  for(int i=0;i<N;i++){
    S+=A[i];
    assert(A[i]<=30000);
  }

  int flag = 1;
    
  for(int i=0;i<N;i++)
    if( __gcd( A[i], S-A[i] ) == 1 ) flag = 0;
  
  int gc = A[0];
    
  for(int i=0;i<N;i++) gc = __gcd( gc, A[i] );
  
  if( flag && gc == 1 ) return true;
  
  return false;
}

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

  if( n == 3 ){
    cout<<"2 5 63"<<endl;
    return 0;
  }
  
  int sum = 0;
  
  for(int i=2;i<=30000;i+=2){
    
    sum += i;
      
    if( sum % 3 == 0 ){
	
      int cnt1 = i / 2;
      
      int cnt2 = ( n - cnt1 ) / 2 * 2;
      
      int flag = cnt1 + cnt2 != n;
      
      if( cnt1 >= 1 && cnt2 >= 1 && cnt1 + cnt2 + flag == n ){
	
	if( 3 * ( cnt2 * 2 - 1 ) >= 30000 ) continue;
	
	vector<int> ans;
	
	for(int j=1;j<=cnt1;j++){
	  ans.push_back( j * 2 );
	}
	
	int x = 3, cnt = 0;
	
	while(1){
	  
	  if( x % 6 != 0 ){
	    ans.push_back( x );
	    cnt++;
	  }
	  
	  x += 3;
	  
	  if( cnt == cnt2 ) break;
	}

	if( flag ) ans.push_back( 30000 );
	  
	for(int j=0;j<n;j++){
	  if(j) cout<<' ';
	  cout<<ans[j];
	}

	cout<<endl;
	  
	assert(check(ans));
	  
	return 0;
      }
      
    }
    
  }
  
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    string S;
    cin >> S;
    int tail = S.length();
    for(int i = 0 ;i < S.length(); i++){
        if(tail <= 0){
            cout << "YES";
            break;
        }else if(6 <= tail && S.substr(max(0,tail-7), 7) == "dreamer"){ 
            tail -= 7;
        }else if(5 <= tail && S.substr(max(0,tail-6), 6) == "eraser"){
            tail -= 6;
        }else if(4 <= tail && S.substr(max(0,tail-5), 5) == "erase" || S.substr(max(0,tail-5), 5) == "dream"){
            tail -= 5;
        }else{
            cout << "NO";
            break;
        }        
    }
}

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

using namespace std;

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

int N;
int dp[110][4][4][4];
int mod = 1e9 + 7;

signed main() {
    cin >> N;
    dp[0][0][0][0] = 1;
    for (int i = 0; i < N + 3; i++) {
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 4; k++) {
                for (int l = 0; l < 4; l++) {
                    (dp[i + 1][k][l][0] += dp[i][j][k][l]) %= mod;
                    (dp[i + 1][k][l][1] += dp[i][j][k][l]) %= mod;
                    if (!(k == 1 && l == 3))(dp[i + 1][k][l][2] += dp[i][j][k][l]) %= mod;
                    if (!(j == 1 && (k == 2 || l == 2) || k == 1 && l == 2 || k == 2 && l == 1))
                        (dp[i + 1][k][l][3] += dp[i][j][k][l]) %= mod;
                }
            }
        }

    }
    cout << dp[N + 3][0][0][0] << endl;

}

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

using namespace std;

int main(){
    long a,b;
    cin >> a >> b;
     long result = 0;

    if( a > b ) result = a+a-1;
    else if( a==b ) result = a+b;
    else result = b+b-1;

    cout << result << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#include <chrono>
#include <random>
#include <math.h>
#include <time.h>
#include <assert.h>
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end() 
#define PII pair <ll,ll>
#define N 100005
#define MOD 1000000007
#define INF 1000000000000000000
using namespace std;

ll dp[(1 << 21) + 10];
vector <int> v[22];
int main()
{
	int n, setbits, mask, A[22][22];
	cin >> n;
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			cin >> A[i][j];
		}
	}
	for (int i = 0; i < (1 << n); ++i)
	{
		setbits = __builtin_popcount(i);
		v[setbits].push_back(i);
	}
	dp[0] = 1;
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 0; j < v[i - 1].size(); ++j)
		{
			mask = v[i - 1][j];
			for (int k = 0; k < n; ++k)
			{
				if(A[i][k] == 0)
					continue;
				if((mask & (1 << k)) == 0)
				{
					dp[(mask | (1 << k))] += dp[mask];
					dp[(mask | (1 << k))] %= MOD;
				}
			}
		}
	}
	cout << dp[(1 << n) - 1];
}


Measured memory_bytes: 26044
# 13
A, B, C = input().split(' ')
count = 0
A = int(A)
B = int(B)
C = int(C)
a = A
b = B
c = C

while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
  N=[]
  N.append(B/2 + C/2)
  N.append(A/2 + C/2)
  N.append(A/2 + B/2)
  A = N[0]
  B = N[1]
  C = N[2]
  count += 1
  if A == a and B == b and C == c:
    print(-1)
    break
else:
  print(count)


Measured memory_bytes: 9124
#include<bits/stdc++.h>
using namespace std;
int h,w;
int dp[81][81][80*80*4+11];
int b[81][81];
int a[81][81];
const int add=640*2;
signed main()
{
	scanf("%d%d",&h,&w);
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
			scanf("%d",&a[i][j]);
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
			scanf("%d",&b[i][j]);
	dp[1][1][add+a[1][1]-b[1][1]]=1;
	dp[1][1][add-a[1][1]+b[1][1]]=1;
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
			if(i!=1||j!=1)
				for(int k=-80*80*2;k<=80*80*2;k++)
				{
if(k+a[i][j]-b[i][j]+add<=80*80*4&&k+a[i][j]-b[i][j]+add>=0)
{
dp[i][j][k+a[i][j]-b[i][j]+add]=max(dp[i][j][k+a[i][j]-b[i][j]+add],dp[i-1][j][k+add]);
dp[i][j][k+a[i][j]-b[i][j]+add]=max(dp[i][j][k+a[i][j]-b[i][j]+add],dp[i][j-1][k+add]);
}
if(k+b[i][j]-a[i][j]+add<=80*80*4&&k+b[i][j]-a[i][j]+add>=0)
{
dp[i][j][k+b[i][j]-a[i][j]+add]=max(dp[i][j][k+b[i][j]-a[i][j]+add],dp[i-1][j][k+add]);
dp[i][j][k+b[i][j]-a[i][j]+add]=max(dp[i][j][k+b[i][j]-a[i][j]+add],dp[i][j-1][k+add]);
}

				}
	for(int k=0;k<=80*80*2;k++)
		if(dp[h][w][add+k]||dp[h][w][add-k])
		{
			printf("%d",k);
			return 0;
		}
	return 0;
}


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

const int P = 200003, K = 20, LIM = 1000;
const long long mod = 998244353ll, R1 = 2ll, R2 = 3ll;

template <class T>
void read(T &x) {
	int sgn = 1;
	char ch;
	x = 0;
	for (ch = getchar(); (ch < '0' || ch > '9') && ch != '-'; ch = getchar()) ;
	if (ch == '-') ch = getchar(), sgn = -1;
	for (; '0' <= ch && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
	x *= sgn;
}
template <class T>
void write(T x) {
	if (x < 0) putchar('-'), write(-x);
	else if (x < 10) putchar(x + '0');
	else write(x / 10), putchar(x % 10 + '0');
}

int n, len = 1;
long long cnt[P], w[K][P << 2], inv[P << 2], ans = 0ll;

long long qpow (long long a, long long b) {
	long long res = 1ll;
	for (; b; b >>= 1, a = a * a % mod) {
		if (b & 1) res =  res * a % mod;
	}
	return res;
}
int bitrev[P << 2];
void ntt_init() {
	while (len < (P << 1)) len <<= 1;
	inv[1] = 1ll;
	for (int i = 2; i <= len; i++) inv[i] = (mod / i) * (mod - inv[mod % i]) % mod;
	for (int i = 0; (1 << i) <= len; i++) {
		w[i][0] = 1ll, w[i][1] = qpow(R2, mod - 1 >> i);
		for (int k = 2; k <= (1 << i); k++) w[i][k] = w[i][k - 1] * w[i][1] % mod;
	}
	bitrev[0] = 0;
	for (int i = 1; i < len; i++) {
		bitrev[i] = bitrev[i >> 1] >> 1;
		if (i & 1) bitrev[i] |= (len >> 1);
	}
}
void ntt (long long *a, int ty) {
	for (int i = 0; i < len; i++) {
		int j = bitrev[i];
		if (j < i) swap(a[i], a[j]);
	}
	for (int i = 1, j = 1; i < len; i <<= 1, j++) {
		for (int k = 0; k < len; k += (i << 1)) {
			for (int l = 0; l < i; l++) {
				long long u = a[k + l], v = a[k + l + i];
				long long rt = w[j][ty > 0 ? l : (i << 1) - l];
				a[k + l] = (u + rt * v) % mod;
				a[k + l + i] = (u + mod * mod - rt * v) % mod;
			}
		}
	}
	if (ty < 0) {
		for (int i = 0; i < len; i++) a[i] = a[i] * inv[len] % mod;
	} 
}

long long vec1[P << 2], vec2[P << 2], vec3[P << 2];
int main () {
	read(n);
	for (int i = 0; i < P; i++) cnt[i] = 0;
	for (int i = 0; i < n; i++) {
		int x;
		read(x);
		ans -= 1ll * x * x % P;
		cnt[x]++;
	}
	ntt_init();
	for (int i = 0; i < len; i++) vec1[i] = vec2[i] = 0;
	for (int i = 0, j = 1; i < P - 1; i++, j = 1ll * j * R1 % P) {
		vec1[i] = cnt[j] / LIM;
		vec2[i] = cnt[j] % LIM;
	}
	
	ntt(vec1, 1), ntt(vec2, 1);
	for (int i = 0; i < len; i++) vec3[i] = 2ll * vec1[i] % mod * vec2[i] % mod;
	for (int i = 0; i < len; i++) vec1[i] = vec1[i] * vec1[i] % mod;
	for (int i = 0; i < len; i++) vec2[i] = vec2[i] * vec2[i] % mod;
	ntt(vec1, -1), ntt(vec2, -1), ntt(vec3, -1);
	
	for (int i = 0, j = 1; i < P - 1; i++, j = 1ll * j * R1 % P) {
		long long res = 0ll;
		res += 1ll * LIM * LIM * (vec1[i] + vec1[i + P - 1]);
		res += 1ll * LIM * (vec3[i] + vec3[i + P - 1]);
		res += vec2[i] + vec2[i + P - 1];
		ans += res * j; 
	}
	ans >>= 1;
	write(ans), putchar('\n'); 
	return 0;
}

Measured memory_bytes: 31812
sx, sy, tx, ty = map(int, input().split())
X = tx - sx
Y = ty - sy

first = 'U'*Y + 'R'*X + 'D'*Y + 'L'*X
second = 'L'+ 'U'*(Y+1) + 'R'*(X+1) + 'DR' + 'D'*(Y+1) + 'L'*(X+1) + 'U' 
print(first+second)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
const int MAXN = 1e5+7;
#define lop(i,a,b) for(register int i = (a); i <= (b); ++i)
#define dlop(i,a,b) for(register int i = (a); i >= (b); --i)
#define read2(a, b) (read(a), read(b))
#define read3(a, b, c)  (read(a), read(b), read(c))
template<class T> void chmax(T &a, T b) {if (a < b) a = b;}
template<class T> void chmin(T &a, T b) {if (a > b) a = b;}
inline void update(int &x, int y) {x += y; if (x >= mod) x -= mod;}

template<class T> void read(T & x) {
  register int c = getchar(), f = 1; x = 0;
  while(!isdigit(c)) (c=='-')&&(f=-f), c = getchar();
  while(isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x * f;
}


int main(void) {
  int a, b;
  cin >> a >> b;
  int ans = a;
  if (b < a) ans--;
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
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; }


int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1LL << 60;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())
#define rSORT(v) std::sort(v.begin(), v.end(),std::greater<int>())


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int temp = n;
    int sum = 0;
    while (temp>0) {
        sum += temp % 10;
        temp /= 10;
    }
    if (n%sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

using namespace std;

int N;
int A[200000];
int B[200000];

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

int main()
{
  cin >> N;
  rep(i, N) {
    cin >> A[i];
    B[i] = A[i];
  }
  sort(B, B+N);
  int a, b;
  b = B[N/2];
  a = B[N/2-1];
  rep(i, N) {
    if (A[i] > a) cout << a << endl;
    else cout << b << endl;
  }
}

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

using namespace std;
typedef long long ll;

// #define DEBUG

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int n, k, x, y;
    cin >> n;
    set<int> workspace;

    for (int i = 0; i < n; i++)
    {
        cin >> k;
        if (k == 0)
        {
            cin >> x;
            workspace.insert(x);
            cout << workspace.size() << "\n";
        }
        else if (k == 1)
        {
            cin >> x;
            auto z = workspace.find(x);
            cout << ((z == workspace.end()) ? 0 : 1) << "\n";
        }
        else if (k == 2)
        {
            cin >> x;
            workspace.erase(x);
        }
        else if (k == 3)
        {
            cin >> x >> y;
            for (auto itr = workspace.lower_bound(x); itr != workspace.upper_bound(y); itr++)
                cout << *itr << "\n";
        }
    }
    return 0;
}

// getline(cin,s);
// a = strtok(s, ",");  ","で分解
// for (int i = 0; i < n; i++)


Measured memory_bytes: 12444
#include<cstdio>
#include<iostream>
#include<ctype.h>
#include<string>
using namespace std;
int main(){
	int A, B;
	cin >> A >> B;
	if(A <= 8 && B <= 8){
		cout << "Yay!" << endl;
	}
	else{
		cout << ":(" << endl;
	}
	return 0;
}


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

using namespace std;

int main()
{
    string s;
    getline(cin, s);

    for(int i = 0; i < s.size(); i++){
        char c = s.at(i);
        if('a' <= c && c <= 'z'){
            c = c - 'a' + 'A';
        }else if('A' <= c && c <= 'Z'){
            c = c - 'A' + 'a';
        }
        s.at(i) = c;
    }

    cout << s << endl;

}


Measured memory_bytes: 3152
#include <iostream>
#include <string>
#include <vector>
#include <stack>

using namespace std;

int main(int argc, char* argv[]) {
  string s;
  cin >> s;

  int N = s.size();

  stack<char> hist;
  for (int i = 0; i < N; ++i) {
    if (hist.empty()) {
      hist.push(s[i]);
      continue;
    }
    if (hist.top() != s[i])
      hist.pop();
    else
      hist.push(s[i]);
  }

  cout << N - hist.size() << endl;

  return 0;

  //string tmp = "";
  //while (true) {
  //  if (s.size() == 0)
  //    break;
  //  vector<int> removed(s.size());
  //  bool change = false;
  //  int n_removed = 0;
  //  //int head = 0;
  //  //int last = s.size() - 1;
  //  //while (head < last) {
  //  //  if (s[head] != s[head + 1]) {
  //  //    removed[head] = 1;
  //  //    removed[head + 1] = 1;
  //  //    head += 2;
  //  //    change = true;
  //  //    n_removed += 2;
  //  //  } else {
  //  //    ++head;
  //  //  }

  //  //  if (head >= last)
  //  //    break;

  //  //  if (s[last] != s[last - 1]) {
  //  //    removed[last] = 1;
  //  //    removed[last - 1] = 1;
  //  //    last -= 2;
  //  //    change = true;
  //  //    n_removed += 2;
  //  //  } else {
  //  //    --last;
  //  //  }
  //  //}
  //  int last_not_changed = -1;
  //  stack<int> lasts;
  //  for (int i = 0; i < s.size() - 1; ++i) {
  //    if (last_not_changed != -1 && s[last_not_changed] != s[i]) {
  //      removed[last_not_changed] = 1;
  //      removed[i] = 1;
  //      change = true;
  //      n_removed += 2;
  //      last_not_changed = -1;
  //      continue;
  //    }
  //    if (s[i] != s[i + 1]) {
  //      removed[i] = 1;
  //      removed[i + 1] = 1;
  //      change = true;
  //      n_removed += 2;
  //      ++i;
  //    } else {
  //      last_not_changed = i;
  //    }
  //  }
  //  if (!change)
  //    break;
  //  tmp.resize(s.size() - n_removed);
  //  int j = 0;
  //  for (int i = 0; i < s.size(); ++i) {
  //    if (removed[i] == 0)
  //      tmp[j++] = s[i];
  //  }
  //  s = tmp;
  //}

  cout << N - s.size() << endl;

  return 0;
}

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

int N, M;
pair<int,int> PD[10010];
int main() {
  while (cin >> N >> M && N) {
    int d, p;
    for (int i=0; i<N; ++i) {
      cin >> d >> p;
      PD[i] = make_pair(p, d); // first is danger, second is length
    }

    sort(PD, PD+N);
    reverse(PD, PD+N); // PD in descending order
    // for (int i=0; i<N; ++i) cout << PD[i].first << endl;

    int S = 0;
    for (int i=0; i<N; ++i)
      S += PD[i].first * PD[i].second;

    // Show when money runs out; which then S is the answer
    for (int i=0; i<N; ++i) {
      if (M <= 0) break;
      int guarded = min(M, PD[i].second); // interval protected by guard
      S -= PD[i].first * guarded;
      M -= guarded;
  }
    cout << S << endl;
  }
}
    

Measured memory_bytes: 1240
#include <stdio.h>
 
int n ,k, i, c, p;
int main() {
  scanf("%d%d\n", &n, &k); k = n + 2 * k;
  while(i++ < n) if((c = getchar_unlocked()) != p) k-- , p = c;
  printf("%d\n", k < n ? k : n - 1);
  return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    ll ans = 0;
    rep(i,N){
        if(i!=N-1){
            ans+=A[i]/2;
            if(A[i+1]!=0&&A[i]%2==1){
                A[i+1]-=1;
                ans++;
            }
        }else{
            ans += A[i]/2;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
using namespace std;
int A[3];
int main()
{
	int tot=0;
	scanf("%d%d%d",&A[0],&A[1],&A[2]);
	while(A[0]!=A[1]||A[1]!=A[2]) {
		sort(A,A+3);
		tot++;
		if(A[1]-A[0]>=2)
			A[0]+=2;
		else
			A[1]+=1,A[0]+=1;
	}
	printf("%d",tot);
}

Measured memory_bytes: 128
"""考え方
上下左右のいずれか隣接するマスが黒である必要がある。
つまり黒マスが1つだけポツンと存在した場合はNGとなる。

横チェック、縦チェック、の2つに分断して確認を行う。
"""

H,W = map(int,input().split())

list_matu = []

for h in range(H):
  list_matu.append(list(input()))


## 横チェック
ng_matu=[]
for h in range(H): ## 全レコードが対象
  for w in range(1,W-1): ## 列ごとに実施
    target = list_matu[h][w]
    target_left = list_matu[h][w-1]
    target_right = list_matu[h][w+1]
    
    if target=='#':
      if (target_left != '#') and (target_right != '#'):
        ng_matu.append([h,w])


## 縦チェック
for w in range(W):
  for h in range(1,H-1):
    target = list_matu[h][w]
    target_over = list_matu[h+1][w]
    target_under = list_matu[h-1][w]
    
    if target=='#':
      if (target_over != '#') and (target_under != '#'):
        if [h,w] in ng_matu:
          print('No')
          exit()


print('Yes')


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt(),m=sc.nextInt();
		int[] a = new int[n+1];
		for(int i=0;i<m;i++)a[sc.nextInt()-1]++;
		long sum=0,n1=2,n2=1;
		if(a[0]!=0) {
			n2=0;
			n1=1;
		}
		if(a[1]!=0)n1=0;
		for(int i=3;i<=n;i++) {
			if(a[i-1]!=0)sum=0;
			else sum=(n1+n2)%1000000007;
			n2=n1;
			n1=sum;
		}
		if(n==2)sum=n1;
		if(n==1)sum=n2;
		if(sum<0)sum=0;
		System.out.print(sum);

	}
}



Measured memory_bytes: 50332
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define IO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define rep(i,m,n) for(int i=m ; i<n ; i++)
#define endl '\n'
#define pb push_back
const int N = 2e5 + 5;
using namespace std;
int main()
{
    IO;
    ll n,k,a[N];
    cin>>n>>k;
    rep(i,0,n) cin>>a[i];
    sort(a,a+n,greater<int>());
    ll cnt=0;
    rep(i,0,n){
    if(k>0){
        k--;
        continue;
    }
    cnt+=a[i];
    }


    cout<<cnt;

}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll mod=1e9+7;

int main() {
  ll n,k,fl,fr;
  cin >> n >> k >> fl >> fr;
  vector<ll> a(n);
  for(ll i=0;i<n;i++) {
    cin >> a[i];
  }
  ll n1=n/2;
  ll n2=n-n1;
  vector<vector<ll>> a1(n1+1),a2(n2+1);
  for(ll i=0;i<(1<<n1);i++) {
    bitset<20> bit(i);
    ll res=0;
    for(ll j=0;j<n1;j++) {
      if(bit.test(j)) {
        res+=a[j];
      }
    }
    a1[bit.count()].push_back(res);
  }
  for(ll i=0;i<(1<<n2);i++) {
    bitset<20> bit(i);
    ll res=0;
    for(ll j=0;j<n2;j++) {
      if(bit.test(j)) {
        res+=a[n1+j];
      }
    }
    a2[bit.count()].push_back(res);
  }
  for(ll i=0;i<=n1;i++) {
    sort(a1[i].begin(),a1[i].end());
  }
  for(ll i=0;i<=n2;i++) {
    sort(a2[i].begin(),a2[i].end());
  }
  ll ans=0;
  for(ll i=0;i<=min(k,n1);i++) {
    if(k-i>n2) continue;
    for(ll j=0;j<a1[i].size();j++) {
      ll l=-1,r=a2[k-i].size();
      ll temp=(l+r)/2;
      while(l+1<r) {
        if(a1[i][j]+a2[k-i][temp]<fl) {
          l=temp;
        }
        else {
          r=temp;
        }
        temp=(l+r)/2;
      }
      ll res=r;
      l=-1;
      r=a2[k-i].size();
      temp=(l+r)/2;
      while(l+1<r) {
        if(a1[i][j]+a2[k-i][temp]>fr) {
          r=temp;
        }
        else {
          l=temp;
        }
        temp=(l+r)/2;
      }
      res=l-res+1;
      if(res>0) {
        ans+=res;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 23368
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)

N = int(input())
T = [int(input()) for _ in range(N)]
lcm = 1
for t in T:
    lcm = lcm * t // gcd(lcm, t)
print(lcm)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define mod 1000000007
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
bool vis[200005];
vector<int> vec[2000005], v1;
int child[2000005];
int parent[2000005];
int div1[100005];
int min_indx[200005];
int count1 = 0;
int height = 0;
int max_indx[200005];
void dfs(int node)
{

    vis[node] = 1;

    min_indx[count1] = node;
    max_indx[node] = min(max_indx[node], count1);
    count1++;

    //  count1++;
    child[node] = height++;
    for (int i = 0; i < vec[node].size(); i++)
    {
        if (!vis[vec[node][i]])
        {
            dfs(vec[node][i]);
            min_indx[count1] = node;
            max_indx[node] = min(max_indx[node], count1);
            count1++;
        }
    }
    height--;
}
int MAXN = 200005;
int LOGMAXN = (int)log2(200005) + 1;
int M[200005][60];
int ans[200005];
void fun(int a, int b, int c)
{
    //ll val = 1;

    while (a <= b)
    {
        ans[a] += c;
        int p = -a;
        a += (a & p);
    }
}
int find1(int a)
{
    int sum = 0;
    while (a != 0)
    {
        sum += ans[a];
        int p = -a;
        a -= (a & p);
    }
    return sum;
}
void process2(int A[], int N)
{
    int i, j;

    for (i = 0; i < N; i++)
        M[i][0] = i;
    for (j = 1; 1 << j <= N; j++)
        for (i = 0; i + (1 << j) - 1 < N; i++)
            if (find1(M[i][j - 1]) < find1(M[i + (1 << (j - 1))][j - 1]))
                M[i][j] = M[i][j - 1];
            else
                M[i][j] = M[i + (1 << (j - 1))][j - 1];
}
int arr1[1000005], arr2[1000005];
int32_t main()
{
    FAST;
    int n;
    cin >> n;
    if (n % 2 == 0)
    {
        cout << n << " " << n << " " << n / 2 << "\n";
    }
    else
    {
        bool flag = 0;
        int i, j;
        for (i = 1; i < 3501; i++)
        {
            for (j = 1; j < 3501; j++)
            {
                int p = n * i * j;
                int p1 = 4 * i * j - n * i - j * n;
                if (p1 > 0 && p % p1 == 0)
                {
                    flag = 1;
                    int ans = p / p1;
                    cout << i << " " << j << " " << ans << "\n";
                    return 0;
                }
            }
        }
        //  cout << i << " " << j << " " << ans << "\n";
    }

    return 0;
}

Measured memory_bytes: 50548
def factorize(n):
    ans = 0 
    b, e = 2, 0  
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            ans += int((-1 + (1+8*e)**(1/2))/2)
        b, e = b + 1, 0
    if n > 1:
        ans += 1
    return ans

N = int(input())
print(factorize(N))

Measured memory_bytes: 9452
/**
 *   created: 25 January 2019  00:27:23
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) (c).begin,(c).end()
#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007

void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================
vector<int> dp(100000,-1),v(100000);
int n,k;
int frog(int cs)
{
	if(cs<=0)
		return 0;
	if(dp[cs]!=-1)
		return dp[cs];
	int mini=INF,temp;
	int ls=max(cs-k,0);
	for(int i=cs-1;i>=ls;i--){
		temp = frog(i) + abs(v[i]-v[cs]);
		if(temp<mini)
			mini = temp;
	}
	return dp[cs]=mini;
}
int main()
{
	optimizeIO();
	cin>>n>>k;
	// v.resize(n);
	// dp.resize(n);
	F(i,0,n-1)
		cin>>v[i];
	cout<<frog(n-1);
	return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const int INF = 1e9;

signed main(){
  lint N, M; cin >> N >> M;
  vector<lint> a(N);
  for(int i = 0; i < N; i++) cin >> a[i];
  map<lint, lint> MAP;
  lint num = 0;
  MAP[0]++;
  for(int i = 0; i < N; i++){
    num += a[i]; num %= M;
    MAP[num]++;
  }
  lint ans = 0;
  for(auto value : MAP) ans += value.second * (value.second - 1) / 2;
  cout << ans << endl;
}

Measured memory_bytes: 4992
#include<stdio.h>
#include<string.h>

int main()
{
    int a,b,c;
    int i,f;
    char s[15];
    while(scanf("%d%d",&a,&b)!=-1)
    {
        f=1;
        scanf("%s",s);
        c=strlen(s);
        if(s[a]!='-') printf("No\n");
        else
        {
            for(i=0;i<a;i++) if(s[i]=='-') f=0;
            for(i=a+1;i<=c+1;i++) if(s[i]=='-') f=0;
            if(f==0) printf("No\n");
            else printf("Yes\n");
        }

    }
}


Measured memory_bytes: 128
/**
 *    author: kalyan       
**/
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
using namespace std;
 
void solve(){
    ll n;
    cin >> n;
    ll cnt=0;
    for(ll i=1; i<n; ++i){
        for(ll j=1; i*j < n ;++j){
            cnt++;
        }
    }
    cout << cnt;
    
}
 
int main(){
    fastio;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int t;
    t = 1;
    // cin >> t;
    while(t--){
    	solve();
    }
    return 0;
}

Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {

		 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		 try{

			 int x = Integer.parseInt(br.readLine());

			 System.out.printf("%d\n", x*x*x);

		 }catch(IOException e){
			 e.printStackTrace();
		 }
	}
}


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

int main(){
  int a,b;
  cin >> a >> b;
  int ans;
  if(a > b){
    ans = a-1;
  }
  else{
    ans = a;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
<?php
    fscanf(STDIN, "%d", $total);
    $input = trim(fgets(STDIN));
    $numbers = explode(" ", $input);
    $groups = array_count_values($numbers);
    ksort($groups);
    $neighbors = array();
    foreach ($groups as $key => $value) {
        $count = $value;
        if (array_key_exists($key-1, $groups)) {
            $count += $groups[$key-1];
            }
        if (array_key_exists($key+1, $groups)) {
            $count += $groups[$key+1];
            }
        $neighbors[$key] = $count;
    }
    echo max($neighbors). "\n";
?>


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

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

  int N = S.size() + 1;
  vector<long long> more(N), less(N);
  if (S[N - 2] == '>') {
    more[N - 2] = 1;
  }
  if (S[0] == '<') {
    less[1] = 1;
  }
  for (int i = N - 3; i >= 0; --i) {
    if (S[i] == '>') {
      more[i] = more[i + 1] + 1;
    } else {
      more[i] = 0;
    }
  }
  for (int i = 1; i < N - 1; ++i) {
    if (S[i] == '<') {
      less[i + 1] = less[i] + 1;
    } else {
      less[i + 1] = 0;
    }
  }

  long long ans = 0;
  for (int i = 0; i < N; ++i) {
    ans += max(more[i], less[i]);
  }

  cout << ans << endl;
}


Measured memory_bytes: 8708
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<fstream>
using namespace std;
    
#define NUM 10000
queue<int> s[NUM];

int main(){

    int n, q, order, t;
    cin >> n >> q;
    for(int i=0;i<q;i++){
        cin >> order >> t;
        switch (order)
        {
        case 0:
            int num;
            cin >> num;
            s[t].push(num);
            break;
        case 1:
            if(!(s[t].empty())) cout << s[t].front() << endl;
            break;
        case 2:
            if(!(s[t].empty()))s[t].pop();
            break;
        default:
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 10456
#include <stdio.h>

#define MAX_LEN 100

int main(void)
{
    int count,i,j;
    char s[MAX_LEN];
    int chg_cnt;
    
    chg_cnt=0;
    scanf("%s", s);
    for(count=0;  s[count]!='\0'; count++);

    for(i=0; i<count/2; i++){
        if(s[i] != s[count-1-i]){
            chg_cnt++;
        }
    }
    printf("%d\n",chg_cnt);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
double x[100005],y[100005];
double dx[100005],dy[100005];
int n;
double check(double a){
	double mnx=1e18,mxx=-1e18,mny=1e18,mxy=-1e18;
	for(int i=0;i<n;i++){
		double xx=x[i]+a*dx[i];
		double yy=y[i]+a*dy[i];
		mnx=min(mnx,xx);
		mxx=max(mxx,xx);
		mny=min(mny,yy);
		mxy=max(mxy,yy);
	}
	return (mxx-mnx)*(mxy-mny);
}
int main(){
	
	cin>>n;
	char s;
	memset(dx,0,sizeof(dx));
	memset(dy,0,sizeof(dy));
	for(int i=0;i<n;i++){
		cin>>x[i]>>y[i]>>s;
		if(s=='D')
			dy[i]=-1;
		if(s=='U')
			dy[i]=1;
		if(s=='R')
			dx[i]=1;
		if(s=='L')
			dx[i]=-1;
	}
	double l=0,r=1e9;
	double ans=1e18;
	for(int i=0;i<200;i++){
		double ll=(l*2+r)/3;
		double rr=(r*2+l)/3;
		double lll=check(ll),rrr=check(rr);
		ans=min(ans,lll);
		ans=min(ans,rrr);
		if(lll<rrr)
			r=rr;
		else l=ll;
	}
	printf("%lf\n",ans);
}


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

int main() {
  int W, H, N;
  cin >> W >> H >> N;

  int w=0, h=0;
  for (int i=0; i<N; i++) {
    int x, y, a;
    cin >> x >> y >> a;

    if (a == 1) {
      if (w < x) w = x;
    } else if (a == 2) {
      if (W > x) W = x;
    } else if (a == 3) {
      if (h < y) h = y;
    } else {
      if (H > y) H = y;
    }
  }
  if (W < w) {
    W = 0; w = 0;
  }
  if (H < h) {
    H = 0; h = 0;
  }

  // cout << w << " " << W << endl;
  // cout << h << " " << H << endl;
  cout << (W - w) * (H - h) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a<b){ 
    if(b<c){
        cout<<"Yes"<<endl; 
    }else{
        cout<<"No"<<endl;
    }    
  }else{
      cout<<"No"<<endl;
  }
   return 0;
}


Measured memory_bytes: 3052
n,a,b = map(int,input().split())
    
def calc(n, a, m):
    x = 1
    y = 1
    for i in range(a):
        x = (x*(n-i))%m
        y = (y*(i+1))%m
    return (x*pow(y, m-2, m))%m

m = 10**9+7
x = pow(2,n,m)-1
print((x-calc(n,a,m)-calc(n,b,m))%m)

Measured memory_bytes: 3064