akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	int res;
	if (N == 1) {
		res = M - 2;
		if (M == 1) {
			res = 1;
		}
	}
	else if (M == 1) {
		res = N - 2;
	}
	else {
		res = N*M - 2 * (N - 1 + M - 1);
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+10;
int s[maxn];
int n;

int main ()
{
    while (~scanf("%d",&n))
    {
        int ans = 0;
        int cnt = 0;
        for(int i=0;i<n;i++){
            scanf("%d",&s[i]);
            if(s[i] % 4 ==0)
                ans++;
            if(s[i] % 2 ==0)
                cnt++;
        }
        ans += (cnt-ans)/2;
       // printf("%d\n",ans);
        if(n % 2 == 1)
        {
            int t = n/2;
            if(t <= ans)
                printf("Yes\n");
            else
                printf("No\n");

        }
        else{
            int t = n/2;
            if(t <= ans)
                printf("Yes\n");
            else
                printf("No\n");
        }
    }
    return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int m=in.nextInt(),f=in.nextInt(),b=in.nextInt();
		int d=m-b,da=Math.abs(d);

		if(d>=0)System.out.println(0);
		else if(da>f)System.out.println("NA");
		else System.out.println(da);

		in.close();
	}

}



Measured memory_bytes: 26240
s = readline.strip.split('') #.map(&:to_i)
arr = s.map{0}

base = 0
last_r = 0
for i in 0.upto(s.size - 1)
  if s[i] == 'R' && s[i+1] == 'L'
    last_r = i
  end
  if s[i] == 'L' && s[i+1] == 'R'
    odd = 0
    even = 0
    for j in base.upto(i)
      if (j - last_r) % 2 == 0
        even += 1
      else
        odd += 1
      end
    end
    arr[last_r] = even
    arr[last_r + 1] = odd
    base = i + 1
  end
end

odd = 0
even = 0
for j in base.upto(s.size - 1)
  if (j - last_r) % 2 == 0
    even += 1
  else
    odd += 1
  end
end
arr[last_r] = even
arr[last_r + 1] = odd

puts arr.join(" ")


Measured memory_bytes: 11388
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

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

Measured memory_bytes: 256
#c
import itertools
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
num=[i for i in range(1,n+1)]
i=0
a=0
b=0
for x in itertools.permutations(num,n):
    i+=1
    
    if x==p:
        a=i
    if x==q:
        b=i
ans=abs(a-b)
print(ans)

Measured memory_bytes: 3064
n=int(input())
#A=1~(N//2)+1まで全探索
ans=10**5
for i in range(1,(n//2+2)):
    wa=0
    for j in range(len(str(i))):
        wa += int(str(i)[j])
    for k in range(len(str(n-i))):
        wa += int(str(n-i)[k])
    ans=min(ans,wa)
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()

int main() {
	int n, m;
	cin >> n >> m;
	cout << (m - 1) * m / 2 + n * (n - 1) / 2 << endl;
}


Measured memory_bytes: 256
//34
#include<iostream>

using namespace std;

int main(){
  for(int n,p;cin>>n>>p,n|p;){
    int player[50]={};
    int w=p;
    int i;
    for(i=0;;i=(i+1)%n){
      if(w){
	w--;
	player[i]++;
	if(player[i]==p)break;
      }else{
	w=player[i];
	player[i]=0;
      }
    }
    cout<<i<<endl;
  }
  return 0;
}

Measured memory_bytes: 868
import sys
readline = sys.stdin.readline
#非再帰
import sys
def scc(Edge):
    N = len(Edge)
    Edgeinv = [[] for _ in range(N)]
    for vn in range(N):
        for vf in Edge[vn]:
            Edgeinv[vf].append(vn)
    
    used = [False]*N
    dim = [len(Edge[i]) for i in range(N)]
    order = []
    for st in range(N):
        if not used[st]:
            stack = [st, 0]
            while stack:
                vn, i = stack[-2], stack[-1]   
                if not i and used[vn]:
                    stack.pop()
                    stack.pop()
                else:
                    used[vn] = True
                    if i < dim[vn]:
                        stack[-1] += 1
                        stack.append(Edge[vn][i])
                        stack.append(0)
                    else:
                        stack.pop()
                        order.append(stack.pop())
    res = [None]*N
    used = [False]*N
    cnt = -1
    for st in order[::-1]:
        if not used[st]:
            cnt += 1
            stack = [st]
            res[st] = cnt
            used[st] = True
            while stack:
                vn = stack.pop()
                for vf in Edgeinv[vn]:
                    if not used[vf]:
                        used[vf] = True
                        res[vf] = cnt
                        stack.append(vf)
    M = cnt+1
    components = [[] for _ in range(M)]
    for i in range(N):
        components[res[i]].append(i)
    tEdge = [[] for _ in range(M)]
    """
    teset = set()
    for vn in range(N):
        tn = res[vn]
        for vf in Edge[vn]:
            tf = res[vf]
            if tn != tf and tn*M + tf not in teset:
                teset.add(tn*M + tf)
                tEdge[tn].append(tf)
    """
    return res, components, tEdge
        
N, M = map(int, readline().split())
Edge = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, readline().split())
    Edge[a].append(b)

R, comp, tE = scc(Edge)
Ans = [str(len(comp))]

for c in comp:
    Ans.append(f'{len(c)} ' + ' '.join(map(str, c)))

print('\n'.join(Ans))



Measured memory_bytes: 284776
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n,x;
	int m[103];
	int min = 0x3FFF,cnt =0;
	scanf("%d%d",&n,&x);
	for (int i = 0; i < n; ++i){
		scanf("%d",&m[i]);
		x -= m[i];
		if(min > m[i])	min = m[i];
	}
	cnt = x / min + n;
	printf("%d\n", cnt);
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main()
{
	int n,i,j,hp,sum=0;
	int d[n];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&d[i]);
	}
	for(j=0;j<n;j++)
	{
		for(i=j+1;i<n;i++)
		{
			hp=d[i]*d[j];
			sum=sum+hp;
		}
	}
	printf("%d\n",sum);
	
	
	return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

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

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, m, x[50], y[50], a[50], b[50];

