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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    REP(i, n) {
        cin >> s[i];
        sort(ALL(s[i]));
    }
    sort(ALL(s));
    ll t = 0;
    int x = 0;
    FOR(i, 1, n) {
        if (s[i] != s[x]) {
            if (i - x > 1) {
                ll p = 0;
                FOR(j, 1, i - x) {
                    p += j;
                }
                t += p;
            }
            x = i;
        }
    }
    if (n - x > 1) {
        ll p = 0;
        FOR(j, 1, n - x) {
            p += j;
        }
        t += p;
    }

    cout << t << endl; 
}


Measured memory_bytes: 7296
A,V=map(int,input().split())
B,W=map(int,input().split())
T=int(input())

if A<=B:
    A_place=A+V*T
    B_place=B+W*T
    if A_place>=B_place:
        print("YES")
    else:
        print("NO")
else:
    A_place=A-V*T
    B_place=B-W*T
    if A_place<=B_place:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 9216
import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()
A = rl()

B = [0] * (len(A)+1)
for i, a in enumerate(A):
    j = a - 1
    B[j] += 1
for b in B:
    print(b)


Measured memory_bytes: 91296
import numpy as np 
n, k = map(int, input().split())
seq = list(map(int, input().split()))
index = [i for i in range(len(seq)) if seq[i]==1][0]
left = index
right = n - index - 1
#print(index, left, right)
time = int(np.ceil((left+right) / (k-1)))
print(time)

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

int N;
int A, B, C;
int cnt = 0;
string out = "No";

int main()
{
    cin >> A >> B >> C;
    cin >> N;

    for(int i = 0; i < N; i++)
    {
        if(A < C)
        {
            if(A < B)
            {
                out = "Yes";
            }
            else
            {
                B = B * 2;
                //cout << "B: " << B << endl;
                if((A < B) && (B < C)) out = "Yes";
            }
        }
        else
        {
            C = C * 2;
            //cout << "C: " << C << endl;
            if((A < B) && (B < C)) out = "Yes";
        }
    }

    cout << out << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; string s;
    while (cin >> n >> s, n || s != "0") {
        ll m = linf;
        vector<ll> ans;
        bool rejected = false;
        try {
            set<vector<ll>> used;
            rep(a, 7) rep(b, 7) rep(c, 7) rep(d, 7) rep(e, 7) rep(f, 7) {
                if (a + b + c + d + e + f != s.size()) continue;
                vector<ll> v;
                if (a) v.pb(a);
                if (b) v.pb(b);
                if (c) v.pb(c);
                if (d) v.pb(d);
                if (e) v.pb(e);
                if (f) v.pb(f);
                if (used.count(v) > 0) continue;
                used.insert(v);
                ll cnt = 0;
                vector<ll> vals;
                bool flag = true;
                rep(i, v.size()) {
                    string str = s.substr(cnt, v[i]);
                    if (str.size() > 1 && str[0] == '0') {
                        // flag = false;
                        // break;
                    }
                    vals.pb(stoll(str));
                    cnt += v[i];
                }
                if (!flag) continue;
                ll sum = 0;
                rep(i, vals.size()) sum += vals[i];
                if (sum > n) continue;
                if (n - sum == m) {
                    rejected = true;
                }
                else if (n - sum < m) {
                    rejected = false;
                    m = n - sum;
                    ans = vals;
                }
            }
            if (rejected) throw string("rejected");
            if (m == linf) throw string("error");
            cout << n - m << " " << ans << endl;
        }
        catch (string err) {
            cout << err << endl;
        }
    }
}

Measured memory_bytes: 3308
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int main(){
    int i;
    
    int n;
    scanf("%d\n",&n);
    int a[n];
    for(i=0;i<n;i++)scanf("%d ",&a[i]);
    
    int m;
    scanf("%d\n",&m);
    int b[m];
    for(i=0;i<m;i++)scanf("%d ",&b[i]);
    
    int k;
    if(n>m)k=m;
    else k=n;
    
    for(i=0;i<k;i++){
        if(a[i]<b[i]){
            printf("1\n");
            return 0;
        }else if(a[i]>b[i]){
            printf("0\n");
            return 0;
        }
    }
    
    if(m>n)printf("1\n");
    else printf("0\n");
    
    return 0;
}


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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

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

    int A, B; cin >> A >> B;
    if(A+B >= 10) cout << "error" << endl;
    else cout << A+B << endl;
}

