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

using namespace std;

#define sz(v)           ((int)((v).size()))
#define clr(v, d)       memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0; i<sz(v); ++i)
#define lp(i, n)        for(int i=0; i<(int)(n); ++i)
#define lpi(i, j, n)    for(int i=(j); i<(int)(n); ++i)
#define lpd(i, j, n)    for(int i=(j); i>=(int)(n); --i)
#define INF             1000000000

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int N = 35;

bool arr[N];

int main()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	string str = "";
	cin >> n;
	if(n == 0)
		cout << 0;
	while(n != 0){
		str = ((n % -2 == 0)? "0" : "1") + str;
		n = (n / -2) + (((n % -2) < 0) ? 1 : 0);
	}	cout << str;
	return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())

    for n in range(1, 3501):
        for h in range(1, 3501):
            b = 4 * h * n - N * n - N * h
            if b > 0:
                w = N * h * n / b
                if w.is_integer():
                    print("{} {} {}".format(n, h, int(w)))
                    exit()

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <cstdio>
const int mod = 1000000007;
char s[10010];
long long dp[110], t[110];
void add(long long &v, long long x) {
	v += x;
	if (v >= mod) v -= mod;
}
int main() {
	int d;
	scanf("%s%d", s, &d);
	int a = 0;
	for (int i = 0; s[i]; i++) {
		s[i] -= '0';
		for (int j = 0; j < d; j++) {
			t[j] = 0;
		}
		for (int k = 0; k < 10; k++) {
			for (int j = 0; j < d; j++) {
				add(t[(j+k)%d], dp[j]);
			}
		}
		for (int k = 0; k < s[i]; k++) {
			add(t[(a+k)%d], 1ll);
		}
		a = (a + s[i]) % d;
		for (int j = 0; j < d; j++) {
			dp[j] = t[j];
		}
	}
	dp[0] += (a == 0) - 1;
	dp[0] = (dp[0] + mod) % mod;
	printf("%lld\n", dp[0]);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    string s, t;
    string w[4]={"dream", "dreamer", "erase", "eraser"};
    cin >> s;

    //左右反転
    reverse(s.begin(), s.end());
    for(int i=0;i<4;i++){
        reverse(w[i].begin(), w[i].end());
    }

    int flag = 1;
    for(int i=0;i<s.size();){
        int flag2 = 0;
        //w[]と一致するかどうか調べる
        for(int j=0;j<4;j++){
            //sをw[]の長さぶん抜き出して比較
            if(s.substr(i, w[j].size()) == w[j]){
                //一致した
                flag2 = 1;
                i +=  w[j].size();
            }
        }
        //一致しなかった
        if(flag2==0){
            flag = 0;
            break;
        }
    }

    if(flag==1)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

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

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 N,W;
    cin >> N >> W;
    
    vector<i64> w(N),v(N);
    rep(i,0,N) cin >> w[i] >> v[i];
    
    vector<i64> dp(W+1);
    dp[0]=0;
    if(w[0]<=W) dp[w[0]]=v[0];
    rep(i,1,N){
        for(i64 j=W; j>=0; --j){
            if(j-w[i]<0) break;
            chmax(dp[j],dp[j-w[i]]+v[i]);
        }
    }
    
    cout << *max_element(begin(dp),end(dp)) << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    int A = scan.nextInt();
    int B = scan.nextInt();
    String U = scan.next();

    if(S.equals(U)) {
    	A--;
    }else if(T.equals(U)) {
    	B--;
    }

    System.out.print(A + " ");
    System.out.print(B);
  }
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

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

	int k;
	while(cin >> k, k) {
		int sum = 0;
		for(int i = 0; i < k * (k - 1) / 2; i++) {
			int a;
			cin >> a;
			sum += a;
		}
		cout << sum / (k - 1) << endl;
	}
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int n=0;
  if (N >= 10){
    for (int i=0; i<N; i++){
      int x;
      x = N/10;
      if(x>0){
        n++;
        continue;
      }
      else
        break;
    }
    int f = 0;
    int a = N;
    for (int i=0; i<n; i++){
      f = f + a%10;
      a = a/10;
    }
    int F;
    F = N%f;
    if (F == 0)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  else
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){

    int N, K, i, j, count=0;
    scanf("%d%d",&N,&K);

    int ans[N+1];

    for(i=0;i<=N;i++){
        ans[i] = 0;
    }

    for(i=0;i<K;i++){
        int d, a;
        scanf("%d",&d);
        for(j=0;j<d;j++){
            scanf("%d",&a);
            ans[a]++;
        }
    }

    for(i=1;i<=N;i++){
        if(ans[i]==0){
            count++;
        }
    }

    printf("%d",count);

    return 0;
}

