akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

void InputNumber(int* number, int limitLow, int limitHigh);
void call(int n);

int main(void) {
	int n;

	InputNumber(&n, 3 , 10000);
	call(n);
}

void InputNumber(int* number, int limitLow, int limitHigh) {
	int x;
	do {
		scanf("%d", &x);
	} while (x < limitLow || x > limitHigh);
	*number = x;
}

void call(int n) {
	int i;
	int x;

	for (i = 1; i <= n; i++) {
		if (i % 3 == 0) {
			printf(" %d", i);
			continue;
		}

		for (x = i; x > 0; x /= 10) {
			if (x % 10 == 3) {
				printf(" %d", i);
				break;
			}
		}
	}
	printf("\n");
}


Measured memory_bytes: 2112
%:pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;

#define int long long

int n , a , b , l , r;

void doit(int a , int b , int len , int l , int r) {
    int L = 0 , R = a / len , ans = -1;
    while(L <= R) {
	int mid = (L + R) >> 1;
	int res = 0;
	if(!mid) res = 0;
	else {
	    if(mid * len == a && mid - 1 == b) {
		res = 0;
	    }
	    else {
		res = (b - mid + 1) / (a - mid * len + 1);
		if((b - mid + 1) % (a - mid * len + 1) != 0) ++ res;
	    }
	}
	if(res > len) {
	    R = mid - 1;
	}
	else {
	    L = mid + 1; ans = mid;
	}
    }
    for(int i = l;i <= min(r , ans * (len + 1) - 1);++ i) {
	if(i % (len + 1) == 0) putchar('B'); else putchar('A');
    }
    if(r < ans * (len + 1)) return;
    l = max(l , ans * (len + 1));
    int rb = b - (ans - 1) , ra = a - ans * len;
    int end = ans * (len + 1);
    if(l == end) {
	++ l; putchar('B'); if(l > r) return;
    }
    ++ end;
    -- rb;
    int Ra = rb / len + (rb % len != 0) - 1;
       end = end + ra - Ra;
       if(l > r) return;
       for(int i = l;i <= min(r , end - 1);++ i) putchar('A');
       l = max(l , end); ra = Ra; if (l> r) return;
    int rem = len - ((ra + 1) * len - rb);
    for(int i = l;i <= r;++ i) {
	if(i < rem + end) {
	    putchar('B');
	}
	else {
	    if(i % (len + 1) == (rem + end) % (len + 1)) putchar('A'); else putchar('B');
	}
    }
}

main(void) {
    for(cin >> n;n--;) {
	cin >> a >> b >> l >> r;
	if(a == b) {
	    for(int i = l;i <= r;++ i) if(i & 1) putchar('A'); else putchar('B'); puts("");
	    continue;
	}
	if(!a || !b) {
	    for(int i = l;i <= r;++ i) if(a) putchar('A'); else putchar('B'); puts(""); continue;
	}
	int len = 0;
	if(a > b) len = (a / (b + 1)) + (a % (b + 1) != 0);
	else len = b / (a + 1) + (b % (a + 1) != 0);
	doit(a , b , len , l , r);
	puts("");
    }
}


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

int main() {
  int n; cin >> n;
  vector<int> vec(n);
  for (int i=0; i<n; i++) cin >> vec[i];
  
  int j=0;
  for (int i=0; i<n; i++) {if(vec[i]%2==0) j++;}
  
  vector<int> vec2(j); bool can = true;
  int k=0;
  for (int i=0; i<n; i++){
    if(vec[i]%2==0){
     vec2[k] = vec[i];
      k++;
    }
  }
  
  for (int i=0; i<j; i++){
    if(vec2[i]%3!=0 && vec2[i]%5!=0) can = false;
  }
  
  if(can)cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;
  
  return 0;
}

Measured memory_bytes: 256
MOD = 10 ** 9 + 7
S = gets.to_i
dp = Array.new(S + 1, 0)
dp[3] = 1
(4 .. [S,4].max).each do |s|
  dp[s] = (dp[s - 3] + dp[s - 1]) % MOD 
end
puts dp[S]


Measured memory_bytes: 14344
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define PRINT(x) cout<<(x)<<endl
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
#define PB push_back
#define MP make_pair

const int MAX_X = 1000, MAX_Y = 1000;

int q;
string X, Y;

int dp[MAX_X + 1][MAX_Y + 1];

int main() {
    cin >> q;
    REP(_, q) {
        cin >> X >> Y;
        REP(i, X.size() + 1) {
            REP(j, Y.size() + 1) dp[i][j] = 0;
        }
        REP(i, X.size()) {
            REP(j, Y.size()) {
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j]);
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j + 1]);
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j]);
                if (X[i] == Y[j]) dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
            }
        }
        int Z_size = dp[X.size()][Y.size()];
        PRINT(Z_size);
    }
    return 0;
}


Measured memory_bytes: 7000
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n; cin>>n;
	int a[n];
	int maxi = -INT_MAX, second_max = -INT_MAX, max_index;
	for(int i = 0 ; i < n ; i++)
	{
		cin>>a[i];
		if(a[i]>maxi)
		{
			maxi =  a[i];
			max_index  = i;
		}
		else if(a[i]>second_max)
			second_max = a[i];

	}
	for(int  i = 0 ; i < n ; i++)
		cout<<((i==max_index)?second_max:maxi)<<endl;

	return 0;
}

