akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );

	while ( stdin.hasNextInt() ) {

	    final int p = stdin.nextInt();
	    final int q = stdin.nextInt();

	    int[] quotients = new int[80];
	    int[] rest = new int[80];
	    int mod = ( p % q ) * 10;
	    int index = -1;
	    int repFirst = -1;
	    boolean finish = false;

	    while ( !finish ) {
		index++;
		rest[index] = mod;
		quotients[index] = mod / q;
		mod %= q;
		mod *= 10;
		for ( int i = 0; i < index; i++ ) {
		    if ( rest[i] == rest[index] ) {
			repFirst = i;
			finish = true;
			break;
		    }
		}
		if ( mod == 0 ) {
		    finish = true;
		}
	    }

	    if ( mod > 0 ) {
		for ( int i = 0; i < index; i++ ) {
		    System.out.print( quotients[i] );
		}
		System.out.println();
		for ( int i = 0; i < repFirst; i++ ) {
		    System.out.print( " " );
		}		
		for ( int i = repFirst; i < index; i++ ) {
		    System.out.print( "^" );
		}
		System.out.println();
	    } else {
		for ( int i = 0; i <= index; i++ ) {
		    System.out.print( quotients[i] );
		}
		System.out.println();
	    }
	}	
    }    
}

Measured memory_bytes: 25756
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
int S[13];
int dp[2][1<<13][7];

bool f(int x, int b, int c) {
  if (dp[x][b][c] != -1) return dp[x][b][c];
  bool none = true;
  rep(i, 13) {
    if ((1<<i) & b) continue;
    if (((1<<(i+1))&b)==0 && (i==0 || ((1<<(i-1))&b)==0)) continue;
    if (S[i] != x) continue;
    if (x==0 && c+1 == 6) return dp[x][b][c] = true;
    if (x==1 && __builtin_popcount(b|(1<<i))-1-c == 6) return dp[x][b][c] = true;

    if (!f(x^1, b|(1<<i), c+(x==0))) return dp[x][b][c] = true;
    none = false;
  }
  if (none) {
    if (!f(x^1, b, c)) return dp[x][b][c] = true;
  }
  return dp[x][b][c] = false;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  rep(_, N) {
    rep(i, 13) S[i] = 1;
    rep(i, 6) {
      int x; cin >> x; x--;
      S[x] = 0;
    }
    S[6] = 2;
    rep(a, 2) rep(b, 1<<13) rep(c, 7) dp[a][b][c] = -1;
    if (f(0, 1<<6, 0)) cout << "yes\n";
    else cout << "no\n";
  }
  return 0;
}

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

using namespace std;

#define debug(x) cout << #x << "==" << x << endl;

const int inf = 100000000;

typedef long long ll;


int main() {
  ios::sync_with_stdio(false);

  int N;
  cin >> N;

  vector<ll> a(N);
  vector<ll> b(N);
  for(int i = 0; i < N; i++) { 
    cin >> a[i]; 
    cin >> b[i]; 
  }

  ll sum = 0;

  for(int i = N - 1; i >= 0; i--) {

    ll cur_a = a[i] + sum;
   
    if( b[i] == 1 || a[i] == 0 || cur_a % b[i]  == 0) {
      continue;
    } else {
      ll new_a;
      new_a = (( cur_a / b[i] ) + 1) * b[i];
      sum += new_a - (a[i] + sum);
    }
  }

  cout << sum << "\n";

   return 0;
}


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

typedef long long ll;
using namespace std;

const double PI = 3.14159265358979;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    double a, b, x;
    cin >> a >> b >> x;
    double l, r;
    double diff = PI * pow(10, -10) / (double)180;
    double ans;
    if (a * b * 0.5 < x/a) {
        l = 0;
        r = asin(b / pow(a*a + b*b, 0.5));
        while (r - l > diff) {
            double mid = (l + r)/2;
            if (a * b * a - 0.5 * a * a * tan(mid) * a < x) {
                r = mid;
            } else {
                l = mid;
            }
        }
        ans = l / PI * (double)180;
    } else {
        l = 0;
        r = asin(a / pow(a*a + b*b, 0.5));
        while (r - l > diff) {
            double mid = (l + r)/2;
            if (0.5 * b * b * tan(mid) * a < x) {
                l = mid;
            } else {
                r = mid;
            }
        }
        ans = 90 - (l / PI * (double)180);
    }
    cout << setprecision(8) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  string s;
  cin>>s;
  if(s[0] == s[2]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int N, M, input, sum = 0;
  	cin >> N >> M;
  	for(int i = 0; i < M; i++)
    {
      cin >> input;
      sum += input;
	}
  	if(sum > N)	cout << "-1\n";
  	else cout << N - sum << '\n';
	return 0;
} 	


Measured memory_bytes: 3644
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;

