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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll n,m,p;

int main(){
    while(cin >> n >> m >> p && n){
        ll sum = 0;
        vector<ll> mo(n);
        rep(i,n){
            cin >> mo[i];
            sum += mo[i];
        }
        sum *= 100;
        ll num = sum * p;
        num /= 100;
        sum -= num;
        if(mo[m-1] == 0)cout << 0 << endl;
        else cout << sum / mo[m-1] << endl;
    }
}


Measured memory_bytes: 3032
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define vvvel vector<vvel>
void mmin(int &a, int b) { a = min(a, b); }
void mmax(int &a, int b) { a = max(a, b); }
void sor(vel &v) { sort(v.begin(), v.end()); }
int zero() { return 0; }
int gcd(int a, int b) {
	if (a < b) return gcd(b, a);
	if (b == 0) return a;
	int r = a % b;
	return gcd(b, r);
}
int ord(int a,int p) {
	if (a%p != 0) return 0;
	return 1 + ord(a / p,p);
}
int rui(int a, int n) {
	if (n == 0) {
		return 1;
	}
	return a * rui(a, n - 1);
}
signed main() {
	int n; cin >> n;
	int h, w; cin >> h >> w;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (h <= a and w <= b) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import math
mod = 10 ** 9 + 7
n, m = map(int, input().split())

fn = math.factorial(n)
fm = math.factorial(m)

if abs(n-m) >= 2:
    print(0)
else:
    if (n+m)%2 == 0:
        print(fn*fm*2%mod)
    else:
        print(fn*fm%mod)

Measured memory_bytes: 5180
N = int(input())
syougen = [[]*N for _ in range(N)]

for i in range(N):
    A = int(input())
    for j in range(A):
        x, y = [int(s) for s in input().split()]
        syougen[i].append((x,y))

def judge(bit):
    for i in range(N):
        if not bit & (1<<i):
            continue
        for x, y in syougen[i]:
            if y == 1 and not bit & (1<<x-1):
                return False
            if y == 0 and bit & (1<<x-1):
                return False
    return True

ans = 0
for bit in range(2**N):
    if judge(bit):
        res = 0
        for i in range(N):
            if bit & (1<<i):
                res += 1
        ans = max(res, ans)
        
print(ans)




Measured memory_bytes: 3192
A=int(input())
B=int(input())
C=int(input())
X=int(input())

l=0
for a in range(A+1):
    ax = X - a*500
    for b in range(B+1):
        if C*50 + b*100 >= ax and ax - b*100 >=0:
            l+=1
print(l)


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

 public class Main{
// taking inputs
static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split(" ");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;}
static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
static long ModInv(long a,long m){return Modpow(a,m-2,m);}
static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
static long[] f;
static long mod=(long)1e9+7;
//......................................@uthor_Alx..............................................

   public static void main(String[] args) throws  IOException{
	        		  assign();
	        		  	int[] x=int_arr();
	        		  	int n=x[0],m=x[1];
	        		  	f=new long[m+2];
	        		  	f[0]=1;
	        		  	for(int i=1;i<m+2;i++){
	        		  		f[i]=Modmul((long)i,f[i-1],mod);
	        		  	}
	        		  	long res=Modmul(f[n],nck(m,n,mod),mod);
	        		  	long pie=0,sign=1;
	        		  	for(int i=0;i<=n;i++){
	        		  		pie+=sign*Modmul(nck(n,i,mod),Modmul(nck(m-i,n-i,mod),f[n-i],mod),mod);
	        		  		sign*=-1l;
	        		  		pie%=mod;
	        		  	}
	        		  	pie+=mod;pie%=mod;
	        		  	res=Modmul(res,pie,mod);
	        		  	
	        		  	out.write(res+"");
                      	out.flush();
	        		 
	}
}
	       


Measured memory_bytes: 40600
#include <iostream>
#include <vector>
#include <string>

using namespace std;

namespace {

}

class Station {
public:
	Station(int C, int S, int F)
		: C_(C)
		, S_(S)
		, F_(F)
	{

	}

	int C_;
	int S_;
	int F_;
};

int main()
{
	int N = 0;
	
	cin >> N;
	
	vector<Station> station;

	for (int i = 0; i < N - 1; ++i){
		int C = 0, S = 0, F = 0;
		cin >> C >> S >> F;
		station.push_back(Station(C, S, F));
	}

	for (int i = 0; i < N - 1; ++i){
		int time = station[i].S_ + station[i].C_;;

		for (int j = i + 1; j < N - 1; ++j){
			if (time <= station[j].S_){
				time = station[j].S_ + station[j].C_;
			}
			else {
				int n = (time - station[j].S_) / station[j].F_;
				int m = (time - station[j].S_) % station[j].F_;
				if (m != 0){
					++n;
				}
				time = station[j].S_ + station[j].F_ * n + station[j].C_;
			}

		}
		cout << time << std::endl;
	}

	cout << "0";

	return 0;
}

Measured memory_bytes: 256
import copy
n = int(input())
x = [int(i) for i in input().split()]

#ユークリッド互除法の関数の定義
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)