Measured memory_bytes: 1720
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MAXN 1000005
namespace IO {
    struct q_instream {
        template < typename classT >
        inline q_instream operator>>(classT &e) const {
            e= 0;
            classT f= 1, c= 0;
            while(c < '0' || c > '9') {
                if(c == '-') f= -1;
                c= getchar();
            }
            while(c >= '0' && c <= '9') e= e * 10 + c - '0', c= getchar();
            return e= e * f, (*this);
        }
    } in;
 
    struct q_outstream {
        template < typename classT >
        inline q_outstream operator<<(const classT &e) const {
            if(e < 0) {
                putchar('-');
                (*this) << -e;
            }
            else {
                if(e > 9) (*this) << (e / 10);
                putchar(e % 10 + '0');
            }
            return (*this);
        }
        inline q_outstream operator<<(const char &c) const {
            return putchar(c), (*this);
        }
    } out;
}
using namespace IO;
 
int n,num[MAXN];
struct node{
	int l,r;
	int pos;//问题的位置 
}block[MAXN];
 
 
ll BIT[MAXN];
ll lowbit(ll x){return x&(-x);}
void change(int x,ll val){
	for(int i=x;i<=n;){
		BIT[i]+=val;
		i+=lowbit(i);
	}
}
ll getSum(int x){
	ll res=0;
	for(int i=x;i;){
		res+=BIT[i];
		i-=lowbit(i);
	}
	return res;
}
 
bool cmp(node a,node b){
	if(a.r<b.r)return true;
	else if(a.r<b.r&&a.l>b.l)return true;
	return false;
}
 
int ans[MAXN];
unordered_map<int,int> mp;//first最后一次出现的位置 
int book[MAXN];
int main(){
	int m;
	in>>n;
	in>>m;
	for(int i=1;i<=n;i++){
		in>>num[i];
	}
	
	
	for(int i=1;i<=m;i++){
		in>>block[i].l;in>>block[i].r;
		block[i].pos=i;
	}
	sort(block+1,block+m+1,cmp);
	
	int nxt=1;
	for(int i=1;i<=m;i++){
		for(int j=nxt;j<=block[i].r;j++){
			if(book[num[j]]){
				change(book[num[j]],-1);
			}
			change(j,1);
			book[num[j]]=j;
		}
		nxt=block[i].r+1;
		ans[block[i].pos]=getSum(block[i].r)-getSum(block[i].l-1);
	}
	
	for(int i=1;i<=m;i++){
		out<<ans[i];
		puts("");
	}
	return 0;
} 

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

int main() {
    int n,t;
    double a;
    cin >> n;
    cin >> t >> a;
    double h[n];
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    double tmp = 500;
    int ans = 0;
    for(int i=0;i<n;i++){
        double ctmp = t - h[i] * 0.006;
        if(abs(a - tmp) > abs(a - ctmp)){
            tmp = ctmp;
            ans = i;
        }
    }
    cout << ans + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Rep(i, N) for(int i = 0; i < N; i++)
#define Reps(i, x, N) for(int i = x; i < N; i++)

const int LLINF = 1LL << 60;


signed main()
{
  int N, R;

  while(cin >> N >> R, N || R) {
    int p, c;
    
    int num[55];
    Rep(i, N) num[i] = N - i - 1;
    
    while(R--) {
      int temp[55];

      cin >> p >> c; --p;
      
      Rep(i, c) temp[i] = num[i + p];
      for(int i = p - 1; i >= 0; i--) num[c + i] = num[i];
      Rep(i, c) num[i] = temp[i];
    }
    cout << num[0] + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 2968
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define N 100007
#define INF 1000000000
using namespace std;

typedef long long ll;

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

int main()
{
    int a, b, res;
    cin >> a >> b;
    cout << (a == b ? a + b : 2 * max(a, b) - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) for(int i=0;i<n;i++)
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vlai=valarray<int>;

int main(void){
    int n;
    while(cin>>n,n){
        vector<set<int>> kl(n+1);
        rep(i,n+1){
            int m;cin>>m;
            rep(j,m){int k; cin>>k; kl[i].insert(k);}
        }
        int ans=-1;
        rep(i,n){
            if(includes(all(kl[i]), all(kl[n]))){
                if(ans==-1){
                    ans=i+1;
                }else ans=-2;
            }
        }
        cout<<(ans<0?-1:ans)<<endl;
    }
}

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

#define      pb    push_back
#define      ff    first
#define      ss    second
#define      ll    long long int
#define      endl  "\n"
#define      FASTIO        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);


#define      TEST    int t ; cin >> t ; while( t -- )

const ll big = 10e7 + 11 ;

int  main (  ) {

    FASTIO ;

    int n ;
    cin >> n ;

    map < int , ll > mp , mp1 ;
    vector < ll > v ;

    for( int i = 0 ; i < n ; i++ ){
        int x ;
        cin >> x ;

        v.pb( x ) ;

        mp[ x ]++ ;
    }

    ll total = 0 ;

    for( auto it = mp.begin( ) ; it != mp.end( ) ; it++ ){
        ll x = it->ss ;
        x-- ;
        total += ( x * ( x + 1 ) / 2 ) ;
    }

    ll  ans = total ;

    for( int i = 0 ; i < n ; i ++ ){
        ans = total ;
        ll x = mp[ v[ i ] ] ;

        x-- ;
        ll k = x * ( x + 1 ) / 2 ;

        ans -= k ;

        x-- ;

        ans += ( x * ( x + 1 ) / 2 ) ;
        cout << ans ;

        if( i != n - 1 ) cout <<  endl ;
    }

    return  0 ;
}


Measured memory_bytes: 11120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
int main(){
    LL a,b;
    cin >> a >> b;
    cout << a*b << endl;

    return 0;
}

Measured memory_bytes: 3640
# coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop, heapify
import copy
import sys
from functools import lru_cache
INF = float('inf')
mod = 10**9+7
sys.setrecursionlimit(10 ** 6)


def lcm(a, b): return a * b / gcd(a, b)

# 1 2 3
# a, b, c = LI()


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I()


def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS()


def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S()


def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2]


def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]]


def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def]