Measured memory_bytes: 3596
#include<cmath>
#include<bits/stdc++.h>
#define MAX(a,b) (a>b? a:b)
#define MIN(a,b) (a>b? b:a)
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define repr(i,n) for(lint i=(lint)(n);i>0;--i)
#define reps(i,a,b) for(lint i=a;i<=(lint)(b);i++)
typedef long long lint;
typedef long double ld;
using namespace std;
const ld PI = acos(-1.0);

int main(){
    string S;
    cin >> S;
    char c[4] = { 'A', 'C', 'G', 'T' };
    vector<int> cnt(1);
    cnt[0] = 0;
    int cur = 0;
    bool flag = false;
    rep(i,S.length()) {
        rep(j,4) {
            if(S[i]==c[j]) {
                cnt[cur]++;
                flag = true;
            }
        }
        if(!flag) {
            cnt.push_back(0);
            cur++;
        }
        flag = false;
    }
    int m = *max_element(cnt.begin(), cnt.end());
    cout << m << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n = I()
A = []
for i in range(n):
    s, p = input().split()
    p_ = (-1)*int(p)
    A.append((s, p_, i+1))
A.sort(key=itemgetter(0,1))
# print(A)
for a in A:
    print(a[2])


Measured memory_bytes: 63980
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
using namespace std;
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;
}
int main() {
    int N, M;
    cin >> N >> M;

    vector<vector<int> > ans(M, vector<int>(2, 0));
    vector<vector<pair<int, int> > > p(N, vector<pair<int, int> >());
    rep(i, 0, M) {
        int P, Y;
        cin >> P >> Y;
        P--;
        ans[i][0] = P;
        p[P].push_back(make_pair(Y, i));
    }

    rep(i, 0, N){
        sort(p[i].begin(), p[i].end());
        rep(j, 0, p[i].size()) {
            ans[p[i][j].second][1] = j + 1;
        }
    }

    rep(i, 0, M) {
        cout << setfill('0') << setw(6) << ans[i][0] + 1;
        cout << setfill('0') << setw(6) << ans[i][1] << endl;
    }
    return 0;
}

Measured memory_bytes: 12416
import java.util.*;

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

        int N = stdin.nextInt();

        Set<Integer> num = new HashSet<>();

        for (int i = 0; i < N; i++) {
            int n = stdin.nextInt();
            num.add(n);
        }

        System.out.println(num.size());
    }
}


Measured memory_bytes: 21972
D = int(input())
c = list(map(int, input().split()))
last = [0] * 26
ans = []
S = []
prev_score = 0
maxsi_list = []
for d in range(1, D+1):
    s = list(map(int, input().split()))
    S += [s]
    maxs = float('-inf')
    maxss = float('-inf')
    maxi = -1
    maxii = -1
    cumsump = 0
    for i in range(26):
        tmp = -c[i] * (d - last[i])
        cumsump += tmp
    for i in range(26):
        tmp = -c[i] * (d - last[i])
        tmp2 = s[i] + cumsump - tmp
        if tmp2 > maxs:
            maxs = tmp2
            maxi = i
        if s[i] > maxss:
            maxii = i
            maxss = s[i]
    ans += [maxi+1]
    last[maxi] = d
    prev_score += maxs
    maxsi_list += [maxii+1]

for dd in range(D):
    last = [0] * 26
    score = 0
    for d in range(1, D+1):
        if dd == (d-1):
            maxc = 0
            maxci = -1
            for i in range(26):
                cost = c[i] * (d - last[i])
                if maxc < cost:
                    maxc = cost
                    maxci = i+1
            prev_a = ans[dd]
            ans[dd] = maxci
        td = ans[d-1] - 1
        cumsump = 0
        for i in range(26):
            if td != i:
                tmp = -c[i] * (d - last[i])
                cumsump += tmp
        last[td] = d
        score += S[d-1][td]+cumsump
    if score <= prev_score:
        ans[dd] = prev_a
    else:
        prev_score = score

for dd in range(D):
    last = [0] * 26
    score = 0
    prev_a = ans[dd]
    ans[dd] = maxsi_list[dd]
    for d in range(1, D+1):
        td = ans[d-1] - 1
        cumsump = 0
        for i in range(26):
            if td != i:
                tmp = -c[i] * (d - last[i])
                cumsump += tmp
        last[td] = d
        score += S[d-1][td]+cumsump
    if score <= prev_score:
        ans[dd] = prev_a
    else:
        prev_score = score

for a in ans:
    print(a)

Measured memory_bytes: 72212
N, S = map(int, input().split())
A_array = list(map(int, input().split()))

mod = 998244353

sum_array = [0] * S
ans = 0