def gcd_multi(n,x):
    if n==1:
        return x[0]
    else:
        element = gcd(x[0], x[1])
        if n==2:
            return element
        else:
            for i in range(2,n):
                element=gcd(element,x[i])
            return element

X=[0 for i in range(n)]
Y=[0 for i in range(n)]

for i in range(1,n):
    X[i]=gcd(X[i-1],x[i-1])

for i in range(n-1)[::-1]:
    Y[i]=gcd(Y[i+1],x[i+1])

Z=[gcd(X[i],Y[i]) for i in range(n)]
print(max(Z))


Measured memory_bytes: 14968
#include<stdio.h>

int main()
{
    int n,i;
    scanf("%d",&n);
    int flag =0;

    int arr[n];

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

    }



    for(i=0;i<n;i++)
    {
        if(arr[i]%2 == 0)
        {
            if(arr[i]%3 == 0 || arr[i]%5 == 0)
            {
                flag = 0;
            }

            else
            {
                flag = 1;
                break;
            }


        }
    }

    if(flag == 0)
        printf("APPROVED\n");
    else if(flag == 1)
        printf("DENIED\n");

    return 0;
}


Measured memory_bytes: 128
N = int(input())
dum_list = list(map(int, input().split()))

goukei = sum(dum_list)

last_yama = int(goukei/2 - sum([a for i,a in enumerate(dum_list[:-1]) if i%2==0] ))
start_yama = dum_list[-1] - last_yama

yama_small = [start_yama,]
for d in dum_list[:-1]:
    yama_small.append(d-yama_small[-1])

print(" ".join(map(str,[int(y*2) for y in yama_small])))

Measured memory_bytes: 87908
#include <iostream>
#include <algorithm>
using namespace std;
int max(int a, int b){if (a > b) return a; return b;} 

int main()
{
    int a, b;
    cin >> a >> b;
    int sum  = 0;
    sum +=  max(a, b);
    int c = max(a, b)  - 1;
    sum += max(c, a + b - max(a, b));
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int xx[2010][4010][2];
pair<int, int> a[2010];
int dp[2010][2010];
int ch[2010][2];
int n;
int func(int here, int here1) {
	if (here > n + 1 || here1 > n + 1)return 1234567890;
	if (here == n + 1 && here1 == n + 1)return 0;
	int &ret = dp[here][here1];
	if (ret != -1)return ret;
	ret = 1234567890;
	int cc = ch[here][0];
	ret = min(ret, func(here + 1, here1) +xx[here + 1][cc][0] + xx[here1][cc][1]);
	cc = ch[here1][1];
	ret = min(ret, func(here, here1 + 1) +  xx[here][cc][0] + xx[here1 + 1][cc][1]);
	return ret;
}
int main()
{
	memset(dp, -1, sizeof(dp));
	scanf("%d", &n);
	for (int i = 0; i < n*2; i++)
	{
		char q; int w;
		scanf(" %1c %d", &q, &a[i].second);
		if (q == 'B')
			a[i].first = 1;
		ch[a[i].second][a[i].first] = i;
	}
	for (int z= 0;z < 2;z++) {
		for (int i = 1; i <= n; i++) {
			int sum = 0;
			for (int y = 0; y < n * 2; y++)
			{
				if (a[y].first == z&&a[y].second >= i)
					sum++;
				xx[i][y][z] = sum;
			}
		}
	}
	printf("%d", func(1, 1));
}

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


int main(){
  long long n,a,b,ans;
  cin >> n >> a >> b;
  if(a>b){
    ans=0;
  }else if(n==1){
    if(a!=b){
      ans=0;
    }else{
      ans=1;
    }
  }else{
    ans=(b-a)*(n-2)+1;
  }
  cout << ans << endl;
  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if (a+b > c+d) {
    cout << "Left";
  }
  else if (a+b == c+d) {
    cout << "Balanced";
  }
  else {
    cout << "Right";
  }
}

Measured memory_bytes: 256
#include <stdio.h>
int q, n, c;
int main() {
	scanf("%d", &q);
	for(int i = 0; i < q; i++) {
		scanf("%d", &n);
		if(n > 1) c++;
		for(int j = 2; j * j <= n; j++) {
			if(n % j == 0) {
				c--; break;
			}
		}
	}
	printf("%d\n", c);
}

Measured memory_bytes: 2712
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,mochi[101];
cin>>n;
for(int i=0;i<n;i++){
cin>>mochi[i];
}
for(int i=0;i<n-1;i++){
for(int j=0;j<n-i-1;j++){
if(mochi[j]<mochi[j+1]){
int temp=mochi[j];
mochi[j]=mochi[j+1];
mochi[j+1]=temp;
}
}
}
int ans=1;
for(int i=1;i<n;i++){
if(mochi[i]!=mochi[i-1]) ans++;
}
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 256
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val Array(a, b, c) = in.readLine().split("\\s+").map(_.toInt)

    out.println(
      if (c >= a && c <= b) {
        "Yes"
      } else {
        "No"
      }
    )

    out.flush()
  }
}


Measured memory_bytes: 25524
s = input()
s = [s[0:2], s[2:4]]
if (int(s[0]) > 12 or int(s[0]) == 0) and 1 <= int(s[1]) <= 12:
    print('YYMM')