// code
// ------------------------------------------------
int main() {

  ll n;
  cin >> n;
  vector<ll> s(n);
  rep(i,n) cin >> s[i];

  vsort(s);

  ll ans = 0;
  rep(i,n) ans+=s[i];

  if(ans%10==0)
  {
    bool flg = false;
    rep(i,n)
    {
      if((ans - s[i])%10!=0)
      {
        flg = true;
        ans -=s[i];
        break;
      }
    }
    if(!flg) ans = 0;
  }

  cout << ans << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
using System;

public class Class1
{
	public static void Main()
	{
		int  games =int.Parse( Console.ReadLine());
		int taro=0;
		int hanako=0;
		
			for (int i = 0; i < games; i++) 
			{
				string animals=Console.ReadLine();
				string[] name=animals.Split();
				int vs=String.Compare(name[0],name[1],StringComparison
				                      .OrdinalIgnoreCase);
				if(vs==0)
				{
					taro++;
					hanako++;
				}
				else if(vs<0)
				{
					hanako+=3;
				}
				else if(vs>0)
				{
					taro+=3;
				}
			}
			Console.WriteLine(taro+" "+hanako);
				
	}
		
}

Measured memory_bytes: 9248
from sys import stdin


def out_ctrl(s):
    print(s)

def main(N_tolist):
    for n in N_tolist:
        if n == '7':
            return 'Yes'
    else:
        return 'No'


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = _in[0] # type:str
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    N_tolist = list(N)
    TF = main(N_tolist)
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)


Measured memory_bytes: 61960
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
int N, K, x, sum;
cin >> N >> K;
sum = 0;
  rep(i, N){
    cin >> x;
    if(x - 0 > K - x){
      sum += 2 * (K - x);
    }  
    else{
      sum += 2 * x;
    }
  }
cout << sum << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int arr[6666];
map<int,int> vis;
signed main(){
	for(int i=0;i<=60;i++) arr[i]=-1;
	int n,m;
	cin>>n>>m;
	int f=1;
	for(int i=1;i<=m;i++){
		int x,y;
		cin>>x>>y;
		if((arr[x]!=-1&&arr[x]!=y)){
			f=0;
		}
		vis[y]=1;
		arr[x]=y;
	}
	if(!f) {
		printf("-1");return 0;
	}
	if(arr[1]==0){
		if(n==1) {
			cout<<"0";
		}else{
			cout<<"-1";
		}
		return 0;
	}
	if(arr[1]==-1&&n>1) {
		arr[1]=1;vis[1]=1;
	}
	for(int i=1;i<=n;i++){
		if(arr[i]!=-1) cout<<arr[i];
		else{
			cout<<"0";
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if("s".equals(s.subSequence(s.length() - 1, s.length()))) {
            System.out.println(s + "es");
        } else {
            System.out.println(s + "s");
        }
    }
}

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

int main() {
  int i;
  cin >> i;
  
  int a = i / 1000;
  int tmp = i % 1000;
  int b = tmp / 100;
  tmp = tmp % 100;
  int c = tmp / 10;
  int d = tmp % 10;
  
  if((a == b && b == c) || (b == c && c == d) ){
    cout << "Yes" << endl;  
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;


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

        char c = s.charAt(0);
        int minRange = s.length();
        for(int i = 1; i < s.length(); i++){
            char currentC = s.charAt(i);
            if(c != currentC){
                int range = (i >= s.length() - i) ? i : s.length()-i;
                if(range < minRange){
                    minRange = range;
                }
                c = currentC;
            }
        }
        System.out.println(minRange);
    }
}


Measured memory_bytes: 26068
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

int keta(long long n) {
    int cnt = 0;
    while (n > 0) {
        cnt++;
        n /= 10;
    }
    return cnt;
}
int main() {
    long long n;
    cin >> n;

    int minx = 100000;
    for (long long i = 1; i*i <= n; i++) {
        if (n%i != 0)
            continue;
        long long a = i, b = n / i;
        minx = min(minx, keta(b));
    }
    cout << minx << endl;
    return 0;
}

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

using namespace std;
                                 
int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.setf(ios::fixed); cout.precision(17);
	long long n;
	cin >> n;
	long long m = n;
	for(long long i = 1ll; i * i <= n; i++){
		if(n % i == 0){
			m = min(m, n/i);
		}	
	}	
	cout << (int)floor(log10(m)) + 1 << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

int main(){
	int K;
	string s,tmp2="",tmp="",max_str;
	int size=0,cnt=0;
	vector<string> list;
	cin>>s;
	cin>>K;
	
	for(int i=0;i<s.size();i++){
		for(int j=1;j<=5;j++){
			tmp=s.substr(i,j);

			list.push_back(tmp);
		}
	}

	sort(list.begin(),list.end());

	for(int i=0;i<list.size();i++){
		if(list[i]==""){
			continue;
		}
		if(tmp2!=list[i]){
			cnt++;
			if(cnt==K){
				cout<<list[i]<<endl;
				break;
			}
		}
		tmp2=list[i];
	}
	return 0;
}

Measured memory_bytes: 1660
n = int(input())
arr = list(map(int,input().split()))

arr.sort()

pep = [0 for i in range(24)]
pep[0] = 1

lr =True
for a in arr:
    if a== 0:
        pep[0] += 1
    else:
        if pep[a] > 1:
            pep[24-a] += 1
        elif pep[24-a] > 1:
            pep[a] += 1
        else:
            if lr:
                pep[a] += 1
                lr = not lr
            else:
                pep[24-a] += 1
                lr = not lr

ans = 1e9
for i in range(24):
    if pep[i] > 1:
        ans = 0
        break
    for j in range(i+1,24):
        if pep[i] > 0 and pep[j] > 0:
            d = min(j-i,24-(j-i))
            if ans > d:
                ans = d
# print(pep)
print(ans)

Measured memory_bytes: 38436
#include <iostream>
#include <math.h>
using namespace std;

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

    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <limits>

using namespace std;

template<class T = int,T divided_by = 10>
constexpr T PINF(){ return std::numeric_limits<T>::max()/divided_by; }
template<class T = int,T divided_by = 10>
constexpr T MINF(){ return std::numeric_limits<T>::lowest()/divided_by; }

template<class T = int> T gcd(T a, T b){ return b ? gcd(b,a%b) : a; }
template<class T = int> T lcm(T a, T b){ return a / gcd(a,b) * b; }
template<class T = int> T lcm_safe(T a, T b){ T p = a/gcd(a,b); return (b <= PINF<T>()/p) ? p*b:PINF<T>(); }
//オーバーフローするとき+INFを返す
//
int main() {
	cin.tie(nullptr); ios::sync_with_stdio(false);

	long long n, m;

	cin >> n >> m;

	long long ans = min(n,m/2);

	n -= ans;
	m -= ans*2;

	ans += m/4;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
  int N;
  cin >> N;
  map<int,int> mp;
  for(int i = 0;i < N;i++){
    int a;
    cin >> a;
    a--;
    mp[a] = i + 1;
  }

  for(auto itr:mp){
    cout << itr.second << endl;
  }
}


Measured memory_bytes: 5504
h,w=map(int,input().split())
s=[list(input()) for a in range(h)]
check=[[-1,0],[0,-1],[1,0],[0,1]]
for i in range(h):
    for j in range(w):
        cnt=0
        if s[i][j]=="#":
           if i>=1:
                if s[i+check[0][0]][j+check[0][1]]=="#":
                    cnt+=1
           if j>=1:
                if s[i+check[1][0]][j+check[1][1]]=="#":
                    cnt+=1
           if i <= h-2:
               if s[i + check[2][0]][j + check[2][1]]=="#":
                    cnt+=1
           if j <= w - 2:
               if s[i + check[3][0]][j + check[3][1]]=="#":
                   cnt+=1
           if cnt == 0:
               print("No")
               exit()

print("Yes")



Measured memory_bytes: 39664
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int i[] = new int[]{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
		int K = sc.nextInt();
		System.out.println(i[K-1]);
	}
}