for i, A in enumerate(A_array):
    if A > S:
        continue
    if A == S:
        ans = (ans + (i+1) * (N-i)) % mod
        continue
    ans = (ans + sum_array[S-A] * (N-i)) % mod
    for j in range(S-1, A, -1):
        sum_array[j] = (sum_array[j] + sum_array[j-A]) % mod
    sum_array[A] = (sum_array[A] + (i+1)) % mod
    # print(sum_array, ans)
print(ans)


Measured memory_bytes: 42348
def resolve():
    '''
    code here
    '''
    import math
    X = int(input())

    def is_prime(num):
        if num in [1, 2, 3]:
            return True
        else:
            div = 2
            while div <= int(math.sqrt(num)) + 1:
                if num % div == 0:
                    return False
                div += 1
            return True

    while is_prime(X) == False:
        X += 1

    print(X)

if __name__ == "__main__":
    resolve()


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

int main()
{

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

    int a,i,j,c=0;
    string x,y;
    cin>>a>>x>>y;

    for(i=0;i<=a;i++)
    {
        c=1;
        for(j=0;j<a;j++)
        {
            if(i+j==a)break;
            if(x[i+j]!=y[j])
            {
                c=0;
                break;
            }
        }
        if(c)
        {
            cout<<a+i;
            break;
        }
    }



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _itr ::iterator
#define forn(i, x, y) for (ll i = x; i < y; ++i)
#define ford(i, x, y) for (ll i = x; i > y; --i)
#define forne(i, x, y) for (ll i = x; i <= y; ++i)
#define forde(i, x, y) for (ll i = x; i >= y; --i)
#define rd(x) cin >> x; cin.ignore();
#define rdstr(x) getline(cin, x);
#define rdarr(x, y) for (ll i = 0; i < y; ++i) cin >> x[i];
#define rdmtr(x, y, z) for (ll i = 0; i < y; ++i) for (ll j = 0; j < z; ++j) cin >> x[i][j];
#define pb push_back

#define X first
#define Y second

using namespace std;
typedef long long ll;
typedef long double ld;

const ll MaxN = 2e5 + 7;
const ll MaxM = 5e3 + 7;
const ll Mdl = 1e9 + 7;
const ll INF = 1e18 + 7;

typedef pair<ll, ll> pi;
typedef vector<ll> vi;
typedef ll arr[MaxN];

ll REPIT = 1;

const bool MQ = false;

ll d, s, t;

void Solve()
{
    cin >> d >> t >> s;
    cout << (((d + s - 1) / s <= t) ? "Yes\n" : "No\n");
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifdef OFFLINE
    freopen("input.inp", "r", stdin);
    #endif
    if (MQ == true)
    {
        rd(REPIT);
    }
    while (REPIT--) Solve();
    cout.flush();
    #ifdef OFFLINE
    fclose(stdin);
    #endif
}


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

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    int p[n+1];
    int pos[n+1];
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&p[i]);
        pos[p[i]]=i;
    }
    long long res=0;
    multiset<int> s={0,0,n+1,n+1};
    for(int t=n;t>=1;t--)
    {
        long long al,bl,ar,br;
        multiset<int>::iterator it=s.lower_bound(pos[t]);
        ar=*it;
        it++;
        br=*it;
        it--; it--;
        al=*it;
        it--;
        bl=*it;
        res+=(t*(al-bl)*(ar-pos[t]));
        res+=(t*(pos[t]-al)*(br-ar));
        s.insert(pos[t]);
    }
    cout << res << endl;
    return 0;
}


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

int main(void) {
  long long int N;
  long long int sumt=0,suma=0;
  long long int timest,timesa,times;
  long long int nt,na;
  scanf("%lld\n",&N);
  for (int i = 0; i < N; i++) {
    scanf("%lld %lld",&nt,&na);
    if (i==0){
      sumt=nt;
      suma=na;
    }else{
      timest = (sumt-1)/nt+1;
      timesa = (suma-1)/na+1;
      times = max(timest,timesa);
      sumt = nt * times;
      suma = na * times;
    }
  }
  printf("%lld\n",sumt+suma);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include <bitset>

using namespace std;

#define ll long long
#define ld long double
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < n; i++)
#define PI 3.14159265358979323846
int N, K;
int main()
{
    cin >> N >> K;
    double sum = 0;
    for (int i = 1; i < N + 1; i++)
    {
        double tmp = (double)1 / (double)N;
        int point = i;
        while (point < K)
        {
            point *= 2;
            tmp /= (double)2;
        }
        sum += tmp;
    }

    cout << setprecision(15) << sum << endl;
}


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

using namespace std;

