akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

students = [0] * n
for i in range(n):
    a, b = map(int, input().split())
    students[i] = (a + b, a - b)
checkpoints = [0] * m
for i in range(m):
    c, d = map(int, input().split())
    checkpoints[i] = (c + d, c - d)

for a_p_b, a_m_b in students:
    current_distance = 10 ** 10
    current_point = None
    for i, c_d in enumerate(checkpoints):
        c_p_d, c_m_d = c_d
        if max(abs(a_p_b - c_p_d), abs(a_m_b - c_m_d)) < current_distance:
            current_point = i + 1
            current_distance = max(abs(a_p_b - c_p_d), abs(a_m_b - c_m_d))
    print(current_point)


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
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; }
const ll MOD = 1e9+7;
const int SIZE = (1LL << 12) + 10000;
const ll INF = 1e8;

int C[2000][20];
int A[2000];
int B[2000];

ll DP[SIZE];

int main(){
    int N, M;
    cin >> N >> M;
    REP(i,M){
        int a, b;
        cin >> a >> b;
        A[i] = a;
        B[i] = b;
        REP(k,b){
            int c;
            cin >> c;
            c--;
            C[i][k] = c;
        }
    }

    ll ans = 0;
    fill(DP, DP+SIZE, INF);
    DP[0] = 0;

    REP(i,M){
        int bit = 0;
        REP(k,B[i]){
            int c = C[i][k];
            bit |= 1LL << c;
        }

        for(int b = 0; b < (1LL << 12); b++){
            if(DP[b | bit] > DP[b] + A[i]){
                DP[b | bit] = DP[b] + A[i];
            }
        }
    }

    ans = DP[(1LL << N) - 1];
    if(ans == INF) ans = -1;

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


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

int main() {
  int n;
  int k;
  int count=1;
  

  cin >> n >> k;
    
  while (1) {
    n/=k;
    if(n==1||n==0) {
      if(n==1) {
        count++;
      }
      break;
    }
    count++;
  }

  cout << count << endl;

  return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <unordered_set>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <climits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#define _USE_MATH_DEFINES
#include <math.h>
#include <complex>
#include <atomic>
#include <thread>

using namespace std;
typedef long long ll;
#define ln '\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define drep(i,n) int i = 0;for(;i<(n);++i)
#define FOR(i,s,e) for(int i=s;i<=(e);++i)
#define DFOR(i,s,e) int i = s;for(;i<=(e);++i)
#define FORR(i,s,e) for(int i=s;i>=(e);--i)
#define DFORR(i,s,e) int i = s;for(;i>=(e);--i)
#define fore(a, x) for(auto& a : x)
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ft first
#define sd second
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(),a.end()
#define Fill(a,b) memset(a,b,sizeof(a))
template<typename T1, typename T2> bool Max(T1& a, T2 b) { return a<b ? a = b, 1 : 0; }
template<typename T1, typename T2> bool Min(T1& a, T2 b) { return a>b ? a = b, 1 : 0; }



const int N = 200001, inf = 10000;


void solve() {
  char a;
  char bcd[3];
  cin >> a;
  rep(i, 3)cin >> bcd[i];
  rep(sub, 8) {
    string str;
    str += a;
    int v = a - '0';

    rep(i, 3) {
      int sign = 1;
      if ((sub >> i) & 1) {
        str += '+';
        sign = 1;
      }
      else {
        str += '-';
        sign = -1;
      }
      str += bcd[i];
      v += sign * (bcd[i] - '0');
    }
    if (v == 7) {
      str += "=7";
      cout << str << ln;
      return;
    }
  }
    
}


void init() {
  
}

int main(void) {
  ios::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
  //freopen("C:\\Users\\LENOVO\\Documents\\Visual Studio 2015\\Projects\\Test\\Input\\in.in", "r", stdin);

  init();
  int TC = 1;
#if 0
  cin >> TC; cin.get();
#endif
  FOR(TI, 1, TC) {
    //cout << "Case #" << TI << ": ";
    solve();
  }
  
  
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll a;

int main() {
	cin >> a;
	cout << a + a * a + a * a * a << endl;
	return 0;
}

Measured memory_bytes: 3632
/************************Code by Hardik Aggarwal!!!!***********************************/

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % mod; 
    p = (p * p) % mod; 
  
    return (y%2 == 0)? p : (x * p) % mod; 
}

int main()
{	

	IOS
	ll a,b,c;
	cin>>a>>b>>c;
	ll ans=max(c-(a-b),0LL);
	cout<<ans;


}
    
 
    
    


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

int main() {
    int n, b;
    cin >> n >> b;
    int sum = 0, c = 1;
    vector <int> v(n);
    for ( int i = 0; i<n; i++) {
        cin >> v[i];
    }
    for ( int i = 0; i<v.size(); i++) {
        sum+=v[i];
        if (sum<=b) {
            c++;
        }
        if ( sum>=b) break;
    }
    cout << c << '\n';
    return 0;
}


Measured memory_bytes: 256
import copy
import collections
import itertools
h,w,k=map(int,input().split())
a=[[i for i in input()] for j in range(h)]
cnt=0
for row in itertools.product([True,False],repeat=h):
    for col in itertools.product([True,False],repeat=w):
        d=copy.deepcopy(a)
        for x in range(w):
            for y in range(h):
                if row[y] or col[x]:d[y][x]="@"
        cc=collections.Counter(list(itertools.chain.from_iterable(d)))
        if cc["#"]==k:cnt+=1
print(cnt)

Measured memory_bytes: 9560
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

struct UnionFind {
    parent: Vec<usize>,
    size: Vec<usize>,
}

impl UnionFind {
    fn new(n: usize) -> UnionFind {
        // initialize
        let mut v: Vec<usize> = vec![];
        for i in 0..n + 1 {
            v.push(i)
        }
        let mut s: Vec<usize> = vec![1; n + 1];

        UnionFind { parent: v, size: s }
    }

    fn root(&self, x: usize) -> usize {
        if self.parent[x] == x {
            return x;
        } else {
            return self.root(self.parent[x]);
        }
    }

    fn size(&self, a: usize) -> usize {
        let ra = self.root(a);
        self.size[ra]
    }

    fn unite(&mut self, a: usize, b: usize) {
        let mut ra = self.root(a);
        let mut rb = self.root(b);
        if ra == rb {
            return;
        }
        if self.size[ra] < self.size[rb] {
            std::mem::swap(&mut ra, &mut rb)
        };
        self.size[ra] += self.size[rb];
        self.parent[rb] = ra;
    }

    fn same(&self, a: usize, b: usize) -> bool {
        let ra = self.root(a);
        let rb = self.root(b);
        ra == rb
    }
}

use std::collections::HashSet;

fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut uf = UnionFind::new(n);
    let mut uniq = HashSet::new();

    let mut a: Vec<(usize, usize, usize)> = vec![];

    for _ in 0..m {
        a.push((read(), read(), read()));
    }
    for i in 0..a.len() {
        uf.unite(a[i].0, a[i].1);
    }

    for i in 0..n {
        uniq.insert(uf.root(i + 1));
    }
    println!("{}", uniq.len());
}


Measured memory_bytes: 7780
#include <stdio.h>
int main(void){
    int n, sum;
    int arr[50];
    sum = 0;
    scanf("%d\n", &n);

    for (int i = 0; i < n; i++)
    {
        scanf("%d", &arr[i]);
        if (i == 0) continue;
        
        for (int j = i -1; j >= 0; j--)
            sum += arr[i] * arr[j];
    }
    
    printf("%d\n", sum);
    return(0);
}

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    N, K = LI()
    a_list = LI()
    f_list = LI()

    # 答えで二分探索

    low = 0
    maxa = max(a_list)
    maxf = max(f_list)
    high = (maxa * maxf * N) + 1

    # 妥当な割り当て
    a_list = sorted(a_list)
    f_list = sorted(f_list, reverse=True)
    import math

    dprint(a_list)
    dprint(f_list)

    def judge(ans):
        # ans を答えにできるか
        cnt = 0
        for i in range(N):
            a = a_list[i]
            f = f_list[i]
            if a*f > ans:
                # 差分を訓練で埋める
                ki = math.ceil((a*f - ans) / f)
                cnt += ki
                if cnt > K:
                    dprint('False', ans, cnt)
                    return False
        dprint('True', ans, cnt)
        return True

    while low < high:
        mid = math.floor((low + high) / 2)

        guess = judge(mid)
        # dprint(high, low, mid, guess)

        if guess == True:
            # できるので、これより1少ないのが最大
            high = mid
        else:
            # できないので、これより大きい
            low = mid + 1
        # dprint(high, low)
    print(low)


solve()

Measured memory_bytes: 108620
#include <iostream>
#include <cmath>
int main()
{
    int K, X;
    std::cin >> K >> X;
    int min = std::max(-1000000, X - K + 1);
    int max = std::min(1000000, X + K - 1);
    for (int i=min; i<=max; ++i) {
        if (i != min) std::cout << ' ';
        std::cout << i;
    }
    std::cout << std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
  public class Main {
      public static void main(String[] args){
          Scanner sc = new Scanner(System.in);
         int a = Integer.parseInt(sc.nextLine());
        String s = sc.next();

        String ans = "Yes";
        if (s.length() % 2==1) {ans="No"; }
         else{
          for (int i = 0; i < a/2; i++) {
             if (s.charAt(i)!=s.charAt(i+a/2)) {ans="No";} 
         } 
         }

         
         System.out.println(ans);
     }
 }

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

int main(void){
    int a[5],min = 10,b;
    rep(i,5){
        cin >> a[i];
        if(min > a[i]%10 && a[i]%10 != 0){
            min = a[i]%10;
            b = i;
        }
    }
    int max = 0;
    rep(i,5){
        if(b == i)max += a[b];
        else {
            if(a[i]%10 > 0)max += a[i] - a[i]%10 + 10;
            else max += a[i];
        }
    }
    cout << max;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define all(a) (a).begin(), (a).end()

int main() {
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	if (x + r > w || x - r < 0 || y + r > h || y - r < 0)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int h,w;
bool outside(int x,int y){
	if(x<0||x>=w)return true;
	if(y<0||y>=h)return true;
	return false;
}

int main(){
	char ch;
	cin>>h>>w;
	bool dt[h][w];
	rep(i,h){
		rep(j,w){
			cin>>ch;
			dt[i][j]=((ch=='#')?1:0);
		}
	}
	bool ans=true;
	rep(i,h){
		rep(j,w){
			if(dt[i][j]){
				bool check=false;
				rep(k,4){
					if(outside(j,i))continue;
					if(dt[i+dy[k]][j+dx[k]]){
						check=true;
						break;
					}
				}
				if(!check){
					ans=false;
					break;
				}
			}
		}
		if(!ans)break;
	}
	cout<<((ans)?"Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

constexpr int64_t MOD = 1'000'000'007;

template< typename T >
T mod_pow(T x, T n) {
    T ret = 1;
    while(n > 0) {
        if(n & 1) (ret *= x) %= MOD;
        (x *= x) %= MOD;
        n >>= 1;
    }
    return ret;
}

int64_t modinv(int64_t a) {
    int64_t b = MOD, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

int64_t comb(int64_t n, int64_t r) {
    int64_t res = 1;
    for(int64_t i=1; i<=r; i++) {
        res *= (n-i+1);
        res %= MOD;
        res *= modinv(i);
        res %= MOD;
    }
    return res;
}

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

    cout << (mod_pow(2L, n) - 1 - comb(n, a) - comb(n, b) + 2*MOD) % MOD << endl;
    return 0;
}


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

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(t, c) for (auto&& t : c)
#define ALL(c) begin(c), end(c)
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define fk first
#define sv second

const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1}, dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c, d;

  cin >> a >> b >> c >> d;
  cout << max(min(b, d) - max(a, c), 0) << endl;
}

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

int black[4100][4100] = {};
int white[4100][4100] = {};

int n, k;
int get(int array[4100][4100], int y, int x){
    return array[y+k/2][x+k/2]-array[y][x+k/2]-array[y+k/2][x]+array[y][x];
}

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

    int x, y;
    char c;
    k *= 2;
    for(int i = 0;i < n;i++){
        cin >> x >> y >> c;
        x = x % k;
        y = y % k;
        if(c == 'B'){
            black[y+1][x+1]++;
            black[y+k+1][x+1]++;
            black[y+1][x+k+1]++;
            black[y+k+1][x+k+1]++;
        }else{
            white[y+1][x+1]++;
            white[y+k+1][x+1]++;
            white[y+1][x+k+1]++;
            white[y+k+1][x+k+1]++;
        }
    }

    for(int i = 0;i < 2*k;i++){
        for(int j = 0;j < 2*k;j++){
            black[i][j+1] += black[i][j];
            white[i][j+1] += white[i][j];
        }
    }

    for(int i = 0;i < 2*k;i++){
        for(int j = 0;j < 2*k;j++){
            black[i+1][j] += black[i][j];
            white[i+1][j] += white[i][j];
        }
    }

    int ans = 0;
    for(int i = 0;i < k;i++){
        for(int j = 0;j < k;j++){
            ans = max(ans, get(black, i, j) + get(white, i, j+k/2)+get(white, i+k/2, j)+get(black,i+k/2,j+k/2));
        }
    }

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

Measured memory_bytes: 131328
#include <bits/stdc++.h>
using namespace std;
int INF = 10000;
int main(){
  string s;
  cin >> s;
  int N = s.size();
  set<char> st;
  for (int i = 0; i < N; i++){
    st.insert(s[i]);
  }
  int ans = INF;
  for (char c : st){
    vector<string> A(1);
    for (int i = 0; i < N; i++){
      if (s[i] == c){
        A.push_back("");
      } else {
        A.back().push_back(s[i]);
      }
    }
    int tmp = 0;
    for (int i = 0; i < A.size(); i++){
      int tmp2 = A[i].size();
      tmp = max(tmp, tmp2);
    }
    ans = min(ans, tmp);
  }
  cout << ans << endl;
}

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

using namespace std;

string check(string s) {
    if(s.size()%2) return "No";
    for(int i=0;i<s.size()/2;i++) if(s[i] != s[i+s.size()/2]) return "No";
    return "Yes";
}

int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    cout << check(s) << endl;
    return 0;
}


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

int main() {
    int angle = 90;
    double x = 0, y = 0, radian = M_PI * angle / 180;
    while (true) {
        int d, t;
        scanf("%d,%d", &d, &t);
        if (d == 0 && t == 0)
            break;

        x += d * cos(radian);
        y += d * sin(radian);
        angle -= t;
        radian = M_PI * angle / 180;
    }
    printf("%d\n%d\n", (int)x, (int)y);
}

Measured memory_bytes: 0
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 

    String str = sc.nextStr();
    int n = str.length();
    int[] ns = new int[n];

    long count = 0;
    long ans = 0;
    for(int i = 0; i < n; i++){
      if(str.charAt(i) == 'B'){
        count++;
      }else{
        ans += count;
      }
    }

    System.out.println(ans);

  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

Measured memory_bytes: 25940
using System;
using System.Linq;

namespace _2600
{
	class Program
	{
		static void Main(string[] args)
		{
			int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
			int[] sumw = new int[x[1] + 1]; int[] sumh = new int[x[2] + 1];
			for (int i = 0; i < x[0]; i++)
			{
				int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
				sumw[Math.Max(0, a[0] - a[2])]++; sumw[Math.Min(x[1], a[0] + a[2])]--;
				sumh[Math.Max(0, a[1] - a[2])]++; sumh[Math.Min(x[2], a[1] + a[2])]--;
			}
			bool retw = true; int sum = 0;
			for (int i = 0; i < x[1]; i++)
			{
				sum += sumw[i]; if (sum <= 0) retw = false;
			}
			bool reth = true; sum = 0;
			for (int i = 0; i < x[2]; i++)
			{
				sum += sumh[i]; if (sum <= 0) reth = false;
			}
			Console.WriteLine(retw||reth ? "Yes" : "No");
		}
	}
}


Measured memory_bytes: 24824
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <climits>
using namespace std;
void solve()
{
	int n,temp;
	cin>>n;
	set<int>s;
	for(int i=0;i<n;i++) {
		cin>>temp;
		s.insert(temp);
	}
	if(s.size()==n) cout<<"YES\n";
	else cout<<"NO\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // int t;
    // cin>>t;
    // while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;



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

  vector<int> ship(n+1);
  REP(i,n+1) ship[i] = 0;
  REP(i,m){
    int a, b;
    cin >> a >> b;
    --a, --b;
    if(a == 0) ship[b]++;
    if(b == n) ship[a]++;
  }

  bool ok = false;

  REP(i,n+1){
    if(ship[i] >= 2) {
      ok = true;
      break;
    }
  }

  if(ok) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;
  return 0;
}


Measured memory_bytes: 4044
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>

#define ll long long

using namespace std;
string s;
long long n;

long long f(string s, int & nn){
    if(!s.length()){nn=1;  return 0;}
    long long res = 0; nn=0;
    for(int i=1; i<=s.length(); i++){
	string ss = s.substr(0, i);
	string ss2 = s.substr(i);
	int k=1;
	long long num = stol(ss);
	long long num2 = f(ss2,k);
	res += num*k +num2;
	nn+=k;
//	cout<<ss<<" "<<ss2<<" "<<num<<" "<<num2<<"\n";
    }
    return res;
}

int main(){
    cin>>s;
    n = s.length();
    int k=0;
    cout<<f(s,k);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define INF 0x7FFFFFFF//or 0x3f3f3f3f ? -Wall
using namespace std;

template<class T> inline
void read(T& x) {
	int f = 1; x = 0;
	char ch = getchar();
	while (ch < '0' || ch > '9')   {if (ch == '-') f = -1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}

/*============ Header Template ============*/

const int N = 200000 + 5;

int n, k;
int p[N], t[N];
int a[N], b[N];

int solve() {
	for (int i = n - 1; i; i--) {
		for (int j = 1; j <= 2 * i - 1; j++) {
			t[1] = a[j];
			t[2] = a[j + 1];
			t[3] = a[j + 2];
			sort(t + 1, t + 3 + 1);
			b[j] = t[2];
		}
		for (int j = 1; j <= 2 * i - 1; j++) a[j] = b[j];
	}
	return a[1];
}

int main() {
	read(n), read(k);
	if (k == 1 || k == 2 * n - 1) {printf("No\n"); return 0;}
	a[n] = k; int cur = 1;
	for (int i = n - 1; i; i--) {
		if (cur == k) cur++;
		a[i] = cur;
		cur++;
	}
	cur = 2 * n - 1;
	for (int i = n + 1; i <= 2 * n - 1; i++) {
		if (cur == k) cur--;
		a[i] = cur;
		cur--;
	}
	printf("Yes\n");
	for (int i = 1; i <= 2 * n - 1; i++) printf("%d\n", a[i]);
	//printf("ans = %d\n", solve());
	return 0;
}

Measured memory_bytes: 2304
H, N = map(int, input().split())
A = [None] * N
B = [None] * N

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

lim = H + max(A)
dp = [10**8] * lim
dp[0] = 0

for h in range(lim):
    for n in range(N):
        rem = h - A[n]
        cns = B[n]

        if 0 < rem:
            cns += dp[rem]
        dp[h] = min(cns, dp[h])

print(min(dp[H:lim]))


Measured memory_bytes: 42588
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <set>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)
int main(){
    int N,a,b,c,deg[10000];
    cin>>N;
    rep(i,N) deg[i]=0;
    vector<int> edge[10000],vec;

    rep(i,N-1){
        cin>>a>>b;
        edge[a-1].push_back(b-1);
        edge[b-1].push_back(a-1);
        deg[a-1]++;
        deg[b-1]++;
    }
    rep(i,N){
        cin>>c;
        vec.push_back(c);
    }
    sort(vec.begin(),vec.end());
    ll M=0;
    int node,ans[10000];
    rep(i,N-1){
        M+=vec[i];
        rep(j,N){
            if(deg[j]==1){
                node=j;
                ans[node]=vec[i];
                deg[j]=-1;
                rep(j,edge[node].size()){
                deg[edge[node][j]]--;
                }
                break;
            }            
        }
    }
    rep(i,N){
        if(deg[i]>-1) ans[i]=vec.back();
    }
    cout<<M<<endl;
    rep(i,N) cout<<ans[i]<<" ";

    
    return 0;
}

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

using namespace std;

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

	int rest = X % 500;
	int five_hundreds = X / 500;
	int five = rest / 5;

	cout << five_hundreds * 1000 + five * 5 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

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

    bool ok=false;
    for(int i=0;4*i<=N;i++){
        for(int j=0;4*i+7*j<=N;j++){
            if(4*i+7*j==N) ok=true;
        }
    }
    cout<<(ok? "Yes":"No")<<endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main(void){
    ll X=0;
    ll Y=0;
    cin>>X>>Y;
    bool flag=0;
    
    ll A=2*X;
    if(A==Y){
            cout<<"Yes"<<endl;
            flag=1;
        }
        
    for(ll i=0; i<X;i++){
        A=A+2;
        if(A==Y){
            cout<<"Yes"<<endl;
            flag=1;
        }
        
    }
        
        if(flag==0)
        cout<<"No";
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <queue>

using namespace std;
const int maxn = 1000005;

queue<int> q;
char s[maxn],t[maxn];int n,ans,cur,las;

bool comp(char *s,char *t)
{
	for (int i=1;i<=n;i++)
		if (s[i]!=t[i]) return false;
	return true;
}
int main()
{
	scanf("%d %s %s",&n,s+1,t+1);cur=n;
	if (comp(s,t)) {puts("0");return 0;}
	for (int i=n;i>=1;i--)
	{
		las=cur;cur=min(i,cur);
		while (cur&&s[cur]!=t[i]) --cur;
		if (cur<=0) {puts("-1");return 0;}
		if (las==cur) continue;
		while (q.size()&&q.front()-(int)q.size()+1>i) q.pop();
		q.push(cur);ans=max(ans,(int)q.size());
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 6272
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;

int N, K, h[202020], dp[202020];

void solve() {
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    FOR(N)
    cin >> h[i];
    FOR(N + 1000)
    dp[i] = INF;
    dp[0] = 0;
    FOR(N) {
        FOR(nxt, i + 1, min(i + K + 1, N)) {
            chmin(dp[nxt], dp[i] + abs(h[i] - h[nxt]));
        }
    }
    cout << dp[N - 1] << endl;
    solve();
    return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define MAXN 3005
#define INF 0x3f3f3f3f
#define rint register int
#define LL long long
#define LD long double
using namespace std;

int n, m, cnt, f[MAXN][MAXN], pre[MAXN][MAXN];
char s[MAXN], t[MAXN], ans[MAXN];

void print(int x, int y)
{
	if(x==0 || y==0) return;
	if(pre[x][y]==0)
	{
		ans[++cnt]=s[x-1];
		print(x-1, y-1);
	}
	if(pre[x][y]==1) print(x-1, y);
	if(pre[x][y]==2) print(x, y-1);
}

int main()
{
	scanf("%s%s", s, t);
	n=strlen(s); m=strlen(t);
	for(rint i=1; i<=n; ++i)
	{
		for(rint j=1; j<=m; ++j)
		{
			if(s[i-1]==t[j-1]) f[i][j]=f[i-1][j-1]+1, pre[i][j]=0;
			else
			{
				if(f[i-1][j]>f[i][j-1]) f[i][j]=f[i-1][j], pre[i][j]=1;
				else f[i][j]=f[i][j-1], pre[i][j]=2;
			}
		}
	}
	print(n, m);
	for(rint i=cnt; i>=1; i--) printf("%c", ans[i]);
	return 0;
}

Measured memory_bytes: 70784
#include<stdio.h>

int main(void){
	int x,y,s;
	while(1){
        scanf("%d\n%d",&x,&y);
		if(x==0 && y==0){
			break;
		}else{
			if(x>y){
				s = x,x = y,y = s;
			}else{
			}
		}
		printf("%d %d\n",x,y);



	}


	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;
using P = pair<int, int>;
const int MOD = 1e9+7;
const double EPS = 1e-9;

map<int, vi> match;
vector<bool> seen, visited;
vi order;
bool able = true;

void dfs(int v) {
  seen[v] = true;

  for (auto nv : match[v]) {
    if (seen[nv] && !visited[nv]) {
      able = false;
      return;
    }
    if (!seen[nv]) dfs(nv);

    if (!able) return;
  }

  order.push_back(v);
  visited[v] = true;
}

void solve() {
  int n; cin >> n;

  vi start, ends;
  int prev, next;  // game number
  int tmp;

  rep(i,n) {
    cin >> tmp; --tmp;

    if (i < tmp) prev = n*i + tmp;
    else prev = n*tmp + i;
    start.push_back(prev);

    rep(j,n-2) {
      cin >> tmp; --tmp;

      if (i < tmp) next = n*i + tmp;
      else next = n*tmp + i;
      match[prev].push_back(next);
      prev = next;
    }
    ends.push_back(prev);
  }

  seen.assign(n*n, false);
  visited.assign(n*n, false);
  rep(i,n) {
    if (seen[start[i]]) continue;
    dfs(start[i]);
    if (!able) {
      cout << -1 << endl;
      return;
    }
  }
  reverse(ALL(order));

  vi days(n*n, 1);
  for (auto v : order) {
    for (auto nv : match[v]) {
      days[nv] = max(days[nv], days[v]+1);
    }
  }
  
  int ans = 0;
  rep(i,n) ans = max(ans, days[ends[i]]);
  cout << ans << endl;
}

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


Measured memory_bytes: 61296
import collections
h, w = map(int, input().split())
counter = collections.Counter()
for i in range(h):
    counter += collections.Counter(input())

cnt = [0, 0, 0, 0]
for k, v in counter.items():
    cnt[v % 4] += 1
if h % 2 == 0 and w % 2 == 0:
    if cnt[1] == 0 and cnt[2] == 0 and cnt[3] == 0:
        print('Yes')
    else:
        print('No')
elif h % 2 == 1 and w % 2 == 1:
    if (cnt[1] == 1 and cnt[2] <= (h - 1)//2 + (w - 1)//2 and cnt[3] == 0) or (cnt[1] == 0 and cnt[2] <= (h - 1)//2 + (w - 1)//2 - 1 and cnt[3] == 1):
        print('Yes')
    else:
        print('No')
elif h % 2 == 1:
    if cnt[1] == 0 and cnt[3] == 0 and cnt[2] <= w // 2:
        print('Yes')
    else:
        print('No')
else:
    if cnt[1] == 0 and cnt[3] == 0 and cnt[2] <= h // 2:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 39920
import Data.IntMap.Lazy (adjust, fromList, (!))

main = interact $ unlines . map (show . next_mayor . map read . words) . takeWhile (/= "0 0") . lines

next_mayor [n,p] = game p 0 (fromList (zip [0..n-1] (repeat 0)))
 where
  game p' n' im
   | p'==1 && im!n'==(p-1) = n'
   | p'==0 = game (im!n') (mod (n'+1) n) (adjust (const 0) n' im)
   | otherwise = game (p'-1) (mod (n'+1) n) (adjust succ n' im)

Measured memory_bytes: 4088
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string str;
    cin >> str;

    int res1 = 0;
    for(char c : str){
        res1 += c - '0';
    }
    int res2 = (str.length()-1) * 9 + str[0] -'1';
    cout << max(res1,res2) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	char n[3];
	cin >> n;
	if(n[0] == '7' || n[1] == '7' || n[2] == '7'){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<stack>
#include<map>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
int main()
{
	int n;
	scanf("%d",&n);
	int gcdx;
	scanf("%d",&gcdx);
	for(int i=2;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		gcdx=gcd(x,gcdx);
	}
	printf("%d\n",gcdx);
	return 0;
}

Measured memory_bytes: 384
# B - Coins
A=int(input())
B=int(input())
C=int(input())
X=int(input())
cnt = 0
for a in range(0,A+1):
    for b in range(0,B+1):
        for c in range(0,C+1):
            if a * 500 + b * 100 + c * 50 ==X:
                cnt+=1
print(cnt)

Measured memory_bytes: 3060
import java.util.Scanner;


public class Main{

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int cnt = Integer.parseInt(s.nextLine());
		int[] maxHeap = new int[cnt];
		String[] tmp = s.nextLine().split(" ");
		for(int i=0 ; i<cnt ; i++) {
			maxHeap[i] = Integer.parseInt(tmp[i]);
		}
		buildMaxHeap(maxHeap);
		for(int i=0 ; i<maxHeap.length ; i++) {
			System.out.print(" " + maxHeap[i]);
		}
		System.out.println("");
	}

	public static void maxHeapify(int[] maxHeap, int index) {
		int leftChild = index*2;
		int rightChild = (index*2)+1;
		int max = maxHeap[index-1];
		if(maxHeap.length>=leftChild && maxHeap[leftChild-1]>maxHeap[index-1]) {
			max = maxHeap[leftChild-1];
		}
		if(maxHeap.length>=rightChild && maxHeap[rightChild-1]>max) {
			max = maxHeap[rightChild-1];
		}
		if(max!=maxHeap[index-1]) {
			if(max==maxHeap[leftChild-1]) {
				int tmp = maxHeap[leftChild-1];
				maxHeap[leftChild-1] = maxHeap[index-1];
				maxHeap[index-1] = tmp;
				maxHeapify(maxHeap, leftChild);
			}else if(max==maxHeap[rightChild-1]) {
				int tmp = maxHeap[rightChild-1];
				maxHeap[rightChild-1] = maxHeap[index-1];
				maxHeap[index-1] = tmp;
				maxHeapify(maxHeap, rightChild);
			}
		}
	}

	public static void buildMaxHeap(int[] maxHeap) {
		for(int i=(maxHeap.length/2) ; i>0 ; i--) {
			maxHeapify(maxHeap, i);
		}
	}
}

Measured memory_bytes: 185384
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
typedef long long int64;
using namespace std;
using P = pair<int64, int64>;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const int64 INF = 1LL << 62;
const int inf = 1<<30;
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; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> const&P){
    os << P.first;
    os << " ";
    os << P.second;
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
//fixed<<setprecision(10)<<ans<<endl;

int64 gcd(int64 a, int64 b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int64 lcm(int64 n, int64 m){
    return n * (m / gcd(n, m));
}

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

    int upper = 3500;
    int64 G,numerator,denomirator,G2,numerator2,denomirator2;
    for(int h=1;h<=upper;h++){
        for(int n=h;n<=upper;n++){
            int64 LCM = lcm(lcm(n,h),N);
            numerator = LCM*4/N - LCM/h - LCM/n;
            denomirator = LCM;

            if(numerator < 0 or denomirator < 0) continue;
            if(gcd(numerator, denomirator) == numerator){
                cout << h << " " << n << " " << denomirator/numerator << "\n";
                return 0;
            }

        }
    }    
}

Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int parent(int i) { return i / 2; }
int left(int i) { return i * 2; }
int right(int i) { return i * 2 + 1; }

signed main() {
	int i, h, A[250 + 1];
	cin >> h;
	rep(i, h) cin >> A[i + 1];
	rep(i, h) {
		cout << "node " << i+1 << ": " << "key = " << A[i + 1] << ", ";
		if (parent(i + 1) >= 1) cout << "parent key = " << A[parent(i + 1)] << ", ";
		if (left(i + 1) <= h) cout << "left key = " << A[left(i + 1)] << ", ";
		if (right(i + 1) <= h) cout << "right key = " << A[right(i + 1)] << ", ";
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3076
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var N int
	fmt.Scan(&N)
	var arr []int
	for _, v := range strings.Split("123456789", "") {
		w, _ := strconv.Atoi(strings.Repeat(v, 3))
		arr = append(arr, w)
	}
	var r int
	for i := 0; i < len(arr); i++ {
		if N <= arr[i] {
			r = arr[i]
			break
		}
	}
	fmt.Println(r)

}

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

int main()
{
	char s[3];
	cin >> s;
	int ans = 0;
	for(int i = 0; i < 3; i++){
		if(s[i] == '1'){
			ans++;
		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();

        System.out.println((n-h+1)*(n-w+1));



    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}//ここまで

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    string s,t;
    cin >> s >> t;
    string tes;
    bool flag,ans = false;
    int index,num = s.size()-t.size();
    for(int i=0;i<=num;i++){
        flag = true;
        tes = s.substr(num-i,t.size());
        for(int j=0;j<t.size();j++){
            if(tes[j]!=t[j]&&tes[j]!='?')flag = false;
        }
        if(flag){
            index = num-i;
            ans = true;
            break;
        }
    }
    if(!ans)COUT("UNRESTORABLE");
    else{
        for(int i=0;i<s.size();){
            if(i==index){
                cout << t;
                i+=t.size();
            }
            else{
                if(s[i]=='?') cout << 'a';
                else cout << s[i];
                i++;
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def No(): print('No')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

x,y = imn()

diff = max(abs(x), abs(y))-min(abs(x),abs(y))
if x == 0:
    if y > 0:
        print(y)
    else:
        print(abs(y)+1)
elif y == 0:
    if x > 0:
        print(abs(x)+1)
    else:
        print(abs(x))
elif x > 0 and y > 0 or x < 0 and y < 0:
    if x < y:
        print(diff)
    else:
        print(diff+2)
else:
    print(diff+1)

Measured memory_bytes: 5804
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

int gcm(long a, long b) {
	if (a == 0) {
		return b;
	}
	else if (b == 0) {
		return a;
	}
	else if (a > b) {
		return gcm(b, a % b);
	}
	else{
		return gcm(a, b % a);
	}
}

int main()
{
	long a, b;
	cin >> a >> b;
	long long res = (long long)a * (long long)b;
	cout << res/gcm(a,b);
}

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

int main(){

int ptr =0;
    string str;
    cin>>str;
    for(int i=0;i<str.size();i++){
            int k = i+1;
        if((k % 2 ==0  && str[i] == 'R') || (k % 2 != 0  && str[i] == 'L')){
            ptr =1;
            break;
        }
        else{
            ptr =0;
        }

    }
    if(ptr == 1){
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }
}


Measured memory_bytes: 256