Measured memory_bytes: 2432
n = int(input())
ps = [int(i) for i in input().split()]
print(sum([1 for i in range(1, n-1) if not((ps[i-1] < ps[i] and ps[i+1] < ps[i]) or (ps[i-1] > ps[i] and ps[i+1] > ps[i]))]))

Measured memory_bytes: 3060
#include <iostream>

int main()
{
    using namespace std;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int ans = n%1000;
    if(ans == 0)
        cout<<0;
    else
        cout<<(1000-ans);
    
    return 0;
}


Measured memory_bytes: 3120
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int64_t w, h, x, y;
  cin >> w >> h >> x >> y;

  cout << (double)w * h / 2 << " ";

  if (w % 2 == 0 && h % 2 == 0 && w / 2 == x && h / 2 == y) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 888
a = int(input())
b = input()

import math

def nCr(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n-r)


R = 0
G = 0
B = 0
for i in b:
    if i == "R":
        R += 1
    elif i == "G":
        G += 1
    else:
        B += 1


if R == 0 or G == 0 or B == 0:
    print(0)
else:
    res = 0
    for i in range(0, len(b)):
        for k in range(i + 1, len(b)):
            if (i + k) % 2 == 0:
                if b[i] != b[k] and b[i] != b[(i + k) //2] and b[k] != b[(i + k) //2]:
                    res += 1

    print(nCr(R, 1) * nCr(G, 1) * nCr(B, 1) - res)

Measured memory_bytes: 68552
#include<stdio.h>
int main(void){
 int n;
  scanf("%d",&n);
  switch(n%10){
    case 0:
    case 1:
    case 6:
    case 8:puts("pon");break; 
    case 3: puts("bon");break;
    default:puts("hon");
  }
  return 0;
}


Measured memory_bytes: 1624
#include <iostream>
#include <string>
#include <stdlib.h>
#include <bits/stdc++.h>
using namespace std;

int main() {
  long q,a,b,Min,Max,sq,ans;
  cin>>q;
  for(int i=0;i<q;i++){
    cin>>a>>b;
    Min=min(a,b);
    Max=max(a,b);
    sq=sqrt(a*b);
    //cout<<sq<<endl;
    ans=sq*2-2;
    if(a==b){
      ans+=1;
    }
    if(sq*sq==Min*Max){
      ans-=1;
    }
    if(sq*(sq+1)<a*b){
      ans+=1;
    }
    cout<<ans<<endl;
  }
    
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = a; i < (b + a); i++)
#define W1 while (1)
#define COUT(x) cout << x << endl
using namespace std;
using ll = long long;
using ld = long double;
#define ALL(x) x.begin(),x.end()
#define P pair<int,int>
#define mod 1000000007
#define PB push_back
#define F first
#define S second

int main() {
  int k;
  cin >> k;
  ll ans = 0;
  FOR(i, 1, k) {
    FOR(j, 1, k) {
      int ij = __gcd(i, j);
      FOR(l, 1, k) {
        ans += __gcd(ij, l);
      }
    }
  }
  COUT(ans);

  return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000000;
const int mod = 1000000007;
int ng[34578], ans[345678];
signed main() {
	int n, a = 1, cnt = 0; cin >> n;
	vector<vector<int>>test(n, vector<int>(2));
	for (int h = 0; h < n; h++) {
		cin >> test[h][0]; test[h][1] = h + 1; ans[test[h][0]] = h + 1;
		ng[h] = test[h][0];
	}
	sort(ng, ng + n);
	sort(test.begin(), test.end());
	//前
	for (int h = 0; h < n; h++) {
		for (int i = 1; i < test[h][1]; i++) {
			while (a == ng[cnt]) { a++; cnt++; }
			if (a >= test[h][0]) { cout << "No" << endl; return 0; }
			ans[a] = test[h][1]; a++;
		}
	}
	reverse(test.begin(), test.end()); a = n * n; cnt = n - 1;
	//後
	for (int h = 0; h < n; h++) {
		for (int i = 0; i < n - test[h][1]; i++) {
			while (a == ng[cnt]) { a--; cnt--; }
			if (a <= test[h][0]) { cout << "No" << endl; return 0; }
			ans[a] = test[h][1]; a--;
		}
	}
	cout << "Yes" << endl;
	for (int h = 1; h <= n * n; h++) {
		if (h == 1) { cout << ans[h]; }
		else { cout << ' ' << ans[h]; }
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int ans = 1;

    rep(i, n) {
        if (ans > k) {
            ans += k;
        }
        else {
            ans *= 2;
        }
    }

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

Measured memory_bytes: 256
/**
*    created: 13.05.2020 19:38:25
**/
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#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++)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int a, b;
    cin >> a >> b;
    if (a >= 13) cout << b << endl;
    else if (6 <= a && a <= 12) cout << b/2 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let [h, w] = nextIntArray()
    let s = []
    while (hasNext()) {
        s.push(next())
    }
    let a = Array.from( new Array(h), _ => new Array(w).fill(0))
    let dir = [
        [-1, -1],
        [-1, 0],
        [-1, 1],
        [0, -1],
        [0, 1],
        [1, -1],
        [1, 0],
        [1, 1],
    ]
    for (let i = 0; i < s.length; i++) {
        for (let j = 0; j < s[i].length; j++) {
            if (s[i][j] == "#") {
                a[i][j] = "#"
            } else {
                let cnt = 0
                for (let d of dir) {
                    let x = j + d[0]
                    let y = i + d[1]
                    if (0 <= x && x < s[0].length && 0 <= y && y < s.length) {
                        if (s[y][x] == "#") cnt++
                    }
                }
                a[i][j] = cnt
            }
        }
    }
    for (let l of a) {
        console.log(l.join(""))
    }
}
Main()



Measured memory_bytes: 33236
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define mc map<char, int>
#define ms map<string, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
//#define mod 1000000007LL
#define mod 998244353 
using namespace std;
int power(int x, int y) ;
int gcd(int a, int b) ;

signed main() {
    quickie
    int n ;
    cin >> n ;
    int a[n] ;
    rep(i ,0, n) cin >> a[i] ;
    sort(a, a+n) ;
    if(a[n/2] == a[n/2-1]) cout << 0 << "\n" ;
    else cout << (a[n/2] - a[n/2-1]) << "\n" ;
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}
 
int gcd(int a,int b){
    if(a==0) return b;
    return gcd(b%a,a);
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        String[] line = stdin.readLine().split(" ");
        int n = Integer.parseInt(line[0]);
        int k = Integer.parseInt(line[1]);
        
        double sum = 0;
        for (int dice = 1; dice <= n; dice++) {
            int i = dice;
            int c = 1;
            while (i < k) {
                c *= 2;
                i *= 2;
            }
            sum += 1.0d / (n * c);
        }
        
        System.out.println(sum);
    }
}


Measured memory_bytes: 21204
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n, d;
	cin >> n >> d;
	int ans = 0;
	while (n--) {
		int x, y;
		cin >> x >> y;
		ans += (x * x + y * y <= d * d);
	}
	cout << ans << '\n';
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    int i,count=0;
    int arr[n];
    for(i=0;i<n;i++)
    cin>>arr[i];
    for(i=0;i<n;i++){
        if(arr[i]>=k)
        count++;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 3952
N = int(input())
la = list(map(int, input().split()))

lcnt = [0] * (max(la) + 3)

for i in range(N):
    lcnt[la[i]+2] += 1
    lcnt[la[i]+1] += 1
    lcnt[la[i]] += 1

print(max(lcnt))

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

vector< int >apply(const vector< int >&v) {
    int n = v.size();
    vector< int >cu(n, 0);
    for (int i = 0; i < n; i++) {
        int l = max(i-v[i], 0);
        int r = min(i+v[i], n-1);
        cu[l]++;
        if (r+1 < n) cu[r+1]--;
    }
    for (int i = 1; i < n; i++) cu[i] += cu[i-1];
    return cu;
}


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

    vector< int >a(n);
    for (int &x : a) cin >> x;

    while (k--) {
        vector< int >r = apply(a);
        if (a == r) break;
        swap(a, r);
    }

    for (int i = 0; i < n; i++) cout << a[i] << " ";

    return 0;
}


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

typedef long long ll;

int main()
{
    int i,j;
    int n,m;
    cin >> n >> m;
    vector<bool> pro(n,false);
    vector<int> wa(n,0);
    for(i = 0;i < m;++i){
        int p;
        string s;
        cin >> p >> s;
        if(s == "AC"){
            if(pro.at(p-1)){
                continue;
            }else{
                pro.at(p-1) = true;
            }
        }else{
            if(pro.at(p-1)){
                continue;
            }else{
                ++wa.at(p-1);
            }
        }
    }
    int ans_a = 0;
    int ans_w = 0;
    for(i = 0;i < n;++i){
        if(pro.at(i)){
            ++ans_a;
            ans_w += wa.at(i);
        }
    }
    cout << ans_a << endl;
    cout << ans_w << endl;
    return 0;
}

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

int main(){
	string sd,t;

	cin >> sd >> t;

	for(int i = sd.size() - t.size(); i >=0; --i){
		int start = i;
		for(int j = 0; j < t.size(); ++j){
			if(sd[start+j] != t[j] && sd[start+j] != '?'){
				break;
			}
			if(j == t.size() - 1){
				for(int k = 0; k < t.size(); ++k){
					sd[start + k] = t[k];
				}
				for(auto& s : sd){
					if(s == '?')s = 'a';
				}
				cout << sd << endl;
				return 0;
			}
		}
	}
	cout << "UNRESTORABLE" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
  int main(){
   int a,b,sum;
  while(1){
    scanf("%d",&a);
    if(a==0){
    break;
    }
	b=1000-a;
	sum=0;
     
     if(b>= 500){
       b=500-a;
        sum++;
        
        }
      y:
      if(b>=100){
       b=b-100;
        sum++;
        goto y;
        }
       z:
         if(b>=50){
       b=b-50;
        sum++;
        goto z;
        }
        ab:
         if(b>=10){
       b=b-10;
        sum++;
        goto ab;
        }
        if(b>=5){
         b = b-5;
          sum++;
           }
           sum += b;
           
printf("%d\n",sum);
}
return 0;
}

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

const ll INF=1001001001;

int main(){
    int n; cin >> n;
    vector<vector<ll>> m(n,vector<ll>(3)),dp(n,vector<ll>(3,0));
    rep(i,n) rep(j,3) cin >> m[i][j];
    rep(j,3) dp[0][j]=m[0][j];
    rep2(i,n) rep(j,3){
        rep2(k,3){
            dp[i][j]=max(dp[i-1][(j+k)%3]+m[i][j],dp[i][j]);
        }
    }
    ll ans=dp[n-1][0];
    rep2(k,3) ans=max(ans,dp[n-1][k]);
    cout << ans << endl;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const long long N = 1e6 + 17;
ll cnt, ans, lnt, sum, n, l1, x, y, a[N], mx;
pair<ll,ll>pr[N];
vector<ll>v,v2,v3;
map<ll,ll>mp;
bool used[N], t1, t2;
vector<string>sv;

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    string s;
    cin >> s;
    for(ll i = 0; i < s.size(); i ++)
    {
        if(s[i] == 'A' or s[i] == 'C' or s[i] == 'T' or s[i] == 'G')
        {
            cnt ++;
        }
        else
        {
            cnt = 0;
        }
        mx = max(cnt, mx);
    }
    cout << mx << endl;
	//cout << "\nTime Elapsed : " << clock () * 1.0 / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 2304
n=int(input())
cost=[[float('inf')]*n for _ in range(n)]
m=int(input())
for _ in range(m):
    a,b,c,d=map(int,input().split(','))
    cost[a-1][b-1]=c
    cost[b-1][a-1]=d
s,g,V,P=map(int,input().split(','))

for k in range(n):
    for i in range(n):
        for j in range(n):
            if cost[i][j] > cost[i][k] + cost[k][j]:
                cost[i][j] = cost[i][k] + cost[k][j]

print(V-P-cost[s-1][g-1]-cost[g-1][s-1])


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

using namespace std;

#define pb push_back
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define sz(x) (int)(x).size()
#define f(n) for(int i=0;i<n;++i)
#define f2(n) for(int j=0;j<n;++j)
#define f3(n) for(int k=0;k<n;++k)
#define F(i,x,n,y) for(i=x;i<n;i+=1)
#define fi(i) for(i=0;i<n;++i)
#define fa(x,y) for(auto x:y)

//Warsaw debug template
#define LOCAL
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1,debug&>::type operator<<(c i){
sim > struct rge {c b,e;};
sim > rge<c> range(c i, c j) {return rge<c>{i,j};}
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug{
#ifdef LOCAL
~debug() {cerr<<endl; }
eni(!=) cerr<< boolalpha << i; ris;}
eni(==) ris <<range(begin(i),end(i)); }
sim, class b dor(pair<b,c> d){
ris<<"("<<d.first<<","<<d.second<<")";
}
sim dor(rge<c> d){
    *this << "[";
    for(auto it=d.b;it!=d.e;++it)
        *this <<"," +(it==d.b)<< *it;
    ris<<"]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) "["<<#__VA_ARGS__":"<<(__VA_ARGS__)<<"]"
//End of debug template        
    

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    int ans=0;
    fa(x,s){
        if(x=='+') ++ans;
        else --ans;
    }
    cout<<ans<<endl;


    return 0;
}


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

using namespace std;

typedef pair < int , int > pii;

const int N = 1e5;

pii dat[N + 5];
int n,m;

int main(){
	cin >> n >> m;
	for(int i=0; i<m; i++){
		cin >> dat[i].first >> dat[i].second;
	}
	int mini = 0, maxi = N+5;
	for(int i=0; i<m; i++){
		mini = max(mini, dat[i].first);
		maxi = min(maxi, dat[i].second);
	}
	cout << max(0, maxi-mini+1) << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define lli long long int
#define MOD 1000000007
#define FOR(i,n) for(int i=0;i<(int)N;i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;

inline lli getint(){
    lli n;
    scanf("%lld",&n);
    return n;
}

inline vector<lli> getints(int n){
    vector<lli> a(n);
    for(int i=0;i<n;i++)scanf("%lld",&a[i]);
    return a;
}

inline string getstr(){
  string s;
  cin>>s;
  return s;
}

void dumpints(vector<lli> a){
  cout<<"[";
  for(int i=0;i<a.size()-1;i++){
    cout<<a[i]<<",";
  }
  cout<<a[a.size()-1]<<"]"<<endl;
}

template<class T> bool ifinclude(vector<T> a,T x){
    auto itr=find(a.begin(),a.end(),x);
    return distance(a.begin(),itr)!=a.size();
}

int main(void){
  vector<lli> a=getints(3);
  sort(ALL(a));
  if(a[0]%2==0||a[1]%2==0||a[2]%2==0){
    cout<<0<<endl;
  }else{
    cout<<a[0]*a[1]<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
// Ver19.02
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int x, a, b;
  scanf("%d%d%d", &x, &a, &b);
  if (b - a <= 0)
    puts("delicious");
  else if (b - a <= x)
    puts("safe");
  else
    puts("dangerous");

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using i64 = int64_t;

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

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

    bool flg = (n % s(n)) == 0;

    cout << (flg ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>


int main()
{
    const uint N_MAX = 100000;

    int N = 1;
    // int t[N_MAX], x[N_MAX], y[N_MAX] = {0};
    int t, x, y = 0;
    bool possible = true;

    // Input number of stop
    std::cin >> N;
    for (int i = 0; i < N; ++i) {
        // Input each time and stop
        std::cin >> t >> x >> y;

        // Judge
        // Max distance
        possible = x + y <= t;
        // Count
        if (possible) {
            possible = (x + y + t) % 2 == 0;
        }
        if (!possible) {
            break;
        }
    }

    // Output
    std::cout << (possible ? "Yes" : "No") << std::endl;
    return 0;
}


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


int main()
{
  string s, t;
  cin >> s >> t;
  vector<vector<int>> pos(26);
  rep(i, s.size())
    pos[s[i] - 'a'].push_back(i + 1);
  vector<vector<int>> nxt(s.size() + 1, vector<int>(26, -1));
  rep(i, s.size() + 1)
    rep(j, 26)
    {
      if (pos[j].empty())
        continue;
      auto itr = upper_bound(pos[j].begin(), pos[j].end(), i);
      if (itr == pos[j].end())
        nxt[i][j] = pos[j][0];
      else
        nxt[i][j] = *itr;
    }
  ll ans = 0;
  int pre = 0, crt;
  for (char& c : t)
  {
    if (nxt[pre][c - 'a'] == -1)
    {
      puts("-1");
      return 0;
    }
    crt = nxt[pre][c - 'a'];
    if (pre >= crt)
      ans += s.size() - pre + crt;
    else
      ans += crt - pre;
    pre = crt;
  }
  cout << ans << endl;
  return 0;
}

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

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main() {
  stack<int> sta;
  int n;
  while(cin >> n) {
    if(n != 0) sta.push(n);
    else {
      cout << sta.top() << endl;
      sta.pop();
    }
  }
}

Measured memory_bytes: 1200
#pragma region

#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (register int i = (begin); i < (end); i++)
#define IFOR(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define MOD 1000000007
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  REP(i, vec.size())
  i == 0
      ? os << vec[i]
      : os << ", " << vec[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const deque<T> &deq) {
  os << "deq[ ";
  REP(i, deq.size())
  i == 0
      ? os << deq[i]
      : os << ", " << deq[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const unordered_map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}

#pragma endregion
#define MAX 2147483647

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);

  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  cin >> h;
  int ans = 0;
  for (auto &&_ : h) ans += _ >= K;
  cout << ans << "\n";
}


Measured memory_bytes: 640
def watch():

    second = int(input())
    hours_float = float(second / 3600 )
    hours_int = int(hours_float)

    minute_float = 60* (hours_float - float(hours_int))
    minute_int = int(minute_float)

    second_float = 60 * (minute_float - float(minute_int))
    second_int = round(second_float)
    
    if(second_int >= 60):
        second_int -= 60
        minute_int += + 1
    if(minute_int >= 60):
        minute_int -= 60
        hours_int += 1
    print('{}:{}:{}'.format(hours_int,minute_int,second_int))


watch()



Measured memory_bytes: 5604
import java.util.Scanner;
import java.util.Random;
import java.util.Arrays;

class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		String c = sc.next();
		
		if (a.charAt(a.length() -1) == b.charAt(0) && b.charAt(b.length() -1) == c.charAt(0)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
    	
}
}

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

// kmp をやるための前計算
vector<int> makeTable(const string& s) {
    int n = s.size();
    vector<int> ret(n+1);
    ret[0] = -1;
    int j = -1;
    for (int i = 0; i < n; i++) {
        while (j >= 0 && s[i] != s[j]) j = ret[j];
        ret[i+1] = ++j;
    }
    return ret;
}

// str の中に word とマッチする場所のリストを返す
// ret のそれぞれの要素 el は, 「str[el] からの文字列が word と一致する」ことを示す
vector<int> kmp(const string& str, const string& word) {
    vector<int> table = makeTable(word), ret;
    int m = 0, i = 0, n = str.size();
    while (m+i < n) {
        if (word[i] == str[m+i]) {
            if (++i == (int)(word.size())) {
                ret.push_back(m);
                m = m+i-table[i];
                i = table[i];
            }
        } else {
            m = m+i-table[i];
            if (i > 0) i = table[i];
        }
    }
    return ret;
}

int f;

int serch(int k, int N, vector<int> &match, int M, vector<int> &length, vector<int> &visit){
	if(length[k] != -1){
		return length[k];
	}
	else if(match[k] == 0){
		length[k] = 0;
		return 0;
	}
	else{
		if(visit[k] == 1){
			f = 1;
		}
		else{
			visit[k] = 1;
			length[k] = serch((k + M) % N, N, match, M, length, visit) + 1;
		}
		return length[k];
	}
}

int main(){
	int N, M, i;
	string s, t;
	cin >> s;
	cin >> t;
	N = s.size();
	M = t.size();
	string ss = s + s;
	while(ss.size() <= 2 * M){
		ss += s;
	}
	vector<int> match_list = kmp(ss, t);
	vector<int> match(N, 0);
	for(i = 0; i < match_list.size(); i++){
		if(match_list[i] < N){
			match[match_list[i]] = 1;
		}
	}
	vector<int> length(N, -1), visit(N, 0);
	f = 0;
	int ans = -1;
	for(i = 0; i < N; i++){
		ans = max(ans, serch(i, N, match, M, length, visit));
	}
	if(f == 1){
		printf("-1\n");
	}
	else{
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 28040
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;


int main()
{
	int n;
	while (cin >> n, n) 
	{
		vector<pair<pair<int, int>,string> > v;
		bool used[20] = {0};
		int sum = 0;
		rep(i,n){
			string f;
			int w, s;
			cin >> f >> w >> s;
			v.push_back({{w,s},f });
			sum += w;
		}

		sort(v.begin(), v.end());
		reverse(v.begin(),v.end());

		rep(j,n){
			rep(i, n) {
				if (!used[i]) {
					if (v[i].first.second >= sum - v[i].first.first) {
						cout << v[i].second << endl;
						sum -= v[i].first.first;
						used[i] = 1;
						break;
					}
				}
			}
			sort(v.begin(), v.end());
			reverse(v.begin(), v.end());
		}
	}
	return 0;
}

Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    // ios::sync_with_stdio(false);
    // cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int d;
    cin >> d;
    vi  c(26);
    int mxc = 0;
    int mxc_c = 0;
    REP(i, 26) {
        cin >> c[i];
        if (chmax(mxc, c[i])) mxc_c = i + 1;
    }
    vvl s(d, vl(26));
    int mx = 0;
    int mx_c = 0;
    REP(i, d) REP(j, 26) {
        cin >> s[i][j];
        if (chmax(mx, (int)s[i][j])) mx_c = j + 1;
    }

    vi last(26);
    ll ans = 0;
    vi a(d);
    REP(i, d) {
        ll ans2 = -LINF;
        ll ans_i = -1;
        REP(x, 26) {
            ll tmp = s[i][x];
            REP(j, 26) {
                if (x != j) tmp -= c[j] * ((i + 1) - last[j]);
            }
            if (chmax(ans2, tmp)) ans_i = x;
        }
        last[ans_i] = i + 1;
        ans += ans2;
        // cout << ans_i + 1 << endl;
        a[i] = ans_i + 1;
    }
    mt19937 mt{ random_device{}() };
    uniform_int_distribution<int> dist_d(1, d);
    uniform_int_distribution<int> dist_c(1, 26);
    REP(_, 210000) {
        vi lst(26);
        ll ans_n = 0;
        int x = dist_d(mt);
        int y = (_ % 10 == 0 ? mx_c : _ % 20 == 5 ? mxc_c : dist_c(mt));
        REP(i, d) {
            int t = a[i];
            if (x - 1 == i) t = y;
            ans_n += s[i][t - 1];
            lst[t - 1] = i + 1;
            REP(j, 26) if (t - 1 != j) ans_n -= c[j] * ((i + 1) - lst[j]);
        }

        if (ans_n > ans) {
            a[x - 1] = y;
            ans = ans_n;
        }
    }
    printlnv(a);
    // cout << ans << endl;
}


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

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

    bool ans = false;

    for (int i = a; i <= b; i++) {
        if (i % k == 0) {
            ans = true;
        }
    }

    if (ans) {
        cout << "OK" << endl;
    } else {
        cout << "NG" << endl;
    }
    return 0;
}

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

void doc(){
    freopen("OB.inp","r", stdin);
    freopen("OB.out","w", stdout);
}

void solve(){
    int n;
    cin >> n;
    int a[n], m = 0;
    for(int i = 0 ; i < n; i++){
        cin >> a[i];
        m = max(m, a[i]);
    }
    int d[m + 1];
    memset(d, 0, sizeof(d));
    for(int i = 0; i < n; i++) d[a[i]]++;
    for(int i = 0; i < m; i++)
        while (d[i]--) cout << i << " ";
    for(int i = 1; i < d[m]; i++)
        cout << m << " ";
    cout << m << '\n';
}

int main(){
   // ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
   // doc();
    solve();
}



Measured memory_bytes: 10920
#include <iostream>
using namespace std;
int main(){
  int A,B;
  cin >> A >> B;
  if(A % 3==0 || B % 3==0 || (A+B)%3==0){
    cout << "Possible" << endl;
  }else{
    cout << "Impossible" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll knapsack(ll n,ll wt[],ll v[],ll W){
	ll k[n+1][W+1];
	for(ll i=0;i<=n;i++){
		for(ll w=0;w<=W;w++){
			if(i==0 || w==0)
			k[i][w]=0;
			else if(wt[i-1]<=w){
				k[i][w]=max(v[i-1]+k[i-1][w-wt[i-1]],k[i-1][w]);
			}
			else{
				k[i][w]=k[i-1][w];
			}
		}
	}
	return k[n][W];
}
int main(){
	ll n,W;
	cin>>n>>W;
	ll wt[n],v[n];
	for(ll i=0;i<n;i++){
		cin>>wt[i]>>v[i];
	}
	ll h=knapsack(n,wt,v,W);
	cout<<h<<endl;
}

Measured memory_bytes: 79104
import java.util.*;
import java.math.*;
import java.text.*;

public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int t = in.nextInt();
		for(int i=0; i<t; i++){
			int n = in.nextInt();
			int a=in.nextInt(), b=0, up=0, down=0;
			for(int j=0; j<n-1; j++){
				b=in.nextInt();
				if((b-a)>0){
					if((b-a)>up) up = (b-a);
				}
				else if((b-a)<0){
					if((a-b)>down) down = (a-b);
				}
				a = b;
			}
			System.out.println(up+" "+down);
		}
	}
}

Measured memory_bytes: 12000
#include<stdio.h>

#define NILL -1

static const int MAX = 500;
static const int INFTY = (1<<21);


int check(int x,int A[],int c){
  int i;
  for(i=0;i<c;i++){
    if(A[i]==x)return 0;
  }
  return 1;
}

main(){
  int n, i, j, e, sum=0,k;
  int M[MAX][MAX],p[MAX];
  int flag=0,
    min=INFTY,
    v[MAX],
    c=1,
    F[MAX],
l=0;

  v[0]=0;
  //  p[0]=NILL;
  for(i=1;i<MAX;i++){
    v[i]=NILL;
    //p[i]=NILL;
    }


  scanf("%d", &n);

  for ( i = 0; i< n; i++ ){
    for ( j = 0; j < n; j++ ){
      scanf("%d", &e);
      M[i][j] = (e==NILL)?INFTY:e;
    }
  }
  
  for(i=0;i<n-1;i++){
    min=INFTY;
    for(k=0;k<c;k++){
    //k=0;
      //if(k<c){
      for(j=0;j<n;j++){
	if(check(j,v,c)==1&&min>M[v[k]][j]){
	  min=M[v[k]][j];
	  //l=v[k];
	  flag=j;
	}
      }
      //printf("%d\n",min);
      //p[i]=v[k];
      //k++;
    }
    //printf("%d\n",min);
    //p[i]=v[c];
    // F[i]=min;
    // sum+=min;
    v[c]=flag;
    p[v[i]]=v[c];
    c++;
    //p[v[i]]=v[c-1];

    //v[c]=flag;
    sum+=min;
    //printf("%d %d %d %d\n",flag,min,p[i],v[i]);
  }

  
  /* for ( i = 0; i < n-1; i++ ){
    if ( M[i][p[i]] != INFTY ) sum += M[i][p[i]];
    printf("%d\n", sum);
    }*/
  
  
  printf("%d\n", sum);
  
  return 0;
}

Measured memory_bytes: 808
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

#define all(c) (c).begin(), (c).end()
const int N = 1299709;

template<typename T> inline T sqr(T x){return x * x;}

void sieve(vector<int>& v, int n){
    v.assign(n, 0); iota(all(v), 2);
    for(auto div=v.begin(); sqr(*div)<=v.back(); ++div){
        v.erase(remove_if(div+1, v.end(), [&](int x){return x % *div == 0;}), v.end());
    }
}

int main(){
    vector<int> primes;
    sieve(primes, N);
    for(int k; cin >> k, k;){
        auto itr = lower_bound(all(primes), k);
        cout << (*itr == k? 0: *itr - *(itr - 1)) << '\n';
    }
    return 0;
}

Measured memory_bytes: 6212
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
#define f first
#define s second
#define pb push_back
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

string s, ss, a, aa, b, bb;

int main() {
	fastio; cin >> s;
	ss = s; reverse(ss.begin(), ss.end());
	a = s.substr(0, (s.length()-1)/2);
	aa = a; reverse(aa.begin(), aa.end());
	b = s.substr((s.length()+1)/2);
	bb = b; reverse(bb.begin(), bb.end());
	if (s == ss and a == aa and b == bb) cout << "Yes";
	else cout << "No";
}



Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int w, a, b;
    cin >> w >> a >> b;
    if (a <= b) {
        cout << max(0, b - a - w) << endl;
    }
    else {
        cout << max(0, a - b - w) << endl;
    }
}

Measured memory_bytes: 256
h, w = map(int, input().split())
ww = "." * (w+2)
board = [ww] * (h+2)
for i in range(1, h+1):
    bb = "." + input() + "."
    board[i] = bb

for i in range(1, h+1):
    for j in range(1, w+1):
        if board[i][j] == "#":
            print("#", end='')
        else:
            count = 0
            if board[i+1][j] == "#":
                count += 1
            if board[i][j+1] == "#":
                count += 1
            if board[i+1][j+1] == "#":
                count += 1
            if board[i+1][j-1] == "#":
                count += 1
            if board[i][j-1] == "#":
                count += 1
            if board[i-1][j-1] == "#":
                count += 1
            if board[i-1][j+1] == "#":
                count += 1
            if board[i-1][j] == "#":
                count += 1
            print(count, end='')
        if j == w:
            print("\n", end='')


Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl "\n";
void solve()
{
    ll i,j,k,l,m,n,q,s,t;
    cin>>n>>k;
    k*=k;
    m=0;
    for(i=0;i<n;i++)
    {
        cin>>q>>s;
        t=q*q+s*s;
        if(t<=k)
        m++;
    }
    cout<<m<<endl;
}
int main()
{
    ll i,j,k,l,m,n,o,p,q,r,t,x;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sort stable_sort
#define all(x) (x).begin(),(x).end()
#define rep(i,x) for ((i)=(1);(i)<=(x);(i)++)
#define rep2(i,x) for ((i)=(x);(i)>=(1);(i)--)
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
using namespace std;
int n,i,j,f[105],s;
void solve(int x){
	int i,j;
	rep(i,x){
		int t=s/x;
		rep2(j,n){
			if (!f[j]&&t>=j){
				f[j]=i;
				t-=j;
			}
		}
		assert(!t);
	}
	int cnt=0;
	rep(i,n) rep(j,n) if (i<j&&f[i]!=f[j]) cnt++;
	cout<<cnt<<endl;
	rep(i,n) rep(j,n) if (i<j&&f[i]!=f[j]) cout<<i<<' '<<j<<endl;
}
int main(){
	scanf("%d",&n);
	rep(i,n) s+=i;
	for (i=2;i<s;i++) if (s%i==0){
		solve(i);
		return 0;
	}
	for (;;);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define f first
#define s second
#define int long long
signed main(){
	string s;
	int k;
	cin>>s>>k;
	int n=s.size();
	string d=s;
	int sum=0;
	int tigai=0;
	rep(1,i,n){
		if(s[i]!=s[i-1]){
			tigai++;
		}
	}	
	if(tigai==0){
		c(n*k/2)
		return 0;
	}			
	if(n==2){
		if(s[0]==s[1])c(k)
		else c(0)
		return 0;
	}
	rep(1,i,n){	
		if(s[i]==s[i-1]){
			s[i]='1';
			sum++;
		}		
	}
	
	int ans=0;
	int ans1=0;
	if(d[0]==d[n-1]){
		rep(1,i,n){
			if(d[i]!=d[i-1])break;
			else ans++;
		}
		for(int i=n-1;i>0;i-=1){
			if(d[i]==d[0]){
				ans1++;
			}
			else{
				break;
			}
		}
		if(ans%2==0&&ans1%2==1){
			c(sum*k+k-1)
		}
		else{
			c(sum*k)
		}		
	}							
	else{
		c(sum*k)
	}	
}	


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  int A[100010]{},N;
  cin>>N;
  while(N--){
    int a;
    cin>>a;
    A[a]++,A[a+1]++,A[a+2]++;
  }
  int ans=0;
  for(int i=0;i<100002;i++)ans=max(ans,A[i]);
  cout<<ans<<endl;
}

Measured memory_bytes: 4372
def main():
    s = input()
    l = "abcdefghijiklmopqrstuvwxyz"

    for i in range(len(s)):
        l = l.replace(s[i], '')

    if l == "":
        print('None')
    else:
        print(l[0])


if __name__ == "__main__":
    main()


Measured memory_bytes: 73124
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);

    int kouka = scan.nextInt();

    int syou500,amari500,syou5,uresisa;

    syou500 = kouka/500;
    amari500 = kouka%500;

    syou5 = amari500/5;

    uresisa = syou500*1000 + syou5*5;

    System.out.println(uresisa);
  }
}


Measured memory_bytes: 22612
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {return (a%b) ? gcd(b, a%b) : b;}
ll modPow(ll x, ll n) {
    if(n==0) return 1;
    ll res = modPow(x*x%MOD, n/2);
    if(n&1) res=res*x%MOD;
    return res;
}
ll mul(ll l, ll r) {
    ll ret =1;
    for(int i=0; i<l-r+1; ++i) {
        ret*=i+r;
        ret%=MOD;
    }
    return ret;
}
ll com(ll n, ll k) {
    ll ret1 = mul(n,n-k+1);
    ll ret2 = mul(k,1);
    ll ret3 = modPow(ret2, MOD-2);
    return ret1*ret3%MOD;
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,k; cin >>n>>k;
    ll ans = min(n%k, k-n%k);
    ct(ans);
}


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

using namespace std;

int main() {

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

	int counter = 1;
	for (int i = 1; i < n; i++) {
		if (d[i] != d[i - 1]) { counter++; }
	}

	cout << counter << endl;
}

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

int main()
{
  int N ;
  cin>>N ;
  char S[N] ;
  for(int i=0;i<N;i++) cin>>S[i] ;
  int K ;
  cin>>K ;
  
  for(int i=0;i<N;i++){
    if(S[i]!=S[K-1]) S[i]='*' ;
    cout<<S[i] ;
  }
  
  
  return 0 ;
}

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

int main() {
	double a, b, c, d, e, f, x, y;
	while(cin >> a >> b >> c >> d >> e >> f){
		x = (c*e-b*f)/(a*e-b*d);
		y = (c*d-a*f)/(b*d-a*e);
		if (fabs(x) < 1e-3) x = 0;
		if (fabs(y) < 1e-3) y = 0;
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}


Measured memory_bytes: 3108
#include <cmath>
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <sstream>

using namespace std;


int main(){
    string line;
    getline(cin,line);
    for(int i=0;i<line.length();i++){
        if(isalpha(line[i]))
            line[i]+='A'-'a';
    }
    cout << line << endl;
    return 0;
}

Measured memory_bytes: 1176