class UF {
public:
    vector<int> p;
    UF(size_t n) : p(n) {
        for(size_t i=0; i<n; i++)
            p[i] = i;
    };
    int find(int x) {
        if(p[x] == x) return x;
        return p[x] = find(p[x]);
    };
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        p[x] = y;
    };
};

template<typename T>
struct SparseTable {
    using F = function<T(T,T)>;

    F f;
    vector<vector<T>> st;
    
    SparseTable(const vector<T> &v, const F &f_) : f(f_) {
        size_t b = 0;
        while(((size_t)1 << b) <= v.size()) b++;
        st.assign(b, vector<T>(1<<b));
        copy_n(v.begin(), v.size(), st[0].begin());

        for(size_t i=1; i<b; i++)
            for(int j=0; j+(1<<(i-1)) + (1<<(i-1)) < (1<<b); j++)
                st[i][j] = f(st[i-1][j], st[i-1][j + (1<<(i-1))]);
    }

    // [l, r)
    inline T query(size_t l, size_t r) const {
        size_t b = 0;

        while(((size_t)1 << b) <= (r - l)) b++;
        b--;

        return f(st[b][l], st[b][r - (1<<b)]);
    }
};


int main(void) {
    long n, k;
    cin >> n >> k;
    vector<long> p(n);
    for(auto &e: p) cin >> e;

    SparseTable<long> mi(p, [&](long a, long b){return min(a, b);});
    SparseTable<long> ma(p, [&](long a, long b){return max(a, b);});
    UF uf(n+1);

    vector<long> mas(n); // i..mas[i] is sorted
    for(int i=0; i<n; i++) {
        int j = i;
        for(; j+1<n; j++)
            if(p[j] > p[j+1]) break;
        // p[j-1] < p[j] && p[j] > p[j+1]
        for(int k=i; k<=j; k++)
            mas[k] = j;
        i = j;
    }

    auto f = [&](long i, long j) -> bool {
        // i..j-1 sorted
        if(mas[i] < j-1) return false;
        if(mas[i+k] < j+k-1) return false;

        long M = ma.query(i, j);
        long m = mi.query(i+k, j+k);

        if(ma.query(j, i+k) > m) return false;
        if(mi.query(j, i+k) < M) return false;

        return true;
    };

    for(long l=0; l+k-1<n; l++) {
        long ok=l, ng=min(n-k+1, l+k);
        while(ng - ok > 1) {
            long m = (ok + ng)/2;

            (f(l, m) ? ok : ng) = m;
        }
        for(int i=l; i+1<=ok; i++)
            uf.unite(i, i+1);
        l = ok;
    }

    {
        vector<long> scnt(n);
        for(int i=0; i<=n-k; i++)
            if(mas[i] >= i+k-1)
                uf.unite(i, n);
    }

    long r = 0;
    {
        set<int> s;
        for(int i=0; i<=n-k; i++) {
            int t = uf.find(i);
            if(s.count(t)) continue;
            s.insert(t);
            r++;
        }
    }
    cout << r << endl;
}


Measured memory_bytes: 87292
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int INF=1e9+7;
int cnt[100005];
string S1,S2;
int ABS(int x){
	return x<0?-x:x;
}
int main(){
	ios::sync_with_stdio(false);
	cin>>S1;
	rep(k,S1.length())
	if(S1[k]!='x')S2.push_back(S1[k]);
	else cnt[S2.length()]++;
	rep(k,S2.length())if(S2[k]!=S2[S2.length()-1-k]){
		cout<<"-1\n";
		return 0;
	}
	int ans=0;
	for(int k=0;k<=S2.length();k++)
	ans+=ABS(cnt[k]-cnt[S2.length()-k]);
	printf("%d\n",ans/2);
	return 0;
} 

Measured memory_bytes: 848
#include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1];
int sum;
int main(){
 int i, k, v, n, left, right;
 while(scanf("%d", &n) != EOF) { 
 for(i = 2; i <= MAX_V; i++){
  prime[i] = 1;
 }
 for(i = 2; i*i <= MAX_V; i++){
  if(prime[i]){
   for(k = 2 * i; k <= MAX_V; k += i){
    prime[k] = 0;
   }
  }
 }
 sum= 0; 
 for(i= 0; i <= n; i++){
  sum = sum + prime[i];
 }
 printf("%d\n", sum);
 }
 return 0;
}