int main() {
	cin >> n >> m;
	rep(i,n) cin >> x[i] >> y[i];
	rep(i,m) cin >> a[i] >> b[i];
	
	rep(i,n) {
		int d = 0;
		reps(j,1,m) {
			if (abs(x[i]-a[j]) + abs(y[i]-b[j]) < abs(x[i]-a[d]) + abs(y[i]-b[d])) d = j;
		}
		cout << d+1 << ln;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        vector<string> v;
        for(int i = 1; i < 10; i++){
            v.pb(to_string(i));
        }
        int pos = 0;
        while(1){
            int n = (int)v.size();
            if(n > 100000){
                break;
            }
            for(int i = pos; i < n; i++){
                string curr = v[i];
                int len = (int)curr.length();
                int c = curr[len - 1] - '0';
                for(int j = -1; j <= 1; j++){
                    int con = c + j;
                    if(con >= 0 and con <= 9){
                        string str = to_string(con);
                        v.pb(curr + str);
                    }
                }
            }
            pos = n;
        }
        int n;
        cin >> n;
        cout << v[n - 1] << '\n';
    }
}

Measured memory_bytes: 45168
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbgvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

ll INF = 1000000000000; // 10^12

ll mindis(ll x, ll sw, ll se, ll tw, ll te) {
  ll res = INF;
  auto d = [](ll a, ll b) { return abs(b - a); };
  auto ds = [&](ll x, ll a, ll b) {
    return d(x, a) + d(a, b);
  };
  res = min(res, ds(x, sw, tw));
  res = min(res, ds(x, sw, te));
  res = min(res, ds(x, se, tw));
  res = min(res, ds(x, se, te));
  res = min(res, ds(x, tw, sw));
  res = min(res, ds(x, tw, se));
  res = min(res, ds(x, te, sw));
  res = min(res, ds(x, te, se));
  return res;
}

int main () {
  int A, B, Q; cin >> A >> B >> Q;
  vector<ll> s(A + 2), t(B + 2);
  s.at(0) = t.at(0) = -INF;
  rep2(i, 1, A + 1) cin >> s.at(i);
  rep2(i, 1, B + 1) cin >> t.at(i);
  s.at(A + 1) = t.at(B + 1) = INF;
  // dbv(s); dbv(t);
  rep(i, Q) {
    ll x; cin >> x;
    auto its = lower_bound(all(s), x);
    ll sw = *prev(its), se = *its;
    auto itt = lower_bound(all(t), x);
    ll tw = *prev(itt), te = *itt;
    // db(x); db(sw); db(se); db(tw); dbl(te);
    cout << mindis(x, sw, se, tw, te) << endl;
  }
}

Measured memory_bytes: 2944
import sys
input = sys.stdin.readline
import collections

# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
    x = int(input())
    for a in range(-200, 200):
        for b in range(-200, 200):
            ans = a ** 5 - b ** 5
            if ans == x:
                print(a, b)
                exit()


def bi(num, a, b, x):
    print((a * num) + (b * len(str(b))))
    if (a * num) + (b * len(str(b))) <= x:
        return False
    return True

def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()