def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]]


def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]]


def SRL(n): return [list(S()) for i in range(n)]

@lru_cache(maxsize=None)
def dp(i, j):
    if i == 0:
        return 0 if j == 0 else -INF
    if j == 0:
        return max(dp(i - 1, 0) + a[i-1], dp(i - 1, 1) - a[i-1])
    else:
        return max(dp(i - 1, 0) - a[i - 1], dp(i - 1, 1) + a[i - 1])


n = I()
a = LI()


def main():
    print(dp(n, 0))


if __name__ == "__main__":
    main()


Measured memory_bytes: 344352
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;

int main(){
  ll N; cin >> N;
  ll x_max = sqrt(N);
  ll res;
  for(ll x = x_max; 0 < x; x--){
    if(N % x == 0){
      ll y = N / x;
      res = x + y - 2;
      break;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
import java.util.*;


import java.io.*;
/**
 * MLASERP
 */
public class Main {

    
    static MyScanner in  = new MyScanner();
   static int mod  = 1000000007;
    static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      static StringTokenizer st;
      static int []dr  = {1,-1,0,0};
      static int [] dc = {0,0,-1,1};
public static void main(String[] args) {
    int D  = in.nextInt();
    int T  = in.nextInt();
    int S = in.nextInt();
    int dis = S*T;
    out.println(dis>=D?"Yes":"No");
    out.flush();
   

}
static int rcToxy(int r, int c,int W){
    return r*W+c;
}
static class Node{
    int r, c,prev,change;
    Node(int r, int c){
        this.r =r ;
        this.c = c;
    }
}
public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;
 
      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }
 
      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }
 
      int nextInt() {
          return Integer.parseInt(next());
      }
 
      long nextLong() {
          return Long.parseLong(next());
      }
 
      double nextDouble() {
          return Double.parseDouble(next());
      }
 
      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }
}

Measured memory_bytes: 32920
n=int(input())
s=input()
l=[]
k=len(s.replace(".",""))
ans=n-k
#自分含め左にいくつ黒があるか
cnt=0
#左の黒、右の白
for i in range(n):
  cnt+=int(s[i]=="#")
  ans=min(ans,2*cnt+n-i-1-k)
print(ans)

Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  string S;
  cin >> N >> S;
  int w = 0, b = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == '#') {
      b++;
    }
    else {
      w++; 
    }
  }
  int answer = min(N - b, N - w), B = b, W = w;
  for (int i = 0; i < N - 1; i++) {
    if (S.at(i) == '#') {
      b--;
    }
    else{
      w--; 
    }
    answer = min(answer, B - b + w);
  }
  cout << answer << endl;
}

Measured memory_bytes: 3748
#ifdef LOCAL_BUILD
#include "pch.h"
#define DLOG(msg) cout << "#" << __LINE__ << ":" << msg << endl;
#else
#include <bits/stdc++.h>
#define DLOG(msg)
#endif
using namespace std;

int main() {
  int n;
  cin >> n;
  int min_ = numeric_limits<int>::max();
  int max_diff = numeric_limits<int>::lowest();
  for (int t, i = 0; i < n; ++i) {
    cin >> t;
    if (i != 0) {
      max_diff = max(max_diff, t - min_);
    }
    min_ = min(min_, t);
  }
  cout << max_diff << endl;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int y,m,d;
	char a,b;
	cin>>y>>a>>m>>b>>d;
	
	if(y<2019)
	{
		cout<<"Heisei";
		return 0;
	}
	else
	if(y==2019)
	{
		if(m==1 && d<=31 || m==2 && d<=28 || m==3 && d<=31 || m==4 && d<=30)
		{
			cout<<"Heisei";
			return 0;
		}
	}
	
	cout<<"TBD";
	return 0;
 } 

