akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    typedef long long ll;
    #define pr pair<int,int>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    #define GG(x) if(x) {puts("error");exit(666);}
    #define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
    #define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    inline int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> inline void add(T &x,const T y){x=mm(x+y);}
    inline ll qpower(ll x,ll e,int mod=MOD){ll ans=1;GG(e<0)while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=3e5+10;

    char str[N];int fuk[N],ln[N];
    void main()
    {
        scanf("%s",str+1);int n=strlen(str+1);
        int k=qread();
        if(n==1){write(k/2);return;}
        int nowlen=0,cnt=0;ll ans=0;
        fo(i,2,n) if(str[i-1]==str[i])
        {
            if(nowlen==0) nowlen=2,fuk[i-1]=fuk[i]=++cnt;
            else nowlen++,fuk[i]=cnt;
        } else ans+=nowlen/2,ln[cnt]=nowlen,nowlen=0;
        ans+=nowlen/2;ln[cnt]=nowlen;

        if(str[1]==str[n])
        {
            if(fuk[1]==fuk[n] and fuk[1]>0) {write(1ll*n*k/2);return;}
            if(fuk[1]+fuk[n]==0) {write(1ll*(ans)*k+k-1);return;}
            if(fuk[1]>0 and fuk[n]>0) {write(1ll*(ans)*k+(k-1)*(ln[1]%2+ln[cnt]%2==2) );return;}
            if(fuk[1]>0) {write(1ll*(ans)*k+(k-1)*(ln[1]&1));return;}
            if(fuk[n]>0) {write(1ll*(ans)*k+(k-1)*(ln[cnt]&1));return;}
        }
        write(1ll*(ans)*k);
    }
};//(ans+MOD)%MOD
signed main()
{
    srand(time(0));
    mine::main();
}


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

int main(){
  double N, tax_free;
  int i, j, flag = 1;
  cin >> N;
  
  tax_free = (N / 1.08) - 2;
  for(i = tax_free ; i < tax_free + 4 ; i++){
    j = floor(i * 1.08);
    if(j == N){
      flag = 0;
      break;
    }
  }
  
  if(flag == 1){
    cout << ":(" << endl;
  }
  else{
    cout << i << endl;
  }
  
 
  
  return 0;
}

Measured memory_bytes: 256
N = int(input())
H = [int(s) for s in input().split(' ')]
max_h = H[0]
for h in H[1:]:
    if max_h == h - 1 or max_h == h:
        continue
    elif max_h < h:
        max_h = h - 1
    else:
        print('No')
        exit(0)

print('Yes')


Measured memory_bytes: 14224
A, B, K = map(int, input().split())

if B - A > 2 * K:
    for i in range(A, A + K):
        print(i)
    for i in range(B - K+1, B+1):
        print(i) 
else:
    for i in range(A, B+1):
        if i < A + K or i > B - K:
            print(i)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
const int MAXI = 1e6 + 10;

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

int main() {
	cin.tie(0)->sync_with_stdio(false);

	int n; cin >> n;
	vector<int> cnt(MAXI, 0);

	int d = 0;
	REP(i, n) {
		int a; cin >> a;
		cnt[a]++;
		d = gcd(d, a);
	}
	if (d > 1) {
		cout << "not coprime" << '\n';
		return 0;
	}

	for (int i = 2; i < MAXI; i++) {
		int sum = 0;
		for (int j = i; j < MAXI; j += i)
			sum += cnt[j];
		if (sum > 1) {
			cout << "setwise coprime" << '\n';
			return 0;
		}
	}
	cout << "pairwise coprime" << '\n';
	return 0;
}