Measured memory_bytes: 23764
a, b, c, d, e, f = map(int,input().split())
wa = []
for ia in range(30):
    for ib in range(30):
        if 100*(ia*a+ib*b) <= f and not 100*(ia*a+ib*b) in wa:
            wa.append(ia*a+ib*b)

msu = [0 for i in range(len(wa))]
mc = -0.01
mci = -1
for i,w in enumerate(wa):
    for ic in range(1501):
        for id in range(1501):
            if ic*c+id*d > e*w:
                break
            if ic*c+id*d+w*100 > f:
                break
            if msu[i] < ic*c+id*d:
                msu[i] = ic*c+id*d
                if mc < (ic*c+id*d)/(ic*c+id*d+w*100):
                    mc = (ic*c+id*d)/(ic*c+id*d+w*100)
                    mci = i

print(wa[mci]*100+msu[mci],msu[mci])


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

string a,b; int temp;

int main(){
	cin >> a >> b;
		for(int i = 0; i<a.length(); i++){
			if(a[i] != b[i]){
				temp = temp + 1;
			}
		}
		cout << temp << endl;
	return 0;
}


Measured memory_bytes: 3880
#include<bits/stdc++.h>
using namespace std;
 
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define fi first
#define se second
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define pow10(n) stoll("1"+string(n,'0'))
//fill(all(arr),1)
//if(map.count(key)){}
//bitset<20>(n);
//int mini=min({a,b,c,d,e});
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int p[200];
int main(){
	int m,n1,n2;
	while(true){
	cin>>m>>n1>>n2;
	if(m==0&&n1==0&&n2==0)break;
	for(int i=0;i<m;i++){
		cin>>p[i];
	}
	int set,best=0;
	for(int i=n1;i<=n2;i++){
		if(best<=p[i-1]-p[i]){
			set=i;
			best=p[i-1]-p[i];
		}
	}
	cout<<set<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
/**********************************************************/
/**            Bismillahir-rahmanir-rahim                **/
/**  In the name of Allah, the Beneficent, the Merciful. **/
/**********************************************************/
/****@author: Sayed Sohan, CSE 13th batch(2016), MBSTU*****/
/**********************************************************/

#include <bits/stdc++.h>
using namespace std;
//              Typedefs
typedef long long               ll;
typedef unsigned long long      ull;

//              Templates
template<class T>               using min_heap = \
                                priority_queue<T, \
                                std::vector<T>, std::greater<T>>;

//              Basic-Defs
#define PB                      push_back
#define MP                      make_pair
#define SP                      " "
#define NL                      "\n"
#define all(v)                  v.begin(), v.end()

//              DEBUG--SECTION
#define DE                      cout<<"HERE\n";
#define DE1(x)                  cout<<x<<"###\n";
#define DE2(x,y)                cout<<x<<"--->"<<y<<"\n";
#define Pause                   system("pause");

//              Functions
#define clr(arr,value)          memset(arr,value,sizeof(arr))
#define __FAST_IO               ios_base::sync_with_stdio(0);\
                                cin.tie(0);cout.tie(0);
#define NUM1(x)                 __builtin_popcount(x)
#define LCM(x,y)                (x*y)/__gcd(x,y)

//              Sizes--Math     0123456789
#define MOD                     1000000007   //1e9+7 
#define MAX                     100050      
#define INF                     1e18
#define PI                      acos(-1)
#define eps                     1e-6

//** your code goes from here

class Solve
{
public:
    void solve(){
        ll i,j,k,n,m,T; //basic variables
        ll l,r,d;
        cin>>l>>r>>d;
        ll ans = 0;
        for(i=l;i<=r;i++){
            if(i%d==0) ans++;
        }
        cout<<ans<<NL;

    }
};

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    __FAST_IO;
    Solve A;
    ll T=1;
    // cin>>T;

    while(T--){
        A.solve();
    } 
    


    /// Don't forget to set array size....
    return 0;
}




Measured memory_bytes: 3648
#include <iostream>
#include <cmath>
#include <stdint.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
using namespace std;
 
#define int long long
#define INF (1e18)+1
 
int nChoosek( int n, int k )
{
    if (k > n) return 0;
    if (k * 2 > n) k = n-k;
    if (k == 0) return 1;

    int result = n;
    for( int i = 2; i <= k; ++i ) {
        result *= (n-i+1);
        result /= i; 
    }
    return result;
}

int choose2(int n){
	
	return n*(n-1)/2;
}
 
 int countDigit(int  n) 
{ 
    int k = 0; 
    while (n != 0) { 
        k = n%10; 
        n = n / 10; 
    } 
    return k; 
} 

int a[8];
int tmp[8];

int perm(int n){
	
 	for(int i=0; i<n; i++){
 		
 		a[i] = i+1;
	 }
	int cnt = 0;
	do { 
		bool flag = true;
       	for(int i=0; i<n; i++){
       		
       		if(a[i] != tmp[i]){
       			flag = false;
			}
       		
		}
		cnt++;
		if(flag){
			return cnt;
		}
        
    } while (next_permutation(a, a + n)); 
	
	
	
}

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

 	for(int i=0; i<N; i++){		
	 	cin >> tmp[i];
	}
	int a = perm(N);
 	for(int i=0; i<N; i++){		
	 	cin >> tmp[i];
	}
 	int b = perm(N);
 	
 	cout << abs(a-b) << endl;
}