Measured memory_bytes: 256
# input
S = list(input())

# check
length = len(S)
if len == 1:
    print(0)
else:
    bwb = ["0", "1"]
    wbw = ["1", "0"]
    cnt = [0] * 2
    for i in range(length):
        if S[i] == bwb[i % 2]:
            cnt[0] += 1
        if S[i] == wbw[i % 2]:
            cnt[1] += 1

    print(min(cnt))

Measured memory_bytes: 3956
import java.util.Scanner;

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

        int N = sc.nextInt();
        int M = sc.nextInt();

        int L = 0;
        int R = Integer.MAX_VALUE;

        for(int i=0; i<M; i++){
            int tmpL = sc.nextInt();
            int tmpR = sc.nextInt();

            L = Integer.max(L, tmpL);
            R = Integer.min(R, tmpR);
        }

        int result = R - L +1;
        result = Integer.max(result, 0);

        System.out.println(result);;

        sc.close();

    }
}

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

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

    int r, c;
    cin >> r >> c;
    vector<vector<int>> matrix(r, vector<int>(c));
    rep(i, r) rep(j, c) cin >> matrix[i][j];

    vector<int> col_sum(c);
    for (int row = 0; row < r; row++) {
        int row_sum = 0;
        for (int col = 0; col < c; col++) {
            cout << matrix[row][col] << " ";
            row_sum += matrix[row][col];
            col_sum[col] += matrix[row][col];
        }
        cout << row_sum << endl;
    }

    int all_max = 0;
    for (int i = 0; i < col_sum.size(); i++) {
        cout << col_sum.at(i) << " ";
        all_max += col_sum.at(i);
    }
    cout << all_max << endl;
    return 0;
}


Measured memory_bytes: 3184
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
using namespace std;

const int INF = 1 << 28;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const int ddx[] = {1, 1, 0, -1, -1, -1, 0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2};
const int ddy[] = {0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1};

class State
{
public:
  int x, y, m, c;
  State(int _x, int _y, int _m, int _c)
    :x(_x), y(_y), m(_m), c(_c) {}
  bool operator < (const State& st) const
  {
    return this->c > st.c;
  }
};

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

    int sx, sy, tx, ty, M = 0;
    vector<vector<int> > map(H, vector<int>(W, 1));
    for (int y = 0; y < H; ++y) {
      for (int x = 0; x < W; ++x) {
        if (tile[y][x] == 'S') {
          sx = x;
          sy = y;
          tile[y][x] = '.';
        } else if (tile[y][x] == 'G') {
          tx = x;
          ty = y;
          tile[y][x] = '.';
        } else if (tile[y][x] == 'M') {
          tile[y][x] = ('A' + M);
          ++M;
        } else if (tile[y][x] == '#') {
          map[y][x] = INF;
        }
      }
    }

    for (int y = 0; y < H; ++y) {
      for (int x = 0; x < W; ++x) {
        if (map[y][x] != INF)
          continue;
        for (int d = 0; d < 24; ++d) {
          int xx = x + ddx[d];
          int yy = y + ddy[d];
          if (xx < 0 || xx >= W || yy < 0 || yy >= H)
            continue;
          if (d < 8)
            map[yy][xx] = max(map[yy][xx], 3);
          else
            map[yy][xx] = max(map[yy][xx], 2);          
        }
      }
    }

    priority_queue<State> que;
    que.push(State(sx, sy, 0, 0));
    vector<vector<vector<int> > > dp(H, vector<vector<int> >(W, vector<int>((1 << M), INF)));
    while (!que.empty()) {
      State st = que.top();
      que.pop();
      if (st.x == tx && st.y == ty && st.m == ((1 << M)-1)) {
        cout << st.c << endl;
        break;
      }

      if (dp[st.y][st.x][st.m] < st.c)
        continue;
      dp[st.y][st.x][st.m] = st.c;

      if (isalpha(tile[st.y][st.x]))
        st.m |= (1 << (tile[st.y][st.x] - 'A'));

      for (int d = 0; d < 4; ++d) {
        int xx = st.x + dx[d];
        int yy = st.y + dy[d];
        if (xx < 0 || xx >= W || yy < 0 || yy >= H ||
            tile[yy][xx] == '#' || dp[yy][xx][st.m] <= st.c + map[st.y][st.x])
          continue;

        dp[yy][xx][st.m] = st.c + map[st.y][st.x];
        que.push(State(xx, yy, st.m, dp[yy][xx][st.m]));
      }
    }

  }
  return 0;
}

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

public class Main
{
    public static void main(String [] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] input = reader.readLine().split(" ");

        if((double)Integer.parseInt(input[0])/Integer.parseInt(input[2]) > (double)Integer.parseInt(input[1]))
        {
            System.out.println("No");
        }
        else if((double)Integer.parseInt(input[0])/(double)Integer.parseInt(input[2]) <= (double)Integer.parseInt(input[1]))
        {
            System.out.println("Yes");
        }
    }
}


