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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define all(x) (x).begin(), (x).end()
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return 0;}while(0)

const int MOD = 998244353; //1e9+7;
const int MAXN = 1e7+1;

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9+5;
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n,k;
    cin>>n>>k;
    vector<int> v(n);

    for(auto &i:v)        cin>>i;

    vector<int> dp(n,INF);

    dp[0]=0;
    for(int i=0 ; i<n ; i++)
    {
        for(int j=i+1 ; j<=i+k ; j++)
            {
                if(j<n)
                {
                    dp[j]=min(dp[j], dp[i] + abs(v[i]-v[j]));
                }
            }
    }
    cout<<dp[n-1];
}


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

int main() {
	int n;
	cin >> n;
	vector<P> p(n);
	rep(i, n) cin >> p[i].second >> p[i].first;
	sort(p.begin(), p.end());
	ll tmp = 0;
	bool elf = true;
	rep(i, n) {
		tmp += p[i].second;
		if (tmp > p[i].first) elf = false;
	}
	cout << (elf ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
#include <string.h>
#include <cstring>

using namespace std;

int main(){
    
    long long num;
    cin >> num;
    
    bool ans=false;
    while(ans==false){
        if(num==2) {
            cout << num << endl;
            return 0;
        }
        for(int i = 2;i<num;i++){
            if(num%i==0){
                ans = false;
                break;
            }
            else ans = true;
            
        }
        num++;
    }
    
    cout << num-1 << endl;
   
    
    return 0;
}

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

int main() {
  int N,M,a,b;
  cin >> N >> M;
  vector<bool> first(N),second(N);
  for (int i=0; i<M; i++) {
    cin >> a >> b;
    if (a == 1) {
      first[b-1] = true;
    }
    if (b == N) {
      second[a-1] = true;
    }
  }
  
  for (int i=0; i<N; i++) {
    if (first[i] && second[i]) {
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }
  
  cout << "IMPOSSIBLE" << endl;
}
  

Measured memory_bytes: 256
#include <stdio.h>

const int DX[] = {-1, 0, 1, 0};
const int DY[] = {0, -1, 0, 1};

char map[16][16];

void blast(int y, int x)
{
    int i;

    if (map[y][x] != '1'){
        return;
    }

    map[y][x] = '0';
    for (i = 0; i < 4; ++i){
        blast(y + DY[i], x + DX[i]);
    }
}

int main(void)
{
    int i, j;
    int cnt;

    while (scanf("%s", map[1] + 1) != EOF){
        for (i = 2; i <= 12; ++i){
            scanf("%s", map[i] + 1);
        }

        cnt = 0;
        for (i = 1; i <= 12; ++i){
            for (j = 1; j <= 12; ++j){
                if (map[i][j] == '1'){
                    ++cnt;
                    blast(i, j);
                }
            }
        }

        printf("%d\n", cnt);
    }

    return (0);
}

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

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

  bool flag = false;

  if(a <= 8 && b <= 8) flag = true;

  else if(a > b && (a*2 + b <= 16)) flag = true;

  else if(a < b && (a + b*2 <= 16)) flag = true;

  if(flag) cout << "Yay!" << endl;
  else cout << ":(" << endl;

  return 0;

}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
vector<int> Zalgo(const string &S) {
    int N = (int)S.size();
    vector<int> res(N);
    res[0] = N;
    int i = 1, j = 0;
    while (i < N) {
        while (i+j < N && S[j] == S[i+j]) ++j;
        res[i] = j;
        if (j == 0) {++i; continue;}
        int k = 1;
        while (i+k < N && k+res[k] < j) res[i+k] = res[k], ++k;
        i += k, j -= k;
    }
    return res;
}

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

    int res = 0;
    for (int i = 0; i < N; ++i) {
        string T = S.substr(i);
        auto lcp = Zalgo(T);

        for (int j = 0; j < T.size(); ++j) {
            int l = min(lcp[j], j);
            res = max(res, l);
        }
    }
        
    cout << res << endl;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

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

typedef long long ll;
typedef pair<int,int> ii;

void solve() {

}

int main() {
  char c;
  cin >> c;
  if( 'A' <= c && c <= 'Z' ) { puts("A"); }
  else puts("a");
  return 0;
}


Measured memory_bytes: 3624
N,K=map(int,input().split())
p=list(map(int,input().split()))
S=[0]*(N+1)


for i in range(N):
    S[i+1]=S[i]+p[i]
    
ans=0
for i in range(K,N+1):
    temp=S[i]-S[i-K]
    ans=max(ans,temp)
    
print((ans+K)/2)





Measured memory_bytes: 71792
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

N, Q = map(int, input().split())
AB = [[0]*2 for i in range(N-1)]
for i in range(N-1):
  AB[i] = list(map(int, input().split()))
C = [0]*N
g = list([] for i in range(N+1))
for i in range(Q):
  p, x = map(int, input().split())
  C[p-1] += x

for i,j in AB:
  g[i].append(j)
  g[j].append(i)
 
def BTS(a, b):
  for i in g[a]:
    if i == b:
      continue
    C[i-1] += C[a-1]
    BTS(i,a)
    
BTS(1,-1)
 
print(*C)


Measured memory_bytes: 257572
from typing import List
import sys


def solution(inp: List) -> int:
    ans: int = 0
    total: int = 0
    N = int(inp[0])
    X = int(inp[1])
    T = int(inp[2])
    while True:
        total += X
        ans += T
        if total >= N:
            break
    return ans


inp: List = []
for j in sys.stdin:
    inp += j.split()
print(solution(inp))


Measured memory_bytes: 10260
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int k, t;
    cin >> k >> t;

    int a[t];
    for( int i = 0; i < t; ++i ) {
        cin >> a[i];

    }
    if( t == 1 ) {
        cout << a[0] - 1 << endl;
        return 0;

    }

    sort( a, a + t, greater<>() );
    int l = 0, r = t - 1;
    while( l < r ) {
        --a[l]; --a[r];
        if( a[l] == 0 ) ++l;
        if( a[r] == 0 ) --r;

    }

    cout << max( a[l] - 1, 0 ) << endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll comb[4020][4020];
int main(){
	ll mod=1e9+7;
	comb[0][0]=1;
	for(int i=1;i<=4010;i++){for(int j=0;j<=i;j++){
		if(j==0||j==i)comb[i][j]=1;
		else{
			comb[i][j]=comb[i-1][j-1]+comb[i-1][j];
			comb[i][j]%=mod;
		}
		//cout<<comb[i][j]<<' ';
	}
	//cout<<endl;
}
	ll s;
	cin>>s;
	ll x=s/3;
	ll ans=0;
	for(int i=1;i<=x;i++){
		ll num=s-3*i;
		ans+=comb[num+i-1][i-1];
		ans%=mod;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 81460
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
ll pow(ll a, ll b, ll m) {
	if (b == 0) return 1;
	if (b == 1) return a;
	if (b % 2 == 0) return pow((a*a) % m, b / 2, m) % m;
	else return (a * pow((a*a) % m, b / 2, m)) % m;
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll k;
	cin >> k;
	ll c = 0;
	for (int i = 0; i < k + 3; i++) {
		c += 7*pow(10, i, k);
		c %= k;
		if (c == 0) {
			cout << i + 1 << endl;
			return 0;
		} 
	}
	cout << -1 << endl;
}



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

int n;
int a[20];
int x[20][20];
int y[20][20];

int counter(int x){
    if(x==0) return 0;
    return counter(x >> 1) + (x &1);// bit calc. 
    //x shift to right by 1, and 
}

void solve(){
    // input part
    cin >> n;
    for( int i=1; i<=n; i++){
        cin >> a[i];
        for( int j=1; j<=a[i]; j++){
            cin >> x[i][j] >> y[i][j];
        }
    }
    // calc. part
    int ans=0;
    // {0, 1, ..., n-1} の部分集合の全探索: bit全探索(bit full search)
    for( int bits=1; bits<(1<<n); bits++){
        /* bit で表される集合の処理 */
        bool ok=true;
        for( int i=1; i<=n; i++){
            // bits & 1 << (i-1) = false の時，skip
            if( !( bits&(1<<(i-1)) ) ) continue;
            for( int j=1; j<= a[i]; j++){
                if( ( (bits>>(x[i][j]-1)) & 1 ) ^y[i][j] ) ok = false;
            }
        }
        if(ok) ans = max( ans, counter(bits));
    }
    cout << ans << endl;
    return;
}

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




Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	int d = read.to!int;
	int n = read.to!int;
	
	if(n == 100) n += 1;
	
	string ans;
	ans = n.to!string;
	foreach(i; 0 .. d) ans ~= "00";
	
	ans.writeln;	
	}

Measured memory_bytes: 256
// Problem : C - Splitting Pile
// Contest : AtCoder - AtCoder Beginner Contest 067
// URL : https://atcoder.jp/contests/abc067/tasks/arc078_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
	int n;cin>>n;
	vi v(n);cin>>v;
	int post[n];
	post[n-1]=v[n-1];
	for(int i=n-2;i>=0;i--)
	post[i]=post[i+1]+v[i];
	int ans=INF;
	int sum=0;
	for(int i=0;i<n-1;i++)
	{
		sum+=v[i];
		ans=min2(ans,abst(sum-post[i+1]));
	}
	cout<<ans;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 6284
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	int n; cin >>n;
	vector<ll> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	int mid=n/2;
	ll left=0;
	ll right=0;
	for(int i=0;i<=mid;i++){
		left+=a[i]*pow(-1,i);
	}
	for(int i=n-1;i>=mid;i--){
		right+=a[i]*pow(-1,i);
	}
	ll first=0;
	if(mid%2==0){
		first=left+right-a[mid];
		//cout << first << endl;
	}
	else{
		first=left+right+a[mid];
		//cout << first <<endl;
	}
	vector<ll > b(n);
	b[0]=first;
	for(int i=1;i<n;i++){
		b[i]=(a[i-1]-b[i-1]/2)*2;
	}
	for(int i=0;i<n;i++){
		cout << b[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 2944
import java.util.Scanner;

fun main(args: Array<String>) {
	val scanner = Scanner(System.`in`)
	val n = scanner.nextInt()
	var min = Integer.MAX_VALUE
	var max = 0
	repeat(n) {
		val a = scanner.nextInt()
		min = Math.min(min, a)
		max = Math.max(max, a)
	}
	println(max-min)
}

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

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

    string s, t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    int mx = 0;
    for(int i = 0; i < (n-m+1); ++i){
        int cnt = 0;
        for(int j = 0; j < m; ++j){
            if(s[i+j] == t[j])++cnt;
        }
        mx = max(mx, cnt);
    }

    cout << m-mx << endl;

    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s.size() == 1) cout << "No" << endl;
  else{
    vector<char> s_vec(s.size());
    for(int i=0; i<s.size(); i++){
      s_vec.at(i)=s.at(i);
    }
    sort(s_vec.begin(), s_vec.end());
    int count=1;
    bool is_beautiful = true;
    for(int i=1; i<s.size(); i++){
      if (s_vec.at(i-1)==s_vec.at(i)) count++;
      else if(count%2==1){
        is_beautiful = false;
      }else count =1;
      if(is_beautiful == false) break;
    }
    if(is_beautiful == true) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

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: 3616
#include <iostream>

using namespace std;

int main(){
    int a,b,c,k,sum=0;
    cin >> a >> b >> c >> k;
    sum = (k > a) ? a : k;
    if (k<a) cout << k << endl;
    else if(k<a+b) cout << a << endl;
    else cout << a - (k-a-b) << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main() {
	int x, y, z, s;
	cin >> s;
	x= s/60/60;
	y= (s-x*60*60)/60;
	z= (s-x*60*60)%60;
	cout << x << ":" << y << ":" << z << endl;
	return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i=0; i<int(n); i++)
#define RNG(i, f, t) for(int i=int(f); i<=int(t); i++)
#define REV(i, f, t) for(int i=int(f); i>=int(t); --i)
#define ALL(v) (v).begin(), (v).end()
bool RELAXED = false;
template<int,typename T> struct MINMAX{ T val; MINMAX(T val) : val(val) {} };
template<typename T> MINMAX<1,T> MAX(T val) { return MINMAX<1,T>(val); };
template<typename T> MINMAX<2,T> MIN(T val) { return MINMAX<2,T>(val); };
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<1,U> rhs) { return lhs = (rhs.val > lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<2,U> rhs) { return lhs = (rhs.val < lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T> inline vector<T> readVector(int n) { vector<T> vec(n); FOR(i,n) cin>>vec[i]; return vec; }
template<typename T> void EXIT(T answer) { cout<<answer<<endl; exit(0); }
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef signed long long int ll;

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

    string s; cin>>s;
    int ans=0;
    FOR(i,s.length()/2) {
        if(s[i] != s[s.length()-i-1])
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N, M int
	fmt.Scan(&N,&M)
	H := make([]int, N)
  isGood := make([]int, N)

	for i:= range H {
		fmt.Scan(&H[i])
		isGood[i] = 1
	}

	for i:=0; i<M; i++ {
		var a, b int
		fmt.Scan(&a,&b)
		if H[a-1] > H[b-1] {
			isGood[b-1] = 0
		} else if H[a-1] < H[b-1]{
			isGood[a-1] = 0
		}
		if H[a-1] == H[b-1] {
			isGood[a-1] = 0
			isGood[b-1] = 0
		}
	}

	var count int
	for i:=range isGood {
		if isGood[i]==1 {
			count++
		}
	}
	fmt.Println(count)
}

Measured memory_bytes: 6492
if __name__ == '__main__':
    n = int(input())
    l = list(map(int, input().split()))

    l = sorted(l)[::-1]
    count = 0
    ans = [(l[i], l[j], l[k]) for i in range(n-2) for j in range(i+1, n-1) for k in range(j+1, n)
           if l[i] < l[j] + l[k] and l[j] < l[i] + l[k] and l[k] < l[i] + l[j]
               and not l[i] == l[j] and not l[i] == l[k] and not l[j] == l[k]]
    print(len(ans))

Measured memory_bytes: 88652
def answer(a: int, b: int, c: int, d: int) -> int:
    return max(0, min(b, d) - max(a, c))


def main():
    a, b, c, d = map(int, input().split())
    print(answer(a, b, c, d))


if __name__ == '__main__':
    main()

Measured memory_bytes: 8968
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define printclock cerr << "Time : " << 1000 * (ld)clock() / (ld)CLOCKS_PER_SEC << "ms\n";
#define deb2(x, y) cout << #x << ": " << x << " | " << #y << ": " << y << endl
#define deb1(x) cout << #x << ": " << x << endl
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define prec(n) fixed << setprecision(n)
#define all(a) a.begin(), a.end()
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define pii pair<int, int>
#define vii vector<int>
#define ld long double
#define int long long
#define mp make_pair
#define pb push_back
#define endl "\n";
#define mod 1000000007
inline void get(vector<int> &arr, int n)
{
    int a;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        arr.push_back(a);
    }
}
inline void print(vector<int> &arr, int n)
{
    for (int i = 0; i < n; i++)
        cout << arr[i] << " ";
    cout << endl;
}
/*----------------------------------TEMPLATE------------------------------------*/
int32_t main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    fast;
    /*----------------------------PEEPEEPOOPOO-------------------------------------*/
    int t;
    t = 1;
    while (t--)
    {
        int n;
        cin >> n;
        vii v;
        get(v, n);
        vii suff(n);
        suff[n - 1] = v[n - 1];
        for (int i = n - 2; i >= 0; i--)
        {
            suff[i] = v[i] + suff[i + 1];
        }
        int ans = 0;
        rep(i, 0, n - 1)
        {
            ans = ((ans % mod) + ((v[i] % mod) * (suff[i + 1] % mod)) % mod) % mod;
        }
        cout << ans << endl;
    }
    return 0;
}
/*--------------------------------PEEPEEPOOPOO-------------------------------------*/

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

//ユークリッドの互除法
int GCD(int x, int y){
    if( x % y == 0 ){
        return y;
    }
    return GCD( y , x % y );
}

//O(A+N)解
int main(){
    using namespace std;
    int MAX_A = 1000000;
    vector<int> lowerst_prime(MAX_A + 1, 0);//最小の素因数をいれる(2以上をみていけばいい)
    vector<int> primes;//MAX_A以下の素数の集合
    vector<int> count(MAX_A + 1, 0);//約数として出てくる回数を数える
    for(int i = 2; i <= MAX_A; i++){//線形時間で処理してくれる
        if(lowerst_prime[i] == 0){
            lowerst_prime[i] = i;
            primes.push_back(i);
        }
        for(int j = 0; j < primes.size()&& primes[j] <= lowerst_prime[i]&& i * primes[j] <= MAX_A; j++){
            lowerst_prime[i * primes[j]] = primes[j];//primes[j]がi * primes[j]のもっとも小さな素因数となる
        }
    }
    //入力
    int N;
    cin >> N;
    vector<int> A(N);
    int setwise_gcd = 0;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        //setwise判定
        setwise_gcd = GCD(setwise_gcd, A[i]);//定義から、i == 0 ではA[0]を返す
    }
    if(setwise_gcd != 1){
        cout << "not coprime" << endl;
        return 0;
    }
    for(int i = 0; i < N; i++){
        while(A[i] > 1){
            int divide = lowerst_prime[A[i]];
            if(count[divide]){
                //A[x] % i == A[y] % i == 0 となるx != yが存在するので、i | gcd(x, y)となる
                cout << "setwise coprime" << endl;
                return 0;
            }
            count[divide]++;
            while(A[i] % divide == 0){//割れるだけ割る
                A[i] /= divide;
            }
        }
    }
    cout << "pairwise coprime" << endl;
}

Measured memory_bytes: 15452
#include<bits/stdc++.h>
#define endl "\n" 
#define pi acos(-1)
#define ll long long 
using namespace std;
void att(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
}
void sirra(){
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif
}
void solve();
int main(){
	att();sirra();
	int q=1;//cin>>q;
	while(q--){
		solve();
	}
}
void solve(){
	string s,k;cin>>s>>k;int f(0);
	for(int i=0;s[i];i++){
		if(s[i]!=k[i])
			f++;
	}
	cout<<f;
}

Measured memory_bytes: 3800
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    ll x3, y3, x4, y4;
    ll dx = x2 - x1;
    ll dy = y2 - y1;
    x3 = x2 - dy;
    y3 = y2 + dx;
    x4 = x1 - dy;
    y4 = y1 + dx;
    cout << x3 << " " << y3 << " " << x4 << " " << y4;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int n;
    cin >> n;
    vector<int> B(n-1, 0);
    for(int i = 0; i < n-1; i++)
        cin >> B[i];
    int ans = B[0] + B.back();
    for(int i = 1; i < n-1; i++) {
        ans += min(B[i-1], B[i]);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int a[3],k,i,j,ho;

  scanf("%d %d %d %d",&a[0] ,&a[1] ,&a[2] ,&k);

  for(i = 0; i < 2; i++){
    for(j = 0; j < 2; j++){
      if(a[j] < a[j+1]){
        ho = a[j];
        a[j] = a[j+1];
        a[j+1] = ho;
      }
    }
  }
//  printf("%d%d%d \n",a[0],a[1],a[2]);
  for(i = 0; i<k; i++){
    a[0] *=2;
  }
  printf("%d",a[0]+a[1]+a[2]);
  return 0;
}


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

int main(){
	int x ,i;
	i=1;
	
	while(1){
    cin >> x ;
	if(x==0){break;}
	
	cout<<"Case"<<" "<<i<<":"<<" "<<x<< endl ;
	i+=1;
	}
	
	return 0; 
	}

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

using namespace std;

int ctoi(char ch)
{
    return ch - '0';
}

int main()
{
  string N;
  cin >> N;
  cout << ((stoi(N) <= ctoi(N[0]) * 100 + ctoi(N[0]) * 10 + ctoi(N[0]))
    ? (ctoi(N[0]) * 100 + ctoi(N[0]) * 10 + ctoi(N[0]))
    : ((ctoi(N[0]) + 1) * 100 + (ctoi(N[0]) + 1) * 10 + ctoi(N[0]) + 1)) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
#define REP(i,n) for(int i = 0; i < n; i++)

int main(void)
{
    int min_cost = INT32_MAX;
    int A, B, C, X, Y;

    cin >> A >> B >> C >> X >> Y;

    for(int i = 0; i <= 100000; i++)
    {
        int a = 0, b = 0;

        if(i >= X) a = 0;
        else a = X - i;

        if(i >= Y) b = 0;
        else b = Y - i;

        min_cost = min(min_cost, A * a + B * b + C * 2 * i);
    }

    cout << min_cost  << endl;

    return 0;

}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if (s == "keyence") {
        cout << "YES" << endl;
        return 0;
    }
    rep (i, s.size()) {
        rep (j, s.size() - i) {
            string t = s;
            t.erase(i, j);
            if (t == "keyence") {
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
    
    return 0;
}



Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
s = input()
cnt = 0
ans = 0
for i in range(n-1):
    if s[i] == s[i+1]:
        continue
    else:
        ans += 1
print(ans+1)


Measured memory_bytes: 40812
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int a, b, c; cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,k;
cin>>n>>k;
int arr[n];
for(int i=0;i<n;i++)
    cin>>arr[i];

   int dp[n+1]={};
   dp[1]=abs(arr[1]-arr[0]);
   for(int i=2;i<n;i++)
   {dp[i]=INT_MAX;
        for(int j=i-1;j>=i-k&&j>=0;j--)
   {
       dp[i]=min(dp[j]+abs(arr[i]-arr[j]),dp[i]);
   }
   }
   cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 1792
n=int(input())
mat=[]
dp=[]

for i in range(n):
    l=list(map(int,input().split()))
    mat.append(l)
    dp.append([0]*3)

dp[0][0]=mat[0][0]
dp[0][1]=mat[0][1]
dp[0][2]=mat[0][2]

for i in range(1,n):
    dp[i][0]=max(dp[i-1][1],dp[i-1][2])+mat[i][0]
    dp[i][1]=max(dp[i-1][0],dp[i-1][2])+mat[i][1]
    dp[i][2]=max(dp[i-1][0],dp[i-1][1])+mat[i][2]

print(max(dp[n-1]))

Measured memory_bytes: 47988
package main

import "fmt"

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)
	fmt.Println(max(0, (b-a)*(n-2)+1))
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型

int main()
{
  int64_t N, Y;
  cin >> N >> Y;
  for (int i = 0; i <= N; i++)
  {
    for (int j = 0; j <= N - i; j++)
    {
      if (10000 * i + 5000 * j + 1000 * (N - i - j) == Y)
      {
        cout << i << ' ' << j << ' ' << (N - i - j) << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
}


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

int main()
{
    string s;
    long long k;
    cin >> s>>k;
    string t=s;
    int i;
    long long count = 0;
    long long count2 = 0;
    long long count3 = 0;
    for(i=1;i<t.size();i++)
    {
        if(t.at(i-1)==t.at(i))
        {
            count++;
            t.at(i)='#';
        }
    }
    if(k>=2)
    {
        t = s+s;
        for(i=1;i<t.size();i++)
        {
            if(t.at(i-1)==t.at(i))
            {
                count2++;
                t.at(i)='#';
            }
        }
    }
    if(k>=3)
    {
        t=s+s+s;
        for(i=1;i<t.size();i++)
        {
            if(t.at(i-1)==t.at(i))
            {
                count3++;
                t.at(i)='#';
            }
        }
    }
    if(k==1)cout<<count<<endl;
    else if(k==2)cout<<count2<<endl;
    else if(k==3)cout<<count3<<endl;
    else if(k%2==0)
    {
        cout<<count2+(count3-count)*(k/2-1)<<endl;
    }
    else
    {
        cout<<count+(count3-count)*((k-1)/2)<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		for(; scanner.hasNext();)
		{
			String input = scanner.next();		
			ArrayList<Integer> n = new ArrayList<>();
			
			for(int i=0; i<input.length(); i++)
			{
				n.add(Integer.parseInt(input.substring(i, i+1)));
			}
			
			
			for(; ;)
			{
				ArrayList<Integer> m = new ArrayList<>();
				for(int i=0; i<n.size()-1; i++)
				{
					m.add((n.get(i)+n.get(i+1))%10);
				}
				
				n = m;
				if(m.size() == 1)
				{
					System.out.println(m.get(0));
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 26132
#include <iostream>

int main() {
	int S;
	int h, m, s;

	std::cin >> S;
	
	h = S / 3600;
	m = S % 3600 / 60;
	s = S % 3600 % 60;

	std::cout << h << ":" << m << ":" << s << "\n";

}


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

int main(){
    int N,M,T;
    cin>>N>>M>>T;
    vector<int> V(N);
    for(int i=0;i<N;i++){
        cin>>V[i];
    }
    int ans = 0;
    ans+=V[0]-M;
    ans+=max(0,T-(V.back()+M));
    for(int i=0;i<N-1;i++){
        ans+=max(0,V[i+1]-V[i]-2*M);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3088
a, b, m = map(int, input().split())
aa = [int(x) for x in input().split()]
bb = [int(x) for x in input().split()]
ans = min(aa)+min(bb)
for i in range(m):
  x, y, c = map(int, input().split())
  key = aa[x-1]+bb[y-1]-c
  if key < ans:
    ans = key
print(ans)

Measured memory_bytes: 18488
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 3e5 + 10;
int parent[N],siz[N];
void make_set(int v) {
    parent[v] = v;
    siz[v] = 1;
}
int find_set(int v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}
void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (siz[a] < siz[b])
            swap(a, b);
        parent[b] = a;
        siz[a] += siz[b];
    }
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    for(int i = 1;i <= n;i++){
        make_set(i);
    }
    for(int i = 1;i <= m;i++){
        int x,y;
        cin >> x >> y;
        union_sets(x,y);
    }
    int ans = 0;
    for(int i = 2;i <= n;i++){
        if(find_set(i) != find_set(1)){
            union_sets(i,1);
            ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}
 

Measured memory_bytes: 4432
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+5;

int n,k;
string s;

int main(){
	cin>>s>>k;
	n=s.size();
	bool flag=1;
	for(int i=0;i<n;++i)if(s[i]!=s[0])flag=0;
	if(flag){
		cout<<1ll*k*n/2<<endl;
		return 0;
	}
	ll ans=0;
	for(int i=0,r=0;i<n;i=++r){
		while(r<n-1&&s[r+1]==s[i])r++;
		ans+=(r-i+1)/2;
	}
	ans=ans*k;
	if(s[0]==s[n-1]){
		bool f=0;
		int r=0;
		while(s[r+1]==s[0])r++;
		f|=!(r+1&1);
		int l=n-1;
		while(s[l-1]==s[n-1])l--;
		f|=!(n-l&1);
		if(!f)ans+=k-1; 
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>

using namespace std;

char a[52];
char b[52];

int main()
{
	scanf("%s",a);
	scanf("%s",b);
	int len = strlen(a);
	int lenn = strlen(b);
	for(int i = 0;i < len; i++){
		printf("%c",a[i]);
		if(i != lenn){
			printf("%c",b[i]);
		}
	}
}

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

int main(){
	int W,a,b;
  	cin >> W >> a >> b;
  	if(a>b)swap(a,b);
  	int ans = 0;
  	if(W+a<b){
    	ans = b-(W+a);
    }
  	cout << ans << endl;
}

Measured memory_bytes: 256
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


class Edge:
    def __init__(self,arg_to):
        self.to = arg_to

M = int(input())
N = int(input())

in_num = [0]*(M+1)
G = [[] for _ in range(M+1)] #隣接グラフ

for _ in range(N):
    x,y = map(int,input().split())
    in_num[y] += 1
    G[x].append(Edge(y))

Q = deque()
for i in range(1,M+1):
    if in_num[i] == 0:
        Q.append(i)

while len(Q) > 0:
    node_id = Q.popleft()
    print("%d"%(node_id))
    for edge in G[node_id]:
        in_num[edge.to] -= 1
        if in_num[edge.to] == 0:
            Q.append(edge.to)



Measured memory_bytes: 13832
p,q=map(int,input().split())
mod=10**9+7
x=(2*q-p)//3
y=q-2*x
def ie(n,r,mod):
  if r==1:
    return n%mod
  elif r%2==0:
    return (ie(n,r//2,mod)**2)%mod
  else:
    return ((ie(n,r//2,mod)**2)*n)%mod
if x+2*y!=p or 2*x+y!=q or x<0 or y<0:
  print(0)
elif x==0 or y==0:
  print(1)
else:
  a=[(x+y)%mod]
  b=[1]
  for i in range(1,min(x,y)):
    a.append(a[-1]*(x+y-i)%mod)
    b.append(b[-1]*(i+1)%mod)
  print((a[-1]*ie(b[-1],mod-2,mod))%mod)

Measured memory_bytes: 29516
def main():
  s=input()
  t=input()

  sd=list(s)
  sd.sort()
  td=list(t)
  td.sort(reverse=True)

  for (sc,tc) in zip(sd,td):
    if sc<tc:
      print("Yes")
      return
  if len(sd)<len(td) and sd[len(sd)-1]==td[len(sd)-1]:
    print("Yes")
    return
  print("No")

main()


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

int main() {
  int a[100], n, i, j, t, c;

  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }

  c = 0;
  for (i = 0; i < n; i++) {
    for (j = n - 1; j > i; j--) {
      if (a[j] < a[j - 1]) {
        t = a[j];
        a[j] = a[j - 1];
        a[j - 1] = t;

        c++;
      }
    }
  }

  for (i = 0; i < n; i++) {
    cout << a[i];
    if (i != n - 1) {
      cout << ' ';
    }
  }

  cout << endl << c << endl;

  return 0;
}

Measured memory_bytes: 1160
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
if N == 1:
    print("Hello World")
else:
    A = INT()
    B = INT()
    print(A + B)

Measured memory_bytes: 3892
NS = [int(_) for _ in input().split()]

N = NS[0]
K = NS[1]

def rep(x, K):
    return abs(x-K)

def solve(N, K):
    b = N % K
    if b != 0:
        b = rep(N%K, K)
    
    if b > N:
        b = N

    return b

print(solve(N, K))

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

class Stack {

    int top, tmp;
    int[] data;

    public Stack() {
        top = -1;
        data = new int[1000];
        tmp = 0;
    }

    public int pop() {
        tmp = data[top];
        data[top--] = 0;
        return tmp;
    }

    public void push(int a) {
        data[++top] = a;
    }
}

class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Stack s = new Stack();
        int a, b;
        try {
            String[] n;
            n = br.readLine().split(" ");
            for (int i = 0; i < n.length; i++) {
                if (n[i].equals("+")) {
                    a = s.pop();
                    b = s.pop();
                    s.push(a + b);
                } else if (n[i].equals("-")) {
                    a = s.pop();
                    b = s.pop();
                    s.push(b - a);
                } else if (n[i].equals("/")) {
                    a = s.pop();
                    b = s.pop();
                    s.push(b / a);
                } else if (n[i].equals("*")) {
                    a = s.pop();
                    b = s.pop();
                    s.push(a * b);
                } else {
                    s.push(Integer.parseInt(n[i]));
                }
            }
            System.out.println(s.pop());
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}


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

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

#define MAXN 100002
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define se second 
#define FAIL {printf("-1\n"); return 0;}

int N, W;
LL dp[MAXN];
int B[MAXN];
int ans;

int main(int argc, char **argv)
{
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif

    scanf("%d %d", &N, &W);
    for (int i = 1; i <= 1e5; i++) dp[i] = 1e18;
    B[0] = 1;
    
    for (int i = 0; i < N; i++) {
        int w,v;
        scanf("%d %d", &w, &v);

        for (int k = 1e5; k >= v; k--) {
            if (B[k-v]) {
                B[k] = 1;
                if (dp[k-v] + w <= W) {
                    dp[k] = min(dp[k], dp[k-v] + w);
                    ans = max(ans, k);
                }
            }
        }
    }

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
constexpr int mod = 1000000007;
using namespace std;

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

	long long rez = 0;
	for (; k <= n; ++k)
	{
		rez += ( (n*(n+1))/2 -  (((n - k)*(n - k + 1)) / 2) - ((k*(k - 1)) / 2) + 1) % mod;
		rez %= mod;
	}

	cout << ((rez+1)%mod) << "\n";
	
	return 0;
}

Measured memory_bytes: 3624
#include<iostream>

using namespace std;

int main()
{
    int a,b;
    cin >> a >> b;
    if(a<b)
    {
        cout << "a < b" << endl;
    }
    else if(a>b)
    {
        cout << "a > b" << endl;
    }
    else
    {
        cout << "a == b" << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
main(){
  char a[50][50];
  int w,h,f=0;
  cin>>h>>w;
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)cin>>a[i][j];
  
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      if(a[i][j]=='#' && (a[i+1][j]=='.' && a[i][j+1]=='.' && a[i-1][j]=='.' && a[i][j-1]=='.'))f=1;
       
  if(f==1)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ll n,t,T[200001];
    cin>>n>>t;
    rep(i,n) cin>>T[i];
    ll ans=0,a=0;
    rep(i,n){
        if(T[i]>=a) ans+=t,a=T[i]+t;
        else ans+=T[i]+t-a,a=T[i]+t;
    }
    cout<<ans;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;//ベルマンとかはllにしよ
#define INF 1000000000000

struct Node{
  //ノードの情報
  vector<pair<ll,ll>> edge;//各エッジの接続先のノード番号とコスト
  //ベルマンフォード法用のデータ
  ll mincost=INF;//そのノードへの最小コスト
};

//関係ないループを外す
bool bellmanford(vector<Node>& nodes,ll l1){
  bool f=false;
  for(ll i=0;i<l1;i++){
    f=false;
    for(ll j=0;j<l1;j++){
      Node x=nodes[j];
      if(x.mincost!=INF){
        ll l2=x.edge.size();
        for(ll k=0;k<l2;k++){
          ll a=x.mincost+x.edge[k].second;
          if(nodes[x.edge[k].first].mincost>a){
            nodes[x.edge[k].first].mincost=a;
            if(x.edge[k].first==l1-1)f=true;
          }
        }
      }
    }
  }
  return f;//負の閉路があればtrue
}

int main(){
  ll n,m;cin >> n >> m;
  vector<Node> Nodes(n);
  //mincost0の更新だけしっかりやる
  Nodes[0].mincost=0;//cout << 0;

  for(ll i=0;i<m;i++){
    ll a,b,c;cin >> a >> b >> c;
    Nodes[a-1].edge.push_back(make_pair(b-1,-c));
  }
  //Nodesを更新
  if(bellmanford(Nodes,n)){
    cout << "inf" << endl;
  }else{
    cout << -Nodes[n-1].mincost << endl;
  }

}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-
import sys
import math

N = int(input())

prime = {}
p = 2
while N>=p**2:
  count = 0
  while N%p==0:
    count += 1
    N = N//p
  if count>0:
    prime[p] = count
  p += 1

if N>1:
  prime[N] = 1

answer = 0
for p,v in prime.items():
  minus = 1
  while v>=minus:
    answer += 1
    v -= minus
    minus += 1

print(answer)

Measured memory_bytes: 9200
#include<iostream>
//#include<algorithm>
using namespace std;

long long  a,b,c;
int main(){
    while(cin>>a>>b>>c)
    {
        for(long long  i=a;i<=b;i++)
        {
            if(i<a+c||i>b-c)
                cout<<i<<endl;

        }
    }
   }


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

int n,lvl=1,lvlm=1,l[100005];
unsigned long long d[100005][2];
vector<vector<int> > v;
bool p[100005];
void dfs(int j) {
	if (p[j]) {
		return ;
	}
	l[j]=lvl;
	if (lvl>lvlm) {
		lvlm=lvl;
	}
	lvl++;
	p[j]=true;
	for (int i=0;i<v[j-1].size();i++) {
		dfs(v[j-1][i]);
	}
	lvl--;
}
void cnt(int j) {
	if (l[j]==lvlm) {
		d[j][0]=1;
		d[j][1]=1;
		return ;
	} else {
		d[j][0]=1;
		d[j][1]=1;
		for (int i=0;i<v[j-1].size();i++) {
			if (l[j]<l[v[j-1][i]]) {
				cnt(v[j-1][i]);
				d[j][1]*=d[v[j-1][i]][0];
				d[j][1]=d[j][1]%1000000007;
				d[j][0]*=((d[v[j-1][i]][0]+d[v[j-1][i]][1])%1000000007);
				d[j][0]=d[j][0]%1000000007;
			}
		}
	}
}
int main() {
	cin>>n;
	for (int i=1;i<=n;i++) {
		vector<int> vi;
		v.push_back(vi);
		p[i]=false;
	}
	for (int i=1;i<n;i++) {
		int a,b;
		cin>>a>>b;
		v[a-1].push_back(b);
		v[b-1].push_back(a);
	}
	dfs(1);
	cnt(1);
	cout<<(d[1][0]+d[1][1])%1000000007;
	return 0;
}

Measured memory_bytes: 11888
using System;
using System.Collections.Generic;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            long n = long.Parse(In[0]);
            long k = long.Parse(In[1]);
            long bef = n % k;
            long af = k - bef;
            if (bef < af) Console.WriteLine(bef);
            else Console.WriteLine(af);
        }
    }
}


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


int main(){

    ll N, A, B;
    cin >> N >> A >> B;
    ll mn = A * (N - 1) + B;
    ll mx = A + (N - 1) * B;
    cout << max(0LL, mx - mn + 1) << endl;

    return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	while (cin >> n&&n) {
		char henkan[100000] = {};
		char henkango[100000] = {};
		for (int i = 0; i < n; i++) {
			cin >> henkan[i] >> henkango[i];
		}
		int m;
		cin >> m;
		char data[100000] = {};
		for (int i = 0; i < m; i++) {
			cin >> data[i];
			for (int j = 0; j < n; j++) {
				if (data[i] == henkan[j]) {
					data[i] = henkango[j];
					break;
				}
			}
		}
		cout << data << endl;
	}

    return 0;
}

Measured memory_bytes: 3304
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
d=Counter(a)
import math
def cmb(n,r):
    f = math.factorial
    return int(f(n) // f(r) // f(n-r))
def combination(n, r):
    a = 1
    b = 1
    for i in range(r):
        a *= (n - i)
        b *= (i + 1)
    return a // b
e={}
dd=0
for i,j in d.items():
    dd+=combination(j, 2)
    e[i]=combination(j-1, 1)

for i in a:
    print(dd-e[i])
  


Measured memory_bytes: 32928