Measured memory_bytes: 7156
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    n, l = map(int, input().split())
    s = [input() for _ in range(n)]
    for i in range(l):
        s.sort()
    print("".join(s))
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 10320
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

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

    static class CForbiddenList {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int x = in.readInt();
            int n = in.readInt();
            boolean[] a = new boolean[201];

            for (int i = 0; i < n; i++)
                a[in.readInt()] = true;

            int min = Integer.MAX_VALUE;
            int ans = 0;
            for (int i = -100; i <= 200; i++) {
                if (i >= 0 && a[i])
                    continue;

                if (min > Math.abs(x - i)) {
                    min = Math.abs(x - i);
                    ans = i;
                }

            }

            System.out.println(ans);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new RuntimeException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 32408
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (void)
{
    char S[101];

    gets(S);

    for (size_t i = 0; i < strlen(S); i++) {
        if ((i % 2) && (S[i] == 'R')) {
            puts("No");
            return 0;
        }
        if (((i % 2) == 0) && (S[i] == 'L')) {
            puts("No");
            return 0;
        }
    }

    puts("Yes");

    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(){
   int  n,t,a,i,d[200000],j=1,min=1;
    float sus=0,c=0,cmin=0;
    scanf("%d",&n);
    scanf("%d%d",&t,&a);
    for(i=1;i<=n;i++){
        scanf("%d",&d[i]);
    }
    if(a>t-(d[1]*0.006)){
        cmin=a-(t-(d[1]*0.006));
       
      }
    else{
        cmin=(t-(d[1]*0.006))-a;
    }
    while(j<=n){
        sus=t-(d[j]*0.006);
      
        if(a>sus){
           c=a-sus;
           }
        else{
           
            c=sus-a;
        }
          if(cmin>c){
                min=j;
                cmin=c;
            }
        j++;
    }
    


    printf("%d ",min);
    
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
#define vint vector<int >
#define vll vector<ll >
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int BIT[6] = {1,2,4,8,16,32};
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int H, W, K, KNUM=0, ans=0;
    cin >> H >> W >> K;
    char C[H][W], COPY[H][W];
    REP(h,H){
        REP(w,W){
            cin >> C[h][w];
            if (C[h][w] == '#') KNUM++;
        }
    }
    int hbitMax = 1<<H;
    int wbitMax = 1<<W;

    for(int hbit = 0; hbit < hbitMax; hbit++){
        for(int wbit = 0; wbit < wbitMax; wbit++){
            // 初期化
            int KCNT = KNUM;
            REP(h,H){
                REP(w,W){
                    COPY[h][w] = C[h][w];
                }
            }
            REP(i,7){
                if((i<H) && (hbit & BIT[i])){
                    REP(w,W){
                        if(COPY[i][w] == '#'){
                            KCNT--;
                            COPY[i][w] = '$';
                            // cout << i << "," << w << "\n"; //
                        }
                    }
                }
                if((i<W) && (wbit & BIT[i])){
                    REP(h,H){
                        if(COPY[h][i] == '#'){
                            KCNT--;
                            COPY[h][i] = '$';
                            // cout << h << "," << i << "\n"; // 
                        }
                    }
                }
            }
            if(K == KCNT) ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int N, L;
    int i;
    int EPS = 0;
    int ans;
    int MIN = 10000;

    cin >> N >> L;
    for(i = 1; i <= N; i++){
        EPS += L + i - 1;
        if((fabs(L+i-1)) < fabs(MIN)){
            MIN = L+i-1;
        }
    }

    ans = EPS - MIN;

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 256
// Shift-JIS（シフトジス）

#include <bits/stdc++.h>
using namespace std;

int gcd(long long a, long long b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }

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

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

int main()
{
    int N, A, B;
    cin >> N >> A >> B;
    cout << min(A * N, B) << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

static class Program{
    static void Main() {
        Console.ReadLine();
        int[]a=Console.ReadLine().Split().Select(int.Parse).ToArray();
        int now=0,ans=0;
        foreach(int x in a){
            if(now<=x){
                ans++;
                now=x;
            }
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11348
#include <bits/stdc++.h>
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;
const int INF = 0x3f3f3f3f;
using namespace std;

int n, W, w[101], v[101];
ll dp[100001], mx;
ll oo = 1e18;
int main()
{
    IOS
    cin >> n >> W;
    for (int i = 0; i < n; ++i) {
        cin >> w[i] >> v[i];
        mx += v[i];
    }
    memset(dp, INF, sizeof dp);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        for (int rem = mx; rem>=v[i]; --rem) {
           dp[rem] = min(dp[rem], w[i]+dp[rem-v[i]]);

        }
    }
    int ans =0;
    for (int i = 0; i <= mx; ++i) {
        if (dp[i] <= W) {
            ans = i;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
#define ll long long
const ll mod=1e9+7;
int main(){
  ll n,k;
  cin>>n>>k;
  ll a[n+2],b[n+2],sum=0;
  for(ll i=0;i<=n;i++){
    sum+=i;
    a[i+1]=sum;
  }
  sum=0;
  for(ll i=n;i>=0;i--){
    sum+=i;
    b[n-i+1]=sum;
  }
  ll ans=0;
  for(ll i=k;i<=n+1;i++){
    ans=(ans+(b[i]-a[i]+1))%mod;
  }
  cout<<ans;
}

Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, k;
    cin >> n >> k;
    int p[n];
    rep(i, 0, n) cin >> p[i];
    sort(p, p + n);
    int ans = 0;
    rep(i, 0, k) ans += p[i];
    cout << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

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

	int n, k;
	cin >> n >> k;

	int ans = 0;
	rep(i, n){
		int x;
		cin >> x;

		ans += 2 * min(x, k - x);
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, N) for (int i = 0; i < (N); ++i)
#define rep2(i, a, b) for (ll i = a; i <= b; ++i)
#define rep3(i, a, b) for (ll i = a; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ok() puts(ok ? "Yes" : "No");
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll, ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
// clang++ -std=c++11 -stdlib=libc++

ll N;
ll dfs(ll n) {
  if (n > N)
    return 0;
  ll ret = 0;
  n *= 10;
  ret += dfs(n + 3);
  ret += dfs(n + 5);
  ret += dfs(n + 7);
  bool t = false;
  bool f = false;
  bool s = false;
  while (n) {
    int d = n % 10;
    n /= 10;
    if (d == 3)
      t = true;
    if (d == 5)
      f = true;
    if (d == 7)
      s = true;
  }
  if (t && s && f)
    ret++;
  return ret;
}

int main() {
  cin >> N;
  cout << dfs(0) << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, b, h; cin >> a >> b >> h;
	cout << (a + b)*h / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string a[3];
    char s[3];
    for(int i=0;i<3;i++){
        cin>>a[i];
        transform(a[i].begin(), a[i].end(), a[i].begin(), ::toupper);
        s[i]=a[i][0];
    }
    cout<<s[0]<<s[1]<<s[2]<<endl;
   
    return 0;
}

Measured memory_bytes: 256
import Control.Applicative ((<$>))

main :: IO ()
main = do
    nums <- map (read :: String -> Int) . words <$> getLine
    putStrLn . show $ if (nums !! 0) /= (nums !! 1) 
                      then if (nums !! 0) /= (nums !! 2) then (nums !! 0) else (nums !! 1)
                      else nums !! 2

Measured memory_bytes: 508
def main():
    N, X = list(map(int, input().split()))
    if X in [1, 2 * N - 1]:
        print('No')
        return
    # Xを中心として...,X+2,X-1,X,X+1,X-2,...と並べる
    if N == 2:
        ans = [1, 2, 3]
    else:
        target_list = [X + 2, X - 1, X, X + 1, X - 2]
        target_list = [n for n in target_list if 1 <= n <= 2 * N - 1]
        rest_list = [n for n in range(1, 2 * N) if n not in target_list]
        len_rest = len(rest_list)
        ans = rest_list[:len_rest//2] + target_list + rest_list[len_rest//2:]
    print('Yes')
    for a in ans:
        print(a)


if __name__ == '__main__':
    main()

Measured memory_bytes: 19964
import math
import sys
#####sorting a dictionary by the values#####
def dict_sort(ans):
    ans=sorted(ans.items(),reverse=True,key=lambda kv:(kv[1]))
##### naive method for testing prime or not#####
def is_prime(n):
    if n==1:
        return 0
    for i in range(2,int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True
#####Primes till Nth#####
def seive_primes(n):
    flag=[0]*(n+10)
    flag[1]=flag[0]=1
    i=2
    while i*i<=n+1:
        if flag[i]==0:
            j=i*i
            while j<=n+1:
                flag[j]=1
                j+=i
        i+=1
    return flag
#####greatest common divisor of two numbers#####
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
#####least common multiplyer of two numbers#####
def lcm(a,b):
    return (a*b)//gcd(a,b)
#####function that return all the letters#####
def alphabates():
    return "abcdefghijklmnopqrstuvwxyz"
#####binary search#####
def binary_search(ls,n,flag):
    low=0
    hi=n-1
    while(low<=hi):
        mid=(low+hi)//2
        if ls[mid]==flag:
            return mid
        elif ls[mid]>flag:
            hi=mid-1
        else:
            low=mid+1
    return -1
#####Decimal to Binary(8 bits)#####
def Binary(n):
    if n==0:
        return "00000000"
    binary = "" 
    i = 0
    while n > 0 and i<=8: 
        s1 = str(int(n%2)) 
        binary = binary + s1 
        n /= 2
        i = i+1
        d = binary[::-1] 
    return d
#####quadratic#####
def qdrt(x,a,b,c):
    return a*x*x+b*x+c
#####taking an array/list as input#####
def inp():
    ls=list(map(int,input().split()))
    return ls
#####taking multiple inputs#####
def mult_inp():
    return map(int,input().split())
#####0-1 Knapsack#####
def knapSack(W, wt, val, n): 
    K = [[0 for x in range(W + 1)] for x in range(n + 1)]  
    for i in range(n + 1): 
        for w in range(W + 1): 
            if i == 0 or w == 0: 
                K[i][w] = 0
            elif wt[i-1] <= w: 
                K[i][w] = max(val[i-1]+K[i-1][w-wt[i-1]],  K[i-1][w]) 
            else: 
                K[i][w] = K[i-1][w] 
  
    return K[n][W] 
#####Main function starts from here#####
n=int(input())
ls=inp()
boro=ls[0]
ans=0
for i in range(1,n):
    if ls[i]<boro:
        ans+=boro-ls[i]
    else:
        boro=ls[i]
print(ans)


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

using namespace std;

int w, h;
int gx, gy;
int vx[] = {0, 1, 0, -1};
int vy[] = {1, 0, -1, 0};
int block[100][100];
bool check[100][100];
bool flag;

void dfs(int y, int x) {

  if(y == gy && x == gx) {

    flag = true;
    return;

  } else {

    for(int i = 0; i < 4; ++i) {

      int ny = y + vy[i];
      int nx = x + vx[i];

      if(ny >= 0 && ny < h && nx >= 0 && nx < w && !check[ny][nx] && block[ny][nx] && block[ny][nx] == block[y][x]) {

        check[ny][nx] = true;
        dfs(ny, nx);

      }

    }

  }

}

int main() {

  int sx, sy;
  int n;
  int c, d, x, y;

  while(cin >> w >> h) {

    if(w == 0 && h == 0) break;

    cin >> sx >> sy;
    cin >> gx >> gy;
    cin >> n;

    --sx;
    --sy;
    --gx;
    --gy;

    for(int i = 0; i < h; ++i) {
      for(int j = 0; j < w; ++j) {
        block[i][j] = 0;
        check[i][j] = false;
      }
    }

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

        cin >> c >> d >> x >> y;

        --x;
        --y;

        int bw, bh;

        if(d) {
          bw = 2;
          bh = 4;
        } else {
          bw = 4;
          bh = 2;
        }

        for(int j = 0; j < bh; ++j) {
          for(int k = 0; k < bw; ++k) {
            block[y + j][x + k] = c;
          }
        }

    }

    flag = false;
    check[sy][sx] = true;
    dfs(sy, sx);

    cout << (flag ? "OK" : "NG") << endl;

  }

}

Measured memory_bytes: 1200
from collections import Counter
N = int(input())
V = list(map(int,input().split()))
v1 = V[0::2]
v2 = V[1::2]
v1c = Counter(v1).most_common()
v2c = Counter(v2).most_common()
v1c.append((0,0))
v2c.append((0,0))
if v1c[0][0]==v2c[0][0]:
    print(min(N-v1c[0][1]-v2c[1][1],N-v1c[1][1]-v2c[0][1]))
else:
    print(N-v1c[0][1]-v2c[0][1])

Measured memory_bytes: 21020
#![allow(unused_imports)]
#![allow(dead_code)]
#![macro_use]
use std::io::prelude::*;
use std::cmp::{max, min};
use std::collections::BinaryHeap;

const MOD: i64 = 1e9 as i64 + 7;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn gcd(x: usize, y: usize)->usize{
    if y == 0{
        return x
    }
    gcd(y, x % y)
}

fn main() {
    input! {
        n: usize,
        a: usize,
        b: usize,
        c: usize,
        d: usize,
        e: usize,
    }
    let x = min(a, b);
    let x = min(x, c);
    let x = min(x, d);
    let x = min(x, e);
    let ans = (n + x - 1) / x + 4;
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	void run() {
		Scanner sc = new Scanner(System.in);

		while (sc.hasNext()) {
			double a = sc.nextInt();
			double b = sc.nextInt();
			double c = sc.nextInt();
			double d = sc.nextInt();
			double e = sc.nextInt();
			double f = sc.nextInt();

			double x = (b * f - c * e) / (b * d - a * e);
			double y = (c * d - a * f) / (b * d - a * e);
			
			BigDecimal ax = new BigDecimal(x);
			BigDecimal ay = new BigDecimal(y);
			
			ax = ax.setScale(3, BigDecimal.ROUND_HALF_UP);
			ay = ay.setScale(3, BigDecimal.ROUND_HALF_UP);
			
			System.out.println(ax + " " + ay);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

}

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

#define ll long long
#define ff first
#define sc second

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n, x, y;

    cin >> n;

    pair <ll, ll> point[n];

    for(ll i = 0; i < n; i++)
        cin >> point[i].ff >> point[i].sc;

    sort(point, point + n);

    for(ll i = 0; i < n; i++)
        cout << point[i].ff << " " << point[i].sc << endl;

    return 0;
}



Measured memory_bytes: 4724
n = int(input())
x = input().strip().split()
y = input().strip().split()
x = [float(s) for s in x]
y = [float(s) for s in y]

m_d = 0
y_d = 0
u_d = 0

mmm = [0]*n
md = 0
for i in range(n):
    
    md = abs(x[i]-y[i])
    m_d += md
    y_d += md**2
    u_d += md**3
    mmm[i] = md



print(m_d)
print(y_d**0.5)
print(u_d**(1/3))
print(max(mmm))


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

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

int find(string str, const string& word) {
  int count = 0;
  for (string::size_type pos = 0; (pos = str.find(word, pos)) != string::npos; pos += word.size()) {
    ++count;
  }
  return count;
}

int main(){
    long long a,b,c,d;
    long long count = 0;
    cin >> a >> b >> c >> d;
    long long a_cs, b_cs, a_ds, b_ds, a_cds, b_cds;
    a_cs = a / c;
    if(a % c == 0) a_cs --;
    b_cs = b / c;
    a_ds = a / d;
    if(a % d == 0) a_ds --;
    b_ds = b / d;
    a_cds = a / lcm(c,d);
    if(a % (c*d) == 0) a_cds --;
    b_cds = b / lcm(c,d);
    long long ans;
    ans = b - a + 1 - (b_cs - a_cs) - (b_ds - a_ds) + (b_cds - a_cds);




    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    ll x, y;
    cin >> x >> y;
    ll ans = 0;
    ll tmp = x;
    while(1) {
        if (tmp>y) break;
        ++ans;
        tmp *= 2LL;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int v, e, r;
    cin >> v >> e >> r;

    int s[e], t[e], d[e];
    for(int i = 0; i < e; i++)  cin >> s[i] >> t[i] >> d[i];

    int dist[v];
    for(int i = 0; i < v; i++)  dist[i] = INT_MAX;
    dist[r] = 0;

    for(int i = 0; i < v-1; i++){
        for(int k = 0; k < e; k++){
            if(dist[s[k]] != INT_MAX)   
                dist[t[k]] = min(dist[t[k]], dist[s[k]] + d[k]);
        }
    }

    bool update = false;
    for(int k = 0; k < e; k++){
        if(dist[s[k]] == INT_MAX)   continue;
        if(dist[s[k]] + d[k] < dist[t[k]])  update = true;
    }
    
    if(update){
        cout << "NEGATIVE CYCLE" << endl;
    }else{
        for(int i = 0; i < v; i++){
            if(dist[i] == INT_MAX)  cout << "INF" << endl;
            else                    cout << dist[i] << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3132
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        m: usize, n: usize,
        a: [usize1; n],
    }
    if m == 2 {
        let mut mi = n;
        for i in 0..2 {
            let mut c = 0;
            for j in 0..n {
                let now = (i + j) % 2;
                if a[j] != now {
                    c += 1;
                }
            }
            mi = min(mi, c);
        }
        puts!("{}\n", mi);
        return;
    }
    let mut c = 0;
    let mut cur = m;
    let mut cnt = 0;
    for i in 0..n {
        if cur != a[i] {
            c += cnt / 2;
            cur = a[i];
            cnt = 0;
        }
        cnt += 1;
    }
    c += cnt / 2;
    puts!("{}\n", c);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}



Measured memory_bytes: 1972
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    

    int n;
    cin >> n;
    int ary[n];
    rep(i,n) cin >> ary[i];

    set<int> st;
    int cnt=0;
    rep(i,n)
    {
        if (ary[i]/400<=7) st.insert(ary[i]/400);
        else cnt++;
    }
    int ans = st.size();
    // ans = max(1, ans);
    cout << max(1,ans) << " " << ans+cnt <<  endl;


}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n; cin >> n;
	vector<int> a(n + 1), b(n + 1);
	rep(i, 1, n)cin >> a[i];
	for (int i = n; 0 < i; --i)
	{
		int tmp = 0;
		for (int j = i; j <= n; j = j + i)
		{
			tmp += b[j];
		}
		if (tmp % 2 != a[i])b[i] = 1;
	}
	int num = 0;
	rep(i, 1, n)
	{
		if (b[i])++num;
	}
	cout << num << endl;
	rep(i, 1, n)
	{
		if (b[i])cout << i << " ";
	}
	cout << "" << endl;
}

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

    char S[110];
    char T[110];



    int main()
    {
        int a;scanf("%d", &a );
        scanf("%s%s", S, T);
        for (int i = 0; i < a; ++i) printf("%c%c", S[i], T[i]);printf("\n" );
        return 0;
    }


Measured memory_bytes: 256
#include <stdio.h>

int main(){

	int W,H,x,y,r,result = 0;

	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

	if( (x - r >= 0) && (x + r <= W) && (y - r >= 0) && (y + r <= H) ){
		result = 1;
	}

	if (result == 1){
		printf("Yes\n");
	}else{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  int n;cin>>n;
  string s;cin>>s;
  ll c=0LL,R=0LL,G=0LL,B=0LL;
  vector<int> r(n),g(n),b(n);
  rep(i,n){
    if(s[i]=='R')R++;
    if(s[i]=='G')G++;
    if(s[i]=='B')B++;
    r[i]=R;
    g[i]=G;
    b[i]=B;
  }
  rep(i,n){
    reps(j,i+1,n){
      if(s[i]!=s[j]){
        if(s[i]!='R'&&s[j]!='R'){
          c+=r[j]-r[i];
          if(i%2==j%2&&s[(i+j)/2]=='R')c--;
        }
        if(s[i]!='G'&&s[j]!='G'){
          c+=g[j]-g[i];
          if(i%2==j%2&&s[(i+j)/2]=='G')c--;
        }
        if(s[i]!='B'&&s[j]!='B'){
          c+=b[j]-b[i];
          if(i%2==j%2&&s[(i+j)/2]=='B')c--;
        }
      }
    }
  }
  cout<<c;
}


Measured memory_bytes: 3664
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int K = scan.nextInt();
		int N = scan.nextInt();
		int[] A = new int[N];
		for(int i =0;i<N;i++) {
			A[i]=scan.nextInt();
		}

		int[] L = new int[N];

		for(int i =0;i<N-1;i++) {
			L[i]=A[i+1]-A[i];
//			System.out.println("i:"+i);
//			System.out.println("A[i+1]:"+A[i+1]);
//			System.out.println("A[i]:"+A[i]);
		}
		L[N-1]=K-A[N-1]+A[0];

//		for(int i =0;i<N;i++) {
//			System.out.println(L[i]);
//		}

		Arrays.sort(L);

		int sum = 0;

		for(int i =0;i<N-1;i++) {
			sum += L[i];
		}

		System.out.println(sum);
	}
}

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

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

int h,w;
string s = "#.";

int main() {
    while(cin>>h>>w && h) {
        rep(i,h) {
            rep(j,w) {
                if(i%2 == 0) {
                    cout << s[j%2];
                } else {
                    cout << s[(j+1)%2];
                }
            }
            cout << "\n";
        }
        cout << "\n";
    }

    return 0;
}

Measured memory_bytes: 1180
/*
How to lambda
  ex) sort(ALL(cont),[](dat a,dat b){return a.l<b.l;});
lower_bound/upper_bound
  1 2 2 2 3 3
    ^lb   ^ub */
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
#define BR "\n"
#define REP(i,n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a,b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it,cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it,cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)

#define DumpArray(cont,from,to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;

using namespace std;
typedef long long ll;
typedef long double ld;
int A,B,C;
int main() {
    cin >> A >>  B >> C;
    if (A==B && B==C) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

using namespace std;
typedef long long ll;

int main(void)
{
 int N,X;
 cin>>N>>X;

 int L[N+1];

 for(int i=0;i<N;i++)
 {
     cin>>L[i];
 }
 int D[N+1];
 D[0]=0;
 for(int i=1;i<=N;i++)
 {
     D[i]=D[i-1]+L[i-1];


 }
 long long sum=0;
 for(int i=0;i<N+1;i++)
 {
     if(D[i]<=X)
     {
         sum++;
     }
 }

 cout<<sum<<endl;



}







Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, a: "List[int]"):
    #print(a)
    a_org = a.copy()
    match_cnt = 1
    pop_cnt = 0
    for i in range(N):
        #print(a_org[i], match_cnt)
        if a_org[i] != match_cnt:
            #a.pop(i)
            pop_cnt = pop_cnt + 1
        else:
            match_cnt = match_cnt + 1
            #print('i: ', i, a_org[i])
    
    if pop_cnt == N:
        pop_cnt = -1
    print(pop_cnt)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 27892
#include <bits/stdc++.h>
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrepi(i,a,b) for(int i=((int)(b)-1);i>=(a);--i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) rrepi(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define ZERO(x) memset(x,0,sizeof(x))
#define MINUS(x) memset(x,-1,sizeof(x))
#define UNIQUE(x) (x).erase(unique(ALL(x)), (x).end())
#define TOUPPER(x) transform(ALL(x), (x).begin(), ::toupper)
#define TOLOWER(x) transform(ALL(x), (x).begin(), ::tolower)
#define debug(var)  do{std::cout << #var << " : "; view(var);}while(0)
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){for(const auto& v : vv){ view(v); } }
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void viewarr(T arr[], int n) { for(int i = 0; i < n; ++i) std::cout << arr[i] << " "; std::cout << std::endl; }
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 qp(ll a,ll b){ll ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
ll qp(ll a,ll b,ll mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const int INF = 1e9;
const ll INFL = 1e18;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5;

int main() {
    string s, t;
    cin >> s >> t;
    int n = SZ(s);
    int m = SZ(t);
    bool ans = true;
    if(n+1 != m) {
        ans = false;
    } else {
        rep(i,n) {
            if(s[i] != t[i]) ans = false;
        }
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}


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

int main() {
	int n; scanf("%d%*c", &n);
	rep(I, n) {
		string s[9];
		rep(i, 9) {
			getline(cin, s[i]);
			s[i] = ' ' + s[i];
		}
		rep(i, 9) {
			int cnt[9]{};
			for (int j = 1; j < s[i].size(); j += 2)
				cnt[s[i][j] - '1']++;
			for (int j = 0; j < s[i].size(); j += 2) {
				if (cnt[s[i][j + 1] - '1'] > 1)s[i][j] = '*';
			}
		}
		for (int i = 1; i < s[0].size(); i += 2) {
			int cnt[9]{};
			rep(j, 9)
				cnt[s[j][i] - '1']++;
			rep(j, 9) {
				if (cnt[s[j][i] - '1'] > 1)s[j][i - 1] = '*';
			}
		}
		for (int i = 1; i < s[0].size(); i += 6) {
			for (int j = 0; j < 9; j += 3) {
				int cnt[9]{};
				rep(t, 3)for (int k = 0; k < 6; k += 2) {
					cnt[s[j + t][i + k] - '1']++;
				}
				rep(t, 3)for (int k = 0; k < 6; k += 2) {
					if (cnt[s[j + t][i + k] - '1'] > 1) {
						s[j + t][i + k - 1] = '*';
					}
				}
			}
		}
		rep(i, 9) {
			cout << s[i] << endl;
		}
		if (I != n - 1)cout << endl;
	}
}

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , "; logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 5005;

/* ...o(^-^)o... */

int main(){
    ii2(a,b); out(a*b);
}

Measured memory_bytes: 3632
import java.io.*;
import java.util.*;
public class Main {
    static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static String line;
    static  long n,k,T,N,m,A,B;
    static StringTokenizer st;
    static Scanner in = new Scanner(System.in);
    static char [] word;
    public static void main(String[] args) throws IOException {
        st = new StringTokenizer(br.readLine());
        N = Long.parseLong(st.nextToken());
        A = Long.parseLong(st.nextToken());
        B = Long.parseLong(st.nextToken());
        long sum = A+B;
        long divisor = N/sum;
        long value = N-divisor*sum;
        long answer = 0;
        if (value<A)
            answer+=value;
        else
            answer+=A;
        answer+=(divisor*A);
        pw.print(answer);
        pw.flush();

    }
}

Measured memory_bytes: 24916
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define mod 1000000007


int N,A,B,C;
char s[100005][3];
bool dfs(int a,int b,int c,int nxt,char *ans){
    if(nxt==N&&a>-1&&b>-1&&c>-1){
        printf("Yes\n");
        rep(i,N)printf("%c\n",ans[i]);
        return true;
    }else if(nxt==N){
        return false;
    }
    if(strcmp(s[nxt],"AB")==0){
        bool ret=false;
        if(b>0){
            ans[nxt]='A';
            ret=dfs(a+1,b-1,c,nxt+1,ans);
            if(ret)return ret;
        }
        if(a>0){
            ans[nxt]='B';
            ret=dfs(a-1,b+1,c,nxt+1,ans);
            if(ret)return ret;
        }
        return ret;
    }
    if(strcmp(s[nxt],"BC")==0){
        bool ret=false;
        if(b>0){
            ans[nxt]='C';
            ret=dfs(a,b-1,c+1,nxt+1,ans);
            if(ret)return ret;
        }
        if(c>0){
            ans[nxt]='B';
            ret=dfs(a,b+1,c-1,nxt+1,ans);
            if(ret)return ret;
        }
        return ret;
    }
    if(strcmp(s[nxt],"AC")==0){
        bool ret=false;
        if(c>0){
            ans[nxt]='A';
            ret=dfs(a+1,b,c-1,nxt+1,ans);
            if(ret)return ret;
        }
        if(a>0){
            ans[nxt]='C';
            ret=dfs(a-1,b,c+1,nxt+1,ans);
            if(ret)return ret;
        }
        return ret;
    }
}
signed main(){
    scanf("%lld %lld %lld %lld",&N,&A,&B,&C);
    rep(i,N){
       scanf("%s",s[i]);
    }
    char ans[100005];
    if(!dfs(A,B,C,0,ans)){
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 8360
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {
  
  int A,B,C,K;
  cin >> A >> B >> C >> K;

  while(A >= B) {
    if(K == 0) break;
    B *= 2;
    K--;
  }

  while(B >= C) {
    if(K == 0) break;
    C *= 2;
    K--;
  }
  

  if(A < B && B < C) cout << "Yes" << endl;
  else cout << "No" << endl;



}


Measured memory_bytes: 3644
S = input()

a = []
b = [0]
tmp = S[0]

for i in range(len(S)):
    if tmp == S[i] == "<":
        b.append(b[-1]+1)
    elif tmp == S[i] == ">":
        b.append(b[-1]-1)
    else:
        min_b = min(b[0], b[-1])
        if min_b < 0:
            b = list(map(lambda x: x-min_b, b))
        a.append(b)
        if S[i] == "<":
            b = [0,1]
        else:
            b = [0,-1]
    tmp = S[i]
min_b = min(b[0], b[-1])
if min_b < 0:
    b = list(map(lambda x: x-min_b, b))
a.append(b)

ans = 0
tmp = -1
for x in a:
    ans += max(tmp, x[0])
    ans += sum(x) - x[0] - x[-1]
    tmp = x[-1]
ans += x[-1]

print(ans)

Measured memory_bytes: 43932