Measured memory_bytes: 6484
import           Control.Monad (replicateM)
import           Data.List     (foldl')

main :: IO ()
main = do
  s <- getLine
  q <- readLn
  qs <- replicateM q getQuery
  putStrLn $ solve s qs

data Query = Reverse | Cons Char | Snoc Char

getQuery :: IO Query
getQuery = do
  (t:xs) <- words <$> getLine
  return $ case t of
    "1" -> Reverse
    "2" -> let [f, c] = xs in case f of
      "1" -> Cons $ head c
      "2" -> Snoc $ head c

solve :: String -> [Query] -> String
solve s qs = toList $ foldl' g (fromList s) qs
  where g xs Reverse  = rev xs
        g xs (Cons c) = cons c xs
        g xs (Snoc c) = snoc xs c

type DoubleList a = ([a], [a])

fromList :: [a] -> DoubleList a
fromList xs = (xs, [])

toList :: DoubleList a -> [a]
toList (xs, ys) = xs ++ reverse ys

rev :: DoubleList a -> DoubleList a
rev (xs, ys) = (ys, xs)

cons :: a -> DoubleList a -> DoubleList a
cons x (xs, ys) = ((x:xs), ys)

snoc :: DoubleList a -> a -> DoubleList a
snoc (xs, ys) x = (xs, (x:ys))


Measured memory_bytes: 131708
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()
#define pb push_back

#define error(x) cout << #x << " = " << x << endl

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

const int N = 1e5 + 20;
int n, m, par[N], dp[N];
string s;

deque <int> deq;

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

	cin >> n >> m;
	cin >> s;

	deq.push_front(n);

	for (int i = n - 1; i >= 0; i--)
	{
		if (s[i] == '1') continue;
		while (_sz(deq) && deq.back() > i + m) deq.pop_back();
		if (!_sz(deq)) return cout << "-1\n", 0;

		dp[i] = dp[deq.back()] + 1;
		par[i] = deq.back();

		while (_sz(deq) && dp[i] == dp[deq.front()])
			deq.pop_front();

		deq.push_front(i);
	}

	int x = 0;
	while (x != n)
	{
		cout << par[x] - x << ' ';
		x = par[x];
	}
	cout << '\n';
}


Measured memory_bytes: 1488
#include<stdio.h>
#include<limits.h>
#define N 101

int m[N][N], n;

void matrixChain(int p[]){
  int i, l, j, k, q;

  for(i = 1; i <= n; i++){
    m[i][i] = 0;
  }

  for(l = 2; l <= n; l++){
    for(i = 1; i <= n-l+1; i++){
      j = i + l - 1;
      m[i][j] = INT_MAX;
      for(k = i; k < j; k++){
	q = m[i][k] + m[k + 1][j] +  p[i - 1] * p[k] * p[j]; 
	if(m[i][j] > q){
	  m[i][j] = q;
	}
      }
    }
  }
}

main(){
  int i, r, c;
  int p[N];
  scanf("%d", &n);
  
  for(i = 0; i < n; i++){
    scanf("%d %d", &r, &c);
    if(i == 0){
      p[i] = r;
      p[i + 1] = c;
    }else{
      p[i + 1] = c;
    }
  }
  p[n] = c;
  matrixChain(p);
  printf("%d\n", m[1][n]);
  return 0;
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
int n,x;
int main(){
	scanf("%d",&n);
	int k=0;
	for(int i=1;i<=n;i++){
		scanf("%d",&x);
		k=k^x;
	}
	if(k==0) printf("Yes\n");
	else printf("No\n");
	
} 

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N;
  cin >> N;
  vector<long> data(N);
  for(int i = 0; i < N; i++)cin >> data.at(i);
  long ma;
  long mo = 1000, st = 0;
  for(int i = 0; i < N - 1; i++){
    for(int j = i + 1; j < N; j++){
      if(data.at(i) > data.at(j))break;
      else if(data.at(i) < data.at(j)){
        if(j + 1 != N){
          while(data.at(j) <= data.at(j + 1)){
            j++;
            if(j + 1 == N)break;
          }
        }
        st = mo / data.at(i);
        mo %= data.at(i);
        mo += data.at(j) * st;
        st = 0;
        i = j;
        break;
      }
    }
  }
  cout << mo << endl;
  return 0;
}

Measured memory_bytes: 3488
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  string s;
  cin >> s;
  int one = 0, two = 0;
  for (int i = 0; i < s.size(); i++) {
    if (i % 2) {
      one += (s[i] != '1');
      two += (s[i] != '0');
    } else {
      one += (s[i] != '0');
      two += (s[i] != '1');
    }
  }
  cout << min(one, two) << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, color, D; vll path; ll pre = 0;
