akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD (long long)1000000007
using namespace std;

int main(void){
    int n,q;
    cin >> n >> q;
    vector<int> count(n+1,0);
    string s;
    cin >> s;
    for(int i=1; i<s.length(); i++){
        if(s[i-1]=='A' && s[i]=='C')count[i]++;
        count[i+1]+=count[i];
    }
    int l,r;
    for(int i=0; i<q; i++){
        cin >> l >> r;
        cout << count[r-1]-count[l-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1408
from itertools import combinations
n,m,x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]

ans = 10**9
for i in range(1, n+1):
  for j in combinations(ca,i):
    t = [0]*(m+1)
    for k in j:
      for l in range(m+1):
        t[l] += k[l]
    #if all(t[num] >= x for num in range(1,m)):
    if min(t[1:]) >= x:
      ans = min(ans, t[0])

if ans == 10**9:
  print(-1)
else:
  print(ans)

Measured memory_bytes: 9228
#include<stdio.h>
int main(void)
{
  int children,i,candy;
  char str[4];
  fgets(str,sizeof(str),stdin);
  sscanf(str,"%d",&children);
  for(i=1;i<=children;i++)
  {
    candy += i;
  }
  printf("%d",candy);
  return 0;
}

Measured memory_bytes: 384
//--------------------------------------------------
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,avx,avx2,popcnt,fma")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Ofast")
//--------------------------------------------------
#include <bits/stdc++.h>
#include <chrono>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <cassert>
#include <random>
#include <bitset>
#include <iomanip>
#include <numeric>
#include <time.h>
#include <ctime>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <fstream>
#include <stack>
#include <cstring>
//--------------------------------------------------
#define forn(i, n) for(int i = 0; i < n; i++)
#define forw(i, n) for(int i = n-1; i >= 0; --i)
#define forns(i, n, s) for(int i = s; i < n; i++)
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
//----------------------------------------------------
using namespace std;
//----------------------------------------------------
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
typedef vector<ll> lnum;
typedef complex<ld> comp;
//----------------------------------------------------
const ll mod = 1e9 + 7, mod2 = 998244353;
const ld eps = 1e-6;
const ll inf = 1e18;
const int base = 1e9;
const ld PI = 3.1415926;
//----------------------------------------------------
//#define endl '\n';
#ifdef MY_DEBUG
void deb(ld x) { cerr << x << endl; };
#else
void deb(ld x){};
#endif
//----------------------------------------------------
ll n, k;
ll fact[2*100*1000+1];
//----------------------------------------------------
unsigned int bitcount(ull val) { return __builtin_popcount(val) + __builtin_popcount(val >> 32); }

void local() {
    freopen("test.in", "r", stdin);
}

void remote() {
}

void read() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> k;
}


ll binpow(ll val, ll pw){
    ll res = 1;
    while (pw > 0){
        if(pw & 1) res *= val, res %= mod;
        val *= val, val %= mod;
        pw >>= 1;
    }
    return res;
}

ll c(ll n, ll k){
    return (((fact[n] * binpow(fact[k], mod-2)) % mod) * binpow(fact[n-k], mod-2)) % mod;
}

