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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t k;
  cin >> k;
  
  int64_t total = 0;
  for(int64_t a=1; a<=k;a++){
    for(int64_t b=1; b<=k;b++){
      for(int64_t c=1; c<=k;c++){
        total += gcd(gcd(a,b),c);
      }
    }
  }
  
  cout << total << endl;
  
  return 0;
}



Measured memory_bytes: 3560
from collections import deque

H,W=map(int,input().split())
S=[[False]*(W+2)]
for i in range(H):
    S.append([False]+[c=='.' for c in input()]+[False])
S.append([False]*(W+2))

r=[] # 道のマスの座標 t->(i,j)
for i in range(1,H+1):
    for j in range(1,W+1):
        if S[i][j]:
            r.append((i,j))
m=len(r)
d=[[10**3 for j in range(m)] for i in range(m)] # d[i][j]=i番目の道のマスからj番目の道のマスまでの距離
for u in range(m-1):
    d[u][u]=0
    si,sj=r[u]
    for v in range(u+1,m):
        ti,tj=r[v]
        if (si==ti and abs(sj-tj)==1) or (abs(si-ti)==1 and sj==tj):
            d[u][v]=d[v][u]=1
'''
print(r)
for di in d:
    print(di)
'''
for k in range(m):
    for s in range(m):
        for g in range(m):
            d[s][g]=min(d[s][g], d[s][k]+d[k][g])
    '''
    for di in d:
        print(di)
    print()
    '''
ans=0
for i in range(m-1):
    for j in range(i+1,m):
        ans=max(ans,d[i][j])

print(ans)

Measured memory_bytes: 45532
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//for(int i = ; i < ; i++){}

int main(){
  int n;
  cin>>n;
  vector <ll> v(5,0);
  for(int i = 0; i < n; i++){
    string s;
    cin>>s;
    if(s[0]=='M') v[0]++;
    else if(s[0]=='A') v[1]++;
    else if(s[0]=='R') v[2]++;
    else if(s[0]=='C') v[3]++;
    else if(s[0]=='H') v[4]++;
  }
  ll sum = 0;
  for(int i = 0; i < 5; i++){
    for(int j = i + 1; j < 5; j++){
      for(int k = j + 1; k < 5; k++){
        if(i!=j&&j!=k&&k!=i){
          sum+=v[i]*v[j]*v[k];
        }
      }
    }
  }
  cout<<sum<<endl;
  return 0;
}




Measured memory_bytes: 256
using System;

namespace msol
{
    class Program
    {
        static int[] ReadNumList()
        {
            var line = Console.ReadLine().Split(' ');
            if (line.Length == 1 && string.IsNullOrEmpty(line[0]))
            {
                return new int[0];
            }
            var numList = new int[line.Length];
            for (var i = 0; i < line.Length; ++i)
            {
                numList[i] = int.Parse(line[i]);
            }
            return numList;
        }
        static void Main()
        {
            var nk = Console.ReadLine().Split(' ');
            C(int.Parse(nk[0]), int.Parse(nk[1]), ReadNumList());
        }
        static void C(int n, int k, int[] aList)
        {
            for (var i = k; i < n; ++i)
            {
                if (aList[i] <= aList[i - k])
                {
                    Console.WriteLine("No");
                }
                else
                {
                    Console.WriteLine("Yes");
                }
            }
        }
    }
}


Measured memory_bytes: 45980
let rec gcd n m = if m = 0L then n else gcd m (n % m)

let rec factorize (acc : int64 list) (i : int64) (n : int64) =
    if n <= 1L then
        acc
    else if n < (i * i) then
        n :: acc
    else if n % i = 0L then
        factorize (i :: acc) i (n / i)
    else factorize acc (i + 1L) n

let ab = System.Console.ReadLine().Split()
let a = ab.[0] |> int64
let b = ab.[1] |> int64
let g = gcd a b
let ans = factorize [] 2L g |> List.distinct |> List.length |> (+) 1
printfn "%d" ans


Measured memory_bytes: 14940
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>

typedef long long int ll;

ll min(ll a, ll b){return a>b?b:a;}

int main(void){
    int n,k;
    scanf("%d%d", &n, &k);
    ll h[n];
    for(int i=0; i<n; i++){scanf("%lld", &h[i]);}

    ll dp[n];
    for(int i=0; i<n; i++){dp[i] = LLONG_MAX;}
    dp[0] = 0;
    for(int i=0; i<n-1; i++){
        for(int j=1; j<=k; j++){
            if(i+j == n){
                break;
            }
            dp[i+j] = min(dp[i+j], dp[i]+llabs(h[i]-h[i+j]));
        }
    }

    printf("%lld\n", dp[n-1]);
    return 0;
}

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

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

const int MAX = 1000000;

int	dp[MAX] = {};
int oddp[MAX];

int main() {
	REP( i, MAX ) dp[i] = oddp[i] = i;

	int i = 2, x = 4;
	while( x < MAX ) {
		for( int j = 0; j + x < MAX; j++ ) {
			dp[j + x] = min( dp[j + x], dp[j] + 1 );
			if( x % 2 == 1 ) {
				oddp[j + x] = min( oddp[j + x], oddp[j] + 1 );
			}

			if( j + x > ( i + 8 ) * ( i + 9 ) * ( i + 10 ) / 2 ) break;
		}
		i++;
		x = i * ( i + 1 ) * ( i + 2 ) / 6;
	}


	int n;
	while( 1 ) {
		cin >> n; if( n == 0 ) break;
		cout << dp[n] << " " << oddp[n] << endl;
	}

	
}


Measured memory_bytes: 10800
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define vt vector
#define pb push_back
#define pob pop_back
#define ii pair<int,int>
#define vi vt<int>
#define vvi vt<vi>
#define vii vt<ii>
#define vvii vt<vii>
typedef long long ll;
#define For(i,a,b) for(int i = a; i < b; i++)
#define foR(i,a,b) for(int i = a; i <= b; i++)
#define roF(i,a,b) for(int i = a - 1; i >= b; i--)
#define Rof(i,a,b) for(int i = a; i >= b; i--)