Measured memory_bytes: 3180
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n, W;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> W;

  vector<PLL> vw(n);

  REP(i, n) {
    ll v, w;
    cin >> w >> v;
    vw[i] = P(v, w);
  }

  ll d = vw[0].second;
  sort(vw.begin(), vw.end(), greater<PLL>());

  vector<vector<ll>> v_sum(4, vector<ll>());
  vector<vector<ll>> w_sum(4, vector<ll>());

  REP(i, 4) v_sum[i].push_back(0), w_sum[i].push_back(0);
  REP(i, n) {
    PLL p = vw[i];
    int  dd = p.second - d;
    v_sum[dd].push_back(v_sum[dd][v_sum[dd].size() - 1] + p.first);
    w_sum[dd].push_back(w_sum[dd][w_sum[dd].size() - 1] + p.second);
  }

  ll ans = 0;
  REP(i, v_sum[0].size()) REP(j, v_sum[1].size()) REP(k, v_sum[2].size()) REP(l, v_sum[3].size()) {
    ll wa_sum = w_sum[0][i] + w_sum[1][j] + w_sum[2][k] + w_sum[3][l];
    ll va_sum = v_sum[0][i] + v_sum[1][j] + v_sum[2][k] + v_sum[3][l];
    if(wa_sum <= W) ans = max(ans, va_sum);
  }

  cout << ans << endl;
}


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

using ll=long long;

int main() {
  string S; cin >>S;
  rep(i,0,3) {
    cout <<S[i];
  }
  cout <<endl;
  return 0;
}


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

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

	long long a, b;
	cin >> a >> b;
	b = 2 * b + 1;
	long long ans = a / b;
	if (a%b != 0) ans++;
	cout << ans << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		if (n == 0) {
			System.out.println(0);
			return;
		}
		char[] nums = new char[n];
		for (int i = 0; i < n; i++) nums[i] = '0';
		int m = scan.nextInt();
		
		for (int i = 0; i < m; i++) {
			int pos = scan.nextInt()-1;
			int num = scan.nextInt();
			if ((nums[pos] != '0' && (char) (num + '0') != nums[pos]) || (pos == 0 && num == 0) && n != 1) {
				System.out.println(-1);
				return;
			}
			nums[pos] = (char) ('0' + num);
		}
		
		if (n == 1) {
			System.out.println(String.valueOf(nums));
			return;
		}
		
		
		if (nums[0] == '0') nums[0] = (char) ('0' + 1);
		
		System.out.println(String.valueOf(nums));
		
	}

}