int main() {
#ifdef MY_DEBUG
    local();
#else
    remote();
#endif
    read();

    fact[0] = 1;
    forns(i, n+1, 1) fact[i] = (fact[i-1] * i) % mod;

    ll ans = 0;
    forn(i, min(n, k+1)){
        ans += (c(n, i) * c(n-i + (i-1), (n-i-1)) ) % mod, ans %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
using namespace std;
int main(){
    string S;
    vector <int> flag(4,0);
    vector <int> answer(4,2);
    cin>>S;
    for(int i=0;i<4; i++){
        
        for(int j=0; j<4; j++){
            if(S.at(i)==S.at(j)){
               flag.at(i)++;
            }
        }
    }
    
    if(flag==answer){
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>

using namespace std;

int main() {
  int k;
  cin >> k;
  int ans = 0;
  for (int a = 1; a <= k; a++) {
    for (int b = 1; b <= k; b++) {
      for (int c = 1; c <= k; c++) {
        ans += gcd(a, gcd(b, c));
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3172
S = list(input())
Kisuu = ['R','U','D']
Guusuu = ['L','U','D']

for i in range(len(S)):
    if i%2!=0:
        if not S[i] in Guusuu:
            print('No')
            exit()
    else:
        if not S[i] in Kisuu:
            print('No')
            exit()
print('Yes')

Measured memory_bytes: 3060
class Dice:
    top     = -1
    front   = -1
    right   = -1
    left    = -1
    back    = -1
    bottom  = -1
    
    def __init__(self, top, front, right, left, back, bottom):
        self.top, self.front, self.right, self.left, self.back, self.bottom = top, front, right, left, back, bottom
    
    def rolltoN(self):
        self.top, self.front, self.back, self.bottom = self.front, self.bottom, self.top, self.back
    
    def rolltoS(self):
        self.top, self.front, self.back, self.bottom = self.back, self.top, self.bottom, self.front
    
    def rolltoW(self):
        self.top, self.right, self.left, self.bottom = self.right, self.bottom, self.top, self.left
    
    def rolltoE(self):
        self.top, self.right, self.left, self.bottom = self.left, self.top, self.bottom, self.right
    
    def returntop(self):
        return self.top

a,b,c,d,e,f = map(int, input().split())
dice = Dice(a,b,c,d,e,f)
strorder = input()

for c in strorder:
    if c == 'N':
        dice.rolltoN()
    elif c == 'S':
        dice.rolltoS()
    elif c == 'W':
        dice.rolltoW()
    elif c == 'E':
        dice.rolltoE()
print(dice.returntop())


Measured memory_bytes: 5608
n = int(input())
s = input()

s = list(s)
ans = 0
count = 0

for a in range(1, n):
    l1 = list(set(s[:a]))
    l2 = list(set(s[a:]))

    length1 = len(l1)

    for x in range(length1):
        if l1[x] in l2:
            count += 1
    ans = max(ans, count)
    count = 0

print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
    #define fio ios_base::sync_with_stdio(false), cin.tie(NULL)
    #define ll long long
    #define int long long 
    #define ull unsigned long long 
    #define ld long double
    #define sb __builtin_popcount
    #define vi vector<int>
    #define vc vector<char>
    #define ii pair<int, int>
    #define pq priority_queue<ii, vector<ii>, greater<ii>>
    #define vii vector<ii>
    #define sz(a) int((a).size())
    #define f(a, b) for (int i = a; i < b; i++)
    #define fr(a, b) for (int i = a - 1; i >= b; i--)
    #define tr(x, m) for (auto x : m)
    #define in(a, b) (b.find(a) != string::npos)
    #define minin(a) *min_element(all(a))
    #define maxin(a) *max_element(all(a))
    #define X first
    #define Y second
    #define fill(a, x) memset(a, x, sizeof(a))
    #define pb push_back
    #define pf push_front
    #define mp make_pair
    #define all(v) v.begin(), v.end()
    #define rall(v) reverse(v.begin(), v.end())
    #define unq(v) v.erase(unique(all(v)), v.end())
    #define el "\n"
    #define mx3(a, b, c) max(max(a, b), c)
    #define mn3(a, b, c) min(min(a, b), c)
    #define S(v) accumulate(all(v), (ll)0)
    #define SP(n) cout.precision(n)
    const ld PI = atan(1.0) * 4.0;
    const ll MOD = 1e9 + 7;
    const ll INF = 1e18;
    const ld EPS = 0.0000001;
    const ll MD = 998244353;
    
    int32_t main() {
        fio;
        SP(10);
        ld n;
        cin>>n;
        int ans=100;
        ld r=1;
        for(int i=1;;i++){
           ans += ans*(0.01);
           if(ans>=n){
              cout<<i<<el;
              return 0;
           }
        }
        return 0;
    }


Measured memory_bytes: 3760
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
using namespace std;
typedef pair<int,int> P;//Pでpair<-,->を表す。
typedef long long LL; 

int main()
{ 
    int n;
    cin>>n;
    int a[n+1];
    a[0]=0;
    int flg=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(a[i]==1){
            flg=1;
        }
    }
    if(flg==0){
        cout<<-1<<endl;
        return 0;
    }
    int ans=0;
    int cnt=1;
    for(int i=1;i<=n;i++){
        if(a[i]==cnt){
            cnt++;
        }
        else{ans++;}
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
a, b, c, d, e, f = map(int, input().split())

ans = [100 * a, 0]
for ka in range(f // (100 * a) + 1):
    for kb in range(f // (100 * b) + 1):
        for kc in range(f // c + 1):
            l = 0
            r = f // d + 1
            while 1 < r - l:
                m = (l + r) // 2
                sg = kc * c + m * d
                sw = 100 * ka * a + 100 * kb * b + sg
                if f < sw:
                    r = m
                    continue
                if (100 + e) * sg <= sw * e:
                    l = m
                else:
                    r = m
            kd = l
            sg = kc * c + kd * d
            sw = 100 * ka * a + 100 * kb * b + sg
            if sw <= f and (100 + e) * sg <= sw * e and ans[1] * sw < ans[0] * sg:
                ans = [sw, sg]
print(' '.join(map(str, ans)))

Measured memory_bytes: 45676
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, ll> P;
#define MOD (1000000007ll)
#define l_ength size

vector<int> g[225816];

int main(void){
	int n,m,i,j,a,b;
	bool flag = false;
	cin >> n >> m;
	for(i=0; i<m; ++i){
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	for(i=(g[1].l_ength()-1); i>=0; --i){
		a = g[1][i];
		for(j=(g[a].size()-1); j>=0; --j){
			if(g[a][j] == n){
				flag = true;
				break;
			}
		}
		if(flag){
			break;
		}
	}
	cout << ((flag)?"POSSIBLE":"IMPOSSIBLE") << endl;
	return 0;
}


Measured memory_bytes: 12528
X, Y = map(int,input().split())

if Y%2 == 1:
    print('No')
    exit()

turu = (4* X - Y)/2
kame = (Y - 2*X)/2

if turu.is_integer() and turu >= 0 and kame.is_integer() and kame >=0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9184
//****************************//
/**********  main *************/
//****************************//
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
#include <math.h> 

using namespace std;
typedef long long ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i, n) for (i = 0; i < n; i++)
#define FOR(i, a, b) for (i = a; i < b; i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())

int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int main()
{

    std::cin.tie(0);

    ll a,b,c,k;
    ll res;
    cin >> a >> b >> c >> k;

    ll tmp = k-b;

    if(k-a<0){
        res = k;
        cout << res << endl;
        return 0;       
    }

    if((a-tmp) >= 0){
        res = a;
    }

    if((a-tmp)<0){
        res = a + (a - tmp);
    }

    cout << res << endl;
    return 0;

}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define itn int

int main(void){
    string s;
    cin >> s;
    int sum = 0;
    for(int i = 0;i+1 < s.size();i++){
        if(s[i] != s[i+1])sum++;
    }
    cout << sum << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
void main_sub(void);
int main(int argc, char* argv[]) {
    cout << std::fixed << std::setprecision(10);
    main_sub();
    return 0;
}
// int を int64_t にする
// g++ に -DUSE_STRICT_INT をつけるか、
// 下のコメントアウトを外すと無効化
// #define USE_STRICT_INT
using i64 = int64_t;
#ifndef USE_STRICT_INT
#define int i64
#endif
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF = (1 << 30);
constexpr i64 INFL = (1LL << 62);
constexpr i64 MOD = 1000000007;

void main_sub(void) {
    int n, d, a;
    cin >> n >> d >> a;
    vector<pair<int, int>> x(n);
    rep(i, n) { cin >> x[i].first >> x[i].second; }

    sort(all(x), [](auto const& lhs, auto const& rhs) {
        return lhs.first < rhs.first;
    });
    d = d * 2;
    int tot = 0;
    queue<pair<int, int>> q;
    int ans = 0;
    rep(i, n) {
        int xi = x[i].first;
        int h = x[i].second;
        while (q.size() && q.front().first < xi) {
            tot -= q.front().second;
            q.pop();
        }
        h -= tot;
        if (h > 0) {
            int num = (h + a - 1) / a;
            ans += num;
            int damage = num * a;
            tot += damage;
            q.emplace(xi + d, damage);
        }
    }
    cout << ans << endl;
    // rep(i, n) { cout << x[i].first << " " << x[i].second << endl; }
    return;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int n;
int h[110];

int rec(int l, int r)
{
  if(l == r) return h[l];

  int mi = 1001001001;
  REP(m, l, r){
    if(h[m] == 0){
      if(m == l) return rec(l+1, r);
      if(m == r) return rec(l, r-1);
      else return rec(l, m-1) + rec(m+1, r);
    }
    chmin(mi, h[m]);
  }
  
  REP(m, l, r) h[m] -= mi;
  return rec(l, r) + mi;
}

int main(){
  cin >> n;
  rep(i, n) cin >> h[i];

  cout << rec(0, n-1) << endl;

  return 0;
}


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

int main(){
    int n,q;
    cin >> n ;
    vector<int> a(n);
    vector<int> count(100001,0);
    for(int i = 0;i < n;i++){
        cin >> a[i];
        count[a[i]]++;
    }
    cin >> q;
    ll ans = 0;
    for (int i = 0; i < 100002; i++){
        ans += i*count[i];
    }
    vector<int> b(q);
    vector<int> c(q);
    for(int i = 0;i < q;i++){
        cin >> b[i] >> c[i];
        count[c[i]] += count[b[i]];
        ans += (c[i]-b[i])*count[b[i]]; 
        count[b[i]] = 0;
        cout << ans << endl;
    }
    
}

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

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    cout << (abs(x-a) < abs(x-b) ? 'A' : 'B') << endl;
}


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

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

using ll = long long;
using P = pair<ll,ll>;
using grid = vector<vector<int>>;

const int dx[2] = {1, 0};
const int dy[2] = {0, 1};
const int INF = 1<<30;
const ll mod = 998244353LL;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int K,S;
    cin>>K>>S;
    int ans = 0;
    rep(i,K+1){
        if(S-i<0||S-i>2*K) continue;
        if(S-i<=K) ans += S-i+1;
        else ans += 2*K-(S-i) +1;
    }
    cout<<ans<<endl;
}

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

int H, W;
char s[51][51];
int res[51][51] = {}; 

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

int main() {
    cin >> H >> W;
    for(int i=0; i<H; ++i) {
        for(int j=0; j<W; ++j) cin >> s[i][j];
    }
    for(int i=0; i<H; ++i) {
        for(int j=0; j<W; ++j) {
            if(s[i][j] == '#') {
                res[i][j] = -1;
                continue;
            }
            for(int k=0; k<8; ++k) {
                int x = i + dx[k], y = j + dy[k];
                if(x >= 0 && x < H && y >= 0 && y < W && s[x][y] == '#') ++res[i][j]; 
            }
        }
    }
    for(int i=0; i<H; ++i) {
        for(int j=0; j<W; ++j) {
            if(res[i][j] == -1) cout << '#';
            else cout << res[i][j];
        }
        cout << '\n';
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
const ll INF = 1ll<<60;
vector<vector<ll>> ans(300, vector<ll>(300,INF));
//2020-07-03 05:32:32
//writer SakaTaku
//Dijkstra法   O(|E|log|V|)
struct Edge {int to; ll cost;};
typedef pair<ll, int> P;
typedef pair<P, ll> Pl;
int V;
int n, m, l;
struct Dijkstra {
   int V;
   vector<vector<Edge>> G;
   Dijkstra(int V):V(V),G(V){}
   void add(int v, int w, int cost){
      Edge e;
      e.to = w; e.cost = cost;
      G[v].push_back(e);
   }
   ll inf = (1ll<<60);
   vector<ll> d;
   void solve(int s){
      priority_queue<Pl, vector<Pl>, greater<Pl>> que;
      d = vector<ll>(V,inf);
      d[s] = 0;
      que.push({{0,s},l});
      while (!que.empty()){
         Pl pl = que.top(); que.pop();
         ll fuel = pl.second;
         P p = pl.first;
         if (d[p.second] < p.first)continue;
         for (auto &&e : G[p.second]){
            if (e.cost > l)continue;
            if (fuel < e.cost){
               if (d[e.to] > d[p.second]+fuel+e.cost){
                  d[e.to] = d[p.second] + e.cost+fuel;
                  que.push({{d[e.to], e.to},l-e.cost});
               }
            }
            else{
               if (d[e.to] > d[p.second] + e.cost){
                  d[e.to] = d[p.second] + e.cost;
                  que.push({{d[e.to], e.to},fuel-e.cost});
               }
            }
         }
      }
      rep(i,d.size()){
         if (d[i]==inf)
            ans[s][i] = -1;
         else   
            ans[s][i] = (d[i]-1)/l;
      }
   }
};
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   cin>>n>>m>>l;
   Dijkstra D(n);
   rep(i,m){
      int a, b, c; cin>>a>>b>>c;
      a--;b--;
      D.add(a, b, c);
      D.add(b, a, c);
   }
   int q; cin>>q;
   while(q--){
      int s, t; cin>>s>>t;
      s--;t--;
      if (ans[s][t] != INF)
         cout << ans[s][t] << endl;
      else if (ans[s][t] == -1)
         cout << ans[s][t] << endl;
      else{
         D.solve(s);
         cout << ans[s][t] << endl;
      }
   }
}

Measured memory_bytes: 8064
r,c=gets.split(" ").map(&:to_i)
h = Array.new(r+1).map{Array.new(c+1,0)} 

for i in 1..r                                       # 変数 i を1からrまで増やして繰り返し処理する。
    
a= gets.split.map(&:to_i)
    for j in 1..c                                   # 変数 i を1からcまで増やして繰り返し処理する。
    h[i-1][j-1] = a[j-1]
    h[i-1][c] += a[j-1]
    h[r][j-1] += a[j-1]
    h[r][c] += a[j-1]
    end
end
for i in 0..r
    for j in 0..c
      print " " unless j == 0
      print h[i][j]
    end
    puts
  end



Measured memory_bytes: 7052
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public static void Main()
    {
        string input = Console.ReadLine();
        bool flag = false;
        for (int i = 1; i < input.Length; i++)
        {
            if (input[i - 1] != input[i]) flag = true;
        }
        if (flag == true) { Console.WriteLine("Yes"); }
        else { Console.WriteLine("No"); }
    }
}

Measured memory_bytes: 13140
#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 n,k;
    cin >> n >> k;
    vector <int> p(n);
    rep(i,n){
        cin >> p[i];
    }
    sort(p.begin(),p.end());
    int ans=0;
    rep(i,k){
        ans+=p[i];
    }

    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s,t;
  cin >> s;
  cin >> t;
  int ans = 0;
  for(int i = 0; i < s.length(); i++) {
    if(s.at(i) != t.at(i)) {
      ans += 1;
    }
  }
  cout << ans << endl;
}


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

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline T gcd(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T lcm(T a,T b){return a*b/gcd(a,b);}

const ll INF = 1LL << 60;



//大文字小文字気をつけろ


int main(){
  int n;
  bool a=1;
  cin >> n;
  int t[1000000],x[1000000],y[1000000];
  FOR(i,n){
    cin >> t[i] >> x[i] >> y[i];
  }
  int v=0,nowx=0,nowy=0;
  FOR(i,n){
    if((t[i]-v)>=(abs(nowx-x[i])+abs(nowy-y[i])) && ((t[i]-v)-(abs(nowx-x[i])+abs(nowy-y[i])))%2==0){
      v=t[i];
      nowx=x[i];nowy=y[i];
    }else{
      a=0;
      break;
    }
  }
  if(a){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

}


Measured memory_bytes: 6784
import sys
input = sys.stdin.readline


def main():
    H, W = map(int, input().split())
    A = [list(input()[:-1]) for _ in range(H)]

    dp = [[0]*W for _ in range(H)]
    dp[0][0] = 1
    for h in range(H):
        for w in range(W):
            if h+1<H and A[h][w]==".":
                dp[h+1][w] += dp[h][w]
            if w+1<W and A[h][w]==".":
                dp[h][w+1] += dp[h][w]
    
    print(dp[H-1][W-1]  % (10**9 + 7))


if __name__ == '__main__':
    main()

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

struct Card {
    char suit, value;
};

void bubble(struct Card a[], int n) {
    for (int i = 0; i < n; i++) {
        for (int j = n - 1; j >= i + 1; j--) {
            if (a[j].value < a[j-1].value) {
                swap(a[j], a[j-1]);
            }
        }
    }
}

void selection(struct Card a[], int n) {
    for (int i = 0; i < n; i++) {
        int minj = i;
        for (int j = i; j < n; j++) {
            if (a[j].value < a[minj].value) {
                minj = j;
            }
        }
        swap(a[i], a[minj]);
    }
}

void print(struct Card a[], int n) {
    for (int i = 0; i < n; i++) {
        if (i > 0) {
            cout << " ";
        }
        cout << a[i].suit << a[i].value;
    }
    cout << endl;
}

bool isStable(struct Card c1[], struct Card c2[], int n) {
    for (int i = 0; i < n; i++) {
        if (c1[i].suit != c2[i].suit) {
            return false;
        }
    }
    return true;
}

int main() {
    Card c1[100], c2[100];
    int n;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> c1[i].suit >> c1[i].value;
    }
    for (int i = 0; i < n; i++) {
        c2[i] = c1[i];
    }

    bubble(c1, n);
    selection(c2, n);

    print(c1, n);
    cout << "Stable" << endl;
    print(c2, n);
    if (isStable(c1, c2, n)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }
}



Measured memory_bytes: 3096
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
// #define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr double EPS = 1e-9;



int main() {


    

    // int n,k;
    // cin>>n>>k;
    
    // si s;
    // rep(i,k){
    //     int d;
    //     cin>>d;
    //     rep(j,d){
    //         int D;
    //         cin>>D;
    //         s.insert(D);
    //     }
    // }
    // fin(n-s.size());
    string s;
    cin>>s;
    if(s=="ABC")fin("ARC");
    else fin("ABC");
}



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

long long printNcR(int n, int r){
    long long p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
            long long m = __gcd(p, k); 
            p /= m; 
            k /= m; 
  
            n--; 
            r--; 
        } 
    } 
  
    else
        p = 1; 
    return p;
} 

int main(){
    int n;
    map<vector<int>,long long> bmap;
    cin>>n;
    while(n){
        string s;
        vector<int> bset(26,0);
        cin>>s;
        for(auto i:s){
            bset[i-'a']++;
        }
        bmap[bset]++;
        n--;
    }    
    long long ans=0;
    for(auto i:bmap){        
        if(i.second>1){
            ans +=printNcR(i.second,2);
        }        
    }
    cout<<ans;
}

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

#define REP(i,n) for ( int i=1; i<=int(n); i++ )  
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;
typedef pair<LL, int> pii;
typedef long double LD;
const int INF = 0x3f3f3f3f;

template <class T>  
inline bool RD(T &ret) {  
        char c; int sgn;  
        if (c = getchar(), c == EOF) return 0;  
        while (c != '-' && (c<'0' || c>'9')) c = getchar();  
        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  
        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  
        ret *= sgn;  
        return 1;  
}  
template <class T>  
inline void PT(T x) {  
        if (x < 0) putchar('-') ,x = -x;  
        if (x > 9) PT(x / 10);  
        putchar(x % 10 + '0');  
}

const int N = 1e5 + 100;

LL a[N];
LL d[N];
int main() {
	int n;
	cin >> n;
	LL sum = 0;
	for(int i = 0; i < n; i ++) scanf("%lld", &a[i]);
	for(int i = 0; i < n; i ++) {
		sum += a[i];
		d[i] = a[i] - a[(i - 1 + n) % n]; 
	}
	if(sum % ((1 + n) * 1LL * n / 2) ) return puts("NO") * 0;
	LL K = sum / ((1 + n) * 1LL * n / 2);
	LL c = 0;
	for(int i = 0; i < n; i ++) {
		int t = (K - d[i]) / n;
		if(t < 0 || t > K || (K - d[i]) % n) return puts("NO") * 0;
		c += (K - d[i]) / n;
	}
	if(c == K) puts("YES");
	else puts("NO");
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <bitset>
#include <stack>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)

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;
    }
}
int main(void)
{
    int N, X, T;
    cin >> N >> X >> T;
    if (N % X != 0)
    {
        cout << T * (int)((N / X) + 1);
    }
    else
    {
        cout << T * N / X;
    }
    return 0;
}

Measured memory_bytes: 3632
import copy

h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]

ans = 0
for x in range(2**h):
    for y in range(2**w):
        cnt = 0
        tmp = copy.deepcopy(c)
        for i in range(h):
            if x >> i & 1:
                tmp[i] = ['r']*w
        for j in range(w):
            if y >> j & 1:
                for i in range(h):
                    tmp[i][j] = 'r'
        for i in range(h):
            for j in range(w):
                if tmp[i][j] == '#':
                    cnt += 1
        if cnt == k:
            ans += 1
print(ans)

Measured memory_bytes: 76824
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int mod = 998244353;
int n, k, lft[N], rgt[N];
int dp[N];

int add(int x, int y) {
	if (x + y >= mod) {
		return x + y - mod;
	}
	return x + y;
}

int sub(int x, int y) {
	if (x - y < 0) {
		return x - y + mod;
	}
	return x - y;
}

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

	cin >> n >> k;

	for (int i = 0; i < k; i++) {
		cin >> lft[i] >> rgt[i];
	}

	dp[1] = 1;
	for (int i = 1; i <= n; i++) {
		if (i > 2) {
			dp[i] = add(dp[i], dp[i - 1]);
		}

		for (int j = 0; j < k; j++) {
			int l = i + lft[j];
			int r = i + rgt[j] + 1;

			if (l < N) {
				dp[l] = add(dp[l], dp[i]);
			}
			if (r < N) {
				dp[r] = sub(dp[r], dp[i]);
			}
		}
	}

	cout << dp[n] << '\n';

	return 0;
}


Measured memory_bytes: 4476
// C

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};

int main(){
  int N,M;
  int mondai[100001] = {0},pe[100001]={0};
  int seikai(0),pena(0);
  cin>>N>>M;
  for (int i(0);i<M;i++){
    int p;
    string s;
    cin>>p>>s;
    if (s == "WA" && mondai[p] == 0){
      pena++;
      pe[p]++;
    }
    else if (s == "AC" && mondai[p] == 0){
      seikai++;
      mondai[p] = 1;
    }
  }
  for (int i(0);i<=N;i++){
    if (mondai[i] == 0) pena -= pe[i];
  }
  cout << seikai <<" "<< pena << endl;
  return 0;
}


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

using namespace std;

typedef long long int Int;

int main(void) {
    Int x;
    Int cnt = 0;
    cin>>x;

    cnt = (x / 11)*2;
    x = x % 11;
    if(x > 6)
	cnt += 2;
    else if(0 < x && x <= 6)
	cnt++;

    cout<<cnt<<endl;

    return 0;
}



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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

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

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const bool debug = 0;

struct UnionFind {
	vector<int> par;
	
	UnionFind(int n) {
		par.resize(n);
		REP(i, n) par[i] = i;
	}
	
	int operator[] (int x) {
		return find(x);
	}
	
	int find(int x) {
		if (x == par[x]) return x;
		return par[x] = find(par[x]);
	}
	
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
		
		if (x > y) swap(x, y);
		
		par[y] = x;
	}
	
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

int N, M, K;

int main() {
	cin >> N >> M >> K;
	
	UnionFind uf(N + M);
	
	int ans = -1;
	REP(i, K) {
		int q, a, b;
		scanf("%d %d %d", &q, &a, &b);
		a--; b--;
		
		if (ans != -1) continue;
		
		if (q == 1) {
			if (uf[a + M] < M && uf[b + M] < M && uf[a + M] != uf[b + M]) ans = i + 1;
			uf.unite(a + M, b + M);
		}
		else {
			if (uf[a + M] < M && uf[a + M] != b) ans = i + 1;
			uf.unite(a + M, b);
		}
	}
	
	if (ans == -1) ans = 0;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3612
A, B, C, D, E, F = map(int, input().split())
 
x = set()
y = set()
 
for i in range(F // (100 * A) + 1):
    for j in range((F - 100 * A * i) // (100 * B) + 1):
        if i + j == 0:
            continue
        x.add(A * i * 100 + B * j * 100)
 
for i in range(F // C + 1):
    for j in range((F - C * i) // D + 1):
        y.add(C * i + D * j)
 
ret_w = 1
ret_s = -1
 
for w in x:
    for s in y:
        if w + s <= F and w * E / 100 >= s and s / (w + s) >= ret_s / ret_w:
            ret_s = s
            ret_w = w + s
 
print(ret_w, ret_s)

Measured memory_bytes: 3188
# coding: utf-8

A, B, K = map(int, raw_input().split())

if B-A+1 <= K:
    for i in range(A, B+1):
        print i
else:
    for i in range(A, A+K):
        print i

    for i in range(max(A+K, B-K+1), B+1):
        print i

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

int main() {
        string s;
        cin >> s;
        int a = 0, b = 0;
        string t;
        rep(i, s.size()) t += s[i];
        rep(i, s.size()) {
                ((i % 2 == 0 && s[i] == '1') || (i % 2 == 1 && s[i] == '0') ? a : b) ++;
        }
        cout << min(a, b) << endl;
        return 0;
}


Measured memory_bytes: 640
//a.c A-Chrisitmas Eve Eve Eve
#include<stdio.h>

int main(void){
    int d;
    scanf("%d",&d);
    if(d==25){
        printf("Christmas\n");
    }else if(d==24){
        printf("Christmas Eve\n");
    }else if(d==23){
        printf("Christmas Eve Eve\n");
    }else if(d==22){
        printf("Christmas Eve Eve Eve\n");
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

template <typename T>
class fenwick_tree {
	const int n;
	vector<T> data;
public:
	fenwick_tree(int n_) : n(n_), data(n) {}
	T find(int p) const {
		T res = 0;
		while (p >= 0) {
			res += data[p];
			p = (p & (p + 1)) - 1;
		}
		return res;
	}
	void add(int p, T val) {
		while (p < n) {
			data[p] += val;
			p |= p + 1;
		}
	}
};

// [l, r)
template <typename T>
class range_add_range_sum {
	const int n;
	fenwick_tree<T> bit0, bit1;
public:
	range_add_range_sum(int n_) : n(n_), bit0(n), bit1(n) {}
	T find(int p) const {
		return bit1.find(p) * (p + 1) + bit0.find(p);
	}
	T find(int l, int r) const {
		return find(r - 1) - find(l - 1);
	}
	void add(int l, int r, T val) {
		bit0.add(l, -val * l);
		bit1.add(l, val);
		bit0.add(r, val * r);
		bit1.add(r, -val);
	}
};

range_add_range_sum<int> ft(111111);

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

    int n,m;cin>>n>>m;
    vector<vector<P>> v(m+1);
    for(int i=0;i<n;i++){
        int l,r;cin>>l>>r;
        v[r-l+1].push_back(P(l,r));
    }
    int cnt=0;
    for(int i=1;i<=m;i++){
       int res=n-cnt;
       for(int j=i;j<=m;j+=i){
           res += ft.find(j,j+1);
       }
       cout<<res<<endl;
       for(int j=0;j<(int)v[i].size();j++){
           int l=v[i][j].first,r=v[i][j].second;
           ft.add(l,r+1,1);
       }
       cnt += v[i].size();
    }
}


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

int main() {
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;

  bool f = false;
  int ans1 = 0, ans2 = 0;
  for (int a = 0; 100 * A * a <= F; a++) {
    for (int b = 0; 100 * B * b <= F; b++) {
      int water = 100 * (A * a + B * b);
      for (int c = 0; C * c <= F; c++) {
        for (int d = 0; D * d <= F; d++) {
          int sugar = C * c + D * d;
          int total = water + sugar;
          if (F < total || total == 0 || water == 0 || E * water < sugar * 100) {
            continue;
          }
          if (!f) {
            ans1 = total; ans2 = sugar; f = true;
          }
          if (ans2 * total < ans1 * sugar) {
            ans1 = total; ans2 = sugar;
          }
        }
      }
    }
  }
  cout << ans1 << ' ' << ans2 << endl;
}

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

int n;
long long s[200010],ans,a[100010],b[100010],c[200010];
int main()
{
	scanf("%d",&n);
	long long ji1=0,ji2=0;
	for(int i=1;i<=n;++i)
	{
		scanf("%lld%lld",&a[i],&b[i]);
		c[i]=a[i];
		c[i+n]=b[i];
		ji1+=a[i];
		ji2+=b[i];
	}
	ans=min(ji1,ji2);
	sort(c+1,c+2*n+1);
	for(int i=1;i<=n;++i)
	s[i]=s[i-1]+c[i];
	for(int i=1;i<=n;++i)
	{
		long long x=a[i],y=b[i];
		if(x>y)
		swap(x,y);
		if(lower_bound(c+1,c+2*n+1,x)-c<=n-2)
		{
			if(lower_bound(c+1,c+2*n+1,y)-c<=n-1)
			ans=min(ans,s[n]);
			else
			ans=min(ans,y+s[n-1]);
		}
		else
		ans=min(ans,x+y+s[n-2]);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

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

    int memo[112345];
    int n, k, a[110];

    cin >> n >> k;
    REP(i, n)
    cin >> a[i];

    bool dp[112345];

    fill(dp, dp + k + 1, sizeof(dp));

    dp[0] = false;

    for (int i = 1; i <= k; i++)
    {
        bool check = false;
        REP(j, n)
        {
            if (a[j] <= i)
            {
                if (!dp[i - a[j]])
                {
                    check = true;
                    break;
                }
            }
        }

        dp[i] = check;
    }

    cout << (dp[k] ? "First" : "Second") << endl;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const int MOD = 1000000007; 

int main() {
    ll x; cin >> x;
    ll s = 100;
    int cnt = 0;
    while (s < x) {
        s *= 1.01;
        ++cnt;
    } 
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;
 
void solve(){
  int n,a,b; cin >>n >>a >>b;
  cout <<min(n*a,b);
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  solve();
return 0;}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <string>

using namespace std;

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

    vector<string> s;
    for(int i=0;i<n;i++){
        string x;
        cin >> x;
        s.push_back(x);
    }

    int c[4] = {0};
    for(auto i : s){
        if(i == "AC"){
            c[0]++;
        } else if (i== "WA"){
            c[1]++;
        } else if (i== "TLE"){
            c[2]++;
        } else if (i== "RE"){
            c[3]++;
        }
    }

    cout << "AC x " << c[0] << endl;
    cout << "WA x " << c[1] << endl;
    cout << "TLE x " << c[2] << endl;
    cout << "RE x " << c[3] << endl;

    return 0;
}


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

int main(){
    double x1,x2,a,b;
    cin>>a>>b;
    int s =b/0.1;
    for(int i=s;i<s+10;i++){
        if(floor(i*0.08)==a){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#define N 100005
#define F first
#define S second
using namespace std;

typedef long long ll;
ll n, sum;
pair<ll, ll> a[N];
multiset<ll> s;
int main()
{
	ll i, l1, l2, r1, r2;
	multiset<ll>::iterator it;
	cin >> n;
	for (i = 0; i < n; i++) {
		scanf("%lld", &a[i].F);
		a[i].S = i + 1;
	}
	sort(a, a + n, greater<pair<ll, ll> >());
	s.insert(0); s.insert(0);
	s.insert(n + 1); s.insert(n + 1);
	for (i = 0; i < n; i++) {
		it = s.lower_bound(a[i].S);
		r1 = *it;
		it++; r2 = *it;
		it--; it--; l1 = *it;
		it--; l2 = *it;
        sum += ((a[i].S - l1) * (r2 - r1) + (l1 - l2) * (r1 - a[i].S)) * a[i].F;
        s.insert(a[i].S);
	}
    cout << sum << endl;
    return 0;
}

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

int main() {
  int k=0,times[1000] = {0},top,topsoeji,hantei,sizetop,sizetopsoeji,size[1000] = {0};
  char word[1000][32];
  string str;
  while (cin >> str) {
    //cout << str.size();
    for(int i=0;i<str.size();i++) {
      //      word[k][i] = str.substr(i,1);
      word[k][i] = str[i];
      size[k] = str.size();
      if(size[k] > sizetop) {
        sizetop = size[k];
        sizetopsoeji = k;
      }
    }
    //cout << word[k] << endl;
    k++;
  }


  for(int i=0;i<k;i++) {
    for(int j=i+1;j<k;j++) {
      if(strcmp(word[i],word[j]) == 0)
        hantei = 1;
      else
        hantei = 0;
      if(hantei) {
        times[i]++;
        times[j]++;
      }
    }
  }
  //  for(int i=0;i<k;i++)
    //  cout << times[i] << endl;

  top = times[0];
  topsoeji = 0;
  for(int i=0;i<k;i++) {
    if(times[i] > top) {
      top = times[i];
      topsoeji = i;
    }
  }
  cout << word[topsoeji] << " " << word[sizetopsoeji] << endl;

}

Measured memory_bytes: 0
#include <stdio.h>
#define N 100000

typedef struct Card{
  char mark[2];
  int num;
  int firstorder;
}card;

int partition(card*, int, int);
void quicksort(card*, int, int);

int main(){
  card A[N];
  int i, j, num;
  int flag = 0;
  
  scanf("%d", &num);

  for(i = 0 ; i < num; i++){
    scanf("%s", A[i].mark);
    scanf("%d", &A[i].num);
    A[i].firstorder = i;
  }
  /*  
  printf("\nbefore\n");
  for(i = 0; i < num; i++){
    printf("%s %d  %d\n",A[i].mark, A[i].num, A[i].firstorder);
  }
  */
  quicksort(A, 0, num-1);

  for(i = 0; i < num-1; i++){
    for(j = i+1;j < num; j++ ){
      if(A[i].num == A[j].num){
	if(A[i].firstorder > A[j].firstorder){
	  flag = 1;
	  break;
	}
      }
      else{
	break;
      }
    }
    if(flag == 1){
      break;
    }
  }
  
  //printf("after\n");

  if(flag == 0){
    printf("Stable\n");
  }
  else{
    printf("Not stable\n");
  }
  
  for(i = 0; i < num; i++){
    printf("%s %d\n",A[i].mark, A[i].num);
  }
  
  return 0;
}

int partition(card *A, int p, int r){
  
  int i, j;
  int x;
  card temp;
  
  x = A[r].num;
  i = p-1;
  
  for(j = p; j < r; j++){
    if(A[j].num <= x){
      i = i+1;
      temp = A[i];
      A[i] = A[j];
      A[j] = temp;
    }
  }
  
  temp = A[i+1];
  A[i+1] = A[r];
  A[r] = temp;

  return i+1;
}

void quicksort(card *A, int p, int r){
  int q;
  
  if(p < r){
    q = partition(A, p, r);
    quicksort(A, p, q-1);
    quicksort(A, q+1, r);
  }
  
}



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

int main(){
    int n,k,a;
    cin >> n >> k;
    bool one_side = false;
    int where;
    for(int i = 0; i<n;i++){
		cin >> a;
		if(a==1) {
			where = i;
			if (i<k || i>=n-k){
				one_side = true;
			}
		}
	}
	n-=k;
	int count = 1;
	if(one_side) {
		//cout << n << endl;
		//cout << "HERE" << endl;
		//count+=n/(k-1);
		if(n-n/(k-1)*(k-1) > 0) count++;
		cout << count + n/(k-1);
		}
	else{
		int left = where - k + 1, right = where;
		if(left - left/(k-1)*(k-1) > 0) count++;
		count += left/(k-1);
		n=n-right+1;
		if(n-n/(k-1)*(k-1) > 0) count++;
		cout << count + n/(k-1);
		}
	}
		
		
    
	



Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        final long n = sc.nextLong();

        final List<Map<Long, Integer>> pfs = primeFactorize(n);

        System.out.print(n + ":");
        for (Map<Long, Integer> pf : pfs) {
            for (Map.Entry<Long, Integer> entry : pf.entrySet()) {
                for (int i = 0; i < entry.getValue(); i++) {
                    System.out.print(" " + entry.getKey());
                }
            }
        }
        System.out.println();
    }

    private static List<Map<Long, Integer>> primeFactorize(long n) {
        List<Map<Long, Integer>> res = new ArrayList<>();
        for (long a = 2; a*a <= n; a++) {
            if (n % a != 0) {
                continue;
            }
            int ex = 0;
            while (n % a == 0) {
                ex++;
                n /= a;
            }
            res.add(Collections.singletonMap(a, ex));
        }
        if (n != 1) {
            res.add(Collections.singletonMap(n, 1));
        }
        return res;
    }
}



Measured memory_bytes: 26364