int main() {
	string S, T;
	cin >> S >> T;
	N = S.length();
	M = T.length();
	vll A(26);
	for (i = 0; i < N; i++) {
		A[S[i] - 'a'].push_back(i);
	}
	ll now = -1;
	ll next = 0;
	for (i = 0; i < M; i++) {
		ll key = T[i] - 'a';
		//debug(key,ans);
		if (A[key].size() == 0) {
			cout << -1;
			exit(0);
		}
		if (*A[key].rbegin() <= now) {
			next = A[key][0];
			ans += N - now + next;
			now = next;
		}
		else {
			next = *lower_bound(A[key].begin(), A[key].end(), now + 1);
			ans += next - now;
			now = next;
		}
	}
	cout << ans;
}

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

class Sine
{
    static void Main()
    {
        int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

        var max = Math.Max(input[0] + input[1], Math.Max(input[0] - input[1], input[0] * input[1]));

        Console.Write(max);
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

const int maxn = 100010;

int a[maxn], n;

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    int ans = 0;
    for (int i = 0; i <= n; i++) ans += abs(a[i]-a[i+1]);
    for (int i = 1; i <= n; i++) {
        int t = ans-abs(a[i]-a[i-1])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1]);
        printf("%d\n", t);
    }
    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <map>

int main() {
    int n; std::cin >> n;
    std::map<int, int> l, r;
    for (int i = 0; i < n; i++) {
        int v; std::cin >> v;
        auto& c = (i%2)?l:r;
        c[v]++;
    }

    std::vector<std::pair<int, int>>L, R;
    for (const auto& ll: l) {
        L.push_back(std::make_pair(ll.first, ll.second));
    }
    for (const auto& rr: r) {
        R.push_back(std::make_pair(rr.first, rr.second));
    }
    std::sort(L.begin(), L.end(), [](const auto& x, const auto& y){return x.second > y.second;});
    std::sort(R.begin(), R.end(), [](const auto& x, const auto& y){return x.second > y.second;});

    int rrr = R[0].second, lll = L[0].second;

    if (L[0].first == R[0].first) {
        if (L.size() == 1 && R.size() == 1) {
            rrr = 0;
        } else if (L.size() == 1) {
            rrr = R[1].second;
        } else if (R.size() == 1) {
            lll = L[1].second;
        } else {
            if (L[1].second < R[1].second) {
                rrr = R[1].second;
            } else {
                lll = L[1].second;
            }
        }
    }

    std::cout << n / 2 - lll + n / 2 - rrr << std::endl;
    return 0;
}

Measured memory_bytes: 6140
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    n = int(input())

    fib = [0]*(n+1)
    fib[0] = 1
    fib[1] = 1
    for i in range(2, n+1):
        fib[i] = fib[i-1]+fib[i-2]

    print(fib[n])

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 5604
import sys
from heapq import heappush, heappop
readline = sys.stdin.buffer.readline
write = sys.stdout.write

def solve():
    N, M, C = map(int, readline().split())
    if N == M == C == 0:
        return False
    G = [[] for i in range(N)]
    for i in range(M):
        f, t, c = map(int, readline().split()); f -= 1; t -= 1
        G[f].append((t, c))
    INF = 10**18
    dist = [[INF]*(N+1) for i in range(N)]
    que = [(0, 0, 0)]
    dist[0][0] = 0
    while que:
        cost, v, k = heappop(que)
        if dist[v][k] < cost:
            continue
        for w, d in G[v]:
            if cost + d < dist[w][k]:
                dist[w][k] = cost + d
                heappush(que, (cost + d, w, k))
            if k < N and cost < dist[w][k+1]:
                dist[w][k+1] = cost
                heappush(que, (cost, w, k+1))
    for k in range(N+1):
        if dist[N-1][k] <= C:
            write("%d\n" % k)
            break
    return True

while solve():
    ...



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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> cnt(N, 0);
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        a--;
        cnt[a]++;
    }
    sort(cnt.begin(), cnt.end(), greater<int>());

    int res = 0;
    for (int i = K; i < N; i++)
        res += cnt[i];

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys

input = sys.stdin.readline
P = 2019