Measured memory_bytes: 32816
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <queue>
#include <unistd.h>
#include <set>
using namespace std;

class puzzle{
public:
  int num;
  pair<int, int> zid;
  int v[3][3];
  bool operator<(const puzzle& another) const{
    for(int i = 0; i < 3; i++){
      for(int j = 0; j < 3; j++){
        if(v[i][j] < another.v[i][j]) return false;
        else if(v[i][j] > another.v[i][j]) return true;
      }
    }
    return false;
  }
  void print(){
    for(int i = 0; i < 3; i++){
      for(int j = 0; j < 3; j++){
        cout << v[i][j] << " ";
      }
      cout << endl;
    }
  }
};

bool istarget(puzzle p){
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      if(p.v[i][j] != (i * 3 + j  + 1) % 9) return false;
    }
  }
  return true;
}

void solve(){
  puzzle p, ans;
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin >> p.v[i][j];
      if(p.v[i][j] == 0) p.zid = make_pair(i, j);
    }
  }
  p.num = 0;
  map<puzzle, bool> mp;
  mp[p] = true;
  queue<puzzle> q;
  q.push(p);
  while(q.size() > 0){
    puzzle c = q.front(), n; q.pop();
    //cout << c.num << endl;
    //c.print();
    if(istarget(c)){
      cout << c.num << endl;
      break;
    }
    int x = c.zid.first, y = c.zid.second;
    n = c;
    n.num++;
    if(x >= 1){
      swap(n.v[x][y], n.v[x - 1][y]);
      n.zid.first--;
      if(mp[n] == false){
        q.push(n);
        mp[n] = true;
      }
    }
    n = c;
    n.num++;
    if(x <= 1){
      swap(n.v[x][y], n.v[x + 1][y]);
      n.zid.first++;
      if(mp[n] == false){
        q.push(n);
        mp[n] = true;
      }
    }
    n = c;
    n.num++;
    if(y >= 1){
      swap(n.v[x][y], n.v[x][y - 1]);
      n.zid.second--;
      if(mp[n] == false){
        q.push(n);
        mp[n] = true;
      }
    }
    n = c;
    n.num++;
    if(y <= 1){
      swap(n.v[x][y], n.v[x][y + 1]);
      n.zid.second++;
      if(mp[n] == false){
        q.push(n);
        mp[n] = true;
      }
    }
  }
  return;
}
int main(){
  solve();
  return 0;
}



Measured memory_bytes: 20560
def cnt(xl, xr, yb, yt):
    c = 0
    for i in range(n):
        if xl <= xy[i][0] <= xr and yb <= xy[i][1] <= yt:
            c += 1
    return c


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

x = []
y = []
xy = []
for i in range(n):
    u, v = map(int, input().split())
    x.append(u)
    y.append(v)
    xy.append([u,v])
    
x.sort()
y.sort()

ans = (x[-1]-x[0])*(y[-1]-y[0])
for l in range(n-1):
    for r in range(l+1, n):
        xl, xr = x[l], x[r]
        for b in range(n-1):
            for t in range(b+1, n):
                yb, yt = y[b], y[t]
                s = (xr-xl)*(yt-yb)
                if s < ans:
                    ck = cnt(xl, xr, yb, yt)
                    # print(xl, xr, yb, yt, ck)
                    if ck >= k:
                        ans = s
print(ans)


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

int n, a[105];

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

Measured memory_bytes: 256
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var a int
    fmt.Scan(&a)
    ans := "NO"
    if a==7 || a==5 || a==3{
        ans = "YES"
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


Measured memory_bytes: 640
#!/usr/bin/env python3

N = int(input())
testimony = [[None for _ in range(N)] for _ in range(N)]
person = [None] * N

for i in range(N):
    person[i] = int(input())
    for _ in range(person[i]):
        j, good_or_bad = map(int, input().split())
        j -= 1
        testimony[i][j] = good_or_bad

#ここまでが入力

ans = 0

for i in range(1, 1<<N):
    which_person = [None] * N
    for j in range(N):
        which_person[j] = i>>j & 1
        #print(which_person[j])
    ok = True
    for j in range(N):
        if which_person[j]:
            for k in range(N):
                if testimony[j][k] == None:
                    continue
                if testimony[j][k] != which_person[k]:
                    ok = False
    if ok:
        ans = max(ans, which_person.count(1))
print(ans)

Measured memory_bytes: 3188
#include <cstdio>
using namespace std;

int main()
{
	int n;
	
	while (scanf("%d", &n) != EOF){
		while (39 < n){
			n -= 39;
		}
		if (n < 10){
			printf("3C0%d\n", n);
		}
		else {
			printf("3C%d\n", n);
		}
	}
	
	return (0);
}

Measured memory_bytes: 1024
/* 十 聖イシドールスよ、迷えるプログラマを導き給え！ 十 */
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <deque>
 
#define rep(i, n) for(int i = 0; i < n; i++)
 
//const long long INF = 1LL << 60;
const long long MOD = 1000000007;
using ll = long long;


long long ans = 0;

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

	for(int i = 1; i < N; i++)
	{
		for(int j = 1; i * j < N; j++ )
		{
			//sosu[i*j] = false;
            ans++;
		}
	}


    // for(int i=1; i<N; i++)
    // {
    //     if(sosu[i] == false)
    //     {
    //       make_divisors(i);
    //     }
    // }
	
    std::cout << ans;

    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b-1);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  ll ma=0;
  rep(i,n){
    ll a;
    cin>>a;
    if(a==ma+1)ma++;
  }
  if(ma==0)ma=n+1;
  cout<<n-ma<<endl;
  return 0;

}


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

