akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

const ll INF = 1001001001001001;

int main(){
	int a, b, q;
	cin >> a >> b >> q;
	vector<ll> s(a);
	rep(snip_i, a) cin >> s.at(snip_i);
	vector<ll> t(b);
	rep(snip_i, b) cin >> t.at(snip_i);
	rep(i, q){
		ll x;
		cin >> x;
		ll sr, sl, tr, tl;
		auto itsl = lower_bound(s.begin(), s.end(), x);
		if(itsl == s.end()) sr = INF;
		else sr = *itsl;
		if(itsl == s.begin()) sl = 0;
		else{
			itsl--;
			sl = *itsl;
		}
		auto ittl = lower_bound(t.begin(), t.end(), x);
		if(ittl == t.end()) tr = INF;
		else tr = *ittl;
		if(ittl == t.begin()) tl = 0;
		else{
			ittl--;
			tl = *ittl;
		}
		ll ans = INF;
		if(sr != INF && tr != INF){
			ans = max(sr, tr) - x;
		}
		if(sl != 0 && tl != 0){
			ans = min(ans, x - min(sl, tl));
		}
		if(sl != 0 && tr != INF){
			ll add, sd = fabs(sl - x), td = fabs(tr - x);
			if(sd < td) add = sd*2 + td;
			else add = sd + td*2;
			ans = min(ans, add);
		}
		if(tl != 0 && sr != INF){
			ll add, td = fabs(tl - x), sd = fabs(sr - x);
			if(sd < td) add = sd*2 + td;
			else add = sd + td*2;
			ans = min(ans, add);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 2944
#include <cstdio>

int c[12][12],g[12][12];
int u[1200000],v[1200000],w[1200000];
int i,j,k,m,n,x,y,z;
bool b;

int main()
{
	scanf("%d%d",&n,&m);
	for (i=1;i<=n;i++)
		for (j=1;j<=m;j++)
			scanf("%d",&g[i][j]);
	for (x=0;x<=100;x++)
		for (y=0;y<=100;y++)
			for (z=0;z<=100;z++)
			{
				b=false;
				for (i=1;i<=n;i++)
					for (j=1;j<=m;j++)
						if (x*i+y*j+z<g[i][j])
							b=true;
				if (b)
					continue;
				b=false;
				for (i=1;i<=n;i++)
					for (j=1;j<=m;j++)
						if (x*i+y*j+z==g[i][j])
							b=true,c[i][j]=1;
				if (! b)
					continue;
				k++,u[k]=x,v[k]=y,w[k]=z;
			}
	for (i=1;i<=n;i++)
		for (j=1;j<=m;j++)
			if (! c[i][j])
			{
				puts("Impossible");
				return 0;
			}
	puts("Possible");
	printf("%d %d\n",202,k+200);
	for (i=1;i<=100;i++)
		printf("%d %d X\n",i,i+1);
	for (i=102;i<=201;i++)
		printf("%d %d Y\n",i,i+1);
	for (i=1;i<=k;i++)
		printf("%d %d %d\n",1+u[i],202-v[i],w[i]);
	printf("%d %d\n",1,202);
	return 0;
}

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main(){
    long long int N, A, B;
    cin >> N >> A >> B;
    long long int mm = 0;
    if(N-(A+B) >= 0){
        mm = 0;
    }else{
        mm = max(A,B) - (N - min(A,B));
    }
    cout << min(A,B) <<" "<< mm << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;


int main(){
	
	int N,Q,M,Date[101],i,l,k;
	
	while(0<=scanf("%d%d",&N,&Q)){
		for(i=0;i<101;i++){
			Date[i]=0;
		}
		
		if((N==0) && (Q==0)){
			break;
		}
		
		for(k=0;k<N;k++){
			scanf("%d",&M);
			if(M==0){
				continue;
			}else{
				for(i=0;i<M;i++){
					scanf("%d",&l);
					++Date[l];
				}
			}
		}
		l=0;
		i=0;
		for(k=0;k<100;k++){
			if(i<Date[k] && Date[k]>=Q){
				i=Date[k];
				l=k;
			}
		}
		
		printf("%d\n",l);
	}
	
	return 0;
}

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

using namespace std;

using ll = long long;

ll Solve() {
    ll l;
    cin >> l;

    vector<ll> a(l + 1);
    for (int i = 1; i <= l; ++i) cin >> a[i];

    constexpr int N = 5;
    vector<vector<ll>> dp(l + 1, vector<ll>(N, 1e11));
    dp[0][0] = 0;

    for (int i = 1; i <= l; ++i) {
        for (int j = 0; j < N; ++j) {
            for (int k = 0; k <= j; ++k) dp[i][j] = min(dp[i][j], dp[i - 1][k]);
            if (j == 0 || j == 4) dp[i][j] += a[i];
            else if (j == 1 || j == 3) dp[i][j] += (a[i] == 0 ? 2 : (a[i] % 2 == 1));
            else if (j == 2) dp[i][j] += (a[i] == 0 ? 1 : (a[i] % 2 == 0));
        }
    }

    return *min_element(dp[l].begin(), dp[l].end());
}

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

    cout << Solve() << endl;

    return 0;
}


Measured memory_bytes: 15872
n = int(input())
a = list(map(int, input().split()))
b = [0] * n

for i in range(n, 0, -1):
  f = 0
  for j in range(i, n + 1, i):
    f = f ^ b[j-1]
  b[i-1] = a[i-1] ^ f

print(sum(b))
if sum(b) > 0:
  for i in range(n):
    if b[i] == 1:
      print(i+1, end=" ")


Measured memory_bytes: 7276
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	for sc.Scan() {
		input := nextInt()
		fmt.Println(IsPrime(input))
	}
}

func IsPrime(num int) int {
	eratos := make([]bool, num+1)
	c := 0
	for i := 2; i < len(eratos); i++ {
		if eratos[i] == false {
			c++
			eratosCalc(i, eratos)
		}
	}
	return c
}

func eratosCalc(primeNum int, eratos []bool) {
	for i := primeNum * primeNum; i < len(eratos); i += primeNum {
		eratos[i] = true
	}
}

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}



Measured memory_bytes: 7152
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include <iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define EVEL 1
 
#ifndef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {X=X;}
#define TF(f) {f=f;}
#define END {}
#endif
const int MOD = 1000000007;
const int INF = 1000000;
#define NMAX 50
#define MAX 10
 
    int N,A,B;
    priority_queue<ll> v;
    vector<ll> mo;
    ll temp=0,id=0,mem,yui=1,sum=0;
    long double ans,av=0;
    int TR[1000]={0},bf;
    ll C[200][200];
    bool fir=true;
 
void Conb(int N){
    for(int i=0;i<=N;i++){
        for(int j=0;j<=i;j++){
            if(j==0||j==i)C[i][j]=1;
            else{
                C[i][j]=C[i-1][j-1]+C[i-1][j];
            }
        }
    }
}
 
 
 
int main(){
    ios_base::sync_with_stdio(false);
    cin>>N>>A>>B;
    REP(i,N){
        cin>>temp;
        v.push(temp);
        mo.push_back(temp);
    }
    sort(mo.begin(),mo.end(),greater<ll>());
        ll bu=0;
        for(int j=A;j>0;j--){
            bu+=v.top();
            v.pop();
        }
         av=(double)bu/(double)A;
 
        int count=0;
        int lo=0;
        Conb(N);
        yui=0;
        REP(i,N){
            if(mo[i]==mo[A-1]){
                count++;
                if(i<=A-1)lo++;
            }
DEB(count)DEB(lo)DEB(mo[i])DEB(mo[A-1])END
        }
        if(mo[0]==mo[A-1]){
                FOR(i,A,B+1){
                yui+=C[count][i];
                }
        }else{
            yui=C[count][lo];
        }
 
    cout<<fixed<<av<<setprecision(10)<<endl<<yui<<endl;
}
//ABC057 Maximum Average Sets

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

#define INF 1<<20
#define MAX_V 10

bool done[MAX_V];
int d[MAX_V];
int V;
int cost[MAX_V+1][MAX_V+1];

int dijkstra(int s) {
  int total = 0;
  
  fill(done, done+V, false);
  fill(d, d+V, INF);
  
  d[s] = 0;

  while(1) {
    int v = -1;
    for(int u = 0; u < V; u++) {
      if(!done[u] && ( v == -1 || d[u]<d[v] )) {
	v = u;
      }
    }
    if(v == -1) break;

    done[v] = true;

    for(int u = 0; u < V; u++) {
      d[u] = min(d[u], d[v] + cost[v][u]);
    }
  }

  for(int i=0; i<V; i++) {
    total += d[i];
  }
  
  return total;
}

int main() {
  
  int m;

  while(cin >> m, m) {
    int a, b, c;
    V = 0;
    fill(cost[0], cost[MAX_V], INF);
    
    for(int i=0; i<m; i++) {
      cin >> a >> b >> c;
      cost[a][b] = cost[b][a] = c;
      V = max(V, max(a, b));
    }
    V++;
    //    cout << V << endl << endl;
    
    int res = INF, num;
    for(int i=0; i<V; i++) {
      int temp = res;
      res = min(dijkstra(i), res);

      if(temp>res) {
	num = i;
      }
    }
    
    cout << num << " " << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ii=pair<ll,ll>;
using vi=vector<ll>;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (ll)1e18
#define all(x) (x).begin(),(x).end()
#define print(a); for(auto x:a)cout<<x<<" "; cout<<"\n";
#define mset(a); memset(a,0,sizeof(a));

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
    ll a,b,c,d,t;cin>>a>>b>>c>>d>>t;
    ll len=abs(a-c);
    ll s=abs(b-d);
    if(t*s<len||(b<d)&&a!=c)cout<<"NO\n";
    else cout<<"YES\n";
}


Measured memory_bytes: 3648
import java.util.Scanner;
public class Main {

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

		if(A<=8 && B<=8) {
			System.out.println("Yay!");
		}else {
			System.out.println(":(");
		}

	}

}


Measured memory_bytes: 23764
const M: isize = 1000000007;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let n: usize = buf.trim().parse().unwrap();

    // dp[100][4][4][4]
    let mut dp = vec![vec![vec![vec![0; 4]; 4]; 4]; n+1];

    // TTT
    dp[0][3][3][3] = 1;

    for cnt in 0..n {
        for i in 0..4 {
            for j in 0..4 {
                for k in 0..4 {
                    for c in 0..4 {
                        // A->0, C->1, G->2, T->3
                        // ?AGC
                        // ?ACG
                        // ?GAC
                        // A?GC
                        // AG?C
                        match (i, j, k, c) {
                            (_, 0, 2, 1) |
                            (_, 0, 1, 2) |
                            (_, 2, 0, 1) |
                            (0, _, 2, 1) |
                            (0, 2, _, 1) => {
                                continue;
                            },
                            _ => {
                                dp[cnt+1][j][k][c] += dp[cnt][i][j][k];
                                dp[cnt+1][j][k][c] %= M;
                            }
                        }
                    }
                }
            }
        }
    }

    let mut ans=0;
    for i in 0..4 {
        for j in 0..4 {
            for k in 0..4 {
                ans += dp[n][i][j][k];
                ans %= M;
            }
        }
    }
    println!("{}", ans);
}


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

