akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
#define INF 1000000000
using namespace std;

int main(void){
int n;
cin>>n;
for(int i=0;i<=30;i++){
    for(int j=0;j<=30;j++){
        if(4*i+7*j==n){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
}
cout<<"No"<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define MAXN 200005
#define REP(temp, init_val, end_val) for (int temp = init_val; temp <= end_val; ++temp)
#define REPR(temp, init_val, end_val) for (int temp = init_val; temp >= end_val; --temp)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> intpair;
int read(){
    int f = 1, x = 0;
    char c = getchar();
    while (c < '0' || c > '9'){if(c == '-') f = -f; c = getchar();}
    while (c >= '0' && c <= '9')x = x * 10 + c - '0', c = getchar();
    return f * x; 
}
inline int lowbit(int x){
    return x & (-x);
}
inline int modadd(int x, int y){
    return (x + y >= MOD ? x + y - MOD: x + y);
}
inline int sgn(int x){
    return (x < 0 ? -1: (x > 0 ? 1: 0));
}
template<typename T>
T gcd(T a, T b){
    return (!b) ? a: gcd(b, a % b);
}
int poww(int a, int b){
    int res = 1;
    while (b > 0){
        if (b & 1) res = 1ll * res * a % MOD;
        a = 1ll * a * a % MOD, b >>= 1;
    }
    return res;
}
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
const int ddx[] = {-1, -1, -1, 0, 0, 1, 1, 1}, ddy[] = {-1, 0, 1, -1, 1, -1, 0, 1};

/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/

const int inv2 = 1000000008 / 2;
const int offset = 2001;
int fac[8005], inv[8005], invfac[8005];
int n, a[200005], b[200005];
int f[4005][4005] = {0};
void init(){
    n = read();
    for (int i = 1; i <= n; ++i)
        a[i] = read(), b[i] = read(), 
        ++f[-a[i] + offset][-b[i] + offset];
    fac[0] = fac[1] = 1;
    inv[1] = 1;
    invfac[0] = invfac[1] = 1;
    for (int i = 2; i <= 8000; ++i){
        fac[i] = 1ll * fac[i - 1] * i % MOD;
        inv[i] = 1ll * (MOD - MOD / i) * inv[MOD % i] % MOD;
        invfac[i] = 1ll * invfac[i - 1] * inv[i] % MOD;
    }
}
void solve(){
    for (int i = 1; i <= 4001; ++i)
        for (int j = 1; j <= 4001; ++j){
            f[i][j] = modadd(f[i - 1][j], modadd(f[i][j], f[i][j - 1]));
        }
    int ans = 0;
    for (int i = 1; i <= n; ++i){
        ans = modadd(ans, f[a[i] + offset][b[i] + offset]);
        int cc = 1ll * fac[2 * a[i] + 2 * b[i]] * invfac[2 * a[i]] % MOD;
        cc = 1ll * cc * invfac[2 * b[i]] % MOD;
        ans = modadd(ans, MOD - cc);
    }
    ans = 1ll * ans * inv2 % MOD;
    printf("%d\n", ans);
}
int main(){
    int T = 1;
    while (T--){
        init();
        solve();
    }
    return 0;
}

Measured memory_bytes: 67928
#include<iostream>
#include<vector>
using namespace std;
int main(void){
	int a,b;
	cin>>a>>b;
	int e=a,f=b;
	vector<int> c(5),d(5);
	int keta=10;
for(int i=0;i<5;i++){
c[i]=a%keta;
d[i]=b%keta;
a/=keta;
b/=keta;
}
int ans=0;
int at=10*c[4]+c[3],bt=10*d[4]+d[3];
ans+=(bt-at)*10;
ans+=d[2]-c[2]-1;
at*=1000;
bt*=1000;
at+=100*c[2]+10*c[3]+c[4];
bt+=100*d[2]+10*d[3]+d[4];
//cout<<e<<' '<<at<<endl;
//cout<<f<<' '<<bt<<endl;
if(e<=at)ans++;
if(f>=bt)ans++;
cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
	int N;
	cin >> N;
	int nos = 0;
	int h,res = 0;
	int now = -1;
	for (int i = 0; i < N; ++i) {
		cin >> h;
		if (h > now) {
			res = max(nos,res);
			nos = 0;
		}
		else {
			++nos;
		}
		now = h;
	}
	cout << max(nos,res) << endl;
	return 0;
}


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 2e4+23;

int p[N], a[N], b[N];

void solve() {
  int n; scanf("%d", &n);
  for (int x, i = 0; i < n; ++i) {
    scanf("%d", &x);
    p[x-1] = i+1;
  }
  a[0] = 1;
  printf("1 ");
  for (int i = 1; i < n; ++i) {
    a[i] = a[i-1]+1;
    if (p[i] > p[i-1]) a[i] += p[i]-p[i-1];
    printf("%d ", a[i]);
  }
  puts("");
  b[n-1] = 1;
  for (int i = n-2; i >= 0; --i) {
    b[i] = b[i+1]+1;
    if (p[i] > p[i+1]) b[i] += p[i]-p[i+1];
  }
  for (int i = 0; i < n; ++i) printf("%d ", b[i]);
}

int main() {
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 4024
n, m = map(int, input().split())
AC = [0] * n
WA = [0] * n
w = 0

for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == 'AC' and AC[p] == 0:
        AC[p] += 1
        w += WA[p]
    elif s == 'WA' and AC[p] == 0:
        WA[p] += 1

print(sum(AC), w)

Measured memory_bytes: 51544
process.stdin.resume();
process.stdin.setEncoding("UTF-8");
process.stdin.on('data', function(chunk){
  var arr = chunk.trim().split('\n');
  arr.forEach(function(v){
    var a = (v.split(" ")[0]);
    var b = (v.split(" ")[1]);
    var result = Number(a) + Number(b);
    console.log(result);
  })
});

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N), b(N);
  ll d = 0;
  rep(i, N) cin >> a[i];
  rep(i, N) cin >> b[i];
  rep(i, N) {
    if (a[i] < b[i]) d += (b[i] - a[i]) / 2;
    else d -= a[i] - b[i];
  }
  if (d >= 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 384
#include<math.h>
#include<stdio.h>
int main(void)
{
	int C;
	double a, b, c, S,h,pi=3.141592654;
	scanf("%lf %lf %d", &a, &b, &C);
	c = a*a + b*b - 2 * a*b*cos(C*pi/180);
	S =  a*b*sin(C*pi / 180)/2;
	h = 2 * S / a;
	printf("%f\n%f\n%f\n", S, sqrt(c)+a+b,h);
	return 0;
}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> Pi; typedef priority_queue<int> Pr; typedef vector<int> Vi; typedef vector<Pi> Vp;
typedef map<int,int> MPi; typedef pair<Int,Int> Pl; typedef vector<Int> VI;
const int mod = 1000000007; const Int INF = 1145141919810893931;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) v.begin(),v.end()
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    int n; cin>>n; Int ts,as; cin>>ts>>as;
    for (int i = 0; i < n-1; i++){
        Int t,a; cin>>t>>a; double r=(double)as/ts,rn=(double)a/t;
        if(rn==r)continue;
        else if(rn>r){
            Int c=((ts%t)?ts/t+1:ts/t);
            ts=c*t; as=c*a;
        }else{
            Int c=((as%a)?as/a+1:as/a);
            as=c*a; ts=c*t;
        }
    }
    cout<<as+ts<<'\n';
}

Measured memory_bytes: 256
/*

宣告——
汝身在我之下，托付吾之命运于汝之剑，
遵从圣杯之名，若汝遵从此意志此理，回应吧。
在此起誓，吾是成就世间一切行善之人，吾是肃清世间一切罪恶之人，
被狂乱之槛所囚的囚徒。吾是此锁链的操纵者，
汝为身缠三大言灵之七天，从抑止之轮显现吧，天秤之守护者！

*/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cassert>
#define ll long long
using namespace std;
inline int read(){
	int re=0,flag=1;char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') flag=-1;
		ch=getchar();
	}
	while(isdigit(ch)) re=(re<<1)+(re<<3)+ch-'0',ch=getchar();
	return re*flag;
}
long double n,nn,d,delta;
long double calc(long double st,long double del,long double tot){
	return (st+del*(tot+1.0)/2.0);
}
int main(){
	nn=n=read();d=read();delta=read();d-=delta;
	long double ans=0;n*=2.0;
	for(int i=1;i<=nn;i++){
		ans+=calc(d,delta,n);
//		cout<<i<<' '<<d<<' '<<delta<<' '<<ans<<'\n';
		d=(3.0*delta+(n+2.0)*d)/(n);
		delta=((n+4.0)*delta)/(n);
		n-=2.0;
	}
	printf("%.15lf\n",(double)ans);
}


Measured memory_bytes: 256
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define test(s) \
  if (!(s))     \
    cout << "Line " << __LINE__ << ": [" << #s << "] is false" << endl;
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
#pragma endregion

vector<int> dmax, ans;
vector<vector<int>> G;

void dfs(int v, int d, int c) {
  if (d <= dmax[v])
    return;

  dmax[v] = d;
  if (ans[v] == 0)
    ans[v] = c;
  for (int nv : G[v]) {
    dfs(nv, d - 1, c);
  }
}

signed main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M), b(M);
  G = vector<vector<int>>(N);

  rep(i, M) {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
    G[a[i]].pb(b[i]);
    G[b[i]].pb(a[i]);
  }

  int Q;
  cin >> Q;
  vector<int> v(Q), d(Q), c(Q);
  rep(i, Q) {
    cin >> v[i] >> d[i] >> c[i];
    v[i]--;
  }

  reverse(all(v));
  reverse(all(d));
  reverse(all(c));

  dmax = vector<int>(N, -1);
  ans = vector<int>(N);
  rep(i, Q) {
    dfs(v[i], d[i], c[i]);
  }

  rep(i, len(ans)) {
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 12404
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#define int long long
using namespace std;

typedef pair<int, int> Pii;

void readline(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str());
}
void readline(int N, vector<double> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atof(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atof(s.c_str());
}

signed main(){

    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    readline(N, A);

    int ans = 1;
    int one = K;
    while(one < N){
        ans++;
        one += K - 1;
    }
    
    cout << ans;

    return 0;
}

Measured memory_bytes: 1024
x=int(input())
n=10**5 +10**4
flag=0
pn=0
if x==2:
    print(2)
else:
    for i in range(x,n):
        flag=0
        for k in range(2, int((i)**(1/2))+5):
            if i%k==0:
                flag+=1
        if flag==0:
            pn=i
            break
    print(pn)

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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; }