Measured memory_bytes: 67472
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using ll = unsigned long long;
using namespace std;

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

    int ans = 0;
    for ( int i = 1; i <= n; i+=2) {
        int div = 1;
        int cnt = 0;
        while(true) {
            if (!(i%div)) {
                cnt++;
            }
            div++;

            if (div > i) {
                break;
            }
        }

        if (cnt == 8) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		long A=sc.nextLong();
		long B=sc.nextLong();
		long C=sc.nextLong();
		long D=sc.nextLong();
		
		for(int i=0;i<=N-1;i++){
			long max=D*(N-1-i)-C*i;
			long min=C*(N-1-i)-D*i;
			if(Math.abs(B-A)>=min && Math.abs(B-A)<=max){
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");
	}

}


Measured memory_bytes: 23764
n,k,c = map(int, input().split())
s = input()

ans = [0] * n

p = 0
lasto = - c - 1

for i in range(n):
    if p == k:
        break
    if s[i] == "o":
        if i > lasto + c:
            ans[i] += 1
            p += 1
            lasto = i

s = s[::-1]
p = 0
lasto = - c - 1

q = 0

for i in range(n):
    if s[i] == "o":
        if i > lasto + c:
            ans[n - 1 - i] += 1
            p += 1
            lasto = i
            if p > k:
                q = 1
                break

if q == 0:
    for i in range(n):
        if ans[i] == 2:
            print(i + 1)

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

int main()
{
    string s;
    cin>>s;
    if(s=="SUN") cout<<7;
    if(s=="SAT") cout<<1;
    if(s=="FRI") cout<<2;
    if(s=="THU") cout<<3;
    if(s=="WED") cout<<4;
    if(s=="TUE") cout<<5;
    if(s=="MON") cout<<6;
	return 0;
}
//SUN, MON, TUE, WED, THU, FRI, or SAT.

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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
        a[i] = p[i];
    }
    
    sort(a.begin(), a.end());

    for (int i = 0; i < n; i++)
    {
        if (a[i] != p[i])
        {
            break;
        }

        if (a[n - 1] == p[n - 1])
        {
            cout << "YES" << endl;
            return 0;
        }
        
        
    }
    
    
    for (int i = 0; i < n - 1; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            swap(p[i], p[j]);
            for (int k = 0; k < n; k++)
            {
                if (a[k] != p[k])
                {
                    swap(p[i], p[j]);
                    break;
                }
                
                if (k == (n - 1) && a[n - 1] == p[n - 1])
                {
                    cout << "YES" << endl;
                    return 0;
                }
                
            }
            
        }
        
    }
    cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define INF 10000000

int main(){
  long n;
  long G[100][100],d[100];
  long minc,mi,i;
  bool flg[100];
  long sum=0;
  
  cin >> n;
  for (i=0;i<n;i++){
    for (int j=0;j<n;j++){
      cin >> G[i][j];
      if (G[i][j]==-1) G[i][j]=INF;
    }
    d[i]=INF;
    flg[i]=false;
  }

  d[0]=0;
  while (true){
    minc=INF;
    for (i=0;i<n;i++){
      if (!flg[i]&&d[i]<minc){
	minc=d[i];
	mi=i;
      }
    }
    if (minc==INF) break;
    flg[mi]=true;
    for (i=0;i<n;i++){
      if (G[mi][i]==INF)continue;
      if (!flg[i]&&d[i]>G[mi][i]){
	d[i]=G[mi][i];
	//cout << d[i];
      }
    }
  }
  
  for (i=0;i<n;i++){
    sum+=d[i];
  }
  cout << sum<<endl;
  
  return 0;
}

Measured memory_bytes: 3116
#include <stdio.h>
int main(void)
{
  int d,i;
  	
  scanf("%d",&d);
  
  if(d==25){
  	printf("Christmas");
  }else if(d<25){
    printf("Christmas ");
    	for(i=25; i>d; i--){
      		printf("Eve ");
        }
  }
  return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-

N = int(input().strip())
XL_list = [list(map(int, input().rstrip().split())) for i in range(N)]
#-----

section = []

for X,L in XL_list:
    section.append( ( X - L , X + L ) )


section.sort(key= lambda x: x[1])
prev_tail = -float("inf")
cnt = 0

for left,right in section:
    if prev_tail <= left:
        cnt += 1
        prev_tail = right
        

print(cnt)


Measured memory_bytes: 42792
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <vector>
#include <map>
using namespace std;

typedef pair <long long, long long> pii;

const long long MAX_N = 2e5 + 10;
long long n, ans;
long long Arr[MAX_N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (long long i = 0; i < n; i++)
		cin >> Arr[i];

	if (Arr[0]) {
		cout << "-1\n";
		return 0;
	}

	for (int i = 1; i < n; i++)
		if (Arr[i - 1] + 1 < Arr[i]) {
			cout << "-1\n";
			return 0;
		}

	long long tmp = 0;
	for (long long i = 1; i < n; i++) {
		tmp++;

		if (Arr[i] == 0) {
			tmp = 0;
			continue;
		}
		if (Arr[i] == 1) {
			ans++;
			tmp = 1;
			continue;
		}

		if (Arr[i] == tmp) {
			ans++;
			continue;
		}

		tmp = Arr[i];
		ans += Arr[i];
	}

	cout << ans << "\n";
	return 0;
}
// 

Measured memory_bytes: 1792
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

}

use input::*;

fn main() {
    let (a, b): (usize, usize);
    input!(a, b);
    p((a + b) % 24);
}

Measured memory_bytes: 4352
N, L = map(int, input().split())
apples = [L+i-1 for i in range(1, N+1)]

if 0 in apples:
    print(sum(apples))
elif apples[0] > 0:
    print(sum(apples)-min(apples))
else:
    print(sum(apples)-max(apples))

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

using namespace std;

namespace {
    typedef long long ll;