int main(){
  
  string s;
  cin >> s;
  
  if(s[2]==s[3] && s[4]==s[5])
    cout << "Yes" << endl;
  
  else
    cout << "No" << endl;
  
  return 0;
  
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 100100100;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, X, Y;
    cin >> n >> m >> X >> Y;
    vector<int> x(n), y(m);
    rep(i, n) {
      cin >> x[i];
    }
    rep(i, m) {
      cin >> y[i];
    }

    sort(x.begin(), x.end(), greater<int>());
    sort(y.begin(), y.end());

    if (X <= x[0] && Y >= y[0] && x[0] < y[0]) {
      cout << "No War" << '\n';
    } else {
      cout << "War" << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<string, int> P;
typedef vector<vector<int>> Graph;

const double PI = 3.14159265358979323846;

const int mod = 1000000007;

int N; 

void dfs(string s, char mx) {
	if (s.length() == N){
		cout << s << endl;
	}
	else {
		for (char c = 'a'; c <= mx; c++) {
			dfs(s + c, ((c == mx) ? (char)(mx + 1) : mx));
		}
	}
}

int main(int argc, char *args[]) {
	cin >> N;
	dfs("", 'a');
	return 0;
}


Measured memory_bytes: 1536
import collections

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

c = collections.Counter(lst)
p, q, r = c[1], c[2], c[3]

dp = [[[0] * (n+1) for _ in  range(n+1)]  for _ in range(n+1)]

for k in range(0, r + 1):
    for j in range(0, q + r  + 1 - k):
        for i in range(0, p + q + r + 1 - k - j):
            if i == 0 and j == 0 and k == 0:
                continue
            E = n
            if i > 0:
                E += dp[i-1][j][k] * i
            if j > 0:
                E += dp[i+1][j-1][k] * j
            if k  > 0:
                E += dp[i][j+1][k-1] * k
            dp[i][j][k] = E / (i + j + k)
print(dp[p][q][r])


Measured memory_bytes: 382828
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;
vector <int> n;

int main(){
	long long n,t,ans=0;
	vector <int> a;
	map <int,int> s;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>t;
		a.push_back(t);
		if(s[t]==0){
			s[t]++;
		}else{
			ans+=s[t];
			s[t]++;
		}
	}
	for(int i=0;i<n;i++){
		cout<<ans-s[a[i]]+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 10020
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n,m;
    cin >> n >> m;
    repi(i,m - n + 1,m + n){
        cout << i << " ";
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    int arr[m];
    int sum=0;
    for(int i=0;i<m;i++){
        cin>>arr[i];
        sum=sum+arr[i];
    }
    if(sum>n){
        cout<<"-1";
    }
    else
    {
        cout<<n-sum;
    }
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<utility>
#include<set>
#include<stack>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX  999999
int main(){
    string s;
    while(getline(cin,s)){
        if(s.size()==1&&s[0]=='.') break;
        stack<char>st;
        bool check=true;
        rep(i,s.size()){
            if(s[i] =='(' || s[i] == '[')
                st.push(s[i]);
            else if(s[i]==')'){
                if(st.empty()) check=false;
                else if(st.top()=='(') st.pop();
                else check=false;
            }else if(s[i]==']'){
                if(st.empty())check=false;
                else if(st.top()=='[')st.pop();
                else check=false;
            }
            if(!check) break;
        }
        if(st.empty() &&check) cout<<"yes"<<endl;
        else cout<<"no"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
int main () {
  int n,k,x,y,cost;
  cin >> n >> k >> x >> y;
  if (n <= k) {
    cost=x*n;
  }
  else {
    cost=(x*k)+(y*(n-k));
  }
  cout << cost << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define lld long double
#define mod 1000000007
#define rep(i,n)    for(ll i=0;i<n;++i)
#define forup(i,a,b)    for(ll i=a;i<=b;++i)
#define all(v)    v.begin(),v.end()
#define inf 1000000010
#define pii pair<ll,ll>
#define vl vector<ll>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define MAXN 110
#define bsze 555
#define endl '\n'
#define sz(v) v.size()
#define flush fflush(stdout)
#define fast  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
ll power(ll x,ll y, ll md){ll res = 1;x%=md;while(y>0){if(y&1)res = (res*x)%md;x = (x*x)%md;y = y>>1;}return res%md;}

int main(){
    fast;
    ll r,d,xc,xn;
    cin>>r>>d>>xc;
    forup(i,1,10){
        xn = r*xc - d;
        xc = xn;
        cout<<xn<<endl;
    }
}


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

using namespace std;

typedef long long LL;
typedef pair < int, int > PI;
typedef pair < LL, LL > PL;
typedef pair < double, double > PD;
typedef vector < int > VI;
typedef vector < LL > VL;
typedef vector < double > VD;
typedef vector < PI > VPI;
typedef vector < PL > VPL;
typedef vector < PD > VPD;
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define SZ(x) (int)x.size()
#define ALL(x) begin(x), end(x)
#define FOR(i, a) for(int i = 0; i < (a); ++i)
#define FORR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORD(i, a) for(int i = (a) - 1; i >= 0; --i)
#define FORRD(i, a, b) for(int i = (b) - 1; i >= (a); --i)
#define TRAV(i, x) for(auto&i:x)
const LL MOD = (LL)1e9 + 7;
const int INF = (int)1e9;
const LL LINF = (LL)1e18;

int main(){
    int N, M, A, B;
    scanf("%d %d %d %d", &N, &M, &A, &B);
    FOR(i, N){
        FOR(j, M){
            printf("%d", (i < B) ^ (j < A));
        }
        puts("");
    }
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <iomanip>

using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

void anser(int n, int m) {
	rep(i, m) {
		cout << n;
	}
	cout << endl;

}

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

	if (n < m) {
		anser(n,m);
		return 0;
	} 
	anser(m,n);
	return 0;
}

Measured memory_bytes: 888
__DEUBG__ = 0

import math
import sys

num = int(input())
seq = list(map(int, input().split()))

prev = None
tmp = []
increase = None
count = 0

def dump(x):
    from pprint import pprint
    pprint(x)

#breakpoint()

for x in seq:
    if __DEUBG__:
        print(x)
        print(tmp)
    if prev is None:
        tmp = [x]
    elif increase is True:
        if x >= tmp[-1]:
            tmp.append(x)
        else:
            if __DEUBG__:
                dump(tmp)
            tmp = [x]
            increase = None
            count += 1
    elif increase is False:
        if x <= tmp[-1]:
            tmp.append(x)
        else:
            if __DEUBG__:
                dump(tmp)
            tmp = [x]
            increase = None
            count += 1
    elif increase is None:
        if x == tmp[-1]:
            pass
        elif x > tmp[-1]:
            increase = True
        else:
            increase = False
        tmp.append(x)
    prev = x

if __DEUBG__:
    dump(tmp)

count += 1
print(count)


Measured memory_bytes: 15020
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	int n,a,b;
	cin>>n>>a>>b;
	for(int i=a;i<=b;i++)
		if(i%n==0)
			{
				cout<<"OK"<<endl;
				return 0;
			}
	cout<<"NG"<<endl;
    return 0;
}

Measured memory_bytes: 3620
n,a,b=map(int,input().split())
ans=[];L=[a]*b;x=a*b-n;ct=1
if a+b>n+1 or x<0:print(-1);exit()
for i in range(b-1):
 y=min(a-1,x);L[i]-=y;x-=y
for i in L:
 l=[]
 for j in range(i):
  l+=[str(ct)];ct+=1
 ans+=[' '.join(l)]
print(*reversed(ans))

Measured memory_bytes: 81352
package main

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

func main() {
	s := wordScanner(100)
	l := scanIntSlice(s, 6)
	n := l[0]
	f := min(l[1:])
	fmt.Println(4 + ceilDiv(n, f))
}

func ceilDiv(x, y int) int {
	if x%y > 0 {
		return x/y + 1
	}
	return x / y
}

func min(l []int) int {
	r := l[0]
	for _, n := range l[1:] {
		if n < r {
			r = n
		}
	}
	return r
}

func wordScanner(n int) *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	b := make([]byte, n)
	s.Buffer(b, n)
	return s
}

func scanIntSlice(s *bufio.Scanner, n int) []int {
	vals := make([]int, n)
	for i := range vals {
		s.Scan()
		m, _ := strconv.Atoi(s.Text())
		vals[i] = m
	}
	return vals
}


Measured memory_bytes: 640
bingo = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
l = [int(input()) for _ in range(n)]
for i in range(3):
    if bingo[i][0] in l and bingo[i][1] in l and bingo[i][2] in l:
        print("Yes")
        exit()
for i in range(3):
    if bingo[0][i] in l and bingo[1][i] in l and bingo[2][i] in l:
        print("Yes")
        exit()
if bingo[0][0] in l and bingo[1][1] in l and bingo[2][2] in l:
    print("Yes")
    exit()
if bingo[0][2] in l and bingo[1][1] in l and bingo[2][0] in l:
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 3188
#include<iostream>
#include<map>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define N 1500001
int is_exist[N]={0};
int cnt[N]={0};
int solve(int n,int m,int *h,int *w,int tc){
  map<int,int> M;
  rep(i,m){//length
    int tmp=0;
    rep(j,i+1){
      tmp+=w[j];
    }
    if( is_exist[tmp]!=tc)is_exist[tmp]=tc,cnt[tmp]=1;
    else cnt[tmp]++;
    REP(j,i+1,m){
      tmp=tmp-w[j-i-1]+w[j];
      if ( is_exist[tmp]!=tc)is_exist[tmp]=tc,cnt[tmp]=1;
      else cnt[tmp]++;
    }
  }

  int ret = 0;
  rep(i,n){
    int tmp=0;
    rep(j,i+1){
      tmp+=h[j];
    }
    if (is_exist[tmp]==tc)ret+=cnt[tmp];
    REP(j,i+1,n){
      tmp=tmp-h[j-i-1]+h[j];
      if ( is_exist[tmp] ==tc)ret+=cnt[tmp];
    }
  }
  return ret;
}

main(){
  int n,m;
  int h[1500],w[1500];
  int tc=0;
  while(cin>>n>>m && n){
    tc++;
    rep(i,n)cin>>h[i];
    rep(j,m)cin>>w[j];
    cout << solve(n,m,h,w,tc) << endl;
  }
}

Measured memory_bytes: 4812
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <cmath>
#include <map>

template<typename T> bool chmax( T &a, const T &b ) { if ( a <= b ) { a = b; return ( true ); } else { return ( false ); } }
template<typename T> bool chmin( T &a, const T &b ) { if ( a >= b ) { a = b; return ( true ); } else { return ( false ); } }

using namespace std;

using ll = long long;
using ull = unsigned long long;

using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple

#define F first
#define S second

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

template<typename T> T gcd( const T a, const T b ) { return ( b ? gcd( b, a % b ) : a ); }

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

constexpr ll MOD = 1000000007LL;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

template<typename T = ll> class UnionFind {
public:
	UnionFind( T n ) { rep( i, n ) { par[i] = i; siz[i] = 1; } }
	T find( T x ) { if ( x == par[x] ) return ( x ); else return( par[x] = find( par[x] ) ); }
	void unite( T x, T y ) { T xx = find( x ); T yy = find( y ); if ( xx == yy ) return;
		if ( siz[xx] <= siz[yy] ) swap( xx, yy ); par[yy] = xx; siz[xx] += siz[yy]; }
private:
	vector<T> par, siz;
};

template<typename T = ll> T power( T a, T b, T m = MOD ) {
	T res = 1;
	while ( b > 0 ) { if ( b & 1 ) res = res * a % m;
		a = a * a % m; b >>= 1; }
	return ( res );
}

/*
constexpr ll MAX = 500010;
ll fact[MAX];
ll inv[MAX];
ll inv_fact[MAX];

template<typename T> void initComb( T n, T m = MOD )
{
	fact[0] = fact[1] = inv_fact[0] = inv_fact[1] = 1;
	inv[1] = 1;
	for ( int i = 2; i < n; i++ ) {
		fact[i] = ( fact[i - 1] * i ) % m;
		inv[i] = m - inv[m % i] * ( m / i ) % m;
		inv_fact[i] = inv_fact[i - 1] * inv[i] % m;
	}
}

template<typename T> T comb( T n, T r, T m = MOD )
{
	if ( n < r ) return ( 0 );
	if ( n < 0 || r < 0 ) return ( 0 );
	return ( fact[n] * ( inv_fact[r] * inv_fact[n - r] % m ) % m );
}
*/

void replace( string &s, string t, string r ) {
	string::size_type p = 0;
	while ( ( p = s.find( t, p ) ) != string::npos ) {
		s.replace( p, t.length(), r );
		p += r.length();
	}
}


int main()
{
	char X, Y;
	cin >> X >> Y;

	if ( X > Y )
	{
		cout << ">" << endl;
	}
	else if ( X == Y )
	{
		cout << "=" << endl;
	}
	else
	{
		cout << "<" << endl;
	}

	return ( 0 );
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,-1,1,1,-1};
int dy[]={0,1,0,-1,-1,-1,1,1};



int main(){
    int n;cin >> n;
    vector<LL> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(ALL(a));
    if(a[0] == 0){
        cout << 0 << endl;
    }
    else{
        long double sum = 1;
        LL as = 1;
        for (int i = 0; i < n; i++) {
            sum *= a[i];
            as *= a[i];
        }
        if(sum > 1e18){
            puts("-1");
        }
        else{
            cout << as << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3988