Measured memory_bytes: 23508
h,w = map(int,input().split())
l = []

for i in range(h):
    l.append(list(list(input())))
for i in range(h):
    for j in range(w):
        if(l[i][j] == "#"):
            if (i != 0):
                if(l[i-1][j] == "#"):continue
            if (j != 0):
                if (l[i][j-1] == "#"): continue
            if (i != h-1):
                if (l[i+1][j] == "#"): continue
            if (j != w-1):
                if (l[i][j+1] == "#"): continue
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long a = scan.nextLong() - 1;
        long b = scan.nextLong();
        String A = Long.toBinaryString(a);
        String B = Long.toBinaryString(b);
        long range = b - a + 1;
        int A_len = A.length();
        int B_len = B.length();
        if (A_len < B_len) {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < B_len - A_len; i++) {
                sb.append("0");
            }
            sb.append(A);
            A = sb.toString();
        }
        long[] a_bit = new long[B_len];
        long[] b_bit = new long[B_len];
        StringBuilder sb = new StringBuilder();
        long x = 1;
        for (int i = 0; i < B_len; i++) {
            if (a < 0) {
                break;
            }
            x *= 2;
            a_bit[i] = Math.floorDiv(a,  x) * x / 2 + Math.min(x / 2, a % x);
            a -= x / 2;
        }
        x = 1;
        for (int i = 0; i < B_len; i++) {
            if (b < 0) {
                break;
            }
            x *= 2;
            b_bit[i] = Math.floorDiv(b,  x) * x / 2 + Math.min(x / 2, b % x);
            b -= x / 2;
        }
        for (int i = B_len - 1; 0 <= i; i--) {
            if ((b_bit[i] - a_bit[i]) % 2 == 1) {
                sb.append("1");
                continue;
            }
            sb.append("0");
        }
        String answer = sb.toString();
        System.out.println(Long.parseLong(answer, 2));
    }
}


Measured memory_bytes: 21972
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template<u32 M = 1000000007>
struct modint{
    u32 val;
    modint(): val(0){}
    template<typename T>
    modint(T t){t %= (T)M; if(t < 0) t += (T)M; val = t;}

    modint pow(ll k) const {
        modint res(1), x(val);
        while(k){
            if(k&1) res *= x;
            x *= x;
            k >>= 1;
        }
        return res;
    }
    template<typename T>
    modint& operator=(T t){t %= (T)M; if(t < 0) t += (T)M; val = t; return *this;}
    modint inv() const {return pow(M-2);}
    modint& operator+=(modint a){val += a.val; if(val >= M) val -= M; return *this;}
    modint& operator-=(modint a){if(val < a.val) val += M-a.val; else val -= a.val; return *this;}
    modint& operator*=(modint a){val = (u64)val*a.val%M; return *this;}
    modint& operator/=(modint a){return (*this) *= a.inv();}
    modint operator+(modint a) const {return modint(val) +=a;}
    modint operator-(modint a) const {return modint(val) -=a;}
    modint operator*(modint a) const {return modint(val) *=a;}
    modint operator/(modint a) const {return modint(val) /=a;}
    modint operator-(){return modint(M-val);}
    bool operator==(const modint a) const {return val == a.val;}
    bool operator!=(const modint a) const {return val != a.val;}
    bool operator<(const modint a) const {return val < a.val;}
};
using mint = modint<MOD>;

class Factorial {
    using mint = modint<MOD>;
    vector<mint> facts, factinv;

public:
    explicit Factorial(int n) : facts(static_cast<u32>(n+1)), factinv(static_cast<u32>(n+1)) {
        facts[0] = 1;
        for (int i = 1; i < n+1; ++i) facts[i] = facts[i-1]*mint(i);
        factinv[n] = facts[n].inv();
        for (int i = n-1; i >= 0; --i) factinv[i] = factinv[i+1] * mint(i+1);
    }

    mint fact(int k) const {
        if(k >= 0) return facts[k]; else return factinv[-k];
    }

    mint operator[](const int &k) const {
        if(k >= 0) return facts[k]; else return factinv[-k];
    }

    mint C(int p, int q) const {
        if(q < 0 || p < q) return 0;
        return facts[p] * factinv[q] * factinv[p-q];
    }

    mint P(int p, int q) const {
        if(q < 0 || p < q) return 0;
        return facts[p] * factinv[p-q];
    }

    mint H(int p, int q) const {
        if(p < 0 || q < 0) return 0;
        return q == 0 ? 1 : C(p+q-1, q);
    }
};