int main () {

  int n, m; cin >> n >> m;
  
  int a[1005];
  int count = 0;
  double ans =0; //double 必要
  for (int i=0; i<n; i++) {
    cin >> a[i];
    ans += a[i];
  }
  double sum = ans/(4*m);//double 必要
  
  for (int i=0; i<n; i++) {
    if (a[i] >=sum) count++;
  }
    if (count >= m) cout << "Yes" << endl;
    else cout << "No" << endl;
  
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;


/*
予め集合Sを１グループにしたときの得点を求めておく。
*/

ll n,a[20][20],dp[100010],dp2[100010],visited[100010]={};

ll f(ll s){
	if(visited[s]==1)return dp2[s];
	ll ans=0;
	vector<int> v;//bitが立ってる場所
	rep(i,n)if(s>>i & 1)v.push_back(i);
	rep(i,1<<v.size()){//sの全ての部分集合を求める
		ll t=0;
		rep(j,v.size()){
			if(i>>j & 1)t+=(1<<v[j]);
		}
		if(t==0)continue;
		ans=max(ans,dp[t]+f(s & ~t));
	}
	visited[s]=1;
	// cout<<s<<"="<<ans<<endl;
	return dp2[s]=ans;
}

int main(void){
	cin>>n;
	rep(i,n)rep(j,n)cin>>a[i][j];
	//予め集合Sを１グループにしたときの得点を求めておく。
	rep(s,1<<n){
		ll sum=0;
		rep(j,n)rep(k,j){
			if((s>>j & 1) && (s>>k & 1))sum+=a[j][k];
		}
		dp[s]=sum;
		// cout<<s<<":"<<dp[s]<<endl;
	}
	//
	cout<<f((1<<n)-1)<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#define MOD 1000000007
typedef long long ll;
ll a[300000];
int main() {
	int n;
	ll sum = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < 60; i++) {
		int c0 = 0, c1 = 0;
		for (int j = n - 1; j >= 0; j--) {
			if ((a[j] >> i) & 1) {
				sum += (1LL << i) % MOD * c0 % MOD;
				c1++;
			} else {
				sum += (1LL << i) % MOD * c1 % MOD;
				c0++;
			}
			sum %= MOD;
		}
	}
	printf("%lld\n", sum);
	return 0;
}

Measured memory_bytes: 4056
#include<bits/stdc++.h>
int dmin(int a, int b){
    return (-(a < b) & a) + (-(a >= b) & b);
}
int main(){
    int V, E;
    scanf("%d%d", &V, &E);
    int *d = (int *)malloc(sizeof(int)*V*V);
    for(int i=0; i<V*V; i++) d[i] = (int)1e7;
    for(int i=0; i<E; i++){
        int s, t, x;
        scanf("%d%d%d", &s, &t, &x);
        d[s*V+t] = x;
    }
    int *dp = (int *)malloc(sizeof(int)*V*(1<<V));
    for(int i=0; i<(1<<V); i++)
        for(int j=0; j<V; j++)
            dp[i*V+j] = 1e7;
    
    int *state = (int *)malloc(sizeof(int)*(1<<(V))*(V+1));
    int *num = (int *)malloc(sizeof(int)*(V+1));
    for(int i=0; i<(1<<V); i++){
        int c = 0;
        for(int j=1; j<(1<<V); j<<=1){
            if(i&j) c++;
        }
        state[num[c]*V+c] = i;
        num[c]++;
    }
    for(int i=0; i<=V; i++){
        for(int j=0; j<num[i]; j++){
            for(int k=0; k<V; k++){
                if(state[j*V+i] == 0 && k == 0) dp[0] = 0;
                if(!((state[j*V+i]>>k)&1)) continue;
                for(int l=0; l<V; l++){
                    dp[state[j*V+i]*V+k] = dmin(dp[state[j*V+i]*V+k], dp[(state[j*V+i]^(1<<k))*V+l]+d[l*V+k]);
                }
            }
        }
    }

    int ans = dmin((int)1e7, dp[((1<<V)-1)*V+0]);
    if(ans == 1e7) ans = -1;
    printf("%d\n", ans);
}


Measured memory_bytes: 5440
import sys
from bisect import bisect_left

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B, Q = map(int, readline().split())
    S = [-INF]
    S.extend(int(readline()) for _ in range(A))
    S.append(INF)
    T = [-INF]
    T.extend(int(readline()) for _ in range(B))
    T.append(INF)
    X = [int(readline()) for _ in range(Q)]

    ans = [INF] * Q
    for i, x in enumerate(X):
        i1 = bisect_left(S, x)
        i2 = bisect_left(T, x)

        ans[i] = min(
            abs(x - S[i1 - 1]) + abs(S[i1 - 1] - T[i2 - 1]),
            abs(x - T[i2 - 1]) + abs(T[i2 - 1] - S[i1 - 1]),
            abs(x - S[i1 - 1]) + abs(S[i1 - 1] - T[i2]),
            abs(x - T[i2 - 1]) + abs(T[i2 - 1] - S[i1]),
            abs(x - S[i1]) + abs(S[i1] - T[i2]),
            abs(x - T[i2]) + abs(T[i2] - S[i1]),
            abs(x - S[i1]) + abs(S[i1] - T[i2 - 1]),
            abs(x - T[i2]) + abs(T[i2] - S[i1 - 1]),
        )

    print('\n'.join(map(str, ans)))

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 34360
n, m = map(int, input().split())
a = [0] * n
ans_1 = 0
ans_2 = 0
for i in range(m):
    p, s = map(str, input().split())
    if a[int(p) - 1] >= 0:
        if s == "WA":
            a[int(p) - 1] += 1
            ans_2 += 1
        else:
            a[int(p) - 1] = -1
            ans_1 += 1
for i in range(n):
    if a[i] > 0:
        ans_2 -= a[i]
print(ans_1, ans_2)

Measured memory_bytes: 3828
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define sp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
 
}