    ll N, Z, W;
    vector<ll> A;
    void input() {
        cin >> N >> Z >> W;
        A.clear();
        A.push_back(Z);
        A.push_back(W);
        for (auto i = 0; i < N; i++) {
            ll x; cin >> x;
            A.push_back(x);
        }
        N += 2;
        assert(N == A.size());
    }

    const bool debug = false;
    const int MAX_N = 2012;
    const ll INF = LLONG_MAX / 8LL;
    ll fx(int i, int j); // -> max
    ll fy(int i, int j); // -> min

    ll memo_x[MAX_N][MAX_N];
    ll fx(int i, int j) {
        assert(i < N);
        if (memo_x[i][j] != INF) return memo_x[i][j];
        ll ret = abs(A.back() - A[j]); // 全部引く
        for (int k = i; k < N - 1; k++) {
            ret = max(ret, fy(k + 1, k));
        }
        if (debug) cout << "fx(" << i << "," << j << ") = " << ret << endl;
        assert(ret >= 0);
        return memo_x[i][j] = ret;
    }

    ll memo_y[MAX_N][MAX_N];
    ll fy(int i, int j) {
        assert(i < N);
        if (memo_y[i][j] != INF) return memo_y[i][j];
        ll ret = abs(A.back() - A[j]); // 全部引く
        for (int k = i; k < N - 1; k++) {
            ret = min(ret, fx(k + 1, k));
        }
        if (debug) cout << "fy(" << i << "," << j << ") = " << ret << endl;
        assert(ret >= 0);
        return memo_y[i][j] = ret;
    }


    void solve() {
        for (int i = 0; i < MAX_N; i++) {
            for (int j = 0; j < MAX_N; j++) {
                memo_x[i][j] = INF;
                memo_y[i][j] = INF;
            }
        }
        cout << fx(2, 1) << endl;
    }
}

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



Measured memory_bytes: 63616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
 int k;
 cin >> k;
 int x;
 cin >> x;
 for(int i=k-1;i>=0;i--){
  if(x-i>=-1000000) cout << x-i << " " ; 
 }
 for(int i=1;i<k;i++){
  if(x+i<=1000000) cout << x+i << " " ;
 }
 cout << endl;
 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll>v[4];