using mint = modint<MOD>;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    sort(v.begin(),v.end());
    mint ans = 0;
    Factorial f(n);
    for (int i = k-1; i < n; ++i) {
        ans += mint(v[i])*f.C(i, k-1);
    }
    reverse(v.begin(),v.end());
    for (int i = k-1; i < n; ++i) {
        ans -= mint(v[i])*f.C(i, k-1);
    }
    cout << ans.val << "\n";
    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define scan2() int n,k; cin>>n>>k ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005



int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        string s;
        cin >> s;
        if(s=="ABC"){
            cout << "ARC";
        }
        else{
            cout << "ABC";
        }
        

}


Measured memory_bytes: 3568
import itertools


downer, upper = map(int, input().split(' '))

r_d = (downer // 2019) * 2019
u_d = (upper // 2019) * 2019

rng = range(downer, upper+1)

if r_d in rng or u_d in rng:
    print(0)
    exit(0)

numbers = set([min(i, abs(2019-i)) for i in rng])

c = itertools.combinations(numbers, 2)
s = [(i1 * i2) % 2019 for i1, i2 in c]
print(min(s))


Measured memory_bytes: 75568
H, W = map(int, input().split())
s = ["."*(W+2)]
for i in range(H):
    temp = "."
    temp += input()
    temp += "."
    s.append(temp)
s.append("."*(W+2))
flag = True
for i in range(1, H+1):
    for j in range(1, W+1):
        if s[i][j] == "#" and s[i-1][j] == "." and s[i+1][j] == "." and s[i][j-1] == "." and s[i][j+1] == ".":
            flag = False
            break
    if not flag:
        break
if flag:
    result = "Yes"
else:
    result = "No"
print(result)

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

typedef long long ll;
using namespace std;

ll MOD = 1000000007;
ll power(ll a, ll pow) {
    if(pow == 0) {return 1;}
    auto foo = power(a,pow/2);
    if(pow%2==0) return (foo*foo)%MOD;
    return (((foo*foo)%MOD)*a)%MOD;
}
ll inv(ll a) { return power(a, MOD-2);}

int main() {
    ll ans = 0;
    int N; cin >> N;

    ll N_contrib = 0;
    for(int i = 1; i < N; i++) {N_contrib += inv(i); N_contrib %= MOD;}

    vector<ll> weights(N+1);
    for(int i = 0; i <= N; i++) { weights[i] = inv(i+1)*inv(i+2); weights[i] %= MOD;}
    vector<ll> weightscs(N+1);
    weightscs[0] = weights[0];
    for(int i = 1; i <= N; i++) {weightscs[i] = weights[i] + weightscs[i-1]; weightscs[i] %= MOD;}

    vector<ll> X(N+1);
    for(int i = 1; i <= N; i++) {cin >> X[i];}
    ans += N_contrib*X[N];
    for(int i = 2; i < N; i++) {
        ans += X[i]*weightscs[i-2]; ans %= MOD;
    }

    for(int i = 1; i < N; i++) { ans -= X[i]; ans += MOD; ans %= MOD;}
    for(int i = 1; i <= N-1; i++) { ans *= i; ans %= MOD;}

    cout << ans << endl;



}

Measured memory_bytes: 2560
#include<iostream>
#include<ctype.h>
#include<map>
#include<string>
 
using namespace std;
 
map<string, bool> m;

typedef unsigned long long int ulli;
 
ulli calc(string s) {
	ulli res = 0;
	string t;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != '+') {
			t.push_back(s[i]);
		} else {
			res += stoll(t);
			t.clear();
		}
	}
	if(t.size() != 0)
	res += stoll(t);
	//cout << s << " " << res << endl;
	return res;
}
 
//n = 今の+の数
ulli solve(string s,int n = 0) {
	if (m[s]) return 0;
	m[s] = true;
 
    //cout << s << endl;
 
	if (n == s.size() - 1) {
		return calc(s);
	}
 
	ulli res = calc(s);
	
	for (int i = 1; i < s.size(); i++) {
		string tmp = s;
		if (s[i-1] != '+' && s[i] != '+' && s[i+1] != '+') {
			tmp.insert(tmp.begin() + i, '+');
			res += solve(tmp, n + 1);
		}
	}
	return res;
}
 