typedef long long ll;

using namespace std;

ll cal(string s)
{
  int l=s.length();
  vector<int>re(l);
  rep(i,l-1)
  {
    re[i]=s[i]==s[i+1];
  }
  int res=0;
  rep(i,l-1)
  {
    if(re[i])
    {
      res++;
      re[i+1]=0;
    }
  }
  return (ll)res;
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  ll k;
  cin>>s>>k;
    string ss=s+s;
    ll a=cal(s);
    ll b=cal(ss)-a;
    ll c=cal(ss+s)-a-b;
    ll res;
    if(a==b)res=a*k;
    else if(b==c)
    {
      res=a+b*(k-1);
    }
    else
    {
      if(k%2)
      {
        res=k/2*(a+b)+a;
      }
      else
      {
        res=k/2*(a+b);
      }
    }
    cout<<(ll)res<<endl;

  return 0;

}


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

namespace ConsoleApplication10
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<char, int> ResultDataTable = new Dictionary<char, int>();

            for (char alphabet = 'a'; alphabet <= 'z'; alphabet++)
            {
                ResultDataTable.Add(alphabet, 0);
            }

            while (true)
            {

                string strInputData = Console.ReadLine();

                if (strInputData == null)
                {
                    break;
                }

                else
                {
                    foreach (char charcter in strInputData)
                    {
                        if (ResultDataTable.ContainsKey(Char.ToLower(charcter)))
                        {
                            ResultDataTable[Char.ToLower(charcter)] += 1;
                        }
                    }
                }
            }

            foreach (KeyValuePair<char, int> item in ResultDataTable)
            {
                Console.WriteLine($"{item.Key} : {item.Value}");
            }
        }
    }
}



