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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;
long long int n,cnt=0,ans=0,a[ohara],b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos,even[ohara],odd[ohara];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
  
       cin.tie(0);
    ios::sync_with_stdio(false);
      
      cin>>n;
      ll ma=0,maa=0;
      rep(i,n){
        cin>>a[i];
        if(i%2==0)odd[a[i]]++;
        else even[a[i]]++;
      }
      rep(i,n){
        ma=max(ma,odd[i]);
        maa=max(maa,even[i]);
      }
      ll aa[ohara],bb[ohara],cntt=0;
      rep(i,100001){
        if(odd[i]==ma)aa[cnt++]=i;
        if(even[i]==maa)bb[cntt++]=i;
      }
      rep(i,max(cnt,cntt)){
        if(aa[i]!=bb[i])fl=true;
      }
      if(cnt!=cntt||fl){
      sort(odd,odd+100001);
      reverse(odd,odd+100001);
       sort(even,even+100001);
      reverse(even,even+100001);
      rep(i,100001){
        if(i==0)continue;
        ans+=odd[i];
      }
      rep(i,100001){
        if(i==0)continue;
        ans+=even[i];
      }
      }
      else{
         sort(odd,odd+100001);
      reverse(odd,odd+100001);
       sort(even,even+100001);
      reverse(even,even+100001);
      ll cc=0,dd=0;
      rep(i,100001){
        if(i==1)continue;
        ans+=odd[i];
        cc+=odd[i];
      }
      rep(i,100001){
        if(i==0)continue;
        ans+=even[i];
        dd+=even[i];
      }
      if(cc==0)ans+=n/2;
      cnt=0;
      cc=0;
      dd=0;
      rep(i,100001){
        if(i==0)continue;
        cnt+=even[i];
        cc+=even[i];
      }
      rep(i,100001){
        if(i==1)continue;
        cnt+=even[i];
        dd+=even[i];
      }
      if(dd==0)cnt+=n/2;
      ans=min(ans,cnt);
      //Cout(ans);
      //Cout(cnt);
      }
      Cout(ans);
    
       
return 0;
}


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

#define  ll         long long
#define  llu        unsigned long long
#define  mod        1000000007
#define  pi         ((2.0)*acos(0.0))
#define  pb         push_back
#define  pf         push_front
#define  eb         emplace_back
#define  mp         make_pair
#define  all(x)     (x).begin(),(x).end()
#define  X          first
#define  Y          second

/*loop*/
#define  fr(i,m,n)   for(ll i=m;i<n;++i)

/*output shortcuts*/
#define  nl         "\n"
#define  Yes        cout<<"Yes\n"
#define  yes        cout<<"yes\n"
#define  YES        cout<<"YES\n"
#define  No         cout<<"No\n"
#define  no         cout<<"no\n"
#define  NO         cout<<"NO\n"

ll a[10000000];

/*ll c(ll i,ll n)
{
    if(i>n)
        return 0;

    return abs(a[i]-a[i+1]);
}*/
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n;
    cin>>n;

    ll a[n];
    fr(i,0,n)
    cin>>a[i];

    ll dp[n];
    dp[n-1]=0;

    for(ll i=n-2; i>=0; i--)
    {
       if(i+2 < n) dp[i]= min( (dp[i+1] + abs(a[i]-a[i+1]) ) , (dp[i+2] + abs(a[i]-a[i+2]) ) );
       else
        dp[i] = dp[i+1] + abs(a[i] - a[i+1]);
    }

    cout<<dp[0]<<nl;

return 0;
}



Measured memory_bytes: 5212
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdint.h>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);
static const ll MOD = 1000000007;

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

void solve(std::string S) {
  if (S == "ARC") {
    cout << "ABC" << endl;
  } else {
    cout << "ARC" << endl;
  }
}