int main() {
	string s;
	cin >> s;
	cout << solve(s) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>


int main(){
    int N=0;
    int W[101];
    scanf("%d",&N);
    int i;

    int sum=0;
    for(i=1;i<N+1;i++){
        scanf("%d",&W[i]);
        sum+=W[i];
    }

    int min=100000;
    int S1=0;
   int sa=100000;
    int point=1;
    for(i=1;i<N+1;i++){
        S1+=W[i];
        sa=sum-S1-S1;
        if(sa<0){sa=-sa;}
    if(sa<min){
            min=sa;
        }    
    }
    printf("%d\n",min);

    return 0;
}

Measured memory_bytes: 128
package main

import "fmt"

func main() {
	var h, w int
	fmt.Scanf("%d %d", &h, &w)

	if 1 == h || 1 == w {
		fmt.Print(1)
		return
	}

	t := h * w
	if t%2 == 0 {
		fmt.Print(t / 2)
	} else {
		fmt.Print(t/2 + 1)
	}
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N, M;
    cin >> N >> M;
    string S;
    cin >> S;

    vector<ll> G[N];
    REP(i, M){
    	ll x, y;
    	cin >> x >> y;
    	x--, y--;
    	G[x].push_back(y);
    	G[y].push_back(x);
    }

    vector<ll> cntA(N,0), cntB(N, 0);
    REP(i, N){
    	for(auto x: G[i]){
    		if(S[x]=='A') cntA[i]++;
    		else cntB[i]++;
    	}
    }

    vector<bool> good(N, true);
    queue<ll> qu;
    REP(i, N){
    	if(cntA[i]==0||cntB[i]==0){
    		qu.push(i);
    		good[i] = false;
    	}
    }
    while(!qu.empty()){
    	ll v = qu.front();
    	qu.pop();
    	for(auto u: G[v]){
    		if(good[u]){
    			if(S[v]=='A') cntA[u]--;
    			else cntB[u]--;

    			if(cntA[u]==0||cntB[u]==0){
    				good[u] = false;
    				qu.push(u);
    			}
    		}
    	}
    }

    bool ok = false;
    REP(i, N){
    	if(good[i]){
    		ok = true;
    		//dump(i)
    	}
    }

    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 15568
package main

import (
	"fmt"
)

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func chmin(a *int, b int) {
	if *a > b {
		*a = b
	}
}

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	x := make([]int, n)
	for i := range x {
		fmt.Scan(&x[i])
	}

	d := make([]int, n)
	for i := range d {
		d[i] = abs(x[i] - x[0])
	}

	min := abs(x[0]) + d[k-1] - d[0]
	for i := 0; i+k-1 < n; i++ {
		chmin(&min, abs(x[i])+d[i+k-1]-d[i])
		chmin(&min, abs(x[i+k-1])+d[i+k-1]-d[i])
	}
	fmt.Println(min)
}


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

int main(){
  int x, y;
  int a=0; int b=0;
  cin >> x;
  if(x==2) a=1;
  if(x==4 or x==6 or x==9 or x==11) a=2;
  if(x==1 or x==3 or x==5 or x==7 or x==8 or x==10 or x==12) a=3;
  cin >> y;
  if(y==2) b=1;
  if(y==4 or y==6 or y==9 or y==11) b=2;
  if(y==1 or y==3 or y==5 or y==7 or y==8 or y==10 or y==12) b=3;
  if(a==b) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
}

class Solver {
	int N;
	int M;
	int cnt;
	int[] way;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		N = Integer.parseInt(strArr[0]);
		M = Integer.parseInt(strArr[1]);
		way = new int[N + 1];
	}

	public boolean hasNext() {
		return cnt < M;
	}

	public void readBody(String str) {
		String[] strArr = str.split(" ");
		int a = Integer.parseInt(strArr[0]);
		int b = Integer.parseInt(strArr[1]);
		way[a]++;
		way[b]++;
		// System.out.println(str);
		cnt++;
	}

	public void solve() {
		for (int i = 1; i <= N; i++)
			System.out.println(way[i]);
	}
}


Measured memory_bytes: 21204
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;
using ll=long long;
using pint=pair<int,int>;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define el '\n'
#define ALL(x) x.begin(),x.end()
#define ALLR(x) x.rbegin(),x.rend()
#define ceil_div(a,b) (a+(b-1))/b
#define INF 1e9
#define DEBUG(x) cout<<"debug: "<<x<<endl
#define $in(v,n) ;rep(II,0,n)cin>>v[II]
inline void IN(void){return;}
template<typename F,typename... R>inline void IN(F& f, R&... r){cin>>f;IN(r...);}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}


int main(){
    string s; IN(s);
    string r = string(ALLR(s));
    int sl = s.size();
    int ans = 0;
    rep(i, 0, sl/2){
        if(s[i]!=r[i])ans++;
    }
    cout << ans << el;
    return 0;
}