ll v2[4][100];
int main(void){
    ll n,W;
    cin>>n>>W;
    ll a,b;
    cin>>a>>b;
    v[0].push_back(b);
    for(int i=0;i<n-1;i++){
        ll w,c;
        cin>>w>>c;
        v[w-a].push_back(c);
    }
    for(int i=0;i<4;i++){
        sort(v[i].begin(),v[i].end());
        reverse(v[i].begin(),v[i].end());
        for(int j=0;j<v[i].size();j++){
            v2[i][j+1]=v2[i][j]+v[i][j];
        }
    }
    ll ans=0;
    for(int i=0;i<=v[0].size();i++){
        for(int i1=0;i1<=v[1].size();i1++){
            for(int i2=0;i2<=v[2].size();i2++){
                for(int i3=0;i3<=v[3].size();i3++){
                    if(a*i+(a+1)*i1+(a+2)*i2+(a+3)*i3<=W){
                        ans=max(ans,v2[0][i]+v2[1][i1]+v2[2][i2]+v2[3][i3]);
                        //cout<<ans<<v2[0][i]*i<<v2[1][i1]*i1<<v2[2][i2]*i2<<v2[3][i3]*i3<<endl;
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#define N 5005
using namespace std;
typedef long long ll;
const ll mod = 1000000007LL;
int n, m;
int main() {
  int a, b, c;
  cin>>a>>b>>c;
  if (b-a==c-b) {
  	cout<<"YES"<<endl;
  } else {
  	cout<<"NO"<<endl;
  }
	return 0;
}

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

int d_sum(int n) {
  int s = 0;

  while (n) {
    s += n % 10;
    n /= 10;
  }

  return s;
}
 
int main() {
  ios::sync_with_stdio(0); 
  cin.tie(0); 

  int n, a, b;
  cin >> n >> a >> b;

  int res = 0;
  for (int i = 1; i <= n; ++i) {
    int s = d_sum(i);
    if (s >= a && s <= b) res += i;
  }
  cout << res << "\n";
}


Measured memory_bytes: 3660
#include <iostream>
#include <cmath>
using namespace std;
int main(int argc,char const *argv[])
{
	int n;
	cin>>n;
	int a[2][n];
	int dp[2][n];
	for(int i = 0;i < 2; ++i)
	{
		for(int j = 0;j < n; ++j)
		{
			dp[i][j] = 0;
		}
	}
	for(int i = 0;i < 2; ++i)
	{
		for(int j = 0;j < n; ++j)
		{
			cin>>a[i][j];
		}
	}
	dp[0][0] = a[0][0];
	for(int j = 1;j < n; ++j)
	{
		dp[0][j] = dp[0][j - 1] + a[0][j];
	}
	dp[1][0] = a[0][0] + a[1][0];
	for(int j = 1;j < n; ++j)
	{
		dp[1][j] = max(dp[0][j],dp[1][j - 1]) + a[1][j];
	}
	printf("%d\n",dp[1][n - 1]);
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<long long> A(N);
  for(int i = 0; i < N; ++i){
    cin >> A[i];
  }
  int m = 2+N%2;
  const long long INF = 1e18;
  vector<long long> dp(m,-INF);
  dp[0] = 0;
  for(int i = 0; i < N; ++i){
    vector<long long> dp_(m,-INF);
    for(int j = 0; j < m; ++j){
      if(dp[j] == -INF) continue;
      dp_[j] = max(dp_[j],dp[j]+((i+j)%2 ? 0 : A[i]));
      if(j+1 < m)
        dp_[j+1] = max(dp_[j+1],dp[j]);
    }
    swap(dp,dp_);
  }
  cout << dp.back() << endl;
}


Measured memory_bytes: 4840
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
using namespace std;

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
int INF = INT_MAX / 2;
double EPS = 1e-10;

int main() {
	int N, i1, i2;
	cin >> N >> i1 >> i2;
	i1--; i2--;
	vector<ll> x(N), y(N);
	rep(i, N) {
		ll u, v; scanf("%lld%lld", &u, &v);
		x[i] = u + v; y[i] = u - v;
	}
	map<ll, set<ll_i> > mpx, mpy;
	rep(i, N) {
		mpx[x[i]].insert(ll_i(y[i], i));
		mpy[y[i]].insert(ll_i(x[i], i));
	}
	ll d = max(abs(x[i1] - x[i2]), abs(y[i1] - y[i2]));
	vector<bool> vis(N);
	vis[i1] = vis[i2] = true;
	queue<int> q;
	q.push(i1); q.push(i2);
	while (q.size()) {
		int i = q.front(); q.pop();
		ll X = x[i], Y = y[i];
		{
			auto& st = mpx[X - d];
			auto it = st.lower_bound(ll_i(Y - d, -1));
			while (it != st.end() && it->first <= Y + d) {
				int i = it->second;
				if (!vis[i]) {
					vis[i] = true;
					q.push(i);
				}
				it = st.erase(it);
			}
		}
		{
			auto& st = mpx[X + d];
			auto it = st.lower_bound(ll_i(Y - d, -1));
			while (it != st.end() && it->first <= Y + d) {
				int i = it->second;
				if (!vis[i]) {
					vis[i] = true;
					q.push(i);
				}
				it = st.erase(it);
			}
		}
		{
			auto& st = mpy[Y - d];
			auto it = st.lower_bound(ll_i(X - d, -1));
			while (it != st.end() && it->first <= X + d) {
				int i = it->second;
				if (!vis[i]) {
					vis[i] = true;
					q.push(i);
				}
				it = st.erase(it);
			}
		}
		{
			auto& st = mpy[Y + d];
			auto it = st.lower_bound(ll_i(X - d, -1));
			while (it != st.end() && it->first <= X + d) {
				int i = it->second;
				if (!vis[i]) {
					vis[i] = true;
					q.push(i);
				}
				it = st.erase(it);
			}
		}
	}
	map<ll, vector<ll> > unkox, unkoy;
	rep(i, N) {
		unkox[x[i]].push_back(y[i]);
		unkoy[y[i]].push_back(x[i]);
	}
	for (auto& z: unkox) {
		auto& v = z.second;
		sort(v.begin(), v.end());
	}
	for (auto& z: unkoy) {
		auto& v = z.second;
		sort(v.begin(), v.end());
	}
	ll ans = 0;
	rep(i, N) if (vis[i]) {
		ll X = x[i], Y = y[i];
		{
			auto& v = unkox[X - d];
			ans += upper_bound(v.begin(), v.end(), Y + d) - lower_bound(v.begin(), v.end(), Y - d);
		}
		{
			auto& v = unkox[X + d];
			ans += upper_bound(v.begin(), v.end(), Y + d) - lower_bound(v.begin(), v.end(), Y - d);
		}
		{
			auto& v = unkoy[Y - d];
			ans += lower_bound(v.begin(), v.end(), X + d) - upper_bound(v.begin(), v.end(), X - d);
		}
		{
			auto& v = unkoy[Y + d];
			ans += lower_bound(v.begin(), v.end(), X + d) - upper_bound(v.begin(), v.end(), X - d);
		}
	}
	cout << ans / 2 << endl;
}


Measured memory_bytes: 77824
#include <bits/stdc++.h>
#define ii pair <int , int>
#define is pair <int, string>
#define ll long long
#define mx 100000
#define sf scanf
#define sf(n) scanf("%d",&n)
#define pf printf
using namespace std;
vector <int> v;

/*int intConvert(string s){
    int n;
    stringstream geek(s);
    geek >> n;
    return n;
}*/

/*string strConvert(int n){
    string s;
    stringstream ss;
    ss << n;
    s=ss.str();
    return s;
}*/


int main(){
    int n;
    sf(n);

    double ans= (double)(n - (n/2))/ (double)n;
    pf("%.10lf\n",ans);

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

 class Main
 {
   public static void main(String args[])
   { 
    input();
   }
   static void input()
   {
     Scanner sc = new Scanner(System.in);
     
     int a = sc.nextInt();
     
     int b = sc.nextInt();
     
     int c = sc.nextInt();
     //Divisor calculation
     divisor(a,b,c);
   }
   static void divisor(int a,int b,int c)
   {
     int count = 0;
     
     for(int i = a; i <= b; i ++)
     {
       if(c % i == 0)count ++;
     }
     output(count);
   }
   static void output(int answer)
   {
     System.out.println(answer);
   }
 }
    


Measured memory_bytes: 26344
import numpy as np
from itertools import combinations
U = 101
T = np.zeros(U,np.int32)
T[2] = 1
T[3::2] = 1
for i in range(U):
  if i*i>U:
    break
  if T[i]==1:
    T[i*i::2*i] = 0
N = int(input())
pls = np.where(T)[0].tolist()
dic = {}
for i in range(1,N+1):
  for p in pls:
    cnt = 0
    while i%p==0:
      i //= p
      cnt += 1
    dic[p] = dic.get(p,0)+cnt
ans = 0
for a,b,c in combinations(pls,3):
  if 2<=dic[a] and 4<=dic[b] and 4<=dic[c]:
    ans += 1
  if 4<=dic[a] and 2<=dic[b] and 4<=dic[c]:
    ans += 1
  if 4<=dic[a] and 4<=dic[b] and 2<=dic[c]:
    ans += 1
for a, b in combinations(pls,2):
  if 4<=dic[a] and 14<=dic[b]:
    ans += 1
  if 14<=dic[a] and 4<=dic[b]:
    ans += 1
  if 2<=dic[a] and 24<=dic[b]:
    ans += 1
  if 24<=dic[a] and 2<=dic[b]:
    ans += 1

for a in pls:
  if 74<=dic[a]:
    ans += 1
print(ans)
  

Measured memory_bytes: 12504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define vmax 10000
constexpr ll inf = 100000000000000;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

static const int N=101;
static const int W=100100;
ll dp[N+1][W+1];

int main(){
  int n,c;
  cin>>n>>c;
  int v[N],w[N];
  for(int i=0;i<n;i++){
    cin>>w[i]>>v[i];
  }
  for(int i=0;i<=c;i++){
    dp[0][i]=0;
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<=c;j++){
      if(j<w[i]){
        dp[i+1][j]=dp[i][j];
      }else{
        dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i]);
      }
    }
  }

  cout<<dp[n][c]<<endl;

  return 0;
}



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

int main() {
    int N;
    int n;
    string s;
    cin >> s;

    int sum = 0;
    for (int i = 0; i < s.size(); i++) {
        sum += (s.at(i) - '0');
    }
    
    string ans;
    if (stoi(s) % sum)
        ans = "No";
    else
        ans = "Yes";

    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from fractions import gcd
from functools import reduce

N = int(input())
nums = sorted(list(map(int, input().split())), reverse=True)

#def gcd(a, b):
#    if b == 0:
#        return a
#    else:
#        return
#    gcd(b, a % b)

def find_gcd(ls):
    x = reduce(gcd, ls)
    return x

def main():
    print(find_gcd(nums))
    return 0

if __name__ == "__main__":
    main()


Measured memory_bytes: 16268
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
using namespace std;
typedef long long LL;
const int N=3010;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
int f[N][2],g[N][2];
const int mod=1e9+7;
inline void inc(int &x,int y) { (x+=y)<mod?0:x-=mod; }
int main()
{
	int n=gi(),m=gi(),i,j,ans=0;
	for (i=0;i<=n;i++) f[i][!i]=1;
	while (m--) {
		for (i=0;i<=n;i++)
			for (j=0;j<2;j++) if (f[i][j]) {
					if (i) {
						inc(g[i-1][ j | !(i-1) ],f[i][j]);
						inc(g[i][ j | !(i-1) ],f[i][j]);
					}
					if (i<n) {
						inc(g[i+1][j],f[i][j]);
						inc(g[i][j],f[i][j]);
					}
				}
		for (i=0;i<=n;i++) f[i][0]=g[i][0],f[i][1]=g[i][1],g[i][0]=g[i][1]=0;
	}
	for (i=0;i<=n;i++) inc(ans,f[i][1]);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
    using namespace std;
    #define rep(i, n) for(int i=0;i<(n);i++)
     
    int a[100000] = {};
    int s[100000] = {};
    int n, k, m;
     
    int main() {
     
    	while(cin>>n>>k, n|k) {
    		rep(i, n)cin>>a[i];
    		s[0] = 0;
    		rep(i, k)s[0]+=a[i];
    		rep(i, n-k)s[i+1]=-a[i]+s[i]+a[i+k];
    		m=s[0];
    		rep(i, n-k+1) {
    			if(m<s[i])m=s[i];
    		}
    		cout<<m<<endl;
    	}
     
    	return 0;
    }

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

int main() {
  int x, y;
  cin >> x >> y;

  if (x == 2 || y == 2)
    cout << "No" << endl;
  else if ((x == 4 || x == 6 || x == 9 || x == 11) &&
           (y == 4 || y == 6 || y == 9 || y == 11))
    cout << "Yes" << endl;
  else if (((x < 8 && x % 2 == 1) || (x > 7 && x % 2 == 0)) &&
           ((y < 8 && y % 2 == 1) || (y > 7 && y % 2 == 0)))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

class Program
{
	static void Main(string[] args)
	{
		int a = int.Parse(Console.ReadLine());
		string[] input = Console.ReadLine().Split(' ');
		int b = 0;

		string[] job= input.Distinct().ToArray();

		if (job.Length == input.Length)
		{
			Console.WriteLine("YES");
		}
		else 
		{
			Console.WriteLine("NO");
		}
	}
}

Measured memory_bytes: 46416
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int n;
  cin >> n;
  int64 ret = 0;
  for (int i = 1; i <= n; ++i) {
    if (i % 3 && i % 5) ret += i;
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long int a,b,k,t;
  cin>>a>>b>>k;
  t=a;
  a=a-k;
  k=k-t;
  if(a<0)
    a=0;
  if(k<0)
    k=0;
  b=b-k;
  if(b<0)
    b=0;
  cout<<a<<" "<<b;
}
  

Measured memory_bytes: 256
// tested on node version 0.10.36
var fs = require("fs");

var primes = [2];

function scan_primes(max) {
    var min = primes[primes.length - 1];
    if(max <= min) {
        return;
    }
    for(var n = min + 1; n <= max; n++) {
        var isPrime = true;
        var limit = Math.sqrt(n);
        // check if n is divisible by any of the known primes below it!
        for(var i = 0; i < primes.length; i++) {
            var p = primes[i];
            if(p > limit) {
                break;
            }
            if(n % p === 0) {
                isPrime = false;
                break;
            }
        }
        if(isPrime) {
            primes.push(n);
        }
    }
}

function count_primes_until(m) {
    for(var i = 0; i < primes.length; i++) {
        if(primes[i] > m) {
            return i;
        }
    }
    return primes.length;
}

var input = fs.readFileSync('/dev/stdin').toString();
var lines = input.split("\n");
for(var i = 0; i < lines.length; i++) {
    var n = parseInt(lines[i]);
    if(!isNaN(n)) {
        scan_primes(n + 1);
        // console.log("len:", primes.length);
        // console.log("primes:", primes);
        console.log(count_primes_until(n));
    }
}

Measured memory_bytes: 18236
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_20190707_1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] abc = Console.ReadLine().Split(' ');

            int water = (int.Parse(abc[1]) + int.Parse(abc[2]) - int.Parse(abc[0]));

            if(water > 0)
            {
                Console.WriteLine(water);
            }
            else
            {
                Console.WriteLine(0);
            }
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
 
#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)
 
#define LL long long
#define Ldouble long double
#define PI 3.14159265358979323846264338327950288419
 
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second
 
using namespace std;
 
char s[10];
int len;
 
int main(){
        cin.getline(s, 10);
	len = strlen(s);
	FI(i, 1, len - 1){
		if(s[i] == 'C' && s[i - 1] == 'A'){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

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

//{{{
/********************************************************************/
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;

#define reps(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) reps(i, 0, n)
#define REPS(i, a, b) reps(i, a, b)
#define REP(i, n) rep(i, n)
#define deps(i, a, b) for (int i = a; i >= b; --i)
#define dep(i, n) deps(i, n, 0)
#define DEPS(i, a, b) deps(i, a, b)
#define DEP(i, n) dep(i, n)

#define pf push_front
#define pb push_back
#define mp make_pair
#define fst first
#define FST fst
#define sec second
#define SEC sec
#define sz(obj) ((int)(obj).size())
#define all(v) (v).begin(), (v).end()
#define ALL(v) all(v)
#define endl "\n"

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

//vector<string> split(const string &s, char delim) {
//  vector<string> elems;
//  string item;
//  for (char ch: s) {
//    if (ch == delim) {
//      if (!item.empty()) elems.push_back(item);
//      item.clear();
//    }
//    else item += ch;
//  }
//  if (!item.empty()) elems.push_back(item);
//  return elems;
//}

inline bool inside(int y, int x, int H, int W) { return y >= 0 && x >= 0 && y < H && x < W; }
inline int in() { int x; std::cin >> x; return x; }
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T> void print(T x) { std::cout << x << '\n'; }

/****************************************************************/
//}}}

signed main()
{
  string str;
  cin >> str;
  rep(i, sz(str)) {
    if (str[i] == ',') {
      cout << ' ';
    }
    else {
      cout << str[i];
    }
  }
  cout << "\n";

  return (0);
}

Measured memory_bytes: 256
while True:
    H,W = map(int,input().split())
    if H==0 and W==0: break
    idx = ('#'*W + '\n')
    con = ""
    if W > 2: con = ('#' + '.'*(W-2) + '#\n') * (H-2)
    if H >= 2: con  =con + idx
    print(idx + con)

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

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

ll solve(int A, int B){
	ll ans = 0;
	ll g = gcd(A,B);
	ans = (A/g) * (B/g) * g;
	return ans;
}

int main(){
	int A,B; cin>>A>>B;
	cout<< solve(A,B) <<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int num,i,j,n;
    int card[10][25];
    char mark,d;
    scanf("%d",&num);
      
    for(i=0;i<num;i++){
        scanf("%c", &d);
        scanf("%c %d",&mark,&n);
          
        if(mark=='S'){
            card[0][n]=1;
            }       
          
        if(mark=='H'){
            card[1][n]=1;
            }       
          
        if(mark=='C'){
            card[2][n]=1;
            }       
          
        if(mark=='D'){
            card[3][n]=1;
            }       
          
          
          
          
     
       
          
    }
    for(i=0;i<=3;i++){
      
        for(j=1;j<=13;j++){
                if(card[i][j]!=1){
                    if(i==0){
                        printf("S %d\n",j);
                    }
                    
                    else if(i==1){
                        printf("H %d\n",j);
                    }
                    else if(i==2){
                        printf("C %d\n",j);
                    }
                    else if(i==3){
                        printf("D %d\n",j);
                    }
                        
                    }
        }
    }     
     
      
}



Measured memory_bytes: 2084
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n, m;
    cin >> n >> m;
    vector<set<int>> v(n);
    REP(i,m) {
        int s, c;
        cin >> s >> c;
        s--;
        v[s].insert(c);
    }


    REP(i,n) if (v[i].size() >=2) {
        OUT(-1)
        return 0;
    }


    if (n != 1 && v[0].size()==1 && *v[0].begin() == 0) {
        OUT(-1)
        return 0;
    }
    
    int ans = 0;
    REP(i,n) {
        if (v[i].size() == 1) {
            auto it = v[i].begin();
            ans += *it * pow(10,n-i-1);
        } else if (i == 0 && n != 1) {
            ans += pow(10,n-i-1);
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

 
class Main {
 
    private static Scanner sc = new Scanner(System.in);
    static int r = sc.nextInt();
    static int g = sc.nextInt();
    static int b = sc.nextInt();
    static int n = sc.nextInt();


    public static void main(String[] args) {
        int ans = 0;
        for(int i = 0; i <= 3000; i++){
            for(int j = 0; j <= 3000; j++){
                int v = i*r + j*g;
                if(n >= v && (n-v)%b==0)ans++;
            }
        }  
        System.out.println(ans);     

    }


}


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

using UM = unordered_multimap<ll, ll>;

void f(ll node, ll current_score, vector<ll>& counter, const vector<UM>& tree, const UM& scores)
{
    if (counter[node - 1] != -1) {
        return;
    }

    auto sr_it = scores.equal_range(node);
    current_score += accumulate(sr_it.first, sr_it.second, 0LL, [](auto acc, auto&& p) { return acc + p.second; });
    counter[node - 1] = current_score;

    for (auto&& t : tree) {
        auto range_it = t.equal_range(node);
        while (range_it.first != range_it.second) {
            f(range_it.first->second, current_score, counter, tree, scores);
            range_it.first++;
        }
    }
}

void solve(long long N, long long Q, std::vector<long long>&& a, std::vector<long long>&& b, std::vector<long long>&& p, std::vector<long long>&& x)
{
    vector<UM> tree(2);
    for (ll i = 0; i < N - 1; ++i) {
        tree[0].emplace(a[i], b[i]);
        tree[1].emplace(b[i], a[i]);
    }

    UM scores;
    for (ll i = 0; i < Q; ++i) {
        scores.emplace(p[i], x[i]);
    }

    vector<ll> counter(N, -1);
    f(1, 0, counter, tree, scores);
    replace(begin(counter), end(counter), -1, 0);
    copy(begin(counter), end(counter), ostream_iterator<ll>(cout, " "));
    cout << "\n";
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
// clang-format off
int main(){
    long long N;
    scanf("%lld",&N);
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> a(N-1);
    std::vector<long long> b(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    std::vector<long long> p(Q);
    std::vector<long long> x(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&p[i]);
        scanf("%lld",&x[i]);
    }
    solve(N, Q, std::move(a), std::move(b), std::move(p), std::move(x));
    return 0;
}


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

using namespace std;

typedef long long ll;

int main() {
  string s,t;
  cin>>s>>t;
  bool ok = false;
  for (int i = 0; i < s.size(); i++) {
    rotate(s.begin(),s.begin() + 1, s.end());
    if (s == t) {
      ok = true;
      break;
    }
  }
  if (ok) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <unordered_set>
#include <bitset>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
int gcd(int a, int b) { int c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
int lcm(int a, int b) { int c = gcd(a, b); a /= c; return a*b; }
int nCr(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
int pow(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llpow(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llgcd(long long a, long long b) { long long c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
long long lllcm(long long a, long long b) { long long c = llgcd(a, b); a /= c; return a*b; }
long long llnCr(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
 
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << min(a, b) + min(c, d) << endl;
}

Measured memory_bytes: 256