elif (int(s[1]) > 12 or int(s[1]) == 0) and 1 <= int(s[0]) <= 12:
    print('MMYY')
elif 1 <= int(s[0]) <= 12 and 1 <= int(s[1]) <= 12:
    print('AMBIGUOUS')
else:
    print('NA')

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

int main()
{
  int n;
  cin>>n;
  int taro_point=0,hanako_point=0;
  for (int i = 0; i < n; ++i)
  {
    string taro,hanako;
    cin>>taro>>hanako;
    if(taro>hanako) taro_point+=3;
    else if(taro<hanako) hanako_point+=3;
    else 
    {
      taro_point++; hanako_point++;
    }
  }
  cout<<taro_point<<" "<<hanako_point<<endl;
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define sz(arr) (int)(arr).size()
#define rng(arr) arr.begin(), arr.end()
#define show(x) cout << #x << " = " << x << endl;

using namespace std;
typedef long long int ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

void Main() {
  Cin(int, n);
  Cins(int, n, a);

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

  double mean = (double)sum / n;

  double mi = 1001001001;
  int mii = -1;
  for (int i = 0; i < n; ++i) {
    double sa = abs(a[i] - mean);
    if (mi > sa) {
      mi = sa;
      mii = i;
    }
  }

  cout << mii << endl;
}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

void precalc() {
}

const int maxk = (int) 1e4 + 10;
int a[maxk];
int k, n;

int read() {
  if (scanf("%d%d", &k, &n) < 2) {
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  return 1;
}

void solve() {
  int mx = *max_element(a, a + n);
  int res = 0;
  while ((k - res + 1) / 2 + res < mx) {
    ++res;
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef LOCAL
  freopen(TASK ".out", "w", stdout);
  assert(freopen(TASK ".in", "r", stdin));
#endif

  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 256
from math import gcd
def lcm(a, b):
    return a*b//gcd(a,b)

A, B, C, D = map(int,input().split())

nC = B//C - -(-A//C) + 1
nD = B//D - -(-A//D) + 1
nCD = B//lcm(C,D) - -(-A//lcm(C,D)) + 1

print((B-A+1)-(nC+nD-nCD))

Measured memory_bytes: 9136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 10;
int n;
char s[maxn];


int main()
{
    cin >> s;
    int len = strlen(s);
    int f = 0;
    for(int i = 0; i < len - 1; i ++)
      {
        if(s[i] == 'A' && s[i + 1] == 'B' || s[i] == 'B' && s[i + 1] == 'A'){
          f = 1;
          break;
        }
      }
    puts(f ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val x = sc.nextInt()
    println(answer053a(x))
}

fun answer053a(x: Int): String {
    return if(x < 1200) {
        "ABC"
    } else {
        "ARC"
    }
}

Measured memory_bytes: 29348
#!/usr/bin/env python3
# from typing import *


# def solve(K: int) -> int:
def solve(K):
    curr = 7 % K
    for i in range(1, 10**6 + 1):
        if curr == 0:
            return i

        curr *= 10
        curr += 7
        curr %= K

    return -1


# generated by online-judge-template-generator v4.4.0 (https://github.com/kmyk/online-judge-template-generator)
def main():
    K = int(input())
    a = solve(K)
    print(a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 63032
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s,t;cin>>s>>t;
	int a,b;cin>>a>>b;
	string u;cin>>u;
	if(s==u){
		cout<<a-1<<" "<<b<<endl;
	}else{
		cout<<a<<" "<<b-1<<endl;
	}
}


Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	cout<<b+min(c,a+b+1)<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int ans=3;
  if(a==b && b==c) ans=1;
  else if(a==b || b==c || a==c) ans=2;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[110][100005];
vector<ll> w1,v;
ll knap(ll n,ll w)
{
    if(n==0||w==0)return 0;
    if(dp[n][w]!=-1)return dp[n][w];
    else
    {
        if(w1[n]>w)
        {
            return dp[n][w]=knap(n-1,w)  ;     
            }
            
            else 
            {
                return dp[n][w]=max(v[n]+knap(n-1,w-w1[n]),knap(n-1,w));
            }
    }
}
int main()
{ll n,w;
    cin>>n>>w;
    memset(dp,-1,sizeof(dp));
w1.resize(n+1);
v.resize(n+1);
    for(int i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        w1[i+1]=x;
        v[i+1]=y;
    }
    cout<<knap(n,w);
    
}

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

const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int a, b; cin >> a >> b;
	cout << 6 - a - b << endl;
} 

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

int main(){
  int n, m;
  vector<int> a, b, c, d;
  int ai, bi, ci, di, i, j;
  int dist_i, mindist, minidx;
  
  cin >> n >> m;
  
  for (i=0; i<n; i++) {
    cin >> ai >> bi;
    a.push_back(ai);
    b.push_back(bi);
  }
  
  for (i=0; i<m; i++) {
    cin >> ci >> di;
    c.push_back(ci);
    d.push_back(di);
  }
  
  for (i=0; i<n; i++) {
    for (j=0; j<m; j++) {
      dist_i = abs(a[i]-c[j]) + abs(b[i]-d[j]);
      if (j==0) {
        mindist = dist_i;
        minidx = 1;
      }
      else {
        if (dist_i < mindist) {
          mindist = dist_i;
          minidx = j+1;
        }
      }
    }
    cout << minidx << endl;
  }
  
  return 0;  
}

Measured memory_bytes: 256
#include<stdio.h>
	#include<string.h>
	int main(){
		
		int a,b,c,e,d,f;
		
		scanf("%d %d", &a,&b);
		
		c=a+b;
		d=a-b;
		f=b*a;
		if(c>=d&&c>f){
			printf("%d\n", c);
		}
		else if(d>c&&d>f){
			printf("%d\n", d);
		}
		else printf("%d\n", f);
		return 0;
	}

Measured memory_bytes: 384
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()
    num_list = i_list()

    count = 0

    for i in range(1,n+1):
        if i % 2 == 0:
            continue
        if num_list[i-1] % 2 == 0:
            continue
        count += 1

    print(count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 10520
#include <algorithm>
#include <array>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <string>
#include <string_view>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

int64_t read_int() {
    int64_t ret = 0, sgn = 1;
    int ch = getchar_unlocked();
    while (isspace(ch)) { ch = getchar_unlocked(); }
    if (ch == '-') { sgn = -1; ch = getchar_unlocked(); }
    for (; isdigit(ch); ch = getchar_unlocked())
        ret = (ret * 10) + (ch - '0');
    ungetc(ch, stdin);
    return sgn * ret;
}

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()

template <typename T> inline void assign_min(T& x, const T& value) noexcept { x = min(x, value); }
template <typename T> inline void assign_max(T& x, const T& value) noexcept { x = max(x, value); }

constexpr char LF = '\n';

//-------------------------------------------------------------------------------------------------
#include <atcoder/segtree.hpp>

int64_t op(int64_t a, int64_t b) { return max(a, b); }
int64_t identity() { return 0; }

int main() {
    auto N = read_int();
    auto K = read_int();
    vector<int64_t> A(N);
    REP(i, N) { A[i] = read_int(); }

    int64_t Amax = numeric_limits<int64_t>::min();
    REP(i, N) { assign_max(Amax, A[i]); }

    // dp[i]: i番目までの条件を満たす最大の長さ
    vector dp(N, int64_t());
    atcoder::segtree<int64_t, op, identity> st(Amax+1); // key: A[i], value: max(dp[i])
    REP(i, N) {
        dp[i] = 1;
        if (i > 0) { assign_max(dp[i], dp[i-1]); }
        // A[j] が A[i]-K .. A[i]+K の範囲に入っているような j に対する dp[j] の最大値
        int64_t v = st.prod(max<int64_t>(0, A[i]-K), min(Amax+1, A[i]+K+1)) + 1;
        assign_max(dp[i], v);

        if (st.get(A[i]) < v) {
            st.set(A[i], v);
        }
    }
    cout << dp[N-1] << LF;
}


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


int main() {
	
	int N, x;
	cin >> N >> x;
	vector<int> m(N);
	for (auto &i : m) cin >> i, x -= i;
	sort( m.begin(), m.end() );
	cout << N + x / m.at(0) << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string str = Console.ReadLine();
                var list = new List<decimal>();
                decimal num;
                if (!Decimal.TryParse(str, out num))
                    break;
                list.Add(num);
                for (int i = 1; i < 10; i++)
                {
                    if ((i & 1) == 0)
                        list.Add(list.Last() / 3);
                    else
                        list.Add(list.Last() * 2);
                }
                Console.WriteLine(list.Sum());
            }

        }

    }
}

Measured memory_bytes: 6140
n, m = list(map(int, input().split()))
p_li = []
y_li = []
for i in range(m):
    p, y = list(map(int, input().split()))
    p_li.append(p)
    y_li.append(y)
num = list(range(m))
zip_li = zip(p_li, y_li, num)
from operator import itemgetter
zip_li = sorted(zip_li, key=itemgetter(1))
p_li, y_li, num = zip(*zip_li)
ans = []
f_num = [0 for i in range(n)]
for p in p_li:
    p -= 1
    f_num[p] += 1
    f_n = f_num[p]
    p+=1
    ans.append(str(p).zfill(6) + str(f_n).zfill(6))
zip_li = zip(num, ans)
zip_li = sorted(zip_li, key=itemgetter(0))
num, ans = zip(*zip_li)
for i in ans:
    print(i)

Measured memory_bytes: 39464
#include <stdio.h>

int dp[100001];

int pow(int a, int r){
    int ans = a;
    while(r){
        ans *= a;
        r--;
    }
    return ans;
}

int main(void){
    // Your code here!
    //for(int i = 0; i < 100000; i++) dp[i] = 1000000;
    dp[0] = 0;
    dp[1] = 1;
    int c = 0;
    while(pow(6,c) <= 100000){
        dp[pow(6,c)] = 1;
        c++;
    }
    c = 0;
    while(pow(9,c) <= 100000){
        dp[pow(9,c)] = 1;
        c++;
    }
    
    for(int i = 2; i <= 100000; i++){
        int min = dp[i-1] + 1;
        c = 0;
        while(pow(6,c) <= i){
            if (min > dp[i - pow(6,c)] + 1){
                min = dp[i - pow(6,c)] + 1;
            }
            c++;
        }
        c=0;
        while(pow(9,c) <= i){
            if (min > dp[i - pow(9,c)] + 1){
                min = dp[i - pow(9,c)] + 1;
            }
            c++;
        }
        dp[i] = min;
    }
    
    //for(int i = 0; i <= 10; i++) printf("dp[%d]=%d\n",i, dp[i]);
    
    int N;
    scanf("%d",&N);
    
    printf("%d\n", dp[N]);
}

Measured memory_bytes: 512
//a
#include <iostream>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <functional>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>

#define REP(i,b,n) for(int i=b;i<n;i++)
#define REPR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define BIT(n, b) ((n>>b) & 1)
#define PB push_back
#define MP make_pair

using namespace std;

static const double PI = acos(-1.0);
static const double EPS = 1e-9;
typedef long long ll;
typedef pair<int, int> pii;

int main(){
	
	int n;
	int s[1000];
	
	while(cin>>n, n){
		
		for(int i=0; i<n; ++i){
			cin>>s[i];
		}
		
		sort(s, s+n);
		
		int sum=0;
		
		for(int i=1; i<n-1; ++i){
			sum+=s[i];
		}
		
		sum /=n-2;
		
		cout << sum << endl;
	}
	
	return 0;	
}

Measured memory_bytes: 1176
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

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

    vl a(n);
    rep(i, n) {
        cin >> a[i];
    }

    vvl dp(n, vl(2, -INF));  // dp[i+1][j] : a[i]まで(iは0-index)の総和の最大値。ただし、j = 1 のとき a[i]とa[i+1]に操作を行ったとする
    dp[0][0] = 0;
    rep(i, n-1) {
        rep(j, 2) {
            chmax(dp[i+1][j], dp[i][j] + a[i]);
            chmax(dp[i+1][1-j], dp[i][j] - a[i]);
        }
    }

    out(max(dp[n-1][0] + a[n-1], dp[n-1][1] - a[n-1]));
    re0;
}

Measured memory_bytes: 9604
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main()
{
	int i,j,n,d,ans = 0;
	scanf("%d%d",&n,&d);
	for(i = 2;i <= n;i++)
		for(j = 2;j <= sqrt(i)&&j < 10;j++)
			if(i % j == 0&&i / j < 10&&i / j >= 2)
			{
				if(j * 10 + i / j <= d) ans++;
				if(i / j * 10 + j <= d) ans++;
				if(j * j == i&&j * 11 <= d) ans--;
			}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
import sys
N,Y=map(int,raw_input().split())

if N*10000<Y:
	print "-1 -1 -1"
	sys.exit()

a=[]
for x in range(N+1):
	for y in range(N+1):
			if x*9000+y*4000==Y-(N*1000):
				z=(Y-(10000*x+5000*y)) /1000
				if x+y+z==N and x>=0 and y>=0 and z>=0:
					print x,y,z
					sys.exit()
else:
	print "-1 -1 -1"

Measured memory_bytes: 2692
#include <bits/stdc++.h>
using namespace std;
const int dx[]={0,1,0,-1,1,-1,-1,1};
const int dy[]={-1,0,1,0,1,1,-1,-1};
const int INF = 1<<30;
const int EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
int dp[2][1000010];
int data[1000010];
int main(){
	int index=1;
	while(index*(index+1)*(index+2)/6 < 10000000){
		data[index-1] = index*(index+1)*(index+2)/6;
		index++;
	}
	fill(dp[0],dp[0]+1000000,INF);
	fill(dp[1],dp[1]+1000000,INF);
	dp[0][0] = dp[1][0] = 0;
	rep(i,1000000){
		rep(j,index){
			if(i+data[j] < 1000000){
				dp[0][i+data[j]] = min(dp[0][i+data[j]],dp[0][i]+1);
				if(data[j] % 2 == 1){
					dp[1][i+data[j]] = min(dp[1][i+data[j]],dp[1][i]+1);
				}
			}
		}
	}

	int N;

	while(scanf("%d",&N),N){
		printf("%d %d\n",dp[0][N],dp[1][N]);
	}
	return 0;
}

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

int main(){
	int n;cin>>n;
  vector<int> a(n),b(n);
  for(int i=0;i<n;i++){
    int t;cin >>t;
    a[i]=b[i]=t;
  }
  sort(b.begin(),b.end());
  int x=b[n/2-1];int y=b[n/2];
  for(auto&& w:a){
    int ans=(w>=y)?x:y;
  cout<<ans<<endl;
  }
    
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main(){
  char a,b;
  cin>>a>>b;
  if(a=='H'&&b=='H'){cout<<'H'<<endl;}
  else if(a=='D'&&b=='D'){cout<<'H'<<endl;}
  else if(a=='H'&&b=='D'){cout<<'D'<<endl;}
 else{cout<<'D'<<endl;}
}
  
  

Measured memory_bytes: 3540
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n, x, count = 0, min = 1000;
    cin >> n >> x;

    vector<int> m(n);
    for(int i = 0; i < m.size(); i++){
        cin >> m[i];
        x -= m[i];

        if(m[i] < min) min = m[i];
    }

    count = n;

    while(x >= min){
        count++; x -= min;
    }

    printf("%d\n", count);
    return 0;
}


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

A_B = []
for i in range(N):
    A, B = map(int, input().split())
    A_B.append([A, B])

A_B_yasui = sorted(A_B, key=lambda x: x[0])

money, drink_hon = 0, 0

for a_b in A_B_yasui:
    a, b = a_b[0], a_b[1]
    if drink_hon + b >= M:
        money += (M - drink_hon) * a
        drink_hon += M - drink_hon
        print(money)
        exit()
    else:
        drink_hon += b
        money += b * a


Measured memory_bytes: 21972
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Integer[] a = new Integer[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a, Collections.reverseOrder());
		int Alice = 0;
		int Bob = 0;
		for (int i = 0; i < n; i++) {
			if (i % 2 == 0) {
				Alice += a[i];
			} else {
				Bob += a[i];
			}
		}
		int sa = Alice - Bob;
		System.out.println(sa);
		sc.close();
	}

}


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