void solve()
{
	int n;
	cin >> n;
	ll t[n];
	ll g = 1;
	rep(i, n){
		cin >> t[i];
		g = t[i] / __gcd(g, t[i]) * g;
	}
	cout << g;
}

 
int main()
{
	// freopen("crosses.in", "r", stdin);
	// freopen("crosses.out", "w", stdout);
    Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

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

int main() {
	long long int m,i,j,k,n,sum=0,flag=0;
	string s,t,temp;
	cin>>s;
	for(i=0;i<s.size();i++)
	{
	    cout<<'x';
	}
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PI 3.141592653589
#define ll long long
using namespace std;

int main(){
  int n, y;
  cin >> n >> y;
  int res1 = -1, res2 = -1, res3= -1;
  for(int i=0; i<=n; ++i){
    for(int j=0; j+i<=n; ++j){
     int k = n - i - j;
     int total = 10000*i + 5000*j + 1000*k;
     if(total == y){
       res1 = i;
       res2 = j;
       res3 = k;
     }
    }
  }
  cout << res1 << " " << res2 << " " << res3;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int d, t, s;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> d >> t >> s;
	cout << (t * s >= d ? "Yes\n" : "No\n");
	return 0;
}

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

int main () {
  int H, W;
  cin >> H >> W;
  char arr[H][W];
  for (int i = 0; i < H; i ++){
    for (int j = 0; j < W; j ++){
      cin >> arr[i][j];
    }
  }
  for (int i = 0; i < H; i ++){
    for (int j = 0; j < W; j ++){
      cout << arr[i][j];
    }
    cout << '\n';
    for (int j = 0; j < W; j ++){
      cout << arr[i][j];
    }
    cout << '\n';
  }
}

Measured memory_bytes: 3024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

/*ソートの時に使う
int sort(const void *a, const void *b){
    return *(int*)a-*(int*)b ;
}
    qsort (data,sizeof(data),sizeof(int),sort); 
*/

int main(void){
    bool color[8];
    int n,over=0,ans=0;
    scanf("%d",&n);
    int a[n];
    for (int i=0; i<8; i++){
        color[i]=false;
    }
    for (int i=0; i<n; i++){
        scanf("%d",&a[i]);
        if (a[i]<400){
            color[0]=true;
        } else if (a[i]<800){
            color[1]=true;
        } else if (a[i]<1200){
            color[2]=true;
        } else if (a[i]<1600){
            color[3]=true;
        } else if (a[i]<2000){
            color[4]=true;
        } else if (a[i]<2400){
            color[5]=true;
        } else if (a[i]<2800){
            color[6]=true;
        } else if (a[i]<3200){
            color[7]=true;
        } else {
            over++;
        }
    }
    for (int i=0; i<8; i++){
        if (color[i]==true){
            ans++;
        }
    }
    if (ans==0){
        printf("%d %d\n",1,over);
    } else {
        printf("%d %d\n",ans,ans+over);
    }
	return 0 ;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const long MOD = 1000000007;
int main(){
  int n;
  cin >> n;
  vector<vector<int>> a(n,vector<int> (n));
  for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin >> a[i][j];
  vector<vector<long>> dp(n+1,vector<long> (1<<n,0));
  dp[0][0]=1;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(a[i][j]==0) continue;
      for(int k=0;k<(1<<n);k++){
        dp[i+1][k|(1<<j)] += dp[i][k];
        dp[i+1][k|(1<<j)] %= MOD;
      }
    }
  }
  cout << dp[n][(1<<n)-1] << endl;
}

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

int main( void ){
  int a,b;
  cin>>a>>b;
 
  if(a < b){
    cout<<"a < b\n";
  }
  if(a > b){
    cout<<"a > b\n";
  }
  if(a == b){
    cout<<"a == b\n";
  }

  return 0;
}

Measured memory_bytes: 1124
import java.util.Scanner;


public class Main {
    int a;
    String s;
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        Main m =new Main();
        m.a = stdIn.nextInt();
        m.s = stdIn.next();
        System.out.print(m.check());
    }
    private String check(){
        if(a>=3200) return s;
        return String.valueOf("red");
    }
}

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

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

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
string s;
cin>>s;
ll cnt=0;
ll ans=0;
for(int i=0;i<s.size();i++){
if(s.at(i)=='A'||s.at(i)=='C'||s.at(i)=='G'||s.at(i)=='T'){
    cnt++;
    chmax(ans,cnt);
}else{
    cnt=0;
}
}
cout<<ans<<endl;
}












Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