def main():
    S = input().rstrip()

    N = len(S)
    count = [0] * P
    count[0] += 1
    T = 0
    for i in range(N):
        T = (T + int(S[(N - 1) - i]) * pow(10, i, mod=P)) % P
        count[T] += 1

    ans = 0
    for k in count:
        ans = (ans + k * (k - 1) // 2)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9248
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

const int MAXN = 1000000;
Int fact[MAXN], inv[MAXN];

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

void init_fact() {
    fact[0] = 1;
    for(int i=1; i<MAXN; i++) {
        fact[i] = (fact[i-1] * i) % MOD;
    }

    inv[MAXN - 1] = mod_pow(fact[MAXN - 1], MOD-2);
    for(int i=MAXN - 2; i>=0; i--) {
        inv[i] = (inv[i+1] * (i+1)) % MOD;
    }
}

Int comb(int n, int r) {
    if(r < 0 || n < r) return 0;
    return fact[n] * inv[n-r] % MOD * inv[r] % MOD;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

int h[300];
double dp[300][300];

double calc(int high, int left, int right){
    int flag = 0;
    if (high < left){
        flag ^= 1;
    }
    if (high < right){
        flag ^= 1;
    }

    double a, b;
    a = abs(high-left);
    b = abs(high-right);
    if (flag){
        return a*a/(a+b)/2.0 + b*b/(a+b)/2.0;
    }else{
        return (a+b)/2.0;
    }
}

int main(){
    cin.tie(0);

    int N; cin >> N;
    double INF = 300*300;
    for (int i = 0; i < 300; i++){
        for (int j = 0; j < 300; j++){
            dp[i][j] = INF;
        }
    }

    for (int i = 0; i < N; i++){
        cin >> h[i];
    }
    for (int i = 1; i < 300; i++){
        dp[0][i] = calc(h[0], 1, i); 
    }
    for (int i = 1; i < N; i++){
        for (int j = 1; j < 300; j++){
            for (int k = 1; k < 300; k++){
                dp[i][k] = min(dp[i][k], calc(h[i], j, k)+dp[i-1][j]);
            }
        }
    }
    double ans = INF;
    for (int i = 1; i < 300; i++){
        ans = min(ans, dp[N-1][i]);
    }

    printf("%.12f\n", ans);


    return 0;

}




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

#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384


int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}    //最大公約数
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}     //最小公倍数
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} //コンビネーション
int nHr(int a,int b){return nCr(a+b-1,b);}       // 重複組み合わせ
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}  //階乗
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} // a~bまでの階乗
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}   //数字の各位の和
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}  // b進数の各位の和？
int sankaku(int x){return ((1+x)*x)/2;} //三角数 xまでの和

//以下long long ver
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}

//double
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}


typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;
 
/*CODE START HERE*/
int main() {
  string a, b;
  cin >> a >> b;
  if (a.size()< b.size()){
    cout << "LESS" <<endl;
  }else if ( a.size() > b.size()){
    cout << "GREATER" << endl;
  }else {
    cout << ( a<b ? "LESS" : a==b ? "EQUAL" : "GREATER") << endl;
  } 
}

Measured memory_bytes: 3620
import sys

while 1:
    x = sys.stdin.readline().strip()
    x_list = list(map(int,x.split(" ")))
    
    if x_list[0] == 0 and x_list[1] == 0 :
        break
    
    x_list.sort()
    print(x_list[0],x_list[1])

Measured memory_bytes: 7956
S = input()
N = len(S)
ans = 'No'
cnt = 0
for i in range(int((N - 1) / 2) - 1):
    if S[i] == S[(-1) - i]:
        continue
    else:
        break
else:
    for i in range(int((N + 3) / 2) - 1, N - 1):
        if S[i] == S[(-1) - cnt]:
            cnt += 1
            continue
        else:
            break
    else:
        ans = 'Yes'
print(ans)

Measured memory_bytes: 3064
//$g++ -std=c++11 Template.cpp 

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

priority_queue<int> q_descending;
priority_queue<int, vector<int>, greater<int> > q_ascending;

int f(ll v){
  ll ans = 0LL;
  while(v > 0){
    v /= 10;
    ans++;
  }
  return ans;
}