int main() {
    vector<int> v(5);
    for (int i = 0; i < 5; ++i) {
        cin >> v.at(i);
    }
    int k, l; cin >> k;
    for (int i = 0; i < 4; ++i) {
        for (int j = 0; j < 5; ++j) {
            l = v.at(j) - v.at(i);
            if (l > k) {
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>

using namespace std;

const int maxN = 500;

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

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

vector<vector<int>> getPrimes(){
    vector<int> p(100000, 1);
    vector<int> primes;
    for(int i=2;;i++){
        if(!p[i]) continue;
        primes.push_back(i);
        if(primes.size() == 4 * maxN) break;
        for(int j=2*i;j<100000;j+=i) p[j] = 0;
    }
    vector<vector<int>> res(2, vector<int>(2*maxN));
    int seek = 0;
    for(int i=0;i<maxN;i++){
        res[0][2*i] = primes[seek];
        res[0][2*i+1] = primes[3*maxN-1-seek];
        ++seek;
    }
    for(int i=0;i<2*maxN;i++){
        if(i < maxN/4 || maxN/4*7 <= i){
            res[1][i] = res[0][i];
        } else {
            if(i%2 == 0){
                res[1][i] = primes[seek];
            } else {
                res[1][i] = primes[3*maxN-1-seek];
                ++seek;
            }
        }
    }
    return res;
}

vector<vector<long long>> makeBoard(){
    vector<vector<long long>> res(maxN, vector<long long>(maxN, 0));
    auto primes = getPrimes();
    for(int i=0;i<maxN;i++){
        for(int j=i%2;j<maxN;j+=2){
            int idxA = (i+j)/2;
            int idxB = (i-j+maxN-2)/2;
            res[i][j] = (long long)primes[0][idxA] * primes[1][idxB];
        }
    }
    for(int i=0;i<maxN;i++){
        for(int j=1-i%2;j<maxN;j+=2){
            res[i][j] = 1;
            int dx[] = {-1, 0, 1, 0};
            int dy[] = {0, -1, 0, 1};
            for(int k=0;k<4;k++){
                int nx = i + dx[k];
                int ny = j + dy[k];
                if(nx < 0 || maxN <= nx || ny < 0 || maxN <= ny) continue;
                res[i][j] = lcm(res[i][j], res[nx][ny]);
            }
            ++res[i][j];
        }
    }
    return res;
}

int main(){
    int N;
    auto board = makeBoard();
    while(cin >> N){
        for(int i=0;i<N;i++){
            cout << board[i][0];
            for(int j=1;j<N;j++) cout << " " << board[i][j];
            cout << endl;
        }
    }
}

Measured memory_bytes: 5240
package main

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

func main() {
	ReadInt()
	rdr := NewReader(120)
	s := ReadStrs(rdr)

	m := make(map[string]bool)
	for _, c := range s {
		m[c] = true
	}

	if len(m) == 3 {
		fmt.Println("Three")
		return
	}
	if len(m) == 4 {
		fmt.Println("Four")
		return
	}
}

func ReadInt() (i int) {
	fmt.Scan(&i)
	return
}

type Reader struct {
	rdr  *bufio.Reader
	size int
}

func NewReader(size int) *Reader {
	return &Reader{
		bufio.NewReaderSize(os.Stdin, size),
		size,
	}
}

func ReadLine(r *Reader) string {
	buf := make([]byte, 0, r.size)
	for {
		line, isPrefix, err := r.rdr.ReadLine()
		if err != nil {
			panic(err)
		}
		buf = append(buf, line...)
		if !isPrefix {
			break
		}
	}
	return string(buf)
}

func ReadStrs(r *Reader) []string {
	return strings.Split(ReadLine(r), " ")
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	int a,b;
	cin>>a>>b;
	cout<<a*b;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int x[100009];
main(){
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        cin >> x[i];
    }
    sort(x, x + n);
    int ans = 1e9;
    for(int i = 0; i + k - 1< n; i++){
        int a = x[i];
        int b = x[i + k - 1];
        if(b <= 0) ans = min(ans, abs(a)); else
        if(a >= 0) ans = min(ans, b);
        else
        ans = min(ans, abs(a)+abs(b)+min(abs(a),abs(b)));

    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#pragma GCC optimize ("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
static const int mod = 1e9+7;
const Int Inf = 1e17;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rep(i,n) for(int(i)=0; i<n; i++)
#define rer(i,l,r) for(int i=l; i<=r; i++)
#define gnr(i,l,r) for(int i=r; i>=l; i--)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(pri2i,n-1)cout<<a[pri2i]<<' '; cout<<a[n-1]<<'\n';}
#define prip(p) cout<<p.fi<<' '<<p.se<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< typename T >
vector< T > dijkstra(WeightedGraph< T > &g, int s) {
  const auto INF = numeric_limits< T >::max();
  vector< T > dist(g.size(), INF);

  using Pi = pair< T, int >;
  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  dist[s] = 0;
  que.emplace(dist[s], s);
  while(!que.empty()) {
    T cost;
    int idx;
    tie(cost, idx) = que.top();
    que.pop();
    if(dist[idx] < cost) continue;
    for(auto &e : g[idx]) {
      auto next_cost = cost + e.cost;
      if(dist[e.to] <= next_cost) continue;
      dist[e.to] = next_cost;
      que.emplace(dist[e.to], e.to);
    }
  }
  return dist;
}


int n,m,_,x,y,q;
string s,sb;
bool ok;
char cf,cb;

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

  cin>>n>>m>>q; int r[q]; rep(i,q){cin>>x; r[i]=x-1;} int c; WeightedGraph<int>g(n);
  sort(r,r+q);
  rep(i,m){
    cin>>x>>y>>c;
    g[--x].eb(--y,c); g[y].eb(x,c);
  }
  V(int)d[n]; rep(i,n)d[i]=dijkstra(g,i);
  Int ans=Inf;
  do{
    Int cost=0;
    rep(i,q-1)cost+=d[r[i]][r[i+1]];
    cmin(ans,cost);
  }while(next_permutation(r,r+q));
  END
}

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

typedef long long ll;

int main()
{
    int a[5], k;
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>k) {
        int temp = 0;
        for(int i=0;i<5;i++){
            for(int j=i+1;j<5;j++){
                temp = max(temp, abs(a[i]-a[j]));
            }
        }
        if(temp > k) {
            cout<<":("<<endl;
        }
        else{
            cout<<"Yay!"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
bool G[8][8];
int main() {
	int N, M;
	cin >> N >> M;
	vector<int> v;
	for (int i = 0; i < N; i++) {
		v.push_back(i);
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			G[i][j] = 0;
		}
	}
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a][b] = G[b][a] = 1;
	}
	int cnt = 0;
	do {
		if (v[0] != 0) continue;
		bool OK = 1;
		for (int i = 1; i < N; i++) {
			if (!G[v[i - 1]][v[i]]) {
				OK = 0;
				break;
			}
		}
		if (OK) cnt++;
	} while (next_permutation(v.begin(), v.end()));
	cout << cnt << endl;
}

Measured memory_bytes: 256
/*
3 5
.....
.#.#.
.....
*/
fn main() {
    // let h : i32 = 3;
    // let w : i32 = 5;
    // let mut lines = Vec::new();
    // lines.push(".....");
    // lines.push(".#.#.");
    // lines.push(".....");
    let tmp = read_line();
    let h = tmp[0];
    let w = tmp[1];
    let mut lines = Vec::new();
    for _ in 0..h {
        let s = read_line_str();
        lines.push(s.replace("\n", ""));
    }

    let mut cells : Vec<Vec<i32>> = Vec::new();
    for i in 0..h {
        let mut vec = Vec::new();
        for j in lines[i as usize].chars() {
            if j == '.' {
                vec.push(0);
            } else {
                vec.push(-1);
            }
        }
        cells.push(vec);
    }

    for y in 0..h as i32 {
        for x in 0..w as i32 {
            if cells[y as usize][x as usize] == -1 {
                // search
                for dy in (-1 as i32)..2 {
                    for dx in (-1 as i32)..2 {
                        if dx == 0 && dy == 0 {
                            continue;
                        }
                        let nx = x + dx;
                        let ny = y + dy;
                        if nx < 0 || ny < 0 || nx >= w || ny >= h {
                            continue;
                        }
                        if cells[ny as usize][nx as usize] == -1 {
                            continue;
                        }
                        cells[ny as usize][nx as usize] += 1;
                    }
                }
            }
        }
    }

    for vec in cells {
        for v in vec {
            if v == -1 {
                print!("#");
            } else {
                print!("{}", v);
            }
        }
        println!("");
    }
}

fn read_line() -> Vec<i32> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let v = s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect();
    return v
}

fn read_line_str() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s;
}

Measured memory_bytes: 4352
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
Scanner s = new Scanner(System.in);
		int N = Integer.valueOf(s.next());
		int[] ret = new int[N+1];
		
		for(int x = 1; x < 100; x++) {
			for(int y = 1; y < 100; y++) {
				for(int z = 1; z < 100; z++) {
					int cur = calc(x, y, z);
					if(cur <= N) {
						ret[cur]++;
					}else {
						break;
					}
				}
			}
		}
		
		for(int i = 1; i <= N; i++) {
			System.out.println(ret[i]);
		}
		
		
	}
	
	private static int calc(int x, int y, int z) {
		return (x*x + y*y + z*z + x*y + y*z + z*x);
	}
}

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