map<int,map<int,int> > cell;
int cnt[10];
int dx[] = {-2,-2,-2,-1,0,0,0,-1,-1}, dy[] = {-2,-1,0,0,0,-1,-2,-2,-1};
int ax[] = {0,0,0,1,1,1,2,2,2}, ay[] = {0,1,2,0,1,2,0,1,2};

vii black;

signed main (){
	/*
	freopen(".inp","r",stdin);
	freopen(".out","w",stdout);
	*/
	int r, c, n, a, b;
	cin >> r >> c >> n;
	For(i,0,n){
		cin >> a >> b;
		cell[a][b] = 1;
		black.pb(ii(a,b));
	}
	For(i,0,n){
		int x = black[i].first, y = black[i].second;
		For(j,0,9){
			if(x+dx[j]>0 && y+dy[j]>0 && x+dx[j]+2<=r && y+dy[j]+2<=c){
//				cout << x << " " << y << ' ' << j << " ";
				int coun = 0;
				For(k,0,9){
					coun += cell[x+dx[j]+ax[k]][y+dy[j]+ay[k]];
				}
//				cout << coun << "\n";
				cnt[coun]++;
			}
		}
	}
	For(i,1,10){
		cnt[i] = cnt[i]/i;
	}
	cnt[0] = (r-2)*(c-2) - cnt[1] - cnt[2] - cnt[3] - cnt[4] - cnt[5] - cnt[6] - cnt[7] - cnt[8] - cnt[9];
	For(i,0,10){
		cout<< cnt[i] << '\n';
	}
}



Measured memory_bytes: 204912
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <numeric>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int temp;
    cin >> temp;
    int cnt = 1;
    int ans = 0;
    for(int i=1;i<n;i++){
        int x;
        cin >> x;
        if(temp == x){
            cnt++;
            if(i == n-1){
                ans+=cnt/2;
            }
        }else{
            ans+=cnt/2;
            cnt=1;
        }
        temp = x;
    }
    cout << ans << endl;
}

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

int abs(int x){
  if(x<0){
    return -x;
  } else {
    return x;
  }
}

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

int main()
{
  int n,tmp;
  cin >> n;
  int *A,*S;
  A = (int*)malloc(sizeof(int)*n);
  S = (int*)malloc(sizeof(int)*(n+1));
  tmp = 0;
  for(int i=0; i<n; i++){
    cin >> A[i];
    tmp += A[i];
    S[i] = tmp;
  }
  S[n]=S[n-1];

  int sum = S[n-1];
  tmp = 100000;
  for(int i=0; i<n; i++){
    tmp = min(tmp,abs(sum-2*S[i]));
  }
  cout << tmp << endl;
  return 0;
}


Measured memory_bytes: 256
inp=input().split()
n=int(inp[0])
m=int(inp[1])
arr=[]
pares=0
impares=0
count=1
nums=0

def binary(arr, menor, mayor, x): 
    if mayor >= menor: 
        med = (mayor + menor) // 2
        if arr[med] == x: 
            return med 

        elif arr[med] > x: 
            return binary(arr, menor, med - 1, x) 
  
        else: 
            return binary(arr, med + 1, mayor, x) 
    else: 
        return -1

while len(arr)<(m+n):
    if count%2==0 and pares<n:
        arr.append(count)
        pares+=1
    elif count%2!=0 and impares<m:
        arr.append(count)
        impares+=1
    count+=1
sums=[]


for x in arr:
   for y in arr:
        if(x+y)%2==0 and binary(sums, 0, len(sums)-1, [y,x])==-1 and x!=y:
            sums.append([x,y])
            nums+=1
print(nums)


Measured memory_bytes: 9564
#include<stdio.h>
int main(void)
{
	int a,s;
	int i,n,x;
	while(1){
		scanf("%d",&n);
		if(n==0){
			break;
		}
		s=0;
		for(i=0;i<9;i++){
			scanf("%d",&a);
			s+=a;
		}
		x=n-s;
		printf("%d\n",x);
	}
	return 0;
}


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

