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

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

 int main() {
   ll H, W;
   cin >> H >> W;

   if (H == 1 || W == 1) cout << 1 << endl;

   else if (H % 2 == 0 || W % 2 == 0) cout << H * W / 2 << endl;
   else cout << (H - 1) * (W - 1) / 2 + (H - 1) / 2 + (W - 1) / 2 + 1 << endl;
 }


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

int main()
{
  string s;
  cin >> s;
  int cnt = 0;
  int ans = 0;
  rep(i, s.size())
  {
    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')
    {
      if (s[i - 1] == 'A' || s[i - 1] == 'C' || s[i - 1] == 'G' || s[i - 1] == 'T')
        cnt++;
      else
      {
        cnt = 0;
        cnt++;
      }
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <cstdio>
#include <cstring>
#define ll long long
using namespace std;

const int N = 100010;

inline int read() {
	int jg = 0, jk = getchar() - '0';
	while(jk < 0 || jk > 9)  jk = getchar() - '0';
	while(jk >= 0 && jk <= 9)
		jg *= 10, jg += jk, jk = getchar() - '0';
	return jg;
}

int n, m, fa[N], num, sum;
bool vi[N];
char s[5];

int main() {
	//freopen("a.txt", "r", stdin);
	n = read(), m = read();
	for(int i = 1, j; i <= m; ++i) {
		j = read();
		scanf("%s", s);
		if(s[0] == 'W')  fa[j]++;
		else  if(!vi[j])
			vi[j] = 1, num++, sum += fa[j];
	}
	printf("%d %d", num, sum);
	return 0;
}

Measured memory_bytes: 768
#include <cstdio>
#include <cstring>
#include <vector>
#include <cmath>
#include <queue>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 2000 + 10;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};

int n;
int len, o;
int flag;
int h[N][N];
int vis[N][N];

int valid(int x, int y)
{
	return x >= 0 && y >= 0 && vis[x][y] == flag;
}

void bfs(int sx, int sy)
{
	queue<pair<int, int> > que;
	que.push(make_pair(sx, sy));
	vis[sx][sy] = flag + 1;
	int nx, ny;
	int px, py;
	for( ; que.size(); ) {
		nx = que.front().first;
		ny = que.front().second;
		que.pop();
		for(int i = 0; i < 4; ++ i) {
			px = nx + dx[i];
			py = ny + dy[i];
			if (valid(px, py) && h[nx][ny] == h[px][py]) {
				vis[px][py] = flag + 1;
				que.push(make_pair(px, py));
			}
		}
	}
}

void solve()
{
	len = 0;
	for( ; len * len < n; ++ len);
	o = len;

	++ flag;
	for(int i = 0; i <= 2 * len + 2; ++ i)
		for(int j = 0; j <= 2 * len + 2; ++ j)
			h[i][j] = 0;
	for(int x = -len; x <= len; ++ x) {
		for(int y = -len; y <= len; ++ y) {
			h[x + o][y + o] = 0;
			if (x * x + y * y < n) {
				int tmp = sqrt(n - x * x - y * y);
				for( ; tmp * tmp + x * x + y * y < n; ++ tmp);
				for( ; tmp > 0 && (tmp - 1) * (tmp - 1) + x * x + y * y >= n; -- tmp);
				h[x + o][y + o] = tmp;
			}
			//cout << x << ' ' << y << ' ' << h[x + o][y + o] << endl;
			vis[x + o][y + o] = flag;
		}
	}
	for(int i = 0; i <= 2 * len; ++ i) {
		for(int j = 0; j <= 2 * len; ++ j) {
			if (vis[i][j] == flag || vis[i + 1][j] == flag || vis[i][j + 1] == flag || vis[i + 1][j + 1] == flag) {
				h[i][j] = max(max(h[i][j], h[i + 1][j + 1]), max(h[i][j + 1], h[i + 1][j]));
				if (h[i][j] <= 0) continue;
				//cout << i << ' ' << j << ' ' << h[i][j] << endl;
				vis[i][j] = flag + 1;
			}
		}
	}
	++ flag;
	int ret = 0;
	for(int i = 0; i <= 2 * len; ++ i) {
		for(int j = 0; j <= 2 * len; ++ j) {
			if (vis[i][j] == flag) {
				ret += 6;
				bfs(i, j);
			}
		}
	}
	++ flag;
	cout << ret << endl;
}

int main()
{
	flag = 0;
	for( ; cin >> n && n; ) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 32732
n = int(input())
w = list(map(int, input().split()))

ans = float('inf')

s1 = 0
s2 = 0

for i in range(n):
    s2 += w[i]

for i in range(n-1):
    s1 += w[i]
    s2 -= w[i]
    sa = abs(s1-s2)
    ans = min(sa, ans)

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define int int64_t
#define double long double
#define rep(i, N) for(int i=0; i<N; i++)
#define repr(i, N) for(int i=N-1; i>=0; --i)
#define all(v) v.begin(),v.end() 
using namespace std;
//using pr = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;

//プロトタイプ宣言

//グローバル変数
//const int INF = ;
//const int MAX_N = ;
//const int MAX_M = ;
//vvec dp(MAX_N, vec(MAX_M));

//関数：
/* メイン・プログラム */
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n; cin >> n;
	vvec c(10,vec(10, 0));
	for(int i=1; i<=n; i++) {
		int x, y; x = i;
		y = x % 10;
		while(x >= 10) x /= 10;
		c[x][y]++; 
	}
	
	int ans = 0;
	rep(i, 10)rep(j, 10) ans += c[i][j]*c[j][i];
	
	cout << ans << endl;
	return 0;
}

/*
整数 i,j(0 ≤ i,j ≤ 9) に対して、
ci,j := #{1 ≤ k ≤ N|k の先頭の桁の数は i に等しく、末尾の桁の数は j に等しい }
と定義します。これは、O(N) で計算することができます。ci,j を用いると、この問題の答えは
∑9 ∑9 ci,j × cj,i i=0 j=0
と計算することができます
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int main(){
    int n,i;
    cin >> n;
    vector<pair<int, int> > pairs(n);

    FOR(i,0,n){
        int junni;
        cin >> junni;
        pairs[i] = make_pair(junni, i+1);
    }
    sort(pairs.begin(), pairs.end());
    FOR(i,0,n-1){
        cout << pairs[i].second << ' ';
    }
    cout << pairs[n-1].second << endl;
    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define ll long long

using namespace std;

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

  int x,n;
  cin >> x >> n;
  vector<bool> present(n+2);
  for(int i =0; i <n; ++i){
    int tmp;
    cin >> tmp;
    if(tmp-x+(n+2)/2 >=0 && tmp-x+(n+2)/2 < n+2)
      present[tmp-x+(n+2)/2] = true;
  }
  int m = 1e9+6, idx = 0;
  for(int i = 0; i < n+2; ++i){
    if(present[i] == false){
      if(m > abs(i-(n+2)/2)){
	idx = i+x-(n+2)/2;
	m =  abs(i-(n+2)/2);
      }
    }
  }
  cout<<idx;
      
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
   using namespace std;
   using pii = pair<int, int>;
   using ll = long long;
   #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
   const ll MOD = 1000000007;
   const ll INFL = (1LL << 60);
   const int INFI = (1 << 30);

   int main() {
     string S; cin >> S;
     int n = S.length();
     reverse(S.begin(), S.end());
     vector<int> Smod(n); //右からi桁目のあまり
     vector<int> mod2019(2019, 0); //あまりのカウント

     int m = 1;
     rep(i, 0, n) {
       int d = (int)(S.at(i) - '0');
       d = d * m % 2019;
       Smod.at(i) = d;
       m = m * 10 % 2019;
     }

     int amari = 0;
     mod2019.at(amari)++;
     rep(i, 0, n) {
       amari = amari + Smod.at(i);
       amari %= 2019;
       mod2019.at(amari)++;
     }

     ll ans = 0;
     rep(i, 0, 2019) {
       ans += mod2019.at(i) * (mod2019.at(i) - 1) / 2;
     }

     cout << ans << endl;
   }


Measured memory_bytes: 4448
import sys
S = input()
T = input()
ans = 'UNRESTORABLE'

tmp = True
anss = -1
anse = -1
for i in range(len(S) - len(T) + 1):
    tmp = True
    s = i
    e = i + len(T)
    for j in range(len(T)):
        if S[i + j] != '?' and\
            S[i + j] != T[j]:
            tmp = False
            break

    if tmp:
        anss = i
        anse = i + len(T)

if anss == -1:
    print(ans)

else:
    ans = S.replace('?', 'a')
    ans = ans[:anss] + T + ans[anse:]
    print(ans)


Measured memory_bytes: 3064
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string c1 = Console.ReadLine();
            string c2 = Console.ReadLine();
            string c3 = Console.ReadLine();
            Console.WriteLine($"{c1[0]}{c2[1]}{c3[2]}");
        }
    }
}

Measured memory_bytes: 11092
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;
const ll N=1e3+10;
const ll P=1e9+7;
struct node{int r,l;};
bool operator<(node a,node b){return a.l<b.l||(a.l==b.l&&a.r<b.r);}
bool cmp(node a,node b){return a.r<b.r;}
vector<node>v,v1;
int main()
{
    string s;
    int n,i,j;
    cin>>n;v.clear();v1.clear();
    for(i=0;i<n;i++)
    {
        cin>>s;int x=0,y=0;
        for(j=0;j<s.length();j++)
        {
            if(s[j]=='(')x++;
            else if(x)x--;else y++;
        }
        if(x>y)v.push_back(node{y,x});
        else v1.push_back(node{y,x});
    }
    sort(v.begin(),v.end(),cmp);
    sort(v1.begin(),v1.end());
    int sum=0;
    for(i=0;i<v.size();i++)
    if(sum<v[i].r){printf("No\n");return 0;}
    else sum+=(v[i].l-v[i].r);
    for(i=v1.size()-1;i>=0;i--)
    if(sum<v1[i].r){printf("No\n");return 0;}
    else sum+=(v1[i].l-v1[i].r);
    if(sum==0)printf("Yes");
    else printf("No");
    printf("\n");
    return 0;
}

Measured memory_bytes: 1216
import sys
def solve():
    readline = sys.stdin.readline
    write = sys.stdout.write
    MOD = 998244353

    N = int(readline())
    P = [list(map(int, readline().split())) for i in range(N)]

    P.sort()

    Y = [y for x, y in P]

    def compress(X):
        *XS, = set(X)
        XS.sort()
        return list(map({e: i for i, e in enumerate(XS)}.__getitem__, X))
    Y = compress(Y)

    data = [0]*(N+1)
    def add(k, x):
        while k <= N:
            data[k] += x
            k += k & -k
    def get(k):
        s = 0
        while k:
            s += data[k]
            k -= k & -k
        return s

    def gen(add, get):
        pow2 = [1]*N
        r = 1
        for i in range(1, N):
            pow2[i] = r = r * 2 % MOD

        for i, y in enumerate(Y):
            v1 = get(y+1); v0 = y - v1
            w1 = i - v1; w0 = (N - y - 1) - w1
            add(y+1, 1)
            p1 = pow2[v1]; p0 = pow2[v0]
            q1 = pow2[w1]; q0 = pow2[w0]
            yield (2 * (p1*p0 % MOD)*(q1*q0 % MOD) % MOD) - (1 - p0 - p1 - q0 - q1 + (p0 + q1) * (p1 + q0)) % MOD
    write("%d\n" % (sum(gen(add, get)) % MOD))
solve()

Measured memory_bytes: 119172
use std::cmp;

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

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

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

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

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

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

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

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

fn main() {
    input! {
        n: u64,
        a: u64,
        b: u64,
        c: u64,
        d: u64,
        e: u64
    }
    let mut min = 10000000000000000000;
    for i in vec![a, b, c, d, e] {
        min = cmp::min(min, i)
    }
    let min = min as f64;
    let n = n as f64;
    let ans = (n / min).ceil() + 4.0;
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <vector>
#include <stdio.h>

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> p(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &p[i]);
    p[i]--;
  }

  
  bool pre = p[0] == 0? true: false;
  int ans = pre;
  for (int i = 1; i < n; ++i) {
    if (p[i] == i && !pre) ans++;
    if (p[i] == i && !pre) {
      pre = true;
    } else {
      pre = false;
    }
    // pre = p[i] == i;
  }

  printf("%d\n", ans);
  return 0;
}



Measured memory_bytes: 640
#include "bits/stdc++.h"

using namespace std;

typedef long double ld;
typedef complex<ld> Point;

const ld eps = 1e-9, pi = acos(-1.0);

namespace std {
	bool operator<(const Point &lhs, const Point &rhs) {
		if (lhs.real() < rhs.real() - eps) return true;
		if (lhs.real() > rhs.real() + eps) return false;
		return lhs.imag() < rhs.imag();
	}
}

Point input_point() {
	ld x, y;
	cin >> x >> y;
	return Point(x, y);
}

bool eq(ld a, ld b) {
	return (abs(a - b) < eps);
}

// dot of a and b
ld dot(Point a, Point b) {
	return real(conj(a) * b);
}

// cross of a and b
ld cross(Point a, Point b) {
	return imag(conj(a) * b);
}

class Circle {
public:
	Point p;
	ld r;
	Circle() : p(Point(0, 0)), r(0) {}
	Circle(Point p, ld r) : p(p), r(r) {}
};

vector<Point> is_cc(Circle c1, Circle c2) {
	vector<Point> res;
	ld d = abs(c1.p - c2.p);
	ld rc = (d * d + c1.r * c1.r - c2.r * c2.r) / (2 * d);
	ld dfr = c1.r * c1.r - rc * rc;
	if (abs(dfr) < eps) dfr = 0.0;
	else if (dfr < 0.0) return res; // no intersection
	ld rs = sqrt(dfr);
	Point diff = (c2.p - c1.p) / d;
	res.push_back(c1.p + diff * Point(rc, rs));
	if (dfr != 0.0) res.push_back(c1.p + diff * Point(rc, -rs));
	return res;
}

struct Sphere{
    ld x,y,l;
    Sphere(ld x, ld y, ld l):x(x),y(y),l(l){}
};

bool check(const vector<Circle> &c){
    bool f=false;
    int sz=c.size();
    vector<Point> res;
    for(int i=0;i<sz;i++){
        for(int j=i+1;j<sz;j++){
            res=is_cc(c[i],c[j]);
            for(int k=0;k<(int)res.size();k++){
                bool ftmp=true;
                for(int t=0;t<sz;t++){
                    if(abs(c[t].p-res[k])<c[t].r+eps){
                        continue;
                    }
                    ftmp=false;
                }
                if(ftmp) f=true; 
            }
        }
    }
    for(int i=0;i<sz;i++){
        bool ftmp=true;
        for(int j=0;j<sz;j++){
            if(abs(c[i].p-c[j].p)<c[j].r+eps) continue;
            ftmp=false;
        }
        if(ftmp) f=true; 
    }
    return f;
}

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

    int n;
    while(cin>>n,n){
        vector<Sphere> s;
        ld low=0,high=114514;
        for(int i=0;i<n;i++){
            ld x,y,l;cin>>x>>y>>l;
            s.push_back(Sphere(x,y,l));
            high=min(high,l);
        }
        for(int i=0;i<100;i++){
            vector<Circle> c;
            ld mid=(low+high)/2;
            for(int j=0;j<n;j++){
                ld x=s[j].x,y=s[j].y,l=s[j].l;
                c.push_back(Circle(Point(x,y),sqrt(l*l-mid*mid)));
            }
            if(check(c)) low=mid;
            else high=mid;
        }
        cout<<fixed<<setprecision(10)<<low<<endl;
    }
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define PI 3.1415926535

int main(void)
{
   string s;
   cin >> s;

   string t;
   cin >> t;

   int n = s.size();
   int m = t.size();
   if(m-n==1){
      string tt = t.substr(0, m - 1);
      if (s == tt){
         cout << "Yes" << endl;
         return 0;
      }
   }
   cout << "No" << endl;
   return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn int

typedef long long ll;
typedef pair<ll,ll> p;


int main()
{
  int n;
  cin >> n;
  map<int, int> mp;
  map<int, int> mpRev;
  for (int i = 0; i < n; i++)
  {
    int tmp;
    cin >> tmp;
    mp[tmp]++;
  }

  vector<p> v;
  for(auto a: mp)
  {
    v.push_back({a.second, a.first});
  }
  sort(rall(v));
  // for(auto a: v) cout << a.first << " : " << a.second << endl;

  int count = 0;
  for(auto a : v)
  {
    if(a.first > 1) count += a.first-1;
  }
  if(count % 2 == 1) count++;
  cout << n - count << endl;

}

Measured memory_bytes: 7156
s = open(0).read().split()
x = s[0][0]
s[0] = s[0][1:]
 
while True:
  p = ord(x)-97
  if len(s[p]) == 0:
    print(x.upper())
    break
  x = s[p][0]
  s[p] = s[p][1:]

Measured memory_bytes: 3060
#include <iostream>
#include<vector>

void insertion(std::vector<int>& a, int n){
    for(int i=0;i<n;i++){
        int v = a[i];
        int j = i-1;
        while(j>=0 && a[j]>v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        for(int k=0;k<n;k++){
            std::cout << a[k];
            if(k<n-1){
                std::cout << " ";
            }else{
                std::cout << '\n';
            }
        }
    }
}


int main(){
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    for(int i=0;i<n;i++){
        std::cin >> a[i];
    }
    insertion(a,n);
    return 0;
}


Measured memory_bytes: 3068
#include <stdio.h>
#include <stdlib.h>

int
check(int num)
{
  if ((num % 2) == 1)
    return (1);
  if (((num % 3) == 0) || ((num % 5) == 0))
    return (1);
  return (0);
}

int
main(int argc, char *argv[])
{
  int *a;
  int n;
  int i;
  int approved = 1;
  
  scanf("%d", &n);
  a = (int *) malloc(n * sizeof (int));
  
  for (i = 0; i < n; i++)
    scanf("%d", a+i);
  
  for (i = 0; i < n; i++) {
    approved = check(a[i]);
    if (!approved) {
      printf("DENIED");
      return (0);
    }
  }
  printf("APPROVED");
}
    


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	vector<int> a(m);
	rep(i, m) cin >> a[i];
	int s = 0;
	rep(i, m) s += a[i];
	if(s > n) printf("-1\n");
	else printf("%d\n", n - s);
	return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};

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 long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

bool is_prime[1000010];

int main() {
    ll n,k;
    cin >> n >> k;
    cout << ll(k*pow(k-1,n-1)+0.5) << endl;
    return 0;
}

Measured memory_bytes: 3972
import java.util.*;

class Main {
    public static void main(String [] args){
        Scanner scan = new Scanner(System.in);
        
        while(true){
            int h = scan.nextInt();
            int w = scan.nextInt();
            
            if(h == 0 && w == 0) break;
            
            for(int i = 0; i < h; ++i){
                for(int j = 0; j < w; ++j){
                    System.out.print('#');
                }
                
                System.out.println();
            }
            
            System.out.println();
        }
    }
}

Measured memory_bytes: 38764
S=input()

count1=0
count2=0
for i in range(len(S)):
    if i%2==0:
        if S[i]=="0":
            count1+=1
        else:
            count2+=1
    else:
        if S[i]=="1":
            count1+=1
        else:
            count2+=1
print(min(count1,count2))


Measured memory_bytes: 39536
<?php
# 整数の入力
fscanf(STDIN, "%d", $a);
# スペース区切りの整数の入力
fscanf(STDIN, "%d %d", $b, $c);

$e = $c % $a;
$f = $c - $e;
if($f >= $b)echo "OK";else echo "NG";


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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using namespace std;

int main()
{
    ll k, x;
    cin >> k >> x;

    if (500 * k >= x) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

const string YES = "Yes";
const string NO = "No";

void solve(ll N) {
  bool pred =
      [&](){
        for (auto i = 0; i != 10; ++i ) {
          for (auto j = i; j != 10; ++j ) {
            if (i*j==N) return true;
          }
        }
        return false;
      }();
  cout << (pred ? YES : NO) << endl;
}

int main() {
  ll N;
  cin >> N;
  solve(N);
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7

def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0
    nowmax = A[0]
    for i in range(1,N):
        ans += max(0,nowmax-A[i])
        nowmax = max(nowmax,A[i])
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 93612
#include<iostream>                                                              
                                                                                
using namespace std;                                                            
                                                                                
int main(void){                                                                 
  int n;                                                                        
  cin >> n;                                                                     
  if(n >= 1000){                                                                
    cout <<"ABD";                                                               
  }else{                                                                        
    cout <<"ABC";                                                               
  }                                                                             
  return 0;                                                                     
}

Measured memory_bytes: 256
while True:
    m,f,r=map(int,input().split())
    if(m==-1 and f==-1 and r==-1):
        break
    if(m==-1 or f==-1):
        print("F")
    elif(m+f>=80 and r==-1):
        print("A")
    elif(65<=m+f and r==-1):
        print("B")
    elif(50<=m+f or r>=50):
        print("C")
    elif(30<=m+f):
        print("D")
    else:
        print("F")


Measured memory_bytes: 5592
#include <stdio.h>
int main(void){
    char s;
    
    scanf("%c", &s);
    //printf("%c\n", s);
    
    if(s == 'S'){
        printf("Cloudy\n");
    }else if(s == 'C'){
        printf("Rainy\n");
    }else if(s == 'R'){
        printf("Sunny\n");
    }
    
}


Measured memory_bytes: 1548
#include<bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod=1e9+7;
 
int dx[]={-1, 0, 1, 0};
int dy[]={0, -1, 0, 1};




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

  

int n,k;
cin>>n>>k;
vector<double>p(n+1);
double ans=0.0;
for(int i=1;i<=n;i++)
{
  int x; cin>>x;
  p[i]=1.0*(x+1)/2.0;
  p[i]+=p[i-1];
  if(i>=k)ans=max(ans,p[i]-p[i-k]);
}
cout<<setprecision(10)<<fixed;
cout<<ans<<"\n";






}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007

using namespace std;

int main() {
  string s;
  cin >> s;
  vector<vector<ll>> dp(s.length(), vector<ll>(13));
  if(s.at(0) == '?')
    for(int i = 0; i < 10; i++)
      dp.at(0).at(i) = 1;
  else
    dp.at(0).at(s.at(0) - '0') = 1;
  for(int i = 1; i < s.length(); i++) {
    if(s.at(i) == '?')
      for(int k = 0; k < 10; k++)
        for(int j = 0; j < 13; j++)
          dp.at(i).at((j * 10 + k) % 13) =
              (dp.at(i).at((j * 10 + k) % 13) + dp.at(i - 1).at(j)) % MOD;
    else {
      int d = s.at(i) - '0';
      for(int j = 0; j < 13; j++)
        dp.at(i).at((j * 10 + d) % 13) =
            (dp.at(i).at((j * 10 + d) % 13) + dp.at(i - 1).at(j)) % MOD;
    }
  }
  cout << dp.at(s.length() - 1).at(5) << endl;
}

Measured memory_bytes: 13696
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

typedef struct t_queue{
	int size, head, tail;
	int *datavec;
} Queue;

Queue *initQueue(int);
void freeQueue(Queue*);
int queueLength(Queue*);
void enqueue(Queue*, int);
int dequeue(Queue*);
//void printQueue(Queue*);
void errorQueue();

Queue *initQueue(int size){
	Queue *q = (Queue*)malloc(sizeof(Queue));
	if(q == NULL) errorQueue();

	q->size = size;
	q->datavec = (int*)malloc(sizeof(int) * (size+1));
	if(q->datavec == NULL) errorQueue();
	q->head = q->tail = 0;
	return q;
}

void freeQueue(Queue *q){
	free(q->datavec);
	free(q);
}

int queueLength(Queue *q){
	// mod((head-tail) % (size+1))
	return (q->size+1+q->head-q->tail) % (q->size+1);
}

void enqueue(Queue *q, int data){
	q->datavec[q->head] = data;
	q->head++;
	q->head %= (q->size+1);
}

int dequeue(Queue *q){
	int ret = q->datavec[q->tail];
	q->tail++;
	q->tail %= (q->size+1);
	return ret;
}
/**
void printQueue(Queue *q){
	putc('[', stdout);
	if(q->head != q->tail){
		printf("%d", q->datavec[(q->head+q->size) % (q->size+1)]);
		for(int i=(q->head+q->size) % (q->size+1); i!=q->tail; i=(q->size+i) % (q->size+1)){
			printf(", %d", q->datavec[(i+q->size) % (q->size+1)]);
		}
	}
	printf("]\n");
}
**/
void errorQueue(){
	fprintf(stderr, " %s(%d)", strerror(errno), errno);
	exit(1);
}

int main(){
	int n, m;
	scanf("%d %d\n",&n, &m);
	int dep[n+1], sign[n+1], *graph[n+1], glen[n+1];
	for(int i=0; i<n+1; i++){
		dep[i]=glen[i]=sign[i]=0;
		graph[i] = (int*) malloc(sizeof(int)*4);
		//for(int j=0; j<100; j++) graph[i][j]=0;
	}
	for(int i=0; i<m; i++){
		int a, b;
		scanf("%d %d\n",&a, &b);
		graph[a][glen[a]] = b;
		glen[a]++;
		if((glen[a]%4) == 0){
			graph[a] = (int*) realloc(graph[a], sizeof(int)*(glen[a]+4));
		}
		graph[b][glen[b]] = a;
		glen[b]++;
		if((glen[b]%4) == 0){
			graph[b] = (int*) realloc(graph[b], sizeof(int)*(glen[b]+4));
		}
	}
	
	Queue *q = initQueue(n+1);
	enqueue(q, 1);
	do{
		int t = dequeue(q);
		for(int i=0; i<glen[t]; i++){
			int u = graph[t][i];
			if(dep[u]==0){
				dep[u]=1;
				sign[u] = t;
				//if(t == 32) printf("%d %d %d\n",t,i,u);
				enqueue(q,u);
			}
		}
	}while(queueLength(q)!=0);
	freeQueue(q);
	
	printf("Yes\n");
	for(int i=2; i<n+1; i++){
		printf("%d\n", sign[i]);
	}
	return 0;
}

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

using namespace std;

const int N = int(1e5) + 11;
int dp[N];
vector<int > adj[N];
bool vis[N];
vector<int >res;

void dfs(int s){
	if(vis[s]) return;
	
	vis[s] = true;
	for(auto it : adj[s]){
		dfs(it);	
	}
	res.push_back(s);
}

int main(){
	int node, edges;
	cin >> node >> edges;
	
    for(int i = 0; i < edges; ++i){
    	int x, y; cin >> x >> y;
    	adj[x].push_back(y);
    }
    
    for(int i = 1; i <= node; ++i){
    	dfs(i);
    }
    
    for(auto v : res){
    	for(auto u : adj[v]){
    		dp[v] = max(dp[v], 1+dp[u]);
    	}
    }
    
    int result = 0;
    for(int i = 1; i <= node; i++) result = max(result, dp[i]);
    
    cout << result;
	return 0;
}

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

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

int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    c <<= 1;
    int ans = 2e9;
    for (int i = 0; i <= x || i <= y; ++i) {
        int v = a * max(x - i, 0) + b * max(y - i, 0) + c * i;
        ans = min(ans, v);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
using namespace std;
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
void solve()
{
ll n,W,sum=0;
cin>>n>>W;
  ll w[n],v[n];
  for(int i=0;i<n;i++) 
  {
    cin>>w[i]>>v[i];
    sum+=v[i];
  }
  ll dp[n+1][sum+1];
  memset(dp,INT_MAX,sizeof(dp));
  for(int i=0;i<=n;i++) {
      for(int j=0;j<=sum;j++) {
          if(j>0)
            dp[i][j] = INT_MAX;
            else
            dp[i][j]=0;
      }
  }
  for (int i = 1; i <=n; i++)
  {
      for (int j = 0; j <=sum; j++)
      {
          dp[i][j]=dp[i-1][j];
          if(j>=v[i-1])
          dp[i][j]=min(dp[i][j],dp[i-1][j-v[i-1]]+w[i-1]);
      }
  }
  ll ans=0;
  for (int i = 0; i <=sum; i++)
  {
      if(dp[n][i]<=W)
       ans=i;
  }
  cout<<ans<<endl;
}
int main()
{

FASTIO
 long long int t;
 t=1;
 while(t--)
  solve();
  return 0;
}


Measured memory_bytes: 82460
def convert_citynum(pref_num, rank)
  s_pref_num = pref_num.to_s
  s_rank = rank.to_s
  while s_pref_num.length != 6
    s_pref_num = "0" + s_pref_num
  end
  while s_rank.length != 6
    s_rank = "0" + s_rank
  end
  return s_pref_num + s_rank
end
n, m = gets.chomp!.split(' ').map(&:to_i)
data = {}
n.times do |i|
  data[i+1] = []
end
m.times do |i|
  p, y = gets.chomp!.split(' ').map(&:to_i)
  data[p] << [i+1, y]
end
result = []
data.each do |p_num, val|
  val.sort!{ |cur, nxt| cur[1] <=> nxt[1] }
  i = 0
  val = val.map do |id, year|
    i += 1
    [id, convert_citynum(p_num, i)]
  end
  result << val
end
result.flatten!(1)
result.sort!{ |cur, nxt| cur[0] <=> nxt[0] }
result.each do |val|
  puts val[1]
end

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

int main() {
    int N;
    cin >> N;
    map<string, int> mp;
    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        mp[s]++;
    }
    vector<string> res = {"AC", "WA", "TLE", "RE"};
    for (int i = 0; i < 4; ++i) {
        cout << res[i] << " x " << mp[res[i]] << endl;
    }
    
}

Measured memory_bytes: 3632
import sys
sys.setrecursionlimit(100000000)

line = raw_input().rstrip().split()
N, L = map(int, line)


def solve(trr, N):
    if N == 1:
        return L - trr[0]
    elif N == 2:
        return (L - trr[0]) + (L - trr[1])
    best_hour = -1
    peaks = []
    if trr[0] > trr[1]:
        peaks.append(0)
    if trr[N-1] > trr[N-2]:
        peaks.append(N-1)
    peaks += [i for i in xrange(1, N-1) if trr[i-1] < trr[i] > trr[i+1]]
    for i, p in enumerate(peaks):
        hour1 = hour2 = L - trr[p]
        p_tm1 = p
        while p_tm1+1 < N and trr[p_tm1] > trr[p_tm1+1]:
            hour1 += L - trr[p_tm1+1]
            p_tm1 += 1
        p_tm2 = p
        while p_tm2-1 > -1 and trr[p_tm2] > trr[p_tm2-1]:
            hour2 += L - trr[p_tm2-1]
            p_tm2 -= 1
        if best_hour < hour1:
            best_hour = hour1
        if best_hour < hour2:
            best_hour = hour2
    return best_hour

print solve([int(raw_input().rstrip()) for _ in xrange(N)], N)

Measured memory_bytes: 10832
# coding: utf-8
# Your code here!
n=int(input())
l=list(map(int,input().split()))
ans=[0 for i in range(n)]
for i in range(n):
    if i%2==0:
        ans[0]+=l[i]
    else:
        ans[0]-=l[i]
        
for i in range(1,n):
    ans[i]=(l[i-1]*2-ans[i-1])
for i in range(n):
    print(ans[i],end=" ")



Measured memory_bytes: 14092
var Main = function(Input){
  var Result = '';
  Input.split('').forEach(function(value, index){
    if(value == '1'){
      Result += '9';
    } else if(value == '9'){
      Result += '1';
    } else {
      Result += value;
    }
  });
  console.log(Result);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21952
/*
Rathin Bhargava
IIIT Bangalore

*/
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 


int main()
{
  __;
  int n;
  cin >> n;
  int x = 0,y = 0,z = 0;

  for(int i=0;i<n;i++)
  {
    int a,b,c;
    cin >> a >> b >> c;
    int temp_x = x, temp_y = y, temp_z = z;
    
    temp_x = a + max(y,z);
    temp_y = b + max(x,z);
    temp_z = c + max(x,y);

    x = temp_x; y = temp_y; z = temp_z;
  }
  cout << max(x,max(y,z)) << endl;
  return 0;
}



Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');

var imagine;
while (imagine = lines.shift()) {
	var guess = lines.shift();

	var a = imagine.split(' ').map(function(n){return +n;});
	var b = guess.split(' ').map(function(n){return +n;});

	var hit = 0;
	for (var i = 0; i < 4; i++) {
		if (a[i] == b[i]) {
			hit++;
		}
	}

	var blow = 0;
	for (var i = 0; i < 4; i++) {
		if (a.indexOf(b[i]) >= 0) {
			blow++;
		}
	}
	blow -= hit;

	console.log(hit + ' ' + blow);
}

Measured memory_bytes: 7640
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 100;

int main(){
	
	int n;
	cin >> n;
	int A[MAX];
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	int count = 0;
	int flag = 1;
	while (flag) {
		flag = 0;
		for (int i = n - 1; i > 0; i--) {
			if (A[i] < A[i - 1]) {
				int temp = A[i];
				A[i] = A[i - 1];
				A[i - 1] = temp;
				flag = 1;
				count++;
			}
		}
	}

	for (int i = 0; i < n-1; i++) {
		cout << A[i] << ' ';
	}
	cout << A[n - 1] << endl;
	cout << count << endl;
	
	return 0;
}


Measured memory_bytes: 3096
/**
*    author:  boutarou
*    created: 02.08.2020 20:55:24
**/

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

int main() {
    int x;
    cin >> x;
    if (x >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3592
from itertools import product
n, k = map(int, input().split())
d = list(map(int, input().split()))

a = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} - set(d)

a = sorted(list(a))
l = len(str(n))
c = ""
for i in range(l):
    c += str(a[-1])

if int(c) < n:
        if a[0] == 0:
            ans = str(a[1])
        else:
            ans = str(a[0])
        for i in range(l):
            ans += str(a[0])
        ans = int(ans)
else:
    ans = 10000
    for v in product(a, repeat=l):
        tmp = ""
        for i in v:
            tmp += str(i)
        if int(tmp) >= n:
            ans = min(ans, int(tmp))
print(ans)


Measured memory_bytes: 3064
import java.io.*;

class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int num = Integer.parseInt(br.readLine());
	char[] chars = br.readLine().toCharArray();
    
    for(char c : chars) {
      c += num;
      if(c > 'Z') c -= 26;
	    System.out.print(c);
    }
  }
}

Measured memory_bytes: 24660
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def main():
    n = intin()
    alist = intina()

    ans = 0

    for a in alist:
        for b in alist:
            ans = max(ans, abs(a - b))

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3548
/***"In the name of Allah(swt), the most gracious, most merciful. Allah(swt) blesses with knowledge whom he wants."***/
/*** "ALHAMDULILLAH for Everything..." ***/
#include<bits/stdc++.h>
using namespace std;
#define  fastt       ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define  ll         long long
#define  debug      printf("Come here!")
#define  inf        1000000000000000000
#define  pb         push_back
#define  mp         make_pair
#define  sz(a)      a.size()
#define  mem(a,b)   memset(a,b,sizeof(a))
#define  clr(x)     x.clear()
#define  ff         first
#define  ss         second
#define  case(x)    cout << "Case " << x <<": "

#define  md         1000000007
#define  pi         acos(-1.0)
#define  cos(a)     cos(a*pi/180)
#define  sin(a)     sin(a*pi/180)
#define  tan(a)     tan(a*pi/180)
#define  cosi(a)    acos(a)/(pi/180)
#define  sini(a)    asin(a)/(pi/180)
#define  tani(a)    atan(a)/(pi/180)

#define  vl         vector <ll>
#define  vs         vector <string>
#define  vc         vector <char>
#define  vpll       vector < pair <ll, ll> >
#define  vpsl       vector < pair <string, ll> >
#define  vpls       vector < pair <ll, string> >
#define  pql        priority_queue<ll>
#define  minpql     priority_queue<ll,vector<ll>,greater<ll> >

#define  setbits(x)     __builtin_popcountll(x)
#define  zerobits(x)    __builtin_ctzll(x)

#define toll(a) atoll(a.c_str())
string tostr(ll a) {stringstream rr;rr<<a;return rr.str();}
ll pow(ll c,ll d){return d==0?:c*pow(c,d-1);}
ll gcd(ll a,ll b) {return b==0? a:gcd(b,a%b);}
ll lcm(ll a,ll b) {return ((a*b)/gcd(a,b));}

/* mpp.max_load_factor(0.25); mpp.reserve(1024); */
/* cout << fixed << setprecision(12);*/

int main()
{
    fastt;
    ll n, m, k, i, j, x, y, p=0, s=0, h, f=0;
    cin>>n>>m;
    set<ll>st;
    if(n%2==0){
        s++;
        st.insert(2);
        while(n%2==0){
            n/=2;
        }
    }
    if(m%2==0){
        s++;
        st.insert(2);
        while(m%2==0){
            m/=2;
        }
    }
    for(i=3; i*i<=n; i+=2){
        if(n%i==0){
            s++;
            st.insert(i);
            while(n%i==0){
                n/=i;
            }
        }
    }
    if(n>1){
        s++;
        st.insert(n);
    }
    for(i=3; i*i<=m; i+=2){
        if(m%i==0){
            s++;
            st.insert(i);
            while(m%i==0){
                m/=i;
            }
        }
    }
    if(m>1){
        s++;
        st.insert(m);
    }
    cout<<s+1-st.size()<<endl;
    return 0;
}



Measured memory_bytes: 3640
#include <iostream>
#include <vector>

using namespace std;


int main(){
    vector <int> vec(2);
    vector <int> x1(2);
    vector <int> x2(2);

    cin >> x1.at(0) >> x1.at(1) >> x2.at(0) >> x2.at(1);

    vec.at(0) = x2.at(0) - x1.at(0);
    vec.at(1) = x2.at(1) - x1.at(1); 

    vector <int> vec2(2);
    
    vec2.at(0) = -vec.at(1);
    vec2.at(1) = vec.at(0);

    vector <int> x3(2);
    vector <int> x4(2);

    x4.at(0) = x1.at(0) + vec2.at(0);
    x4.at(1) = x1.at(1) + vec2.at(1);

    x3.at(0) = x4.at(0) + x2.at(0) - x1.at(0);
    x3.at(1) = x4.at(1) + x2.at(1) - x1.at(1);

    cout << x3.at(0) << " " << x3.at(1) << " " << x4.at(0) <<" " << x4.at(1) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define M 200000
int main()
{
	long long int n,i,a[M],m=0;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		if(i>0&&a[i]<a[i-1])
		{
			m+=a[i-1]-a[i];
			a[i]=a[i-1];
		}
	}
	cout<<m;
}

Measured memory_bytes: 5204
#include <stdio.h>

int gcd(int x,int y);

int main(){
    int x,y,ans;
    scanf("%d %d",&x,&y);
    
    ans=gcd(x,y);
    printf("%d\n",ans);

    return 0;
}

int gcd(int x,int y){
    int d;
    while( (d=x%y) != 0){
        x=y;
        y=d;
    }
    return y;
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    string S;
    cin >> S;

    ll g = 0;
    ll p = 0;

    for(char s: S){
        if(s == 'g'){
            g++;
        }
        else{
            p++;
        }
    }

    cout << (g-p)/2 << endl;
    return 0;
}

Measured memory_bytes: 3724
#include <iostream>
#include <string>
#include <stddef.h>
#include <stack>
#include <queue>

using namespace std;

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

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

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

#define M 998244353

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define part(v, s, e) v.begin() + s, v.begin() + e
#define print(v) for (auto i: v) cout << i << " ";

int main() {
    fast;
    ll n, k;
    cin >> n >> k;
    vi arr(n), dp(n, LLONG_MAX);
    REP(i, 0, n)
        cin >> arr[i];
    dp[n-1] = 0;
    RREP(i, n-2, -1) {
        REP(j, 1, k+1) {
            if (i + j >= n)
                break;
            dp[i] = min(dp[i], dp[i+j] + abs(arr[i] - arr[i+j]));
        }
    }
    cout << dp[0] << endl;
    return 0;
}


Measured memory_bytes: 1792
// dile a la jardinera que traigo flores
// corner cases // int vs ll // cin vs scanf
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define N 310
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;

int n;
ld dp[N][N][N];

ld go(int a, int b, int c){
	ld &ans = dp[a][b][c];
	if(ans >= 0) return ans;
	ans = 1;
	if(a) ans += go(a-1,b+1,c)*a/n;
	if(b) ans += go(a,b-1,c+1)*b/n;
	if(c) ans += go(a,b,c-1)*c/n;
	ans /= 1 - 1.0*( n-(a+b+c) )/n;
	return ans;
}

int main(){

	fastio;
	cin >> n;
	int a,b,c,x;
	a = b = c = 0;
	FER(i,0,n){
		cin >> x;
		if(x == 3) ++a;
		else if(x == 2) ++b;
		else if(x == 1) ++c;
	}
	FER(i,0,N) FER(j,0,N) FER(k,0,N) dp[i][j][k] = -1;
	dp[0][0][0] = 0;
	cout << fixed << setprecision(10) << go(a,b,c) << endl;

	return 0;
}


Measured memory_bytes: 465792
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    ll n;
    cin>>n;
    string f,s;
    cin>>f>>s;
    int canuse=3;
    ll res=1;
    bool skip=false;
    // なし 0,-- 1,| 2
    int kind;
    int lkind=0;
    ll mod=1e9+7;
    rep(i,0,n){
        if(skip){
            skip=false;
            continue;
        }
        if(i+1<n&&s[i]==s[i+1]){
            skip=true;
            kind=1;
        }
        else{
            kind=2;
        }

        //今見ているブロックの形とその直前に見たブロックの形だけで値が決められるはず
        if(kind==1){
            if(lkind==0){
                res=res*6%mod;
            }
            else if(lkind==1){
                res=res*3%mod;
            }
            else{
                res=res*2%mod;
            }
            lkind=1;
        }
        else{
            if(lkind==0){
                res=res*3%mod;
            }
            else if(lkind==1){
                res=res%mod;
            }
            else{
                res=res*2%mod;
            }
            lkind=2;
        }
        if(res<0)res+=mod;
    }
    cout<<res<<endl;
    return 0;
}




Measured memory_bytes: 256