Measured memory_bytes: 18004
def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    xa = 500
    xb = 100
    xc = 50

    Count = 0

    for i in range(A + 1):
        for j in range(B + 1):
            for k in range(C + 1):
              if (xa * i + xb * j + xc * k) == X:
                  Count += 1
    print(Count)

main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 10000000000
using namespace std;
using ll = long long;
int dp[105][4][2];
int main()
{
    string s;
    cin >> s;
    int k;
    cin >> k;
    int l = s.size();
    dp[0][0][0]=1;
    rep(i,l){
        rep(j,4){
            rep(x,2){
                int ny = s[i] - '0';
                rep(y,10){
                    int ni = i + 1, nj = j, nx = x;
                    if(y!=0)
                        nj++;
                    if(nj>k)
                        continue;
                    if(x==0){
                        if(y>ny)
                            continue;
                        if(y<ny)
                            nx = 1;
                    }
                    dp[ni][nj][nx] += dp[i][j][x];
                }

            }
        }
    }
    int ans = dp[l][k][0] + dp[l][k][1];
    cout <<  ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define all(v) v.begin(),v.end()
template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
const ll INFL = 1LL << 60;

int main() {
    int A, B, Q; cin >> A >> B >> Q;
    vector<ll> S(A + 2), T(B + 2);

    rep(i, A) cin >> S[i + 1];
    rep(i, B) cin >> T[i + 1];
    S[0] = T[0] = -INFL;
    S[A + 1] = T[B + 1] =  INFL;

    rep(q, Q) {
        ll x; cin >> x;
        auto sr = lower_bound(all(S), x);
        auto tr = lower_bound(all(T), x);
        auto sl = sr; sl--;
        auto tl = tr; tl--;
        assert(*sl < x and x <= *sr);
        assert(*tl < x and x <= *tr);
        ll d = INFL;
        set_min(d, max(*sr, *tr) - x);
        set_min(d, x - min(*sl, *tl));
        set_min(d, *sr - *tl + min(*sr - x, x - *tl));
        set_min(d, *tr - *sl + min(*tr - x, x - *sl));
        cout << d << endl;
    }

    return 0;
}


Measured memory_bytes: 2944
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;
const int INF = (int)1e9 + 7;

string replaceAll(string s, string a, string b) {
    string r;
    for (int p = 0; (p = s.find(a)) != s.npos; ) {
        r += s.substr(0, p) + b;
        s = s.substr(p + a.size());
    }
    return r + s;
}

map<string, string> d;
string t;
int solve(string s, int cnt) {
    if (s == t) return cnt;
    if (s.size() >= t.size()) return INF;
    int res = INF;
    for (auto &p: d) {
        string ns = replaceAll(s, p.first, p.second);
        if (s != ns) res = min(res, solve(ns, cnt + 1));
    }
    return res;
}

int main() {
    int n;
    while (cin >> n, n) {
        d.clear();
        while (n--) {
            string s, t; cin >> s >> t;
            d[s] = t;
        }
        string s; cin >> s >> t;
        int res = solve(s, 0);
        if (res == INF) cout << -1 << endl;
        else cout << res << endl;
    }
}


Measured memory_bytes: 3200
from itertools import chain
import sys

table1 = dict(zip(
    chain(" ',-.?", map(chr, range(65, 91))),
    "101 000000 000011 10010001 010001 000001 100101 10011010\
    0101 0001 110 01001 10011011 010000 0111 10011000\
    0110 00100 10011001 10011110 00101 111 10011111 1000\
    00110 00111 10011100 10011101 000010 10010010 10010011 10010000".split()
))
table2 = dict(enumerate(chain(map(chr, range(65, 91)), " .,-'?")))

for l in sys.stdin:
    code = "".join(table1[c] for c in l.rstrip("\n"))
    code += "0"*(5-(len(code)%5)) if len(code)%5 else ""
    print("".join(table2[int(code[i*5:(i+1)*5], 2)] for i in range(len(code)//5)))


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

vector<int> a;

void print_a() {
    for (auto e : a) {
        cout << e;
        if (e != a.back()) cout << " ";
    }
}
int main() {
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("aizu_code.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int n;
    cin >> n;

    a.resize(n);

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

    for (int i = 0; i < n; i++) {
        int v = a[i];
        int j = i - 1;
        while (j >= 0 && a[j] > v) {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = v;
        print_a();
        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 3092
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<string>
#define D(x) cout<<"D:"<<#x<<'='<<x<<endl;
using namespace std;
typedef long long ll;
vector<string> v[200050];
string w[200050];
map<string, int> m;
int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, Max = 0;
	cin>>n;
	for(int i = 0; i < n; i++)
	{
		 cin>>w[i];
		 if (m.count(w[i]) != 1) m.insert(make_pair(w[i], 0));
		 m[w[i]]++;
	}
	for(auto& val : m)
		Max = max(Max, val.second), v[val.second].push_back(val.first);
	auto& p = v[Max]; 
	sort(p.begin(), p.end());
	for(int i = 0; i < p.size(); i++) cout<<p[i]<<endl;
	return 0;
}


Measured memory_bytes: 31856
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int N = 1e5+5;
const int M = 1e6+5;
const LL Mod = 1e18;
#define pi acos(-1)
#define INF 1e8
#define INM INT_MIN
#define pb(a)  push_back(a)
#define mk(a,b) make_pair(a,b)
#define dbg(x) cout << "now this num is " << x << endl;
#define met0(axx) memset(axx,0,sizeof(axx));
#define metf(axx) memset(axx,-1,sizeof(axx));
#define sd(ax) scanf("%d",&ax)
#define sld(ax) scanf("%lld",&ax)
#define sldd(ax,bx) scanf("%lld %lld",&ax,&bx)
#define sdd(ax,bx) scanf("%d %d",&ax,&bx)
#define sddd(ax,bx,cx) scanf("%d %d %d",&ax,&bx,&cx)
#define sfd(ax) scanf("%lf",&ax)
#define sfdd(ax,bx) scanf("%lf %lf",&ax,&bx)
#define pr(a) printf("%d\n",a)
#define plr(a) printf("%lld\n",a)
int main()
{
    LL a;sld(a);
    string s;cin >> s;
    LL t = (s[0]-'0')*100+(s[2]-'0')*10+s[3]-'0';
    plr(a*t/100);
    //system("pause");
    return 0;
}

Measured memory_bytes: 3756
//#pragma region ALL(include define etc)
#include <iostream>   // swap(a, b)
#include <string>
#include <cmath>      // abs(絶対値) sin cos tan(角度 / 180.0 * 3.141592)
#include <vector>     // vec.push_back(a) vec.pop_back()
#include <algorithm>  // max(a, b) min(a, b) reverse() sort()
#include <functional> // sort(a, a + N, greater<型>());
#include <limits>
#include <math.h>
#include <iomanip>
#define int long long
//#define int unsigned long long
#define ll long long
#define double long double
using namespace std;
//#pragma endregion

signed main()
{
	// 10^18 = 1000000000000000000

	//int h1, h2, m1, m2, k;
	//int box, box1,box2;

	//int N;
	int n;
	//char n;
	//int a, b, c;
	//int m;
	int h, w;
	int k;
	int d;
	//string s;
	//string t;
	//int m1, m2;
	//int a, b, c, k;
	//int x, y;

	//string s[111111];
	//string s[100000];
	//string c[7];
	//int a[100000];
	//int b[200000];
	//int a[2000000] = { 0 };
	//int b[2000000] = { 0 };
	//int a[20000] = { 0 };
	//int b[20000] = { 0 };
	//vector<int>a(2000000);
	//vector<int>b(2000000);

	//int aaa = 0;
	//int bbb = 0;

	int box[20000] = { 0 };
	//int box = 0;
	//int box[7][7] = { 0 };
	//int box2;
	//int p[1111];
	int x[200001], y[200001];/////////////////////////////////////////

	//long double aaa;

	int count = 0;
	//int k, d;
	//int a = 0;
	int all = 0;
	//double all;
	//double a, b;
	//double h, m;
	//int a[30000] = { 0 };
	//double c, d, e;

	//double mbox, hbox;
	//double box, box2;

	bool flag = true;
	//bool flag = false;

	//string str;

	//cin >> h1 >> m1 >> h2 >> m2 >> k;
	cin >> n;
	//cin >> a >> b >> c;
	cin >> d;
	//cin >> h >> w >> k;
	//cin >> x;
	for (int i = 0; i < n; i++)
	{
		cin >> x[i] >> y[i];
		count = (x[i] * x[i]) + (y[i] * y[i]);
		if (sqrt(count) <= d)
		{
			all++;
		}
	}

	//for (int i = 0; i < (n - k + 1); i++)
	//{
	//	for (int j = 0; j < k; j++)
	//	{
	//		box[i] = box[i] * a[i + j];
	//	}
	//	//cout << box[i] << "\n";
	//	if (i != 0 && box[i] <= box[i - 1])
	//	{
	//		cout << "No\n";
	//	}
	//	else if (i != 0 && box[i] > box[i - 1])
	//	{
	//		cout << "Yes\n";
	//	}
	//}

	//n = s.length();

	//sort(p, p + n);
	//n = n - 'Z';

	//for (int i = 0; i < 1000; i++)
	//{
	//	if (n < 1000)
	//	{
	//		all = 1000 - n;
	//		break;
	//	}
	//	n -= 1000;
	//	if (n == 0)
	//	{
	//		all = 0;
	//		break;
	//	}
	//}

	//box = n % 26;

	//for (int i = 0; i < k; i++)
	//{
	//	all += p[i];
	//}

	//all = n + (n * n) + (n * n * n);

	/*if (n > 0)
	{
		cout << "a\n";
	}
	else
	{
		cout << "A\n";
	}*/
	//n = t.length();

	/*cout << "AC x " << ac << "\n";
	cout << "WA x " << wa << "\n";
	cout << "TLE x " << tle << "\n";
	cout << "RE x " << re << "\n";*/

	cout << all << "\n";
	//cout << box << "\n";
	//cout << a << b << c << "\n";

	/*if (flag == true)
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}*/

	//cout << fixed << setprecision(111) << all;
	//return 0;
}


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

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

	int n;
	cin >> n;
	int h[n], dp[n];
	for(int i=0; i<n; ++i) {
		cin >> h[i];
	}
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);
	for(int i=2; i<n; ++i)
		dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
	cout << dp[n-1];
}


Measured memory_bytes: 1024
/*input
20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
 
#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
 
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;
 
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
 
const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;
 
int raise(int a,int n,int m = MOD){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= raise(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}
 
int floor1(int n,int k){
    if(n%k == 0 || n >= 0)return n/k;
    return (n/k)-1;
}
 
int ceil1(int n,int k){
    return floor1(n+k-1,k);
}
 
set<int> facts;
vector<int> nice;
 
bool prime(int n){
	for(int i = 2;i*i <= n;i++){
		if(n%i == 0)return 0;
	}
	return 1;
}
 
void solve(){
  	int a,b;
  	int wow = 0;
  	cin >>a >> b;
  	int gc = __gcd(a,b);
  	for(int i = 1;i*i <= gc;i++){
  		if(gc%i == 0){
  			nice.pb(i);
  			if(i*i == gc)continue;
  			nice.pb(gc/i);
  		}
  	}
  	int ans = 0;
  	REP(i,nice.size()){
  		ans += prime(nice[i]);
  	}
  	cout << ans;
}
 
signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
  return 0;
}

Measured memory_bytes: 384
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

const int MX = 200 * 1000 + 7;

ll t[4 * MX];

void c(int v, int tl, int tr, int pos, ll val) {
    if (tl == tr) {
        t[v] = max(t[v], val);
    } else {
        int tm = (tl + tr) >> 1;
        if (pos <= tm) {
            c(v + v, tl, tm, pos, val);
        } else {
            c(v + v + 1, tm + 1, tr, pos, val);
        }
        t[v] = max(t[v + v], t[v + v + 1]);
    }
}

ll gt(int v, int tl, int tr, int l, int r) {
    if (r < tl || l > tr) {
        return 0;
    }
    if (tl >= l && tr <= r) {
        return t[v];
    }
    int tm = (tl + tr) >> 1;
    return max(gt(v + v, tl, tm, l, r), gt(v + v + 1, tm + 1, tr, l, r));
}

ll f[MX];
int h[MX], a[MX];
int main() {
#ifdef FASTIO
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> h[i];
    }
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    for (int i = 1; i <= n; i++) {
        f[i] = gt(1, 1, n, 1, h[i] - 1) + a[i];
        c(1, 1, n, h[i], f[i]);
    }

    ll ans = 0;
    for (int i = 0; i <= n; i++) {
        ans = max(ans, f[i]);
    }

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



Measured memory_bytes: 8448
#include<stdio.h>
//using namespace std;

int f(int x) {
  int result = 0;
  while (x != 0) {
    result = result*10 + x%10;
    x/=10;
  }
  return result;
}
bool isPal(int n) {
  if (n == f(n))
    return true;
  else
    return false;
}

int main()
{
  int a, b, ans = 0;
  scanf("%d %d", &a, &b);
  for (int i = a; i <=b; i++) {
    if (isPal(i))
      ans++;
    
  }
  printf("%d", ans);
  
  return 0;



}


Measured memory_bytes: 128
import math

def main():
    a, b, c = map(int, input().split())
    
    li = [a, b, c]
    top = max(li)
    top_index = li.index(top)
    bot = min(li)
    bot_index = li.index(bot)
    mid_index = calc_mid_index(top_index, bot_index)
    mid = li[mid_index]
    count = 0
    
    count = top - mid
    bot += count
    mid += count
    
    if (top - bot) % 2 == 0:
        count += (top - bot) / 2 
    else:
        count += math.ceil((top - bot) / 2) + 1
        
    print(int(count))

def calc_mid_index(top_index, bot_index):
    for i in range(3):
        if i != top_index and i != bot_index:
            return i



if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
dict = [771,16843009,15,131841,387,33153,1539]
while True:
    cell = reduce(lambda x,y:x+y,map(lambda x:int(raw_input(),2)<<(8*x),xrange(8)))
    for i in [cell >> j for j in xrange(255)]:
        try:
            print chr(dict.index(i) + ord('A'))
        except ValueError:
            continue
    try:
        raw_input()
    except:
        break

Measured memory_bytes: 6560
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int H,W;
    string S;
    scanf("%d %d",&H,&W);
    for(int i=0;i<H;i++){
        cin>>S;
        cout<<S<<endl;
        cout<<S<<endl;
    }
    return 0;
} 


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

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int h = sc.NextInt();
        int w = sc.NextInt();
        var ans = new char[h + 2][];
        for (int i = 0; i < h + 2; i++)
        {
            ans[i] = new char[w + 2];
            for (int j = 0; j < w + 2; j++)
            {
                ans[i][j] = '#';
            }
        }

        for (int i = 1; i <= h; i++)
        {
            var s = sc.Next();
            for (int j = 0; j < w; j++)
            {

                ans[i][j + 1] = s[j];
            }
        }

        for (int i = 0; i < h + 2; i++)
        {
            Console.WriteLine(new string(ans[i]));
        }
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27540
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq

# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7

def solve(f):
    n = f.read_int()
    a = f.read_int_list()

    def check(num):
        aa = [10**5+1]*(n+1)
        for i, ai in enumerate(a):
            if ai < num:
                aa[i+1] = aa[i]-1
            else:
                aa[i+1] = aa[i]+1

        bit = BinaryIndexedTree(2*10**5+1)
        cnt = 0
        for i in xrange(n+1):
            cnt += bit.sum(aa[i])
            bit.add(aa[i], 1)

        return n*(n+1)/2 - cnt <= cnt

    mi = 0
    ma = 10**9+1

    while ma - mi > 1:
        mid = (ma+mi)/2
        if check(mid):
            mi = mid
        else:
            ma = mid

    return mi


class BinaryIndexedTree(object):
    """Binary Indexed Tree (1-indexed)"""
    def __init__(self, size, default=0):
        self.bit = [default for _ in range(size + 1)]
        self.size = size

    def sum(self, i):
        """sum 1 to i"""
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= i & -i
        return s

    def add(self, i, x):
        """add x to bit[i]"""
        while i <= self.size:
            self.bit[i] += x
            i += i & -i


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case #%d\n"%f.case, solve(f)
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)


Measured memory_bytes: 110324
// B - FizzBuzz Sum
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
	long long n;
	cin >> n;
	long long a = n / 3, b = n / 5, c = n / 3 / 5;
	long long ans = (1 + n) * n / 2 - 3 * (1 + a) * a / 2 - 5 * (1 + b) * b / 2 + 15 * (1 + c) * c / 2;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3632
#define _CRT_SECURE_NO_WARNINGS

#pragma GCC optimize("O3")

#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
#include <cstring>
#include <numeric>
#include <set>
#include <queue>
#include <deque>
#include <array>
#include <string>
#include <cmath>
#include <random>
#include <ctime>
#include <map>
#include <functional>
#include <bitset>
#include <complex>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>

#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using ld = long double;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, m;
	cin >> n >> m;
	vector<vi> g(n);
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		--u; --v;
		g[u].pb(v);
	}
	vi tps;
	vector<bool> was(n, false);
	function<void(int)> dfs = [&](int v) {
		was[v] = true;
		for (int to : g[v]) {
			if (!was[to]) {
				dfs(to);
			}
		}
		tps.pb(v);
	};
	for (int u = 0; u < n; u++) {
		if (!was[u]) {
			dfs(u);
		}
	}
	vi dp(n, 0);
	for (int u : tps) {
		for (int v : g[u]) {
			dp[u] = max(dp[u], dp[v] + 1);
		}
	}
	cout << *max_element(all(dp));
}


Measured memory_bytes: 8696
#include <iostream>
#include <set>
#include <ctime>
using namespace std;
typedef long long ll;
ll C[32];
ll S[366][32];
ll T[366];
ll P[32];
ll L[32];
set<int> H[32];

uint32_t xor128(void) {
  static uint32_t x = 123456789;
  static uint32_t y = 362436069;
  static uint32_t z = 521288629;
  static uint32_t w = 88675123;
  uint32_t t;

  t = x ^ (x << 11);
  x = y; y = z; z = w;
  return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}

ll calcPenalty(int con, int D) {
  ll ret = 0;
  ll prev = 0;
  for (auto& it: H[con]) {
    ll dif = it - prev;
    ret += (dif - 1) * dif / 2;
    prev = it;
  }
  ll dif = D + 1 - prev;
  ret += (dif - 1) * dif / 2;
  ret *= C[con];
  return ret;
}

ll update(int day, int pcon, int ncon, int D) {
  ll pen = -P[pcon] - P[ncon];
  H[pcon].erase(day);
  H[ncon].insert(day);
  ll vP = calcPenalty(pcon, D);
  ll vN = calcPenalty(ncon, D);
  pen += vP + vN;
  ll ret = -pen;
  ret -= S[day][pcon];
  ret += S[day][ncon];
  if (ret > 0) {
    P[pcon] = vP;
    P[ncon] = vN;
    T[day] = ncon;
  } else {
    H[pcon].insert(day);
    H[ncon].erase(day);
  }
  return ret;
}

int main() {
  clock_t time_start = clock();
  ios::sync_with_stdio(false);
  int D;
  cin >> D;
  for (int i=1; i<=26; i++) {
    cin >> C[i];
  }
  for (int i=1; i<=D; i++) {
    for (int j=1; j<=26; j++) {
      cin >> S[i][j];
    }
  }
  for (int day=1; day<=D; day++) {
    ll ocon = 1;
    ll oval = S[day][ocon] + (day - L[ocon]) * C[ocon];
    for (int con=2; con<=26; con++) {
      ll val = S[day][con] + (day - L[con]) * C[con];
      if (val > oval) {
        ocon = con;
        oval = val;
      }
    }
    T[day] = ocon;
    L[ocon] = day;
    H[ocon].insert(day);
  }
  for (int con=1; con<=26; con++) {
    P[con] = calcPenalty(con, D);
  }
  while (1) {
    clock_t time_now = clock();
    if ((double)(time_now - time_start) > (double)CLOCKS_PER_SEC * 1.9) {
      break;
    }
    int day = xor128() % D + 1;
    int ncon = xor128() % 26 + 1;
    int pcon = T[day];
    update(day, pcon, ncon, D);
  }
  for (int day=1; day<=D; day++) {
    cout << T[day] << '\n';
  }
  cout << flush;
}

Measured memory_bytes: 3760
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <random>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> P;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 100;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const int MOD = 1000000007;
int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};

char field[MAX][MAX];

void solve(void){
    int A, B;
    cin >> A >> B;
    printf("%d %d\n", MAX, MAX);
    //init
    rep(MAX, y) {
        rep(MAX, x) {
            //左を白、右を黒
            if (x < MAX / 2) field[y][x] = '.';
            else field[y][x] = '#';
        }
    }
    //植えてく
    rep((B-1)/(MAX/2), i) {
        rep(MAX/2, y) field[2*y][2*i+1] = '#';
    }
    rep(((B-1)%(MAX/2)), y) {
        field[2*y][2*((B-1)/(MAX/2))+1] = '#';
    }
    rep((A-1)/(MAX/2), i) {
        rep(MAX/2, y) field[2*y][(MAX/2)+2*i+1] = '.';
    }
    rep(((A-1)%(MAX/2)), y) {
        field[2*y][(MAX/2)+2*((A-1)/(MAX/2))+1] = '.';
    }

    rep(MAX, y) {
        rep(MAX, x) {
            putchar(field[y][x]);
        }
        putchar('\n');
    }
}

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


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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()

int main() {
    int A, B;
    cin >> A >> B;
    cout << (A + B)%24 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = (int)3e5;
int h, w, n;
set<int> st[N];
int main() {
    ios_base::sync_with_stdio(false);
    cin >> h >> w;
    swap(h, w);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int x, y;
        cin >> x >> y;
        swap(x, y);
        st[x].insert(y);
    }
    for (int i = 1; i <= h; i++) {
        st[i].insert(w + 1);
    }
    int x = 1;
    int y = 1;
    int ans = (int)1e9;
    bool moved = true;
    for (int t = 1; ; t++) {
        if (t % 2 == 1) {
            if (st[x].find(y + 1) != st[x].end()) {
                ans = min(ans, t / 2 + 1);
                break;
            } else {
                y++;
                moved = true;
            }
        } else {
            auto it = st[x].lower_bound(y);
            int d = *it - y;
            ans = min(ans, t / 2 + d);
            if (x + 1 > h || st[x + 1].find(y) != st[x + 1].end()) {
                moved = false;
            } else {
                x++;
                moved = true;
            }

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

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

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A + B < C + D){
    cout << "Right" << endl;
  }
  else if(A + B == C + D){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Left" << endl;
  }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
def main():
    N, P = map( int ,input().split())
    S = [ int(s) for s in list(input().strip())][::-1]
    if P == 2 or P == 5:
        ans = 0
        for i in range(N):
            if S[i]%P == 0:
                ans += N-i
        print(ans)
        return
    L = [0]*P
    L[0] = 1
    t = 0
    s = 1
    for i in range(N):
        t = (S[i]*s+t)%P
        L[t] += 1
        s = s*10%P
    ans = 0
    for l in L:
        ans += l*(l-1)//2
    print(ans)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 6560
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}

ll N, Q;
string s;
vector<pair<char, char> > td;

ll cal(char c){
    ll l , r;

    l = 0 ; r = s.size()-1;
    while(l + 1 < r){
        ll m = (l + r)/2;
        ll now = m;

        rep(i, Q){
            if(td[i].first == s[now]){
                if(td[i].second == c) now--;
                else now++;
            }
        }
        if(now == 0) l = m;
        else r = m;
    }
    return l;
}

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


    cin >> N >> Q;
    cin >> s;
    s = " " + s;
    s += " ";

    rep(i, Q){
        char t, d;
        cin >> t >> d;
        td.pb(mp(t,d));
    }

    ll ans = s.size()-2;
    cerr << "before: " << ans << endl;
    ans -= cal('L');
    cerr << "after once: " << ans << endl;
    reverse(all(s));
    ans -= cal('R');
    cerr << "last result: " << ans << endl;

    cout << ans << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 1360
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll h,w,a,b;cin>>h>>w>>a>>b;
  vl tate(h,-1);
  vl yoko(w,-1);
  rep(i,b)tate[i]=1;
  rep(i,a)yoko[i]=1;
  rep(i,h){
    rep(j,w){
      if(tate[i]*yoko[j]==1)cout<<1;
      else cout<<0;
    }
    cout<<endl;
  }
}

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

bool vd(int x, int y){
	return x>=0 && y>=0 && y<8 && x<8;
}

char solve(char sol[6]){
//	for(int x=0;x<6;++x)cout<<sol[x]<<" ";
	if(sol[0]=='0' && sol[1]=='1' && sol[2]=='0' && sol[3]=='0' && sol[4]=='1' && sol[5]=='1')return 'F';
	if(sol[0]=='0' && sol[1]=='1' && sol[2]=='1' && sol[3]=='1' && sol[4]=='1' && sol[5]=='0')return 'G';
	if(sol[0]=='0' && sol[1]=='1' && sol[2]=='1' && sol[3]=='0' && sol[4]=='0' && sol[5]=='1')return 'E';
	if(sol[0]=='0' && sol[1]=='1' && sol[2]=='0' && sol[3]=='1' && sol[4]=='1' && sol[5]=='0')return 'D';
	if(sol[0]=='0' && sol[1]=='1' && sol[2]=='1' && sol[3]=='0' && sol[4]=='0' && sol[5]=='0')return 'C';
	if(sol[0]=='0' && sol[1]=='1' && sol[2]=='0' && sol[3]=='0' && sol[4]=='1' && sol[5]=='0')return 'B';
	return 'A';
}

int main(){
	char j;
	char mat[8][8];
	while(cin>>j){
		pair<int,int> init = make_pair(-1,-1);
		mat[0][0] = j;
		if(j=='1'){
			init.first = 0;init.second = 0;
		}
		for(int x=1;x<64;++x){
			cin>>j;mat[x/8][x%8] = j;
			if(j=='1' && init.first == -1){
				init.first = x/8;
				init.second = x%8;

			}
		}
		//cout<<init.first<<":"<<init.second<<endl;
		char sol[6];
		int cnt = 0;
		for(int x=0;x<2;++x){
			for(int y=-1;y<2;++y){
				if(vd(init.first + x , init.second + y)){
					sol[cnt++] = mat[init.first + x][init.second + y];
				}else{
					sol[cnt++] = '0';
				}
			}
		}
		cout<<solve(sol)<<endl;
	}		
	return 0;
}

Measured memory_bytes: 1132
#include<cstdio>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	int m=n%10;
	if(m==2||m==4||m==5||m==7||m==9)
	{
		printf("hon\n");
	}
	else
	if(m==0||m==1||m==6||m==8)
	{
		printf("pon\n");
	}
	else
	{
		printf("bon\n");
	}
	return 0;
} 

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

using namespace std;

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

void Main()
{
	int n;
	cin >> n;
	if(n % 1000 == 0){
		cout << 0 << endl;
		return;
	}
	cout << 1000 - (n % 1000) << endl;
}
int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 3644