int main(){
	unsigned long long int n, m;

	cin >> n >> m;

	if(n * 2 >= m){
		cout << (m -  (m % 2)) / 2 << "\n";
	}else{
		unsigned long long int l = m - 2 * n;
		l = (l - (l % 4)) / 4;
		cout << n + l << "\n";
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <algorithm>

template <typename T>
T extgcd(T a, T b, T& x, T& y) {
    T s = a, t = b,
      xs = 1, ys = 0,
      xt = 0, yt = 1;

    while (t != 0) {
        T div = s / t;

        s -= t * div;
        xs -= xt * div;
        ys -= yt * div;

        std::swap(s, t);
        std::swap(xs, xt);
        std::swap(ys, yt);
    }

    x = xs;
    y = ys;
    return s;
}

int main() {
    int a, b;
    std::cin >> a >> b;

    int x, y;
    int g = extgcd(a, b, x, y);
    assert(a * x + b * y == g);

    std::cout << x << " " << y << std::endl;
    return 0;
}



Measured memory_bytes: 3116
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
using namespace std;

int main(){
  long long n;
  cin >> n;
  string s[n];
  for(int i=0;i<n;i++) cin >> s[i];
  map<char,long long> sc;
  for(int i=0;i<n;i++) sc[s[i][0]]++;
  long long count = 0;
  string ma = "MARCH";
  for (int i=0;i<5;i++){
    for (int j=i+1;j<5;j++){
      for (int k=j+1;k<5;k++){
        count += sc[ma[i]]*sc[ma[j]]*sc[ma[k]];
      }

    }
  }
  cout << count << endl;
  return 0;
}



Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int maxV = 90010;
const int maxN = 1e5+10;
const int inf = 0x3f3f3f3f;
const int MOD = 998244353;
const ll INF = 1000000000000000010LL;


int n;
int a[maxN],b[maxN];
int a1[maxN],b1[maxN];
pii c[maxN];
int main() {
	int r;	
	scanf("%d",&r);
	cout<<r*r<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
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;}

const int INF = 100000; 

int main(){
    int a, b, c;
    cin >> a >> b >> c;

    int ans = 3;
    if(a == b || a == c || b == c){
        ans--;
        if(a == b && a == c){
            ans--;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

a.sort()
amax=a[-1]
amin=a[0]

s=[]
ai=a[0]
acnt=-1
for i in range(n):
    if a[i]>ai:
        s.append([ai,acnt+1])
        acnt=0
        ai=a[i]
    else:
        acnt=acnt+1
s.append([ai,acnt+1])
        
# print(s)
    
dn=0
for i in range(len(s)):
    ni=s[i][1]
    if ni>s[i][0]:
        dn=dn+(ni-s[i][0])
    elif ni<s[i][0]:
        dn=dn+ni

print(dn)        

Measured memory_bytes: 16760
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   long N = sc.nextLong();
   long M = sc.nextLong();
   long ans=0;
   
   if(2*N>=M) ans= M/2;
   else ans= N+(M-2*N)/4;
   System.out.println(ans);
 }
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;

i32 a, b;
/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    cin >> a  >> b;

    vec<vec<char>> grid(100, vec<char>(100));
    rep(i,100)rep(j,100) {
        if(i < 50) grid[i][j] = '#';
        else grid[i][j] = '.';
    }
    --a, --b;
    for(i32 i = 0; a > 0; i += 2) {
        for(i32 j = 0; j < 100 && a > 0; j += 2) {
            grid[i][j] = '.';
            --a;
        }
    }
    for(i32 i = 99; b > 0; i -= 2) {
        for(i32 j = 0; j < 100 && b > 0; j += 2) {
            grid[i][j] = '#';
            --b;
        }
    }

    cout << 100 << ' ' << 100 << '\n';
    for(auto v : grid) {
        for(auto ch : v) cout << ch;
        cout << '\n';
    }

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 384
<?php
fscanf(STDIN, "%s", $s);
$n = strlen($s);
$a = array_fill(0, $n+1, 0);
for($i = 0; $i < $n; $i++) {
    if($s[$i] === "<") {
        $a[$i+1] = max($a[$i+1], $a[$i]+1);
    }
}

for($i = $n-1; $i >= 0; $i--) {
    if($s[$i] === ">") {
        $a[$i] = max($a[$i], $a[$i+1]+1);
    }
}

$ans = array_sum($a);
echo $ans;

Measured memory_bytes: 21112
#include<iostream>
using namespace std;
int main()
{
    int k,num,s,i,j,q,cnt=0;
	while(cin>>k>>s)
	{
		cnt=0;
		for(int i=0;i<=k;i++)
		for(int j=0;j<=k;j++)
		{
			num=s-i-j;
			if(num>=0&&num<=k)
		    cnt++;
		}
		cout<<cnt<<endl;
    }
	return 0;
}

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

int main(){
    int n,d; cin>>d>>n;
    if(n==100){
        printf("%.0f",101*pow(100,d));
    }else{
        cout<<n*pow(100,d)<<endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int[][] a = new int[14][14];
		while(s.hasNext()){
			String[] in = s.next().split(",");
			int x = Integer.parseInt(in[0])+2;
			int y = Integer.parseInt(in[1])+2;
			int size = Integer.parseInt(in[2]);
			if(size==1){
				a[x][y]++;
				a[x][y+1]++;
				a[x][y-1]++;
				a[x+1][y]++;
				a[x-1][y]++;
			}else{
				if(size==2){
					med(x,y,a);
				}else{
					if(size==4){break;}
					med(x,y,a);
					a[x][y+2]++;
					a[x][y-2]++;
					a[x+2][y]++;
					a[x-2][y]++;
				}
			}
		}
		int max = 0;
		int num = 0;
		for(int i=2 ; i<12 ; i++){
			for(int j=2 ; j<12 ; j++){
				if(a[i][j]==0)
					num++;
				if(a[i][j] > max)
					max = a[i][j];
			}
		}
		System.out.println(num);
		System.out.println(max);
	}

	static void med(int x, int y, int a[][]){
		a[x][y]++;
		a[x][y+1]++;
		a[x][y-1]++;
		a[x+1][y]++;
		a[x-1][y]++;
		a[x+1][y-1]++;
		a[x+1][y+1]++;
		a[x-1][y-1]++;
		a[x-1][y+1]++;
	}
}

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

#define ll long long

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

	int n;
	cin >> n;
	ll sum = 0;
	int ara[n], ara1[n];
	for (int i = 0; i < n; i++)
	{
		cin >> ara[i];
	}
	for (int i = 0; i < n; ++i)
	{
		cin >> ara1[i];
		if (ara[i] > ara1[i])
		{
			sum += ara[i] - ara1[i];
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

ll inputLValue(){
    ll a;
    cin >> a;
    return a;
};

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

int main()
{
    ll A = inputLValue();
    ll B = inputLValue();
    ll r = gcd(max(A,B), min(A,B));
    ll ans = (A * B) / r;

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#define ll long long
const int N=1e5+5;
int n,Q,m,dn,i;
ll d[N],g[N],ans[N];
ll read(){
	char c=getchar();ll k=0;for (;c<48||c>57;c=getchar());
	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;
}
void write(ll x){if (x>9) write(x/10);putchar(x%10+48);}
int find(ll k){
	int l=1,r=dn,m;
	while (l<r){m=l+r+1>>1;
		if (d[m]<=k) l=m; else r=m-1;
	}
	return l;
}
int main(){
	n=read();Q=read();d[dn=1]=n;
	for (;Q--;){ll k=read();
		for (;k<=d[dn];dn--);d[++dn]=k;
	}
	for (m=d[1],g[dn]=1,i=dn;i;i--) if (g[i]){
		ll k=d[i],v=g[i];d[i]++;
		for (;k>m;){
			int x=find(k);
			g[x]+=k/d[x]*v;k%=d[x];
		}
		ans[k]+=v;
	}
	for (i=m-1;i;i--) ans[i]+=ans[i+1];
	for (i=1;i<=n;i++) write(ans[i]),putchar('\n');
}

Measured memory_bytes: 3968
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

P f(ll x,ll y,ll z,ll w){
	ll c[4] = { x , y , z , w };
	ll a[4] = {};
	rep(i,4){
		rep(j,4){
			a[i] *= 1000;
			a[i] += c[(i+j)%4];
		}
	}
	ll ret = max(max(a[0],a[1]),max(a[2],a[3]));
	ll cnt = 0;
	rep(i,4)if(a[i] == ret)cnt ++;
	return P(ret,cnt);
}

int main(){
	int n;
	ll c[402][4];
	P A[402];
	scanf("%d",&n);
	rep(i,n){
		rep(j,4){
			cin >> c[i][j];
		}
		A[i] = f(c[i][0],c[i][1],c[i][2],c[i][3]);
		//cout << A[i] << endl;
	}
	
	map<ll,int> M;
	rep(i,n)M[A[i].fr] += A[i].sc;
	
	ll ret = 0;
	rep(i,n){
		M[A[i].fr] -= A[i].sc;
		for(int j = i+1 ; j < n ; j ++){
			M[A[j].fr] -= A[j].sc;
			rep(k,4){
				P x[4];
				ll _ret = 1;
				rep(l,4){
					x[l] = f(c[i][l],c[j][(k+4-l)%4],c[j][(k+4-l-1)%4],c[i][(l+1)%4]);
					_ret *= M[x[l].fr];
					M[x[l].fr] -= x[l].sc;
				}
				rep(l,4){
					M[x[l].fr] += x[l].sc;
				}
				ret += _ret;
			}
			M[A[j].fr] += A[j].sc;
		}
	}
	
	cout << ret << endl;
}



Measured memory_bytes: 80128
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
#define pb push_back
#define pll pair<ll, ll>
#define mll map<ll, ll>
#define ff first
#define oo 1000000000000000005
#define ss second
#define el "\n"
#define maxS 200005
#define MOD 998244353
using namespace std;
typedef long long ll;

bool comp(pll p1, pll p2)
{
    return p1.ff-p1.ss > p2.ff-p2.ss; 
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    // ll t;cin>>t;while(t--)
    {
        ll n, only_open_brackets = 0, only_close_brackets = 0;
        cin>>n;
        vector<pll> voc;
        for(ll i=0 ; i<n ; i++)
        {
            string s;
            pll curr;
            curr.ff = curr.ss = 0;
            cin>>s;
            ll l = s.length();
            for(ll j=0 ; j<l ; j++)
            {
                if(s[j] == '(')
                    curr.ff++;
                else if(curr.ff)
                    curr.ff--;
                else
                    curr.ss++;
            }
            
            if(curr.ff != 0 and curr.ss == 0)
                only_open_brackets += curr.ff;
            else if(curr.ff == 0 and curr.ss != 0)
                only_close_brackets += curr.ss;
            else if(curr.ff != 0 and curr.ss != 0)
                voc.pb(curr);
        }
        
        sort(voc.begin(), voc.end(), comp);
        
        ll sz = voc.size(), bal = only_open_brackets, i;
        
        for(i=0 ; i<sz ; i++)
        {
            bal -= voc[i].ss;
            if(bal < 0)
            {
                cout<<"No\n";
                break;
            }
            
            bal += voc[i].ff;
        }
        
        if(i == sz)
        {
            if(bal - only_close_brackets == 0)
            cout<<"Yes\n";
        else
            cout<<"No\n";
        }
    }
    
    return 0;
}

Measured memory_bytes: 7324
#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<cstdio>
#include<vector>
#include<cstring>
#include<cmath>
using namespace std;
#define N (10000000)
vector<int> s;
bool tb[10000000];
int main(){
  int m = sqrt(N);
  for(int i=4;i<N;i+=2) tb[i]=true;
  for(int j=3;j<m;j+=2){
    if(tb[j]) continue;
    for(int i=j*2;i<N;i+=j) tb[i]=true;
  }
  for(int i=2;i<N;i++)
    if(!tb[i]) s.push_back(i);
  int n;
  while(scanf("%d",&n),n){
    for(int i=(int)s.size()-1;i>2;i--){
      if(s[i]>n) continue;
      //    printf("%d %d %d %d\n",s[i],s[i-1],s[i-2],s[i-3]);
      if(s[i]==s[i-1]+2 && s[i-1]==s[i-2]+4 && s[i-2]==s[i-3]+2){
	printf("%d\n",s[i]);
	break;
      }
    }
  }
}

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

int main(){
    int a, b;
    cin >> a >> b;
    if(a <= b) {
        for(int i=0; i<b; i++){
            cout << a;
        }
        cout << endl;
    }else {
        for(int i=0; i<a; i++){
            cout << b;
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#define N 2000
int solve(int , int);
int A[N], M[N];
  int i, j, n, q, m;
int main()
{

  scanf("%d",&n);

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

  scanf("%d",&q);
  for(i = 0 ; i < q ; i++)
    {
      scanf("%d",&M[i]);
    }

  for(i = 0 ; i < q ; i++)
    {
      j = 0;
      if(solve(j, M[i])==1)
	{
	  printf("yes\n");
	}else if(solve(j, M[i])==0){
	printf("no\n");
    }
    }
 

  return 0;
}


int solve(int i, int m)
{
  int res;
  if(m==0) return 1;

  if(i>=n) return 0;
  res = solve(i + 1, m) || solve(i + 1, m - A[i]);

  
}

Measured memory_bytes: 588
def modinv(a,m):
    return pow(a,m-2,m)


n,k = map(int,input().split())
P = 10**9+7



if n-1 <= k:
    N = n + min(n-1,k)
    ans = 1
    for i in range(1,n):
        ans = ans*(N+1-i)*modinv(i,P)%P

else:
    ans = 1
    nCl = 1
    n1Cl = 1
    for l in range(1,k+1):
        nCl = nCl*(n+1-l)*modinv(l,P)%P
        n1Cl = n1Cl*(n-l)*modinv(l,P)%P
        ans = (ans+nCl*n1Cl)%P

print(ans)


Measured memory_bytes: 40684
/**
 * Author: AcFunction
 * Date:   2019-09-04 21:48:14
 * Email:  3486942970@qq.com
**/

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ull unsigned long long
#define db double
#define ldb long double 

#define fi first
#define se second
#define MP make_pair
#define pii pair <int, int>
#define pil pair <int, ll> 
#define pli pair <ll, int>
#define pll pair <ll, ll>  

#define All(x) x.begin(), x.end()
#define pb push_back
#define pf push_front

#define ms0(x) memset(x, 0, sizeof(x))
#define ms1(x) memset(x, -1, sizeof(x))

#define oiu cerr << "Yes!" << endl; 
#define O(x) cerr << #x << ": " << x << endl;  

template <typename T> void printarr(T a[], int b, int e) {
  if(b > e) return ; 
  for(int i = b; i < e; i++) cout << a[i] << " "; 
  cout << a[e] << " " << endl; 
} 

template <typename T> int chkmax(T &x, const T &y) {
  return x < y ? x = y, 1 : 0; 
}

template <typename T> int chkmin(T &x, const T &y) {
  return x > y ? x = y, 1 : 0; 
}

const int N = 5001000; 

int n;
int nxt[N], fir[N], pos[N], a[N], ans[N], cnt, len[N];
ll k;  

int main() {
  scanf("%d %lld", &n, &k); k *= n; 
  for(int i = 1; i <= n; i++) {
    scanf("%d", &a[i]); 
    if(!fir[a[i]]) {
      fir[a[i]] = i;
      pos[a[i]] = i;  
    }
    else {
      nxt[pos[a[i]]] = i; 
      pos[a[i]] = i;  
    }
    nxt[i] = fir[a[i]]; 
  }
  for(int i = 1; i <= n; i++) {
    if(nxt[i] > i) {
      len[i] = nxt[i] - i + 1; 
    }
    else len[i] = n - (i - nxt[i] - 1); 
  }
  int u = 1; ll num = 0; 
  while(1) {
    num += len[u]; 
    u = nxt[u] + 1;
    if(u > n) u -= n;  
    if(u == 1) break ; 
  }
  k = k % num; 
  if(!k) return 0; 
  u = 1; num = 0; 
  // k *= n; 
  while(1) {
    num += len[u];
    if(num >= k) {
      num -= len[u]; 
      for(int j = u; j <= u + k - num - 1; j++) {
        int t = j; if(t > n) t -= n; 
        ans[++cnt] = a[t]; 
      } 
      for(int i = 1; i <= cnt; i++) 
        pos[ans[i]] = fir[ans[i]] = nxt[i] = 0; 
      for(int i = 1; i <= cnt; i++) {
        if(!fir[ans[i]]) {
          fir[ans[i]] = i;
          pos[ans[i]] = i;  
        }
        else {
          nxt[pos[ans[i]]] = i;   
          pos[ans[i]] = i;  
        }
        nxt[i] = fir[ans[i]]; 
      }
      int p = 1; 
      while(p <= cnt) {
        if(nxt[p] > p) {
          p = nxt[p] + 1; 
        }
        else {
          printf("%d ", ans[p]); 
          p++; 
        }
      }
      return 0; 
    }
    u = nxt[u] + 1; 
    if(u > n) u -= n; 
  }
  return 0; 
}


Measured memory_bytes: 14592
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mk make_pair
#define all(a) a.begin(), a.end()
#define len(a) (int)a.size()

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair <int, int> pii;

void solve(){
	string str;
	cin >> str;
	
	int ans = 0;
	for(int i = 0; i < 3; i++)
		if(str[i] == 'R')
			ans = 1;
			
	if(str[0] == 'R' && str[1] == 'R')
		ans = 2;
	if(str[2] == 'R' && str[1] == 'R')
		ans = 2;
	if(str[0] == 'R' && str[1] == 'R' && str[2] == 'R')
		ans = 3;
		
	cout << ans << endl;
}

int main(){
	solve();
	return 0;
}


Measured memory_bytes: 3624
#include <cmath>
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int main() {
	int x, y;
	cin >> x >> y;
	for (int i = 0; i <= x; i++) {
		for (int j = 0; j <= x; j++) {
			if (i + j == x && i * 2 + j * 4 == y) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}


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

int main(int argc, const char * argv[]) {
    int c[3][3];
    
    for (int i = 0; i < 3; i++) {
        cin >> c[i][0] >> c[i][1] >> c[i][2];
    }
    
    int a[3];
    int b[3];
    
    a[0] = 0;
    for (int i = 0; i < 3; i++) {
        b[i] = c[0][i] - a[0];
    }
    
    for (int i = 1; i < 3; i++) {
        a[i] = c[i][0] - b[0];
    }

    bool isOK = true;
    for (int y = 0; y < 3; y++) {
        for (int x = 0; x < 3; x++) {
            if (c[y][x] != a[y] + b[x]) {
                isOK = false;
                break;
            }
        }
        if (!isOK) {
            break;
        }
    }
    
    if (isOK) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
A, B, C, D, E, F = map(int, input().split())
W = []
for i in range(F + 1):
  for j in range(F + 1):
    if A * i * 100 + B * j * 100 < F:
      W.append(A * i * 100 + B * j * 100)
    else:
      break

S = []
for i in range(F + 1):
  for j in range(F + 1):
    if C * i + D * j < F:
      S.append(C * i + D * j)
    else:
      break

# print(S)
# print(W)
      
ans = 0
ans1, ans2 = 0, 0
for i in S:
  for j in W:
    if i + j > 0 and i + j <= F and j * E >= 100 * i:
      if i / (i + j) >= ans:
        ans1, ans2 = i, j
        ans = i / (i + j)

print(ans1 + ans2, ans1)

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

// 各桁の数字を求める関数koromo
int krm(int n,int k){
  int r=0;
  rep(i,k){
    r = n%10;
    n /= 10;
  }
  return r;
}

int main() {
  int a,b,cnt=0;
  cin>>a>>b;
  for(int i=a; i<=b; i++){
    if(krm(i,1)==krm(i,5) && krm(i,2)==krm(i,4)){
      cnt++;
    }
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		sc.close();
		
		int pow2 = 1;
		
		while(pow2*2 <= n) {
			pow2 *= 2;
		}
		
		System.out.println(pow2);
	}

}


Measured memory_bytes: 21716
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

const ll base = 1e9 + 7;

int main() {
    int n;
    string a, b;
    cin >> n >> a >> b;

    ll mul;
    int i;

    if (a[0] == b[0]) {
        i = 1;
        mul = 3;
    }
    else {
        i = 2;
        mul = 6;
    }

    for (; i < n; i++) {
        if (a[i - 1] == b[i - 1]) {
            mul *= 2;
            if(a[i] != b[i]) i++;
        }
        else {
            if (a[i] == b[i]) mul *= 1;
            else {
                i++;
                mul *= 3;
            }
        }
        mul %= base;
    }
    cout << mul << endl;
}

Measured memory_bytes: 256
/****************************************************************
*	Author: huhao
*	Email: 826538400@qq.com
*	Create time: 2020-01-27 15:38:58
****************************************************************/
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#define fr(i,a,b) for(int i=(a),end_##i=(b);i<=end_##i;i++)
#define fd(i,a,b) for(int i=(a),end_##i=(b);i>=end_##i;i--)
int read()
{
	int r=0,t=1,c=getchar();
	while(c<'0'||c>'9')
	{
		t=c=='-'?-1:1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		r=(r<<3)+(r<<1)+(c^48);
		c=getchar();
	}
	return r*t;
}
const int N=300010;
int n,a[N],s[N],ans,Ans;
int check(int p)
{
	int lst=0;
	fr(i,1,n-1) if((i&1)&&s[i+1]>lst&&s[n]-2*(s[i]-lst)>=p) lst=s[i+1];
//	printf("%d %d\n",p,s[n]-2*(s[n]-lst)>=p);
	return s[n]-2*(s[n]-lst)>=p;
}
int main()
{
	n=read();
	fr(i,1,n)
	{
		a[i]=read();
		if(i&1) s[i]=s[i-1]-a[i];
		else s[i]=s[i-1]+a[i];
		Ans+=a[i];
//		printf("%d%c",s[i],i==n?'\n':' ');
	}
	ans=abs(s[n]);
	if(n&1)
	{
		int l=-1000000000,r=1000000000;
		while(l<r)
		{
			int mid=(l+r)>>1;
			if(check(mid)){ l=mid+1; ans=std::max(ans,mid); }
			else r=mid;
		}
	}
	printf("%d %d\n",(Ans+ans)/2,(Ans-ans)/2);
	return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <string.h>
int m[101][101][4];
int main()
{
  int w,h,i,j;
  for(;;){
    scanf("%d%d",&w,&h);
    if(w==0 && h==0) break;
    memset(m,0,sizeof(m));
    for(i=1;i<=w;i++){
      for(j=1;j<=h;j++){
	if(i==1 && j==1) {
	  m[i][j][0] = 1;
	  m[i][j][2] = 1;
	  continue;
	}
	m[i][j][0] = (m[i][j-1][0] + m[i][j-1][3]) % 100000;
	m[i][j][1] = m[i][j-1][0];
	m[i][j][2] = (m[i-1][j][2] + m[i-1][j][1]) % 100000;
	m[i][j][3] = m[i-1][j][2];
      }
    }
    printf("%d\n",
	   (m[w][h-1][0]+m[w][h-1][3]+m[w-1][h][2]+m[w-1][h][1]) % 100000);
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string.h>
#include <stdio.h>
#define LL long long
#define pii pair<int,int>
#define piii pair<int, pii >
#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define vi vector<int>
#define vpi vector< pii >
#define INF 2147483647
#define big 20160116
#define pb push_back
#define mp make_pair
using namespace std;
const int Maxk=1005;
string mul(string a,string b){
	int res[Maxk];
	memset(res,0,sizeof(res));
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	for (int i=0;i<a.length();i++){
		for (int j=0;j<b.length();j++){
			res[i+j]+=(a[i]-'0')*(b[j]-'0');
		}
	}
	for (int i=0;i<Maxk;i++){
		if (res[i]>=10) {
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	string ret;
	bool flag=false;
	for (int i=Maxk-1;i>=0;i--){
		if (flag || res[i]){
			flag=true;
			ret=ret+(char)(res[i]+'0');
		}
	}
	if (ret=="") ret="0";
	return ret;
}
string add(string a,string b){
	if (a.length()<b.length()) swap(a,b);
	while (a.length()!=b.length()){
		b='0'+b;
	}
	for (int i=a.length()-1;i>=0;i--){
		a[i]+=(b[i]-'0');
		if (a[i]>'9' && i){
			a[i]-=10;
			a[i-1]++;
		}
	}
	if (a[0]>'9'){
		a[0]-=10;
		a='1'+a;
	}
	return a;
}
const int Maxn=100005;
int R,C,N;
vector<pair<int,int> > up,down,lf,rg;
bool onboard(int x,int y){
	return x==0 || x==R || y==0 || y==C;
}
void add_point(int x,int y,int num){
	if (x==0){
		up.push_back(mp(y,num));
	}
	else if (x==R){
		down.push_back(mp(y,num));
	}
	else if (y==0){
		lf.push_back(mp(x,num));
	}
	else{
		rg.push_back(mp(x,num));
	}
}
int main(){
	scanf("%d %d %d",&R,&C,&N);
	for (int i=0;i<N;i++){
		int ux,uy,dx,dy;
		scanf("%d %d %d %d",&ux,&uy,&dx,&dy);
		if (onboard(ux,uy) && onboard(dx,dy)){
			add_point(ux,uy,i+1);
			add_point(dx,dy,i+1);
		}
	}
	vector<int> hav;
	sort(up.begin(),up.end());
	sort(down.begin(),down.end());
	sort(lf.begin(),lf.end());
	sort(rg.begin(),rg.end());
	hav.clear();
	for (int i=0;i<up.size();i++){
		int x=up[i].second;
		if (!hav.empty() && hav.back()==x){
			hav.pop_back();
		}
		else{
			hav.pb(x);
		}
	}
	for (int i=0;i<rg.size();i++){
		int x=rg[i].second;
		if (!hav.empty() && hav.back()==x){
			hav.pop_back();
		}
		else{
			hav.pb(x);
		}
	}
	for (int i=down.size()-1;i>=0;i--){
		int x=down[i].second;
		if (!hav.empty() && hav.back()==x){
			hav.pop_back();
		}
		else{
			hav.pb(x);
		}
	}
	for (int i=lf.size()-1;i>=0;i--){
		int x=lf[i].second;
		if (!hav.empty() && hav.back()==x){
			hav.pop_back();
		}
		else{
			hav.pb(x);
		}
	}
	if (hav.empty()){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 2772
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>


using namespace std;

int main(){
 long long int n,k,c;
 cin >> n >> k >> c;
  string s;
  cin >> s;
  int l[200100],r[200100];
  int tl=1, tr = k,cl = c,cr = c;
  for(int i=0;i<200100;i++){
    l[i] = 10000000;
    r[i] = -10000000;
  }
  for(int i=0;i<s.size();i++){
    
    if(s[i] == 'o' && tl <= k){
      l[i] = tl;
      tl++;
      i += c;
    }
    
  }
  
  for(int i=s.size()-1;i>=0;i--){
    
    if(s[i] == 'o'&& tr > 0){
      r[i] = tr;
      tr--;
      i -= c;
    }
    
  }
  
  for(int i=0;i<s.size();i++){
    
    if(l[i] == r[i]){
      cout << i+1 << endl;
    }
  }
  
}
    


Measured memory_bytes: 3332
import math
N=int(input())
x=[]
y=[]
M=0
for i in range(0,N):
    F=input()
    [v,s]=list(map(int,F.split(' ')))
    x.append(v)
    y.append(s)
def dis(x,y,x2,y2):
    return math.sqrt((x-x2)**2+(y-y2)**2)
for i in range(0,N):
    for j in range(0,N):
        M=M+dis(x[i],y[i],x[j],y[j])
print(M/N)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
	int num, i;
	long long a = 0, b = 0;
	cin >> num;
	vector<int> d(num);
	for (i = 0; i < num; i++)
		scanf("%d", &d[i]);
	sort(d.begin(), d.end());
	for (i = 0; i < (num - 2) >> 1; i++) {
		a -= d[i] << 1;
		b += d[num - 1 - i] << 1;
	}
	for (i = 0; i < ((num - 2) >> 1) + (num & 1); i++) {
		a += d[num - 1 - i] << 1;
		b -= d[i] << 1;
	}
	if (num & 1) {
		a -= d[i] + d[i - 1];
		b += d[i] + d[i + 1];
	}
	else {
		a += d[i + 1] - d[i];
		b += d[i + 1] - d[i];
	}
	cout << max(a, b) << "\n";
	return 0;
}


Measured memory_bytes: 640
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N, X;
    scan(N, X);
    auto x = aryread();
    x.map!(a => abs(a - X))
        .reduce!gcd().writeln();
}


Measured memory_bytes: 4220
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cassert>

using namespace std;

void do_print(vector<int> v)
{
	for (auto itr = v.begin(); itr != v.end(); ++itr)
		cout << *itr << " " << endl;
	cout << endl;
}

int main()
{
	int a, b, k;
	vector<int> v1;
	vector<int> v2;

	cin >> a;
	cin >> b;
	cin >> k;

	for (int i = min(a, b); i >= 1; i--) {
		if (a % i == 0 && b % i == 0) {
			k--;
			if (k == 0) {
				cout << i << endl;
				return 0;
			}
		}
	}

	assert(false);
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<map>


using namespace std;

int main()
{
    map<char,char> capital;
    capital['a'] = 'A';
    for(int i=0; i<26; ++i)
    {
        capital['a'+ i ] = 'A' + i;
    }

    string s1,s2,s3;
    cin >> s1 >> s2 >> s3;
    string str = "";
    str += capital[s1[0]];
    str += capital[s2[0]];
    str += capital[s3[0]];

    cout << str << endl;
    // cout << capital[s1[0]] + capital[s2[0]] + capital[s3[0]] << endl;

    // cout << (int)'a' << endl;
    // cout << (int)'b' << endl;
    // cout << 'A' << endl;
    // cout << (int)'B' << endl;
    // cout << capital['b'] << endl;
    // cout << capital['z'] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll X, Y;
  cin >> X >> Y;
  bool flag = false;
  for(int i = 0; i <= X; i++){
    ll num = 2 * i + 4 * (X - i);
    if(num == Y) flag = true;
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main(){
    double x1, y1, x2, y2, x3, y3, x4, y4;

    int n;

    cin >> n;

    for(int i=1; i<=n; i++){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        if((y2-y1)/(x2-x1) == (y4-y3)/(x4-x3)){
            cout << "YES" <<endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

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


int main() {
    long long g = 1;
    rep(i,18) g *= 10;
    int n;
    cin >> n;
    long long ans = 1;
    vector<long long> vec(n)
    rep(i,n) cin >> vec.at(i);
    sort(vec.begin(), vec.end());
    bool ng = false;
    rep(i,n) {
        if(vec.at(i) == 0) {
            cout << 0 << endl;
            return 0;
        }
        if(ng || vec.at(i) > g/ans) {
            ng = true;
        }
        ans *= vec.at(i);
    }
    if(ng) cout << -1 << endl;
    else cout << ans << endl;
}


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

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


    int ans=0,num=N;
    int digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }



    if(digit%2==0){
      digit-=1;
      for (int i = 1; i <= digit; i=i+2) {
        float tmp=1;
        for(int j=0;j<i;j++){
          tmp=tmp*10;
        }
        ans+=int(0.9*tmp);
      }
    }
    else{
      for (int i = 1; i <= digit;i=i+2) {
        float tmp=1;
        for(int j=0;j<i;j++){
          tmp=tmp*10;
        }
        ans+=int(0.9*tmp);
      }
      int tmp=1;
      for(int j=0;j<digit;j++){
        tmp=tmp*10;
      }
      ans+=N-tmp+1;
    }


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


Measured memory_bytes: 256
n, q = list(map(int, input().split()))
s = list(input())
ans = [0, ]
count = 0
for i in range(1, n):
    if s[i - 1] == 'A' and s[i] == 'C':
        count += 1
    ans.append(count)
for _ in range(q):
    l, r = list(map(int, input().split()))
    print(ans[r - 1] - ans[l - 1])

Measured memory_bytes: 6944
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
  int N,a;
  string s="Yes";
  vector<int> v;
  cin>>N;
  for(int i=0;i<N;i++){
      cin>>a;
      v.push_back(a);
  }
  for(int j=0;j<v.size()-1;j++){
    if(v[j]<v[j+1]) {
      v[j+1]-=1;
    }
    if(v[j]>v[j+1]) {
      s="No";
      break;
    }
  }
  cout<<s<<endl;

}

Measured memory_bytes: 892
/*
	*	Created By: 'Present_Sir'
	*	Created On: Saturday 29 August 2020 05:34:24 PM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define sz(v) ((int)v.size())
#define lgt(s) ((int)s.length())
#define int long long
using namespace std;

class Solver{
    public:
        void test(){
            //int t; cin>>t; for(int i=1; i<=t; ++i)
            {
                //cout<<"Case #"<<i<<": ";
                this->solve();
            }
        }
        void solve(){
            string s,t;
            cin>>s>>t;
            int n = lgt(s), m = lgt(t);
            int ans = INT_MAX;
            for(int i=0; i<n-m+1; ++i){
                int curAns = 0;
                for(int j=0; j<m; ++j){
                    if(s[i+j] != t[j]){
                        ++curAns;
                    }
                }
                ans = min(ans, curAns);
            }
            cout<<ans<<endl;
        }
};


int32_t main(){
    IOS;
    Solver S;
    S.test();
    return 0;
}



Measured memory_bytes: 3640
import sys


class BIT:
    def __init__(self, node_size):
        self._node = node_size+1
        self.bit = [0]*self._node

    def add(self, index, add_val):
        while index < self._node:
            self.bit[index] += add_val
            index += index & -index

    def sum(self, index):
        res = 0
        while index > 0:
            res += self.bit[index]
            index -= index & -index
        return res

if __name__ == '__main__':
    n, q = map(int, sys.stdin.readline().split())
    bt = BIT(n)
    for i in range(q):
        a, b, c = map(int, sys.stdin.readline().split())
        if a == 0:
            bt.add(b, c)
        else:
            print(bt.sum(c)-bt.sum(b-1))



Measured memory_bytes: 8140
input = gets.chomp!.to_s
arrayOfStrings = []
arrayOfStrings = input.split("")
 
#前に固まって存在している場合
if arrayOfStrings[0,7].join == "keyence" then
    puts "YES"
#後ろに固まって存在している場合
elsif arrayOfStrings[-7,7].join == "keyence" then
    puts "YES"
#前と後ろに分けて存在し、間に文字列が存在する場合。
elsif arrayOfStrings[0] == "k" && arrayOfStrings[-6,6].join == "eyence" then
    puts "YES"
elsif arrayOfStrings[0,2].join == "ke" && arrayOfStrings[-5,5].join == "yence" then
    puts "YES"
elsif arrayOfStrings[0,3].join == "key" && arrayOfStrings[-4,4].join == "ence" then
    puts "YES"
elsif arrayOfStrings[0,4].join == "keye" && arrayOfStrings[-3,3].join == "nce" then
    puts "YES"
elsif arrayOfStrings[0,5].join == "keyen" && arrayOfStrings[-2,2].join == "ce" then
    puts "YES"
elsif arrayOfStrings[0,6].join == "keyenc" && arrayOfStrings[-1,1].join == "e" then
    puts "YES"
else
    puts "NO"
end

Measured memory_bytes: 1788
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
from fractions import gcd
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    a,b,m = readInts()
    A = readInts()
    B = readInts()
    ans = float('inf')
    for i in range(m):
        x,y,c = readInts()
        x -=1
        y -=1
        ans = min(ans,A[x] + B[y] - c)
    # Aの商品の中で1番最小のやつを買うだけでもいいかもしれない
    # Bの商品の中で1番最小のやつを買うだけでもいいかもしれない
    ans = min(ans,min(A) + min(B))
    print(ans)
if __name__ == '__main__':
  main()


Measured memory_bytes: 20688