int main() {
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
long long read()
{
	char ch=getchar();long long x=0,ff=1;
	while(ch<'0'||ch>'9') {if(ch=='-') ff=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*ff;
}
void write(long long aa)
{
	if(aa<0) putchar('-'),aa=-aa;
	if(aa>9) write(aa/10);
	putchar('0'+aa%10);
	return;
}
long long n,ans,sum;
long long tot,head[2005],nx[4005],to[4005];
long long dis[2005],sz[2005],f[2005],g[2005];
char s[2005];
void jia(long long aa,long long bb)
{
	tot++;
	nx[tot]=head[aa];
	to[tot]=bb;
	head[aa]=tot;
	return;
}
void dfs(long long rt,long long fa,long long dep)
{
	sz[rt]=dis[rt];f[rt]=0;g[rt]=0;
	long long mx=0,mxs=0,F=0;
	for(long long i=head[rt];i;i=nx[i])
	{
		long long yy=to[i];
		if(yy==fa) continue;
		dfs(yy,rt,dep+1);
		sz[rt]+=sz[yy];
		f[rt]+=f[yy]+sz[yy];
		g[rt]+=g[yy]+sz[yy];
		if(f[yy]+sz[yy]>=mx) mx=f[yy]+sz[yy],mxs=yy;
	}
	for(long long i=head[rt];i;i=nx[i])
	{
		long long yy=to[i];
		if(yy==fa) continue;
		if(f[yy]+sz[yy]>g[rt]-g[yy]-sz[yy]) 
		f[rt]=f[yy]+sz[yy]-g[rt]+g[yy]+sz[yy],F=1;
	}
	if(!F) f[rt]%=2;
	return;
}
int main()
{
	n=read();ans=1e9;
	cin>>s;
	for(long long i=0;i<n;++i) dis[i+1]=s[i]-'0';
	for(long long i=1;i<n;++i) 
	{
		long long x=read(),y=read();
		jia(x,y);jia(y,x);
	}
	for(long long i=1;i<=n;++i) 
	{
		sum=0;dfs(i,i,0);
		if(!f[i]) ans=min(ans,g[i]/2);
	}
	if(ans==1e9) puts("-1");
	else write(ans);
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
 int dp[50];
 
int f( int n ){
  if ( n == 0 || n == 1)return dp[n] =1;
  if ( dp[n] != -1 )return dp[n];
  return dp[n] = f( n - 1 ) + f( n - 2 );//??????°
}
 
int main(){
  int n,i;
  for( i = 0 ; i <=44 ; i++)dp[i] = -1;
 
  scanf("%d",&n);
  printf("%d\n",f(n));
 
  return 0;
}

Measured memory_bytes: 596
N, M = map(int, input().split(' '))
count = [0 for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split(' '))
    count[a - 1] += 1
    count[b - 1] += 1

if all([c % 2 == 0 for c in count]):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 4724
#include<iostream>
using namespace std;
int main() 
{
	string s;
	cin>>s;
	int l=s.length() ;
	int k=(l+1)/2;
	int g=0;
	for(int i=0;i<k;i++)
	{
		if(s[i]!=s[l-1-i])
		{
			g=1;
			break;
		}
	}
	k=(l-1)/2;
	for(int i=0;i<k/2;i++)
	{
		if(s[i]!=s[k-1-i])
		{
			g=1;
		}
	}
	k=l-(l+3)/2;
	int t=(l+1)/2;
	for(int i=t;i<t+k/2;i++)
	{
		if(s[i]!=s[l-1-i])
		{
			g=1;
		}
	}
	if(g==0)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func reverse(S string) string {
	s := []byte(S)
	for i := 0; i < len(s)/2; i++ {
		s[i], s[len(s)-1-i] = s[len(s)-1-i], s[i]
	}
	out(string(s))
	return string(s)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	s, t := getString(), getString()

	for i := 0; i < len(s); i++ {
		s = s[len(s)-1:] + s[:len(s)-1]
		if s == t {
			out("Yes")
			return
		}
	}
	out("No")
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

priority_queue<ll> PrimeFact(ll N){
  priority_queue<ll> que;

  while(1){
    bool isPrime = true;
    for(ll i = 2LL ; i*i <= N ; i++){
      if(N % i == 0LL){
        que.push(i);
        N /= i;
        isPrime = false;
        break;
      }
    }
    if(isPrime){
      que.push(N);
      break;
    }
  }

  return que;
}

//========================================
int main(){
  int N;
  cin >> N;
  ll a[N];
  for(int i=0;i<N;i++) cin >> a[i];

  priority_queue<ll> q1 = PrimeFact(a[0]);
  priority_queue<ll> q2 = PrimeFact(a[1]);

  ll ans1 = 1;
  ll t[N];
  for(int i=0;i<N;i++) t[i] = a[i];
  bool pos_dfd = false;
  while(!q1.empty()){
    ll x = q1.top();
    q1.pop();
    int cnt = 0;
    int pos = -1;
    for(int i=0;i<N;i++){
      if(t[i] % x == 0LL) cnt++;
      else {
        if(!pos_dfd) pos = i;
      }
    }

    if(cnt == N){
      ans1 *= x;
      for(int i=0;i<N;i++) t[i] /= x;
    }
    else if(cnt == N - 1 && !pos_dfd){
      ans1 *= x;
      pos_dfd = true;
      t[pos] = a[0];
      for(int i=0;i<N;i++) t[i] /= x;
    }
  }

//-------------------------------------------
  ll ans2 = 1;
  for(int i=0;i<N;i++) t[i] = a[i];
  pos_dfd = false;
  while(!q2.empty()){
    int x = q2.top();
    q2.pop();
    int cnt = 0;
    int pos = -1;
    for(int i=0;i<N;i++){
      if(t[i] % x == 0) cnt++;
      else {
        if(!pos_dfd) pos = i;
      }
    }

    if(cnt == N){
      ans2 *= x;
      for(int i=0;i<N;i++) t[i] /= x;
    }
    else if(cnt == N - 1 && !pos_dfd){
      ans2 *= x;
      pos_dfd = true;
      t[pos] = a[1];
      for(int i=0;i<N;i++) t[i] /= x;
    }
  }

  cout << max(ans1, ans2) << endl;
}

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

int main() {
	
	int n;
	cin >> n;
	for(int i = 111; i <= 999; i += 111){
		if(i >= n){
			cout << i << endl;
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    int main(){
    int a,b,c,d;
    cin>>a>>b>>c;
     
    if(b>=c)
    cout<<"delicious"<<endl;
    else if(c-b<=a)
    cout<<"safe"<<endl;
    else
    cout<<"dangerous"<<endl;
    return(0);
    }

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

int main() {
  double T, X;
  cin >> T >> X;
  cout << T / X << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

int n;
int a[100000];
int cp[100000];

int find(int x) {
    return lower_bound(cp, cp + n, x) - cp ;
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", cp + i);
        a[i] = cp[i];
    }
    sort(cp, cp + n);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        a[i] = find(a[i]);
        ans += (a[i] ^ i) & 1;
    }
    printf("%d\n", ans >> 1);
    return 0;
}


Measured memory_bytes: 1024
from collections import Counter

N = int(input())
As = list(map(int, input().split()))

d = Counter(As)
S = sum(k*v for k, v in d.items())
Q = int(input())
for _ in range(Q):
    B, C = map(int, input().split())
    if B in d:
        S += d[B] * (C-B)
        d[C] += d[B]
        d[B] = 0
    print(S)


Measured memory_bytes: 94340
Public Class Program
  Shared Sub Main()
    Dim nkq As Long() = Array.ConvertAll(Of String, Long)(Console.ReadLine().Split(" "), AddressOf Long.Parse)
    Dim n As Long = nkq(0)
    Dim k As Long = nkq(1)
    Dim q As Long = nkq(2)
    Dim a(0 To n - 1) As Long
    For i As Long = 0 To n - 1
      a(i) = 0
    Next
    For i As Long = 0 To q - 1
      a(Long.Parse(Console.ReadLine()) - 1) += 1
    Next
    For i As Long = 0 To n - 1
      If k - q + a(i) > 0 Then
        Console.WriteLine("Yes")
      Else
        Console.WriteLine("No")
      End If
    Next
  End Sub
End Class

Measured memory_bytes: 16092
#include <iostream>
#include <algorithm>
#ifdef _MSC_VER
#define __builtin_popcount(x) (__popcnt(x))
#endif
using namespace std;
int a, b, c, d, e, f;
int main() {
	while (cin >> a >> b >> c >> d >> e >> f, a | b | c | d | e | f) {
		int x[3] = { a + d, b + e, c + f }, r = 0;
		for (int i = 0; i < 8; i++) {
			int ok = 1;
			for (int j = 0; j < 3; j++) {
				if ((i & (1 << j)) && x[j] < 3) ok = 0;
			}
			if (!ok) continue;
			int y[3] = { x[0], x[1], x[2] };
			int z = y[0] / 3 + y[1] / 3 + y[2] / 3 - __builtin_popcount(i), w = 999999999;
			for (int j = 0; j < 3; j++) w = min(w, y[j] % 3 + ((i & (1 << j)) ? 3 : 0));
			r = max(r, z + w);
		}
		cout << r << endl;
	}
}

Measured memory_bytes: 3080
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#include <list>
#define MOD 1000000007
#define INF 1000000000
typedef long long ll;
using namespace std;
typedef pair<int,int> P;

int main(void){
    string sa,sb,sc;
    cin>>sa;
    cin>>sb>>sc;
    char turn='a';
    int na=0,nb=0,nc=0;
    while(1){
        if(turn=='a'){
            if(na==sa.size())break;
            turn=sa[na++];
        }else if(turn=='b'){
            if(nb==sb.size())break;
            turn=sb[nb++];
             
        }else{
            if(nc==sc.size())break;
            turn=sc[nc++];
        }
    }
    if(turn=='a')printf("A\n");
    else if(turn=='b')printf("B\n");
    else printf("C\n");
    return 0;
}


Measured memory_bytes: 256
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() { 
    int n;cin >> n;
    vector<int> money;
    money.pb(1);
    int k = 1;
    rep1(i, 7) {
        k*=6;
        money.pb(k);
    }
    k=1;
    rep(i, 6) {
        k*=9;
        money.pb(k);
    }
    sort(all(money));
    vi ans(114514,inf);
    ans[0]=0;
    sort(all(money));
    rep(i, 100000) {
        rep(j, 14) {
            if(i+money[j]>100000) break;
            chmin(ans[i+money[j]],ans[i]+1);
        }
    }
    cout << ans[n] << endl;
    return 0;
}

Measured memory_bytes: 4020
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;

    int ans = 0;
    for(int i = 0;i < 1000;i++){
        int c[3] = {i/100,i/10%10,i%10};
        int cnt = 0;
        for(int j = 0;j < n;j++){
            if(s[j]=='0'+c[cnt])cnt++;
            if(cnt == 3){
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
answer = [0 for _ in range(N)]

for _ in range(M):
    s, c = map(int, input().split())

    if not N == 1:
        if s == 1 and c == 0:
            print(-1)
            exit()

    if answer[s-1] == 0:
        answer[s-1] = c
    else:
        if not answer[s-1] == c:
            print(-1)
            exit()

if answer[0] == 0 and not N == 1:
    answer[0] = 1

print("".join(list(map(str, answer))))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int int64_t

signed main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n,i;
    cin>>n;

    if(n>=30)
        cout<<"Yes";
    else
        cout<<"No";
    

    return 0;
}




Measured memory_bytes: 3648
using System;
class test{
    static void Main(string[] args){
        int a,b;
        string[] str = Console.ReadLine().Split(' ');
        a=int.Parse(str[0]);
        b=int.Parse(str[1]);
        Console.WriteLine("{0} {1}",a*b,a*2+b*2);
    }
}


Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  string s;cin >> s;
  int w;cin >> w;
  for(int i = 0; i<s.length(); i+=w){
    cout << s[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
#define inf             1e18
#define mod             1000000007
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r;








void sol()
{   
    cin>>n;
    in(a,n);
    mii m;
    for(auto c:a)m[c]++;
    sort(all(a));
    c=0;
    fo(i,n)
    {
        if(m[a[i]]==1) c++;
        for(int j=a[i];j<=a[n-1];j+=a[i])m[j]=0;
        
    }
    
    
    cout<< c<<endl;
}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)
    sol();
    return 0;
}

Measured memory_bytes: 66996
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<utility>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+9
#define EPS 1e-9
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = j; i < (k); i++)
typedef long long ll;
bool us[10000010]={false};
int p[10000010] = {0};
int main(){
     /*Eratosthenes*/
    p[0] = 2;
    for(int i = 0; i <= 10000010; i+=2){
        us[i] = true;
    }
    int cnt = 1;
    for(int i = 3; i <= 10000010; i+=2){
        int q = 0;
        if(us[i] == true)continue;
        else if(us[i] == false){
            p[cnt] = i;
            ++cnt;
            us[i] = true;
            q = i;
            for(int j = q+q; j <= 10000010; j += q){
                us[j] = true;
            }
        }
    }
    int n;
    while(scanf("%d",&n),n){
        int ans = 0;
        for(int i = 3;p[i] < n+1;i++){
            if(p[i]-2 == p[i-1] && p[i]-6 == p[i-2] && p[i]-8 == p[i-3])ans = p[i];
        }
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 50016
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
vector<int> v;

int main(void){
	scanf("%d",&n);
	m=(n+1)/2;
	double at=m;
	at=at/n;
	printf("%lf\n",at);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
    
int main() {
    int N, X;
    cin >> N >> X;
    int m[N];
    for(int i=0; i<N; ++i) cin >> m[i];

    int cnt = N;
    int sum=0;
    int min = 100005;
    for(int i=0; i<N; ++i) {
        sum += m[i];
        if(m[i]<min) min = m[i];
    }
    cnt += (X-sum)/min;

    cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

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

        List<Integer> list = new ArrayList<>();

        int result = 0;
        for (int i = 1; i <= N; i++) {
            String str = String.valueOf(i);
            //System.out.println("str：" + str);
            int sum = 0;

            //各桁に分ける
            for (int j = 0; j < str.length(); j++) {
                String s = str.substring(j, j+1);
                //System.out.println("s：" + s);
                int x = Integer.parseInt(s);
                //各桁の和
                sum += x;
            }

            //各桁の和が条件に合うか判定し合うものは足す
            if (A <= sum && sum <= B) {
                //System.out.println("sum：" + sum);
                result += i;
            }

        }
        System.out.println(result);
    }

}

Measured memory_bytes: 24276
#include <stdio.h>

int main(void) {
	int n, m, l;
	scanf("%d%d%d", &n, &m, &l);
	long int A[n][m];
	long int B[m][l];
	long long int C[n][l];
	int i, j, k;
	for (i=0; i<n; i++)
	{
		for (j=0; j<m; j++)
		{
			scanf("%ld", &A[i][j]);
		}
	}
	for (i=0; i<m; i++)
	{
		for (j=0; j<l; j++)
		{
			scanf("%ld", &B[i][j]);
		}
	}
	for (i=0; i<n; i++)
	{
		for (j=0; j<l; j++)
		{
			C[i][j]=0;
			for (k=0; k<m; k++)
			{
				C[i][j]+=A[i][k]*B[k][j];	
			}
		}
	}
	for (i=0; i<n; i++)
	{
		for (j=0; j<l-1; j++)
		{
			printf("%lld ", C[i][j]);
		}
		printf("%lld\n", C[i][l-1]);
	}
	return 0;
}

Measured memory_bytes: 832
#include <iostream>
#include <vector>
#include <string.h>
using namespace std;

//1-indexed!
class strong_components{
private:
    vector<vector<int>> v,rv,nv;
    vector<int> rs,visited,cmp,cmp_size;
    void dfs(int n){
        visited[n] = 1;
        for(auto x:v[n]) if(!visited[x]) dfs(x);
        rs.push_back(n);
    }
    void rdfs(int n,int cnt){
        visited[n] = 1;
        cmp[n] = cnt;
        for(auto x:rv[n]) if(!visited[x]) rdfs(x,cnt);
    }
public:
    strong_components(int N,vector<vector<int>>& graph){
        v = graph;
        rv = vector<vector<int>>(N+1);
        visited = cmp = cmp_size = vector<int>(N+1,0);
        for(int i=1;i<=N;i++) for(auto x:v[i]) rv[x].push_back(i);
        for(int i=1;i<=N;i++) if(!visited[i]) dfs(i);
        for(int i=1;i<=N;i++) visited[i] = 0;
        int now = 1;
        for(int i=rs.size()-1;i>=0;i--) if(!visited[rs[i]]) rdfs(rs[i],now++);
        nv = vector<vector<int>>(now+1);
        for(int i=1;i<=N;i++){
            for(auto x:v[i]){
                if(cmp[i]!=cmp[x]){
                    nv[cmp[i]].push_back(cmp[x]);
                    cmp_size[cmp[x]]++;
                }
            }
        }
    }
    int find(int n){return cmp[n];}
    bool is_same_group(int a,int b){return cmp[a]==cmp[b];}
};


int main(){
    int N,M;
    cin >> N >> M;
    vector<vector<int>> v(N+1);
    for(int i=1;i<=M;i++){
        int a,b;
        cin >> a >> b;
        v[a].push_back(b);
    }
    strong_components scc(N,v);
    vector<vector<int>> ans(N+1);
    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
            if(scc.is_same_group(i,j)) ans[i].push_back(j);
        }
    }
    for(int i=1;i<=N;i++){
        int n = ans[i].size();
        for(int j=0;j<n;j++) cout << ans[i][j] << (j!=n-1? " ":"\n");
    }
}


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

int main()
{
  long long n, m;
  long long ans;
  long long temp;
  
  cin >> n >> m;

  ans = n * m;
  if ( n > m ) {
    temp = n;
    n = m;
    m = temp;
  }
  
  if ( n == 1 ) {
    ans -= 2;
  } else {
    ans -= 4;
  }

  if ( n >= 2 && m >= 3) {
    ans -= (n - 2) * 2 + (m - 2) * 2;
  }

  if ( n != 1 || m != 1) {
    cout << ans << endl;
  } else {
    cout << 1 << endl;
  }

  return (0);
}

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

int main(){
	int N;
	cin >> N;
	string ans;
	if(N==0){
		cout << 0 << endl;
		return 0;
	}
	while(N!=0){
		if(N%2==0) ans+='0';
		else{
			ans+='1';
			N-=1;
		}
		N=N/(-2);
	}
	reverse(ans.begin(),ans.end());
	cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <cstdlib>
 
int main(){
int a,v,b,w,t;
cin >> a >> v;
cin >> b >> w;
cin >>t;
int ans=(v-w)*t-abs(a-b);
if(abs(w)-abs(v)>=0){
	cout<<"NO"<<endl;
}else if(ans>=0){
	cout<<"YES"<<endl;
}else if(ans<0){
	cout<<"NO"<<endl;
}  
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main(){
    int H, W;

    while(true){
        cin >> H >> W;
        if(H == 0 && W == 0)
            break;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if((i % 2 == 0 && j % 2 == 0) || (i % 2 == 1 && j % 2 == 1)){
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
int main()
{
   ll n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++)
     cin>>a[i];
  ll ans=0;
  ll st=1;
  for(int i=0;i<64;i++)
  {
    ll c1=0,c2=0;
    for(int j=0;j<n;j++)
    {
     if(a[j]&1)
       c2++;
      else
        c1++;
      a[j]/=2;
    }
    ans=(ans+((st%mod*(c1%mod*c2%mod)%mod)%mod)%mod)%mod;
    st=st*2;
    st%=mod;
  }
  cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 2560
#include <algorithm>
#include <iostream>
#include "vector"
#include "stack"
#include "utility"
#include "bits/stdc++.h"

using namespace std;
//vector<long long> factors;
#define ll long long

#define pii pair<int,int>
#define pll pair<ll,ll>
#define _ <<'\n'
#define __ << ' '
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
int IT_MAX = 1 << 17;
int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x0f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
#define szz(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(false); cout.tie(0);cin.tie(0);
#define flush fflush(stdout)

ll mod(ll a, ll m) { return (a + (abs(a) / m) * m + m) % m; }

ll bp(ll n, ll pw) {
    if (pw == 0) {
        return 1;
    } else if (pw % 2 == 0) {
        ll res = bp(n, pw / 2);
        return (res * res) % MOD;
    } else {
        ll res = bp(n, pw / 2);
        return ((res * res % MOD) * n) % MOD;
    }
}

vector<ll> fac_pre(1010101);

int main() {
    IOS

    ll x, y;
    cin >> x >> y;
    fac_pre[0] = 1;
    for (int i = 1; i < fac_pre.size(); ++i) {
        fac_pre[i] = i * fac_pre[i - 1] % MOD;
    }


    if (x * 2 >= y && y * 2 >= x && (x + y) % 3 == 0) {
        ll n = (x + y) / 3;
        ll k = n / 2;
        k -= (x + y) / 2 - min(x, y);

        ll znam = fac_pre[n];
        ll chils = fac_pre[k] * fac_pre[n - k] % MOD;
        cout << (znam * bp(chils, MOD - 2)) % MOD;
    } else {
        cout << 0;
    }

    return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
const ll L = 2e5 + 5;
ll ans[L];
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	ll n;
 	cin >> n;
 	vector <ll> vec(n + 2);
 	for (ll i = 2; i <= n; i++) cin >> vec[i];
 	for (ll i = n; i >= 2; i--) {
 		ans[vec[i]]++;
 	}
 	for (ll i = 1; i <= n; i++) {
 		cout << ans[i] << endl;
 	}
	return 0;
}

Measured memory_bytes: 6368
#include<cstdio>
#include<cmath>
#include<algorithm>
#define EPS 1e-6	

struct pt {
	int x, y;
	pt(){};
	pt(int _x, int _y) : x(_x), y(_y){};


	bool operator<(pt p) {
		return(x < p.x || (x == p.x && y < p.y));
	}

	bool operator==(pt p) const {
		return(x == p.x && y == p.y);
	};
};

pt points[100];


typedef std::pair<pt, pt> seg;

inline pt operator-(pt a, pt b) {
	return pt(a.x-b.x, a.y-b.y);
}

inline double cross(pt a, pt b) {
	return(a.x*b.y - a.y*b.x);
}

inline bool ccw(pt a, pt b, pt c) {
	return cross(b-a, c-a) >= 0;
}

inline double dot(pt a, pt b) {
	return (a.x*b.x + a.y*b.y);
}


void find(pt p, int numPoints) {
	double r;
	pt pa, pb;
	bool cut = false;

	// assume that there is a horizontal line ray with 
	// p as its origin in the easterly direction
	for (int i = 0; i < numPoints; ++i) {
		if (p == points[i]) {
			printf("1\n");
			return;
		}
		
		pa = points[i] - p;
		pb = points[(i+1)%numPoints] - p;

		// check that vectors are parallel && 
		// have 0 distance between the two
		// i.e. are collinear
		if (cross(pa, pb) == 0 && dot(pa, pb) <= EPS) {
			printf("1\n");
			return;
		}

		// otherwise check if p-ray cuts across ab
		if (pa.y < pb.y) {
			pt temp = pa;
			pa = pb;
			pb = temp;
		}

		// pa points more up
		// pb points more down
		// i.e. ab is a vaguely vertical interval
		if (pa.y >= 0 && pb.y < 0) {
			// p-ray cuts between a and b
			if (cross(pa,pb) > 0) cut = (!cut);
		}

				
	}
	if (cut) {
		printf("2\n");
	} else {
		printf("0\n");
	}
}

int main() {
	int numPoints, numTests, val, a, b;
	scanf("%d", &numPoints);
	for (int i = 0; i < numPoints; ++i) {
		scanf("%d %d", &a, &b);
		points[i] = pt(a, b);
	}

	scanf("%d", &numTests);
	for (int i = 0; i < numTests; ++i) {
		scanf("%d %d", &a, &b);
		find(pt(a,b), numPoints);
	}

	return 0;
}


Measured memory_bytes: 2672
n, x, m = map(int, input().split())
count=x
now=x
flag=-1
sled=[now]
for i in range(1,n):
     now=(now*now)%m
     if now==0:
         flag=0
         break
     if now in sled:
         start=sled.index(now)
         nokori=n-i
         flag=2
         break
     
     else:
         sled.append(now)
     count+=now
     #print(i,now,count)

if flag==2:
    #print(count)
    sled=sled[start:]
    roopnum=int(nokori/len(sled))
    amari=nokori%len(sled)
    
    one_roop=sum(sled)
    count+=one_roop*roopnum
    #print(count)
    for i in range(amari):
        count+=sled[i]
print(count)

Measured memory_bytes: 68432
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll S,W;
    cin >>S>>W;
    
    if(S<=W){
        cout<<"unsafe"<<endl;
    }else{
        cout<<"safe"<<endl;
    }
  


    return 0;
    

}

Measured memory_bytes: 3616
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll x;
    cin >> x;
    cout << (2199-x)/200 << endl;
}

Measured memory_bytes: 3688
# -*- coding: utf-8 -*-
# ALDS1_3_B_queue

from queue import Queue

def processing(p, d, now, q):
    name, time = p.get()
    
    if time <= q:
        now += time
        d.append([name, now])
    else:
        now += q
        time -= q
        p.put([name, time])
    
    return p, d, now

p = Queue()
now = 0
d = []

n, q = map(int, input().split())

for _ in range(n):
    name, time = input().split()
    time = int(time)
    p.put([name,time])
    
while not p.empty():
    p, d, now = processing(p, d, now, q)
        
for name, time in d:
    print(name, time)


Measured memory_bytes: 16188
import copy
h,w = map(int, input().split()) 
map=[[-1]*w for i in range(h)]

for i in range(h):
    s=input()
    for j in range(w):
        if s[j]=="#":
            map[i][j]=-2

zanteisaidai=0

def saidaikyori(saisyo_gyou,saisyo_retu,saidaiti):
    map_copy=copy.deepcopy(map)
    map_copy[saisyo_gyou][saisyo_retu]=0
    kyori=0
    while kyori<300:
        for gyou in range(h):
            for retu in range(w):
                if map_copy[gyou][retu]==kyori:
                    if gyou+1<h:
                        if map_copy[gyou+1][retu]==-1:
                            map_copy[gyou+1][retu]=kyori+1
                    if 0<=gyou-1:
                        if map_copy[gyou-1][retu]==-1:
                            map_copy[gyou-1][retu]=kyori+1
                    if retu+1<w:
                        if map_copy[gyou][retu+1]==-1:
                            map_copy[gyou][retu+1]=kyori+1
                    if 0<=retu-1:
                        if map_copy[gyou][retu-1]==-1:
                            map_copy[gyou][retu-1]=kyori+1

        kyori+=1
    
    for gyou in range(h):
        for retu in range(w):
            saidaiti=max(saidaiti,map_copy[gyou][retu])
    return saidaiti

for gyou in range(h):
    for retu in range(w):
        if map[gyou][retu]==-1:
            zanteisaidai=saidaikyori(gyou,retu,zanteisaidai)

print(zanteisaidai)

Measured memory_bytes: 75720
#include<stdio.h>

int main(void)
{
  int n, i;
  char s[101], a[51];
  
  scanf("%d%s",&n,s);
  
  for(i=0;i<n/2;i++){
    a[i]=s[i];
  }
  
  i=0;
  while((a[i]==s[n/2+i])&&(a[i]!='\0')){
    i++;
  }
  
  if((n/2==i)&&(n%2!=1)) printf("Yes\n");
  else printf("No\n");
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define mod 1000000007
typedef long long ll;
using namespace std;

const int M = (int)(2e6 + 239);


int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast

    double a,b,c,d;
    cin>>a>>b>>c>>d;
    if(b>=c)
    {
        cout<<"Yes"<<endl;
        return 0;
    }
    else if(a<=d)
    {
        cout<<"No"<<endl;
    }
    else
    {
        double x1=c/b;
        double x2=a/d;
        if(x2!=(int)x2)
        {
            x2++;
        }
        if(x1!=(int)x1)
        {
            x1++;
        }
        //cout<<x1<<" "<<x2<<endl;
        if(x1>x2)
        {
            cout<<"No"<<endl;
        }
        else
        {
            cout<<"Yes"<<endl;
        }
    }
}


Measured memory_bytes: 3740
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <map>
#include<numeric>
using namespace std;
#define rep(i,n) for(int i=0; i<(n);i++)
typedef long long ll;


int main(){
    int x, n; cin >> x >> n;
    vector<int> p(n, 100);
    rep(i,n) cin >> p[i];
    int diff = 1000;
    int ans = 0;
    rep(i, 102){
        if(count(p.begin(), p.end(), i)) continue;
        if(diff > abs(x - i)){
            diff = abs(x - i);
            ans = i;
        }
    }
    cout << ans << endl;
	return 0;
}


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

using namespace std;

#define ll long long

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

    vector<int> w, v;
    for(int i = 0; i < N; i++)
    {
        int weight, value;
        cin >> weight >> value;
        w.push_back(weight);
        v.push_back(value);
    }

    // dp[i][j] - maximum value using i items with weight at most j
//    vector<vector<ll>> dp(N+1, vector<ll>(W+1, 0));
//    dp[0][0] = 0;

//    for(int i = 1; i <= N; i++)
//    {
//        for(int j = 0; j <= W; j++)
//        {
//            if(j-w[i-1] >= 0)
//                dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i-1]] + v[i-1]);
//            else
//                dp[i][j] = dp[i-1][j];
//        }
//    }

//    cout << dp[N][W] << endl;

    // dp[i][j] - max value using items UP TO i having weight at most j
    vector<vector<ll>> dp(N, vector<ll>(W+1, 0));
    dp[0][0] = 0;

    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j <= W; j++)
        {
            if(i == 0)
            {
                if(w[i] <= j)
                    dp[i][j] = v[i];
            }
            else {
            if(j-w[i] >= 0)
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]] + v[i]);
            else
                dp[i][j] = dp[i-1][j];
            }
        }
    }

    cout << dp[N-1][W] << endl;

    return 0;
}


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

int n;
int arr[200800];

int32_t main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    int id = 1, cnt = 0;
    
    for(int i = 0; i < n; i++)
        if(arr[i] == id)
            cnt++, id++;
    
    if(cnt == 0) puts("-1");
    else cout << n - cnt << '\n';
    
    return 0;
}

/*

    3 1 4 1 5 9 2 6 5 3
      1         2     3
      
*/

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#define PI 6.28318530717958623200
#define ll long long 
using namespace std;
int main()
{
    ll n,m,sum=0;
    cin>>n>>m;
    ll a[m];
    for(int i=0;i<m;i++){
        cin>>a[i];
        sum+=a[i];
    }
    if(sum<=n)cout<<n-sum;
    else cout<<-1;
}



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

int main() {
    string s;
    while (cin >> s) {
        int n = s.length();
        int ans = 0;
        int i = 0;
        while (i < n) {
            int cnt_j = 0, cnt_o = 0, cnt_i = 0;
            while (i < n && s[i] != 'J') i++;
            while (i < n && s[i] == 'J') i++, cnt_j++;
            while (i < n && s[i] == 'O') i++, cnt_o++;
            while (i < n && s[i] == 'I') i++, cnt_i++;
            if (cnt_o <= cnt_i && cnt_o <= cnt_j && ans < cnt_o) ans = cnt_o;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3988
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;

const int MaxN = 800;
int n, m, K, head, tail;
int a[MaxN + 5][MaxN + 5];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
struct Node {
	int x, y, step;
	void make(int tx, int ty, int tstep) {
		x = tx; y = ty; step = tstep;
	}
}S, seq[MaxN * MaxN * 2 + 5];
bool Inseq[MaxN + 5][MaxN + 5];


void Init()
{
	for (int i = 1; i <= n; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < m; j++) 
			if (s[j] == '.') a[i][j + 1] = 0;
				else if (s[j] == '#') a[i][j + 1] = 1;
					else a[i][j + 1] = 2, S.x = i, S.y = j + 1;
	}
}

bool Check(int x, int y, bool flag)
{
	if (x < 1) return false;	
	if (x > n) return false;
	if (y < 1) return false;
	if (y > m) return false;
	if (Inseq[x][y]) return false;
	if (!flag && a[x][y] == 1) return false;
	return true;
}

void Bfs1()
{
	head = 1, tail = 0;
	memset(Inseq, 0, sizeof(Inseq));
	S.step = 0;
	seq[++tail] = S;
	Inseq[S.x][S.y] = true;
	while (head <= tail) {
		Node now = seq[head];	
		if (now.step >= K) {head++; continue;}
		for (int i = 0; i < 4; i++) {
			int nx = now.x + dx[i];
			int ny = now.y + dy[i];
			if (Check(nx, ny, 0)) {
				Node t;	t.make(nx, ny, now.step + 1);
				seq[++tail] = t;
				Inseq[nx][ny] = true;
			}
		}
		head++;
	}
}

void Bfs2()
{
	for (int i = 1; i <= tail; i++) seq[i].step = 0;
	head = 1;
	//printf("%d %d\n", head, tail);
	while (head <= tail) {
		Node now = seq[head];
		for (int i = 0; i < 4; i++) {
			int nx = now.x + dx[i];
			int ny = now.y + dy[i];
			if (Check(nx, ny, 1)) {
				Node t; t.make(nx, ny, now.step + 1);
				seq[++tail] = t;
				Inseq[nx][ny] = true;
			}
		}
		head++;
	}
	int ans = 1 << 30;
	for (int i = 1; i <= tail; i++) {
		if (seq[i].x == 1 || seq[i].x == n || seq[i].y == 1 || seq[i].y == m)
			ans = min(ans, (seq[i].step + K - 1) / K + 1);
	}
	printf("%d\n", ans);
}

int main()
{
	while (~scanf("%d%d%d", &n, &m, &K)) {
		Init();
		Bfs1();
		Bfs2();
	}
	return 0;
}

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

int main(){

  while(1){
    int a, b;
    char op;
    cin >> a >> op >> b;

    switch(op){
      case '+':
        cout << a + b << endl;
        break;
      case '-':
        cout << a - b << endl;
        break;
      case '*':
        cout << a * b << endl;
        break;
      case '/':
        cout << a / b << endl;
        break;
      case '?':
        return 0;
    }
  }
}



Measured memory_bytes: 3096
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

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

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <math.h>

int main() {
	int n;
	while (scanf("%d", &n) != EOF) {
		int dp[2];
		dp[0] = n / 1000;
		dp[1] = (dp[0] + 1);
		printf("%d\n", dp[n % 1000 != 0 ? 1 : 0] * 1000 - n);
	}
	return (0);
}


Measured memory_bytes: 1724