int
main(void){  
  ios_base::sync_with_stdio(false);

  ll n;
  cin >> n;

  ll ans = 1e10+1;
  FOR(i, 1, sqrt(n)+1){
    if(n%i == 0) {
      ans =  min((int)ans, max(f(i), f(n/i)));
      //cout << "i: " << i << " n/i: " << n/i << " ans: " << ans << endl;
      //cout << "f(i): " << f(i) << " f(n/i): " << f(n/i) << endl;
    }
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

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


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;

int main() {
    int A, P;
    cin >> A >> P;

    int sum ;

    sum = A*3;
    sum += P;

    cout << sum/2 << endl;


}

Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())
ans = ''
ans += 'R' * (tx - sx) + 'U' * (ty - sy)
ans += 'L' * (tx - sx) + 'D' * (ty - sy)
ans += 'D' + 'R' * (tx - sx + 1) + 'U' * (ty - sy + 1) + 'L'
ans += 'U' + 'L' * (tx - sx + 1) + 'D' * (ty - sy + 1) + 'R'
print(ans)

Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    N,K=mis()
    H=lmis()
    H.sort(reverse=True)
    print(sum(H[K:]))

main()


Measured memory_bytes: 27756
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

typedef long long ll;

int read() {
	char ch;
	for(ch=getchar();ch<'0'||ch>'9';ch=getchar());
	int x=ch-'0';
	for(ch=getchar();ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

const int N=3e5+5;

int n,L,x[N],t[N],l[N],r[N];
ll ans;

int main() {
	n=read();L=read();
	fo(i,1,n) x[i]=read();
	fo(i,1,n) t[i]=read();
	fo(i,1,n) {
		if (!(t[i]%(L<<1))) ans+=t[i]/(L<<1);
		else {
			ans+=t[i]/(L<<1)+1;t[i]%=(L<<1);
			l[i]=t[i]<=(x[i]<<1);
			r[i]=t[i]<=((L-x[i])<<1);
		}
	}
	int x=0,y=0;
	fo(i,1,n-1) {
		if (x&&r[i]) {
			x--;ans--;
			if (l[i]) ++y;
		} else if (!l[i]&&r[i]) {
			if (y) y--,x++;
		} else if (l[i]) x++;
	}
	if (!r[n]) ans++;
	printf("%lld\n",(long long)ans*(L<<1));
	return 0;
}

Measured memory_bytes: 4864
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
const int N=2e5+5;
char s[N];
int dp[1<<26],f[N];
int main()
{
    memset(dp,inf,sizeof(dp));
    scanf("%s",s+1);
    int n=strlen(s+1);
    dp[0]=0;
    int st=0;
    for(int i=1;i<=n;i++)
    {
        st^=1<<s[i]-'a';
        f[i]=dp[st]+1;
        for(int j=0;j<26;j++)
            f[i]=min(f[i],dp[st^(1<<j)]+1);
        dp[st]=min(dp[st],f[i]);
    }
    printf("%d\n",f[n]);
}


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

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

Measured memory_bytes: 256
S=input()
capital=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]

if S[0]!="A":
    print("WA")
else:
    p=0
    for i in range(2,len(S)-1):
        if S[i]=="C":
            p+=1
    if p!=1:
        print("WA")
    else:
        q=0
        for i in range(len(S)):
            if S[i] in capital:
                q+=1
        if q!=2:
            print("WA")
        else:
            print("AC")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
using namespace std;
int main(){
    long long d,t,s;
    cin>>d>>t>>s;
    if(d%s!=0){
        d=d/s+1;
    }
    else{
        d=d/s;
    }
    if(d<=t){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

class ModTools:
    """ 階乗たくさん使う時用のテーブル準備 """

    def __init__(self, MAX, MOD):
        """ MAX：階乗に使う数値の最大以上まで作る """
        
        MAX += 1
        self.MAX = MAX
        self.MOD = MOD
        # 階乗テーブル
        factorial = [1] * MAX
        factorial[0] = factorial[1] = 1
        for i in range(2, MAX):
            factorial[i] = factorial[i-1] * i % MOD
        # 階乗の逆元テーブル
        inverse = [1] * MAX
        # powに第三引数入れると冪乗のmod付計算を高速にやってくれる
        inverse[MAX-1] = pow(factorial[MAX-1], MOD-2, MOD)
        for i in range(MAX-2, 0, -1):
            # 最後から戻っていくこのループならMAX回powするより処理が速い
            inverse[i] = inverse[i+1] * (i+1) % MOD
        self.fact = factorial
        self.inv = inverse
    
    def nCr(self, n, r):
        """ 組み合わせの数 (必要な階乗と逆元のテーブルを事前に作っておく) """

        if n < r: return 0
        # 10C7 = 10C3
        r = min(r, n-r)
        # 分子の計算
        numerator = self.fact[n]
        # 分母の計算
        denominator = self.inv[r] * self.inv[n-r] % self.MOD
        return numerator * denominator % self.MOD

N, K = MAP()
A = LIST()

mt = ModTools(N, MOD)
A.sort()
mncnt = [0] * N
for i in range(N):
    mncnt[i] = mt.nCr(N-i-1, K-1)
mxcnt = mncnt[::-1]

mnsm = 0
mxsm = 0
for i in range(N):
    mnsm += A[i] * mncnt[i]
    mxsm += A[i] * mxcnt[i]
    mnsm %= MOD
    mxsm %= MOD
ans = mxsm - mnsm
ans %= MOD
print(ans)


Measured memory_bytes: 63344