typedef long long ll;

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

int main(int argc, char *argv[]) {
  ll N, X;
  cin >> N >> X;
  
  vector<ll> x(N);
  fill(x.begin(), x.end(), 0);
  for (int i = 0; i < N; ++i) {
    cin >> x[i];
  }
 
  ll ans = abs(x[0] - X);
  for (int i = 1; i < N; ++i) {
    ll a = ans;
    ll b = abs(x[i] - X);
    if (a < b) {
      ll tmp = a;
      a = b;
      b = tmp;
    }
    ans = gcd(a, b);
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007      //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

#define ifr(i, n) for (int i = (n)-1; i >= 0; --i)

signed main()
{
    int N;
    cin >> N;
    int counter = 0;

   for(int i = 1; i <= N; i +=2){
        int counter2 = 0;
        FOR(j, 1, i){
            if(i % j == 0)
                ++counter2;
            
        }
        if(counter2 == 8)
            ++counter;
    }
    cout << counter << endl;

}

Measured memory_bytes: 256
n = int(input())
div = []
div2 = []
ans = 0
for i in range(1,10**6+1):
    if n%i == 0:
        div+=[i,n//i]
    if (n-1)%i == 0:
        div2+=[i,(n-1)//i]
div = set(div)
div2 = set(div2)
# print(div)
a = [1]
for i in div:
    if i > 1:    
        t = n
        while t:
            if t%i == 0:
                t = t//i
            else:
                if t%i == 1:
                    ans += 1
                    a += [i]
                break
# for i in div2:
#     if i > 1:    
#         t = n-1
#         while t:
#             if t == 1:
#                 ans += 1
#                 a += [i]
#             t //= i
#         # if n%(i-1) == 1:
#         #     ans += 1
#         #     a += [i-1]
# print(ans)
# print(a)
# print(div)
# print(div2)
for i in div2:
    a+=[i]
a = set(a)
# print(a)
print(len(a)-1)

Measured memory_bytes: 9672
main = interact $ unlines . map itp1_7_a . read' . lines
 where read' = map (map read . words) . takeWhile (/= "-1 -1 -1")

itp1_7_a [m,f,r]
 | m == (-1) || f == (-1) = "F"
 | m+f >= 80 = "A"
 | m+f >= 65 = "B"
 | m+f >= 50 = "C"
 | m+f >= 30 = if r >= 50 then "C" else "D"
 | otherwise = "F"

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

int64_t mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    vector<string> list(3);
    for (int i = 0; i < 3; i++)
        cin >> list[i];
    cout << list[0][0] << list[1][1] << list[2][2];
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int s;
  cin >> s;
  map<int, int> cnt;
  cnt[s] = 1;
  for (int i = 2; ; i++) {
    s = (s % 2) ? 3 * s + 1 : s / 2;
    if (cnt[s] == 1) {
      cout << i << endl;
      return 0;
    }
    cnt[s] = 1;
  }
}


Measured memory_bytes: 256
d,a[];c(int*z){d=*z-*1[&z];}main(){for(;~scanf("%d",a);qsort(a,4,4,c));for(d=4;--d;printf("%d\n",a[d])); 
d=a[3];if(d>=20000)return 1;if(d>=18000)puts("");else if(d>=16000)puts("a");else if(d>=14000)while(1);return 0;}

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

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

    int sum = 0;
    int A[N];
    for(int i=0;i<N;++i){
        int a; cin >> a;
        A[i] = a;
        sum += a;
    }

    double average = (double)sum/N;
    int average_ = (int)round(average);

    int cost = 0;
    for(int i=0;i<N;++i){
       cost += (A[i] - average_) * (A[i] -average_); 
    }

    cout << cost << endl;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    int MOD = 1000000007;
    String S = sc.nextLine();
    long[][] dp = new long[100002][13];
    
    dp[0][0] = 1;
    int m = 1;
    for(int i = 1; i <= S.length(); i++){
      int n = S.length()-i;
      char c = S.charAt(n);
      if(c == '?'){
        for(int j = 0; j < 10; j++){
          for(int k = 0; k < 13; k++){
            dp[i][(j*m+k)%13] += dp[i-1][k];
            dp[i][(j*m+k)%13] %= MOD;
          }
        }
      }else{
        int j = (int)(c - '0');
        for(int k = 0; k < 13; k++){
          dp[i][(j*m+k)%13] += dp[i-1][k];
          dp[i][(j*m+k)%13] %= MOD;
        }
      }
      m *= 10;
      m %= 13;
    }
    System.out.println(dp[S.length()][5]);
  }
}

Measured memory_bytes: 38972
using System;
using System.Windows;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

class Program
{
    static void Main(string[] args)
    {
      //入力を受け取る
      var min = long.MaxValue;
      var N = long.Parse(Console.ReadLine());
      
      for(int i = 0; i < 5 ; i++){
        var num = long.Parse(Console.ReadLine());
        if(min > num){
          min = num;
        }
      }
      
      Console.WriteLine((N-1)/min+5);
      
      
      
    }

}


Measured memory_bytes: 13140