Measured memory_bytes: 3144
#include <iostream>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < n;i++)
int main() {
	int n, p[10],s = 0,sum =0,a;cin >> n;
	rep(i, n) {
		cin >> p[i];
		if (s < p[i]) {
			s = p[i], a = i;
		}
	}
	rep(i, n) {
		if (i != a) sum += p[i];
		else sum += p[i] / 2;
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
// #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
#define fou(i,a,n) for(int i=a;i<n;i++)
#define fod(i,a,n) for(int i=n-1;i>=a;i--)
#define rep(n) fou(_,0,n)
#define tra(a,x) for(auto& a : x)
#define elif(c) else if(c)

#define emb emplace_back
#define pub push_back
#define pob pop_back
#define me min_element
#define Me max_element
#define mp make_pair
#define fi first
#define se second
#define siz(xs) ((int)(xs).size())
#define all(xs) xs.begin(),xs.end()
#define lla(xs) xs.rbegin(),xs.rend()
#define sortup(xs) sort(all(xs))
#define sortdown(xs) sort(lla(xs))
template<class C>void mini(C &a,C b){a=min(a,b);}
template<class C>void maxi(C &a,C b){a=max(a,b);}
#define in(T,...) T __VA_ARGS__;_cin(__VA_ARGS__)
#define out(...) _cout(__VA_ARGS__);
void _cin(){}template<class Head,class...Tail>void _cin(Head&&head,Tail&&...tail){cin>>head;_cin(forward<Tail>(tail)...);}
void _cout(){}template<class Head,class...Tail>void _cout(Head&&head,Tail&&...tail){cout<<head<<endl;_cout(forward<Tail>(tail)...);}
template<class Type>void _cinvec(Type t,int n){}template<class Type,class Head,class...Tail>void _cinvec(Type t,int n,Head&&head,Tail&&...tail){rep(n){cin>>t;head.eb(t);}_cinvec(t,n,forward<Tail>(tail)...);}

#define VI vector<int>
#define VD vector<double>
#define VS vector<string>
#define VVI vector<VI>
#define VVD vector<VD>
#define VVS vector<VS>

// #define int int64_t
// #define double long double

// map
// 横並びcout




signed main(){
  in(int,a,b,c);
  string ans;
  if(c!=max({a,b,c})&&c!=min({a,b,c})) ans="Yes";
  else ans="No";
  out(ans);

  // in(int,N);
  // in(string,S);
  // in(int,K);
  // char c=S[K-1];
  // fou(i,0,N){if(S[i]!=c)cout<<'*';else cout<<S[i];}
  // cout<<endl;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

// x ** n % mods を求める
pub fn mod_pow(x: i64, n: i64, mods: i64) -> i64 {
    if n == 0 {
        return 1;
    }
    let mut res = mod_pow(x * x % mods, n / 2, mods);
    if n % 2 == 1 {
        res = res * x % mods;
    }
    return res;
}

// (1/n) % mods を求める
pub fn mod_inv(n: i64, mods: i64) -> i64 {
    return mod_pow(n, mods-2, mods);
}

// nCk % mods を求める
pub fn mod_comb(n: i64, k: i64, mods: i64) -> i64 {
    let sum1 = (n-k+1..n+1).fold(1, |ac, x| ac * x % mods);
    let sum2 = (1..k+1).fold(1, |ac, x| ac * x % mods);
    return sum1 * mod_inv(sum2, mods) % mods;
}


fn main() {
    input!{
        a: i64,
        b: i64,
        c: i64,
    }
    if c - b - a < 0 {
        println!("No");
    } else {
        let d = (c - b - a) * (c - b - a);
        if 4 * a*b < d {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>
#define INF 100000
using namespace std;
queue<int> que;
int main (void){
    int w,h;

    cin >> h >> w;
    

    
    char a[1005][1005];
    int d[1005][1005];

    int cx[4] = {0, 1, 0, -1,};
    int cy[4] = {1, 0, -1, 0,};

    for(int i = 0; i < 1005; i++){

        for(int j = 0; j < 1005; j++){

            d[i][j] = INF;//使用しない数で初期化することにより、判別を可能に

        }

    }

    for(int i = 0; i < h; i++){

        for(int j = 0; j < w; j++){

            cin >> a[i][j];
            if(a[i][j]=='#'){
                d[i][j] = 0; //目印をつける
                que.push(j); //x,yの順でキューに入れる
                que.push(i);

            }

        }

    }


    while(que.size()){
        int x =que.front(); que.pop();//前から順番にチェック
        int y =que.front(); que.pop();

        for (int k=0;k<4;k++){
            int nx = x + cx[k];
            int ny = y + cy[k];
            if(0 <= nx && nx < w && 0 <= ny && ny < h && a[ny][nx] != '#' && d[ny][nx] == INF){//縦横および#有無をa,d両方で確認

                que.push(nx);//新たにできた＃をキューで処理できるようにする。

                que.push(ny);

                d[ny][nx] = d[y][x] + 1;//操作回数の保持

                a[ny][nx] == '#';
            }
        }
    }
    int max=0;


     for(int i = 0; i < h; i++){

        for(int j = 0; j < w; j++){
            if(d[i][j]!=INF&&d[i][j]>max){
                max=d[i][j];//最大値＝操作回数
            }
        }

    }

        
    
cout <<max << endl;
    
   return 0;
}


Measured memory_bytes: 13328
#include<stdio.h>
#include<stdlib.h>/*atoiのため*/
#include<string.h>

	int top = 0;
	int S[1000];
	
	void push(int x){
	S[++top] = x;/*先にtopの値を１増やしてから配列sにアクセスする*/
	}
	
	int pop(void){
	top--;
	return S[top+1]; /*配列Sにアクセス後、topの値を１増やす*/
	}
	
	
	int main(void){
		int a, b;
		top = 0;
		char s[100];
		while(scanf("%s", s) != EOF){
			if(s[0]=='+'){
				a = pop();
				b = pop();
				push(a + b);
			}
			else if(s[0]=='-'){
				b = pop();
				a = pop();
				push(a - b);
			}
			else if(s[0]=='*'){
				a = pop();
				b = pop();
				push(a * b);
			}
			else{
				push(atoi(s));/*文字列から数値への変換*/
			}
		}
		printf("%d\n", pop());
	return 0;
}
	/*EOFを出力してループを抜けるためCtrl+dを入力する*/


Measured memory_bytes: 2104