int main() {
  int n;
  cin >> n;
  vi p(n);
  rep(i, n) cin >> p[i];

  int m = p[0];
  int ans = 0;
  rep(i, n){
    if (m >= p[i]){
     ans ++;
     m = p[i];
   }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

std::vector<bool> IsPrime;

void sieve(size_t max){
    if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
        IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    } 
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(size_t i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(IsPrime[i]) // iが素数ならば
            for(size_t j=2; i*j<=max; ++j) // (max以下の)iの倍数は
                IsPrime[i*j] = false;      // 素数ではない
}

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


  int n;
  cin >> n;
  sieve(5e5);

  rep(i,5e5){
    if(i<n) continue;
    if(IsPrime[i]) {
      cout << i << endl;
      return 0;
      
    }

  }


  
  return 0;
    

}


Measured memory_bytes: 384
#include <cstdio>  
#include <iostream>  
#include <cstring>  
#include <string>  
#include <cmath>  
#include <algorithm>  
#include <cstdlib>  
#include <utility>  
#include <map>  
#include <stack>  
#include <set>  
#include <vector>  
#include <queue>  
#include <deque>  
#include <sstream>  
#include <bitset>
#include<bits/stdc++.h>      
using namespace std;
#define fi first
#define se second
typedef long long ll; 
const ll maxn = 1e3 + 10;
const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
char mp[maxn][maxn];
int step[maxn][maxn];
bool vis[maxn][maxn];
int n,m;

bool check(int x,int y) {
    if(x < 0 || y < 0|| x >= n || y >= m || vis[x][y] || mp[x][y] == '#') return false;
    return true;
}

int BFS() {
    queue<pair<int ,int> > q;
    q.push(make_pair(0,0));
    step[0][0] = 1;
    vis[0][0] = true;
    while (!q.empty()) {
        pair<int ,int> t = q.front();
        q.pop();
        for(int i = 0;i < 4;i++) {
            int tox = t.fi + Move[i][0];
            int toy = t.se + Move[i][1];
            if(tox == n - 1 && toy == m - 1) return step[t.fi][t.se] + 1;
            if(check(tox,toy)) {
                vis[tox][toy] = true;
                step[tox][toy] = step[t.fi][t.se] + 1;
                q.push(make_pair(tox,toy));
            }
        }
    }
    return -1;
}


int main(){
    int();
    cin>>n>>m;
    int cnt = 0;
    for(int i = 0;i < n;i++)
        for(int j = 0;j < m;j++) {
            cin>>mp[i][j];
            if(mp[i][j] == '#') cnt++;
        }
    int res = BFS();
    if(res == -1) {
        cout<<"-1"<<endl;
    } else {
        cout<<n*m - res - cnt<<endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include <iostream>

#define P 1000000007

using namespace std;

int main(){
    int N;
    int A[100000];
    int T[100000];
    int A_min[100000];
    int T_min[100000];
    int A_max[100000];
    int T_max[100000];
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    for(int i = 0; i < N; i++){
        cin >> T[i];
    }
    A_min[0] = A[0];
    A_max[0] = A[0];
    for(int i = 1; i < N ;i++){
        if(A[i] > A[i-1]){
            A_min[i] = A[i];
            A_max[i] = A[i];
        }else{
            A_min[i] = 1;
            A_max[i] = A[i];
        }
    }
    T_min[N-1] = T[N-1];
    T_max[N-1] = T[N-1];
    for(int i = N-2; i >= 0 ;i--){
        if(T[i] > T[i+1]){
            T_min[i] = T[i];
            T_max[i] = T[i];
        }else{
            T_min[i] = 1;
            T_max[i] = T[i];
        }
    }
    long ans = 1;
    
    for(int i = 0; i < N; i++){
        ans = (ans*(max(0, min(A_max[i], T_max[i])-max(A_min[i], T_min[i])+1)))%P;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
n = int(input())
l = [int(x) for x in input().split()]
min_sum=-1
for t in range(len(l)):
  s1 = l[:t]
  s2 = l[t:]
  s1_sum = sum(s1)
  s2_sum = sum(s2)
  if min_sum < 0 or min_sum > abs(s1_sum - s2_sum):
    min_sum = abs(s1_sum - s2_sum)
print(min_sum)


Measured memory_bytes: 3064
#include <stdio.h>
#include <math.h>

int main(void) {

  long h,w,k;
  scanf("%ld %ld %ld", &h, &w, &k);
  char c[h][w+1];
  for (long i = 0; i < h; i++) {
    scanf("%s", c[i]);
  }
  long count = 0;
  long black;
  long bit_h[h],bit_w[w];
  for (long i = 0; i < h; i++) {
    bit_h[i] = 0;
  }
  bit_h[0] = -1;

  for (long se_h = 0; se_h < pow(2,h); se_h++) {
    bit_h[0]++;
    for (long i = 1; i < h; i++) {
      bit_h[i] += bit_h[i-1]/2;
      bit_h[i-1] %= 2;
    }
    for (long i = 0; i < w; i++) {
      bit_w[i] = 0;
    }
    bit_w[0] = -1;
    for (long se_w = 0; se_w < pow(2,w); se_w++) {
      bit_w[0]++;
      for (size_t i = 1; i < w; i++) {
        bit_w[i] += bit_w[i-1]/2;
        bit_w[i-1] %= 2;
      }
      black = 0;
      for (long i = 0; i < h; i++) {
        for (long j = 0; j < w; j++) {
          if (bit_h[i] == 0 && bit_w[j] == 0 && c[i][j] == '#') {
            black++;
          }
        }
      }
      if (black == k) {
        count++;
      }
    }
  }
  printf("%ld\n", count);

  return 0;
}

Measured memory_bytes: 2528
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const double EPS=1e-12;
const double PI=acos(-1);
struct Point{
    double x,y;
    Point(double _x=0,double _y=0){x=_x;y=_y;}
    Point operator-(const Point& b){return Point(x-b.x,y-b.y);}
    Point operator+(const Point& b){return Point(x+b.x,y+b.y);}
    Point operator*(const double v){return Point(x*v,y*v);}
    double operator*(const Point& b){return x*b.y-y*b.x;}
    double operator^(const Point& b){return x*b.x+y*b.y;}
    bool operator<(const Point& b)const{
        if(fabs(x-b.x)<EPS){
            if(fabs(y-b.y)<EPS)return 0;
            return y<b.y;
        }
        return x<b.x;
    }
    double angle(){return atan2(y,x);}
    double dis(){return sqrt(x*x+y*y);}
    Point rotate(double v){return Point(x*cos(v)-y*sin(v),x*sin(v)+y*cos(v));}
    Point unit(){return (*this)*(1./dis());}
    void scan(){scanf("%lf%lf",&x,&y);}
    void print(){printf("%.9f %.9f\n",x,y);}
}p[3];
Point gg(Point X,Point V1,Point V2,double r){
    double aa=V1.angle()-V2.angle();
    if(aa<0)aa=-aa;
    if(aa>PI)aa=2*PI-aa;
    aa*=0.5;
    double dd=r/sin(aa);
    return X+((V1.unit()+V2.unit()).unit()*dd);
}
double ma;
double f(Point X,Point V1,Point V2,Point Y,Point V3,Point V4){
    double ll=0,rr=ma;
    REP(k,30){
        double mm=(ll+rr)*0.5;
        Point O1=gg(X,V1,V2,mm);
        Point O2=gg(Y,V3,V4,mm);
        if((O1-O2).dis()>mm*2)ll=mm;
        else rr=mm;
    }
    return (ll+rr)*0.5;
}
int main(){
    REP(i,3)p[i].scan();
    VI d[3];
    d[0].PB(1);d[0].PB(2);
    d[1].PB(0);d[1].PB(2);
    d[2].PB(0);d[2].PB(1);
    double a=(p[1]-p[0]).dis();
    double b=(p[2]-p[0]).dis();
    double c=(p[2]-p[1]).dis();
    double s=(a+b+c)*0.5;
    ma=sqrt(s*(s-a)*(s-b)*(s-c))/s;
    double an=0;
    REP(i,3)REP(j,i){
        an=max(an,f(p[i],(p[d[i][0]]-p[i]),(p[d[i][1]]-p[i])
                    ,p[j],(p[d[j][0]]-p[j]),(p[d[j][1]]-p[j])));
    }
    printf("%.12f\n",an);

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
int N, M, K;
vector<int> A, B;
void input() {
  int i, j, k, x, y;
  string s;
  cin >> N >> M >> K;
}
int f(int n) {
  if (n < 0)
    return 0;
  else
    return n / K + 1;
}
void solve() {
  debug(f(M));
  debug(f(N - 1));
  // if (K==1){
  //   cout<<M-N+1<<endl;return;
  // }
  cout << f(M) - f(N - 1) << endl;
}
signed main() {
  input();
  solve();
  return 0;
}

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

int n,a[200005];

int main(void){
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    for(int i=1;i<n;i++){
        if(a[i-1]==a[i]){
            cout<<"NO\n";
            return 0;
        }
    }
    cout<<"YES\n";
    
    return 0;
}


Measured memory_bytes: 1024
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"basic.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
#endif

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    for(int i=0;i<tx - sx;i++){ cout << 'R'; }
    for(int i=0;i<ty - sy;i++){ cout << 'U'; }
    for(int i=0;i<tx - sx;i++){ cout << 'L'; }
    for(int i=0;i<ty - sy;i++){ cout << 'D'; }

    cout << 'D';
    for(int i=0;i<tx - sx + 1;i++){ cout << 'R'; }
    for(int i=0;i<ty - sy + 1;i++){ cout << 'U'; }
    cout << 'L';
    cout << 'U';
    for(int i=0;i<tx - sx + 1;i++){ cout << 'L'; }
    for(int i=0;i<ty - sy + 1;i++){ cout << 'D'; }
    cout << 'R' << '\n';
    return 0;
}


Measured memory_bytes: 888
# -*- coding: utf-8 -*-
import logging
import time


class Solver:
    def __init__(self):
        self.n = 0

    # 入力
    def input_value(self):
        # self.n = int(input())
        # self.A, self.B = map(int, input().split())
        # self.A = list(map(int, input().split()))
        # self.a, self.b, self.c = map(int, [input() for i in range(4)])
        # self.t = [None] * self.n
        self.n = int(input())

    @staticmethod
    def sigma(n):
        x = 0
        if n % 2 == 0:
            for i in range(0, n + 1, 2):
                x += (-2) ** i
        else:
            for i in range(1, n + 1, 2):
                x += (-2) ** i
        return x

    @staticmethod
    def to_base_m2(n):
        # logging.debug(input_str)
        if n == 0:
            return '0'

        MAX_BIT = 35
        s = ''
        i = MAX_BIT
        while i >= 0:
            if i % 2 == 0:
                if Solver.sigma(i - 2) < n <= Solver.sigma(i):
                    s = s + '1'
                    n -= (-2) ** i
                else:
                    s = s + '0'
            elif i % 2 == 1:
                if Solver.sigma(i) <= n < Solver.sigma(i - 2):
                    s = s + '1'
                    n -= (-2) ** i
                else:
                    s = s + '0'
            i -= 1
        while s[0] == '0':
            s = s[1:]
        return s

        # logging.debug(input_str)



    # def run(self):
    #     if self.n % self.k == 0:
    #         return 0
    #     return 1

    @staticmethod
    def test():
        start_time = time.time()

        assert Solver.sigma(2) == 5, 'Error.'
        assert Solver.sigma(3) == -10, 'Error.'
        assert Solver.to_base_m2(9) == '11001', 'Error.'
        assert Solver.to_base_m2(-9) == '1011', 'Error.'
        assert Solver.to_base_m2(123456789) == '11000101011001101110100010101', 'Error.'
        assert Solver.to_base_m2(0) == '0', 'Error.'
        assert Solver.to_base_m2(1) == '1', 'Error.'
        assert Solver.to_base_m2(2) == '110', 'Error.'
        assert Solver.to_base_m2(-1) == '11', 'Error.'
        assert Solver.to_base_m2(-2) == '10', 'Error.'

        elapsed_time = time.time() - start_time
        logging.debug('elapsed_time: {0}'.format(elapsed_time) + '[sec]')


if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)

    solver = Solver()

    # Solver.test()

    solver.input_value()
    ans = solver.to_base_m2(solver.n)
    # print(str(ans))
    print(ans)


Measured memory_bytes: 4208
import sys
# input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
def getlist2():
    return [int(x) * 100000 for x in input().split()]
import math
import bisect
import heapq
from decimal import Decimal
# from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15

def factorization2(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# factorization(24)

## [[2, 3], [3, 1]]
##  24 = 2^3 * 3^1

def factorization(n):
    ret = []
    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i == 0:
            ret.append(i)
            ret.append(n // i)
    ret.append(n)
    return ret

def simulation(n, k):
    while(n >= k):
        if n % k == 0:
            n = n // k
        else:
            n -= k

    if n == 1:
        return True
    else:
        return False
def simulation_answer(n):
    ans = 0
    for i in range(2, n+1):
        if simulation(n, i):
            # print(i)
            ans += 1
    return ans

def submit_answer(n):
    # fcminus = factorization(n - 1)
    ans1 = factorization(n-1)
    # for a, b in fcminus:
    #     ans1 *= (b + 1)

    fc = factorization(n)
    ans2 = 0
    for fact in fc:
        tmp = n
        while (tmp % fact == 0):
            tmp /= fact
        if tmp % fact == 1:
            ans1.append(fact)
        # for power in range(1, b+1):
        #     wari = a**power
        #     while(tmp % wari == 0):
        #         tmp /= wari
        #     # if (n // (a ** power)) == (a ** power) + 1:
        #     if tmp % wari == 1:
        #         ans2 += 1
        #         print(a ** power)

    # print(ans2)
    # for i in range(2, n + 1):
    #     if simulation(n, i):
    #         print(i)
    # return (ans1 + ans2)
    # print(list(set(ans1)))
    return(len(list(set(ans1))))

def main():
    # n = getN()
    # print(factorization(n))
    # print(simulation_answer(n))
    # print(submit_answer(n))
    # for i in range(2, 100000):
    #     if simulation_answer(i) == submit_answer(i):
    #         status = "OK"
    #     else:
    #         status = "NG"
    #
    #         print("{}:  {}".format(i, status))
    #         print("simu: ", simulation_answer(i))
    #         print("sub: ", submit_answer(i))
    n = getN()
    if n == 2:
        print(1)
        return
    else:
        print(submit_answer(n))
        return

if __name__ == '__main__':
    main()

"""
9999
3

2916
"""

Measured memory_bytes: 59756
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n' 
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define all(a)      a.begin(),a.end()
#define getc getchar_unlocked
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
/*---------------------------------------------------------------------------------------------------*/

void solve()
{
  int n,k;
  cin >> n >> k;
  int a[n];
  f(i,n)
    cin >> a[i];
  sort(a,a+n);
  int sum=0;
  f(i,k)
    sum+=a[i];
  cout << sum << '\n';
  return;
} 

signed main()
{
  FAST
  int T=1;
//   cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define LL long long

const int inf = 1e9 + 7;
LL n, m;

int main()
{
    while(~scanf("%lld %lld", &n, &m))
    {
        if(n == 1 && m == 1) printf("1\n");
        else if(n == 1 || m == 1) printf("%lld\n", max(n, m) - 2);
        else
        {
            LL ans = n * m;
            ans -= 2 * m;
            ans -= (n - 2) * 2;
            printf("%lld\n", ans);
        }
    }
}


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

int main() {
    string s,t;
    cin>>s>>t;
    bool flag =true;
    rep(i,3){
        if(s.at(i)!=t.at(2-i))
            flag=false;
    }
    if(flag==true)
        cout<<"YES"<<endl;
    else
    {
        cout<<"NO"<<endl;

    }
    
}



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

using namespace std;


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

template <typename T>
void print(T x)
{
	std::cout << x <<" " ;
}


template <typename T>
void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	string N;
	cin >> N;
	
	string s = "Sunny";
	string c = "Cloudy";
	string r = "Rainy";

	if (N.compare(s) == 0) {
		print(c);
	}
	else if (N.compare(c) == 0) {
		print(r);
	}
	else if (N.compare(r) == 0) {
		print(s);
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

template<int char_size>
struct Trie_Node{
    vector<int> next;
    vector<int> accept;
    vector<int> cnt;
    int exist;
    int size;

    Trie_Node() : exist(0){
        next.assign(char_size, -1);
        cnt.assign(char_size, 0);
    }
};

template<int char_size, char base>
struct Trie{
    using Node = Trie_Node<char_size>;
    vector<Node> nodes;
    int root;

    Trie() : root(0){
        nodes.pb(Node());
    }

    void insert(const string &s, int id){
        int now = 0;
        rep(i, sz(s)){
            int c = s[i]-base;
            int &next = nodes[now].next[c];
            if(next == -1){
                next = sz(nodes), nodes.pb(Node());
            }
            nodes[now].exist++, now = next;
        }
        nodes[now].exist++, nodes[now].accept.pb(id);
    }

    void insert(const string &s){
        insert(s, nodes[0].exist);
    }

    bool search(const string &s, bool prefix = false){
        int now = 0;
        rep(i, sz(s)){
            int c = s[i]-base;
            int &next = nodes[now].next[c];
            if(next == -1) return false;
            now = next;
        }
        return (prefix)? true : sz(nodes[now].accept) > 0;
    }

    bool prefix_search(const string &s){
        return search(s, true);
    }

    int count() const {return nodes[0].exist;}

    int size() const {return sz(nodes);}
};

Trie<26, 'a'> trie;

void dfs(int i, int c){
    using Node = Trie_Node<26>;
    Node &now = trie.nodes[i];
    now.size = sz(now.accept);
    fill(all(now.cnt), 0);
    rep(j, 26){
        if(now.next[j] == -1) continue;
        dfs(now.next[j], j);
        Node nt = trie.nodes[now.next[j]];
        now.size += nt.size;
        rep(k, 26){
            if(j == k) now.cnt[k] += nt.size;
            else now.cnt[k] += nt.cnt[k];
        }
    }
}

int main(){
    int N;
    cin >> N;
    string S[N];
    rep(i, N){
        cin >> S[i];
        reverse(all(S[i]));
        trie.insert(S[i]);
    }
    dfs(0, 0);
    ll ans = 0;
    rep(i, N){
        int n = sz(S[i]), now = 0;
        rep(j, n-1) now = trie.nodes[now].next[S[i][j]-'a'];
        ans += trie.nodes[now].cnt[S[i][n-1]-'a']-1;
    }
    cout << ans << endl;
}

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

/*vector<int> p(n);
cin >> p[i]*/

int main(){

    string s,t,u;
    int a,b;

    cin >> s >> t;
    cin >> a >> b;
    cin >> u;

    if(s == u) a -= 1;
    if(t == u) b -= 1;

    cout << a << " " << b << endl;

    return 0;
}

Measured memory_bytes: 256
from collections import deque
import math

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

n = int(input())
n //= 200

print(10-n)

Measured memory_bytes: 9464