akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll N, L;
string S[100000];

struct node {
  node* next[2] = { NULL, NULL };
  bool leaf = false;
};

void dfs(node* now, ll &grundy, ll depth) {
  if(now->leaf) return;

  REP(i, 0, 2) {
    if(now->next[i] == NULL) {
      ll l = L - depth;
      if(l > 0) {
        ll cnt = 0;
        while(!(l & (1LL << cnt))) cnt++;
        grundy ^= (1LL << cnt);
      }
    } else {
      dfs(now->next[i], grundy, depth + 1);
    }
  }
}

int main(void) {
  cin >> N >> L;
  REP(i, 0, N) cin >> S[i];

  node* root = new node;
  REP(i, 0, N) {
    node* now = root;
    REP(j, 0, S[i].length()) {
      ll v = S[i][j] - '0';
      if(now->next[v] == NULL) now->next[v] = new node;
      now = now->next[v];
    }
    now->leaf = true;
  }

  ll grundy = 0;
  dfs(root, grundy, 0);
  cout << (grundy != 0 ? "Alice" : "Bob") << endl;
}


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

int main() {
  while(true){
    int h,w;cin>>h>>w;
    if(h==0&&w==0)break;
    rep(i,h){
      rep(j,w){
        if(i==0||h-i==1)cout<<"#";
        else{
          if(j==0||w-j==1)cout<<"#";
          else cout<<".";
        }
        if(w-j==1){
          cout<<endl;
        }
      }
    }
    cout<<endl;
  }
}


Measured memory_bytes: 3100
Y = [-2,-2,-2,-1,-1,-1,0,0,0]
X = [-2,-1,0,-2,-1,0,-2,-1,0]
H, W, N = gets.split.map(&:to_i)

lists = []
N.times do
  s, t = gets.split.map(&:to_i)
  lists << [s-1, t-1]
end
lists2 = Hash.new(0)
lists.each do |list|
  9.times do |i|
    nowy = list[0] + Y[i]
    nowx = list[1] + X[i]
    next if 0 > nowy || nowy > H-3 || 0 > nowx || nowx > W-3
    lists2["#{nowy} #{nowx}"] += 1
  end
end
# p lists2
ans = Hash.new(0)
lists2.each do |k, v|
  ans[v] += 1
end
ans[0] = (H-2) * (W-2) - lists2.size
# p ans
10.times do |i|
  next if ans[i] != 0
  ans [i] = 0
end
ans.sort_by{|k, _|k}.each do |_, v|
  puts v
end

Measured memory_bytes: 123132
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

struct Node{
  vector<int> vcon;
  Node(){}
};

bool solve(const vector<Node> &G, int n, int k){
  int *p;
  bool loop = false;
  
  p = new int[k];
  for(int i = 0; i < k; i++) p[i] = i;
  
  do{ loop = false;

    bool bNG = false;
    bool vis[n];
    fill(vis,vis+n,false);

    for(int i = 0; i < k; ++i){
      vis[ p[i] ] = true;
      for(int j = 0; j < G[ p[i] ].vcon.size(); ++j){
	vis[ G[ p[i] ].vcon[j] ] = true;
      }
    }

    for(int i = 0; i < n; ++i){
      if( !vis[ i ] ){
	bNG=true;
      }
    }
    if( !bNG ) return true;
    
    for(int pk=k-1;pk>=0;pk--){p[pk]++;if(p[pk]<=n-(k-pk)){for(int j=pk+1;j<k;j++)p[j]=p[j-1]+1;pk++;loop=true;break;}}
  }while(loop);
  delete [] p; 
  return false;
}

int main(){
  while(true){
    int ans = -1;
    int N,V;
    cin >> N >> V;
    if( N == 0 && V == 0 ) break;
    vector<Node> G(N);
    for(int i = 0; i < V; ++i){
      int a,b;
      cin >> a >> b;
      G[a].vcon.push_back(b);
      G[b].vcon.push_back(a);
    }
    
    for(int k = 1; k <= (N%2==0?N/2:N/2+1); ++k){
      if( solve(G,N,k) ){
	ans = k;
	break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 904
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
const long long INF=1e9+5;
const string alp="abcdefghijklmnopqrstuvwxyg"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYG";
typedef long long ll;

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


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

int main(){
    ll n; cin >> n;
    string s; cin >> s;

    ll le, lw, re, rw, ans = 1e8;
    le = lw = re = lw = 0;

    for(int i = 0; i < n; i++){
        if(s[i] == 'E') re++;
        else rw++;
    }

    for(int i = 0; i <= n; i++){
        ans = min(ans, lw + re);
        if(i == n) break;
        if(s[i] == 'E'){
            re--;
            le++;
        }else{
            rw--;
            lw++;
        }
    }

    put(ans);
}

Measured memory_bytes: 900
from sys import stdin
from itertools import accumulate

def solve():
    file_input = stdin
    
    N = int(file_input.readline())
    G = tuple(tuple(map(int, line.split())) for line in file_input)
    G1 = tuple(t[1:] for t in G)
    
    # accumulated rows
    ar = ((0,) + tuple(accumulate(line)) for line in G)
    
    # accumulated columns
    ac = ((0,) + tuple(accumulate(line)) for line in zip(*G))
    ac_1 = next(ac)
    ac = tuple(zip(*ac))
    
    ans = 0
    for i, t1 in enumerate(zip(G1, ar, ac, ac_1)):
        G_i, ar_i, ac_i, ac_1i = t1
        ar_ii = ar_i[i]
        for j, t2 in enumerate(zip(G1[i:], ar_i[i+1:], ac[i+1:], ac_1[i+1:]), start=i):
            G_j, ar_ij, ac_j, ac_1j = t2
            single_row = ar_ij - ar_ii
            if single_row > ans:
                ans = single_row
                
            if i == j:
                continue
            
            col_max = ac_1j - ac_1i
            
            for ac_jk, ac_ik, G_ik, G_jk in zip(ac_j, ac_i, G_i, G_j):
                col = ac_jk - ac_ik
                
                if col_max > 0:
                    c_ans = col_max + col
                    if c_ans > ans:
                        ans = c_ans
                else:
                    if col > ans:
                        ans = col
                
                t_col_max = col_max + G_ik + G_jk
                if t_col_max > col:
                    col_max = t_col_max
                else:
                    col_max = col
    print(ans)

solve()


Measured memory_bytes: 13828
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>

#define all(x) x.begin(), x.end()
#define sz(x) (int)(x.size())
#define pb push_back
#define mp make_pair
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define endl "\n"
#define int long long

using namespace std;

const int N = (int)(5e5) + 322;
const int inf = 99999999999;

int n, clr[N], d[222][222];

char edge[222][222];

bool dfs(int x, int cl = 1) {
    clr[x] = cl;
    bool res = true;
    for(int i = 0; i < n; ++i) {
        if (edge[x][i] != '1') continue;
        if (clr[i] == -1) {
            res &= dfs(i, cl ^ 1);
        }else if (clr[i] == cl){
            return false;
        }
    }
    return res;
}

signed main () {
    ios_base :: sync_with_stdio (false); cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            cin >> edge[i][j];
            if (edge[i][j] == '1') {
                d[i][j] = 1;
            }else {
                d[i][j] = (i == j) ? 0 : inf;
            }
        }
    }
    memset(clr, -1, sizeof clr);
    if (!dfs(1)) {
        cout << -1;
        return 0;
    }


    for (int k = 0; k < n; ++k)
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j)
                d[i][j] = min (d[i][j], d[i][k] + d[k][j]);

    int mx = 0;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            if (d[i][j] < inf) {
                mx = max(d[i][j], mx);
            }
        }
    }
    cout << mx + 1;

    return 0;
}

Measured memory_bytes: 4988
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N = inputInt()
	s = []
	for i in range(N):
		tmp = input()
		tmp = list(tmp)
		s.append(tmp[:-1])

	ans = {}
	for i in s:
		i.sort()
		#print(i)
		tmp = "".join(i)

		if tmp in ans:
			ans[tmp] += 1
		else:
			ans[tmp] = 1

	oo = 0
	#print(ans)
	for v in ans.values():
		if v == 1:
			continue
		elif v == 2:
			oo += 1
		else:
			tmp = 0
			for i in range(1,v):
				tmp += i
			oo += tmp

	print(oo)

if __name__ == "__main__":
	main()


Measured memory_bytes: 107996
#include<stdio.h>
#define MAX 100
static const int INFTY =(1<<21);
static const int WHITE = 0; 
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

int prim(){
   int u, minv;
   int d[MAX], p[MAX], color[MAX];
   
   for( int i=0; i<n; i++){
      d[i] = INFTY;
      p[i] = -1;
      color[i] = WHITE;
   }

   d[0] = 0;
   
   while( 1 ){
      minv = INFTY;
      u =  -1;
      for(int i=0; i<n; i++){
         if( minv > d[i] && color[i] != BLACK){
            u = i;
            minv = d[i];
         }
      }
      if( u== -1) break;
      color[u] = BLACK;
      for(int v=0; v<n; v++){
         if(color[v] != BLACK && M[u][v] != INFTY){
            if(d[v] > M[u][v] ){
               d[v] = M[u][v];
               p[v] = u;
               color[v] = GRAY;
            }
         }
      }
   }
   int sum = 0;
   for(int i=0; i<n;i++){
      if(p[i] != -1) sum += M[i][p[i]];
   }

   return sum;
}

int main(){
   scanf("%d", &n);

   for(int i=0; i<n; i++){
      for(int j=0; j<n; j++){
         int e; scanf("%d", &e);
         if(e == -1) M[i][j] = INFTY;
         else  M[i][j] = e;
      }
   }

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

   return 0;
} 





Measured memory_bytes: 2052
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

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

    ll x, n; cin >> x >> n;
    ll p[n];
    rep(i, n){
        cin >> p[i];
    }

    ll dist = 1000;
    ll ans = 0;
    reps(i, x - 100, x + 100 + 1){
        bool is_in_p = false;
        rep(j, n){
            if(i == p[j]){
                is_in_p = true;
                break;
            }
        }

        if(is_in_p) continue;

        if(abs(i - x) < dist){
            dist = abs(i - x);
            ans = i;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll H, N;
    cin >> H >> N;
    VL A(N+1), B(N+1);
    rep(i, 1, N+1) cin >> A[i] >> B[i];
    VVL dp(N+10, VL(H+10, 1e18));
    rep(i, 0, N+10) dp[i][0] = 0;
    // dp[i][j] := i番目までの魔法を使ったとき，jのダメージを与えるのに消費する最小魔力
    rep(i, 1, N+1){
        rep(j, 1, H+1){
            dp[i][j] = dp[i-1][j];
            if(A[i] <= j) dp[i][j] = min(dp[i][j], dp[i][j-A[i]] + B[i]);
            else dp[i][j] = min(dp[i][j], dp[i][0] + B[i]);
        }
    }
    
    cout << dp[N][H] << endl;
    return 0;
}

Measured memory_bytes: 79360
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

using namespace std;

//arc069 Scc
//c2つでSを作れる
int main(){
  ll S,C,res;
  cin >> S >> C;

  //Sを使い尽くす
  res = 0;
  if(S > C / 2)
  {
    res = C / 2;
  }
  else
  {
    res += S;
    C -= 2 * S;

    res += C / 4;

  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
a = list(map(int, input().split()))
b = list(map(int, input().split()))
num = int(input())
c = a[0] - b[0]
if c < 0:
  c *= -1
if a[1] <= b[1]:
  print("NO")
else:
  if (a[1] - b[1]) * num >= c:
    print("YES")
  else:
    print("NO")

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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
template <typename T> constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (int i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define COMP(key) [](const auto& a, const auto& b) { return a.key < b.key; }

template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& a) { return is >> a.first >> a.second; }
template<typename T> istream& operator>>(istream& is, vector<T>& a) { for (T& x : a) is >> x; return is; }

template<typename T> using pop_max = std::priority_queue<T>;
template<typename T> using pop_min = std::priority_queue<T, std::vector<T>, std::greater<T>>;

void LOG(const int& x) { cerr << x << "\n"; }
template<typename T> void LOG(const vector<T>& a) { for (const T& x : a) cerr << x << " "; cerr << "\n"; }
template<typename T, std::size_t S> void LOG(const T (&a)[S]) { REP(i, S) cerr << a[i] << " "; cerr << "\n"; }
template<typename T, std::size_t S, std::size_t R> void LOG(const T (&a)[S][R]) { REP(i, S) { REP(j, R) cerr << a[i][j] << " "; cerr << "\n"; } }

i64 ceil(i64 a, i64 b) { return (a - 1) / b + 1; }
i64 gcd(i64 a, i64 b) { while (b != 0) { i64 t = b; b = a % b; a = t; } return a; }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
i64 gcd(const vector<i64>& v) { return accumulate(ALL(v), 1LL, static_cast<i64(*)(i64, i64)>(gcd)); }
i64 lcm(const vector<i64>& v) { return v.empty() ? 0LL : accumulate(v.begin() + 1, v.end(), v[0], static_cast<i64(*)(i64, i64)>(lcm)); }
i64 pow(i64 x, i64 y, i64 z) { i64 a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }
i64 inv(i64 x, i64 m) { return pow(x, m - 2, m); }

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;

const i64 INF = inf<i64>;
using P = pair<i64, i64>;
using T = pair<i64, P>;
const i64 M = 1000000007;
signed main() {
  i64 h, n;
  cin >> h >> n;
  map<i64, i64> ma;
  ma[0] = 0;
  vector<i64> mm(h + 10010, INF);
  mm[0] = 0;
  REP(i, n) {
    i64 a, b;
    cin >> a >> b;
    for (i64 g = 0; g < h + 10010; g++) {
      if (g - a >= 0) {
        mm[g] = min(mm[g], mm[g - a] + b);
      }
    }
  }
  i64 ans = INF;
  for (i64 g = h; g < h + 10010; g++) {
    ans = min(ans, mm[g]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long  long int ll;
int main(){
    ll x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    vector<ll>p(a);
    vector<ll>q(b);
    vector<ll>r(c);
    for(ll i=0;i<a;i++)
        cin>>p[i];
    for(ll i=0;i<b;i++)
        cin>>q[i];
    for(ll i=0;i<c;i++)
        cin>>r[i];
    vector<ll>final;
    sort(r.begin(),r.end());
    sort(q.begin(),q.end());
    sort(p.begin(),p.end());

    for(ll i=0;i<x;i++)
    {
        final.push_back(p[a-1-i]);
    }
    for(ll i=0;i<y;i++)
    {
        final.push_back(q[b-1-i]);
    }
    sort(final.begin(),final.end());
    ll j=c-1;
    for(ll i=0;i<min(x+y,c);i++)
    {
        if(final[i]<=r[j])
        {
            final[i]=r[j];
            j--;
        }
        else
        {
            break;
        }
        
    }
    ll sum=0;
    for(ll i=0;i<x+y;i++)
    {
        // cout<<final[i];
        sum+=final[i];
    }
    cout<<sum<<"\n";
}

Measured memory_bytes: 4724
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cinttypes>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

int main() {
//  freopen("../Console/1.txt", "rb", stdin);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  const string P = "FESTIVAL";

  string S;
  cin >> S;

  cout << S.substr(0, S.size() - P.size()) << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;
ll n, m, add, ans, A[101010], B[5];
int keta(int n) {
	int ans = 0, x = 10, i = 1;
	while (n > 0) {
		B[add] = ((n % x) / i);
		n -= (n % x);
		x *= 10;
		i *= 10;
		add++;
	}
	add = 0;
	if (B[0] == B[4] && B[1] == B[3])
		return 0;
	else
		return 1;
}
int main() {
	cin >> n >> m;
	for (int i = n; i <= m; i++)
		if (keta(i) == 0)
			ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var list = nextStrArray();
	var output = "";
	for(var i = 0; i < list.length; i++){
		output += list[i][0].toUpperCase();
	}
	myout(output);
}


Measured memory_bytes: 7756
#include <iostream>
#include <cstdio>

int main(int argc, const char * argv[])
{
    int a1, a2, a3, a4, b1, b2, b3, b4;
    int cnt_h, cnt_b;
    while (std::cin >> a1 >> a2 >> a3 >> a4 >> b1 >> b2 >> b3 >> b4) {
        cnt_h = cnt_b = 0;
        cnt_h = (a1 == b1) + (a2 == b2) + (a3 == b3) + (a4 == b4);
        if (a1 != b1) {
            cnt_b = (a1 == b2) + (a1 == b3) + (a1 == b4);
        }
        if (a2 != b2) {
            cnt_b += (a2 == b1) + (a2 == b3) + (a2 == b4);
        }
        if (a3 != b3) {
            cnt_b += (a3 == b1) + (a3 == b2) + (a3 == b4);
        }
        if (a4 != b4) {
            cnt_b += (a4 == b1) + (a4 == b2) + (a4 == b3);
        }
        printf("%d %d\n", cnt_h, cnt_b);
    }
    return 0;
}

Measured memory_bytes: 1144
/* Author : fenwick123 */

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> pref (n , 0);
  for (int i = 0; i < n; i++){
    cin >> a[i];
    pref[i] = a[i];
    if (i > 0) pref[i] += pref[i - 1];
  } 
  const long long inf = (long long) 2e18;
  vector<vector<long long>> dp (n + 1 , vector<long long> (n + 1 , inf));
  for (int i = n - 1; i >= 0; --i){
    for (int j = i; j < n; j++){
      if (j == i){
        dp[i][j] = 0;
        continue;
      } 
      for (int k = i; k < j; k++){
        long long cost = pref[j] - (i - 1 >= 0 ? pref[i - 1] : 0);
        dp[i][j] = min (dp[i][j] , dp[i][k] + dp[k + 1][j] + cost);
      }
    }
  }
  cout << dp[0][n - 1] << endl; 
  return 0;
}

Measured memory_bytes: 4680
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int a,b;
    cin >> a >> b;
    int get=max(a,b);
    if(a>b) a--;
    else b--;
    get += max(a,b);

    cout << get;



}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef		long long       ll;
typedef		vector<ll>      vll;
#define		pb              push_back
string intostr(int x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    return str;
}

char Uplowch(char ch){if(ch >= 'A' &&  ch <= 'Z') ch += 32; return ch;}
char Lowupch(char ch){if(ch >= 'a' &&  ch <= 'z') ch -= 32; return ch;}
bool Isalpha(char ch){if((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) return true; return false;}
int Strtoint(string str){stringstream ss(str);int x = 0;ss >> x ;return x ;}
string Intostr(int x){stringstream ss; ss << x; string str = ss.str(); return str;}

#define		PB              pop_back
#define		nn              "\n"
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define		ss              ' '
#define 	S(a)            scanf("%lld",&a)
#define 	SS(a,b)         scanf("%lld %lld",&a,&b)
#define 	SSS(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define		gcd(a,b)        __gcd(a,b)
#define		lcm(a,b)        (a*b)/gcd(a,b)
#define		pi              acos(-1.0)

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

int dx[] = {0 , 0 , -1 , 1} ; // right , left , forward , backward
int dy[] = {1 , -1 , 0 , 0} ;

//bool check(int x , int y) {
//    if(x <= n && y <= m && x >= 1 && y >= 1)
//        return 1 ;
//    return 0 ;
//}

int main()
{
     //freopen("in.txt","r",stdin);

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

	ll n;
	ll flag=0;
	cin>>n;
	while(n)
    {
        if(n%10==7) flag=1;

        n/=10;
    }

    if(flag) cout<<"Yes"<<nn;
    else cout<<"No"<<nn;




}



Measured memory_bytes: 3660
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  REP(i, N) {
    cin >> a[i];
  }
  ll result = 0;
  bool c = false;
  REP(i, N) {
    if (a[i] % 2 == 0) {
      c = true;
    }
  }
  if (c == true) {
    REP(i, N) {
      if (a[i] % 2 == 0) {
        while (a[i] % 2 == 0) {
          a[i] /= 2;
          result++;
        }
      }
    }
    cout << result << endl;
  } else {
    cout << result << endl;
  }
  return 0;
}


Measured memory_bytes: 256
/*================================================================
*   Copyright (C) 2019 Sangfor Ltd. All rights reserved.
*
*   创 建 者： badcw
*   创建日期： 2019/12/22
*
================================================================*/
#include <bits/stdc++.h>

#define ll long long
using namespace std;

const int maxn = 105;
const int mod = 1e9+7;
ll qp(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

template <class T>
inline bool scan(T& ret) {
    char c;
    int sgn;
    if (c = getchar(), c == EOF) return 0; // EOF
    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 out(T x) {
//    if (x > 9) out(x / 10);
//    putchar(x % 10 + '0');
//}

char s[maxn], t[maxn];
int main(int argc, char* argv[]) {
    int n;
    scanf("%d%s%s", &n, s, t);
    for (int i = 0; i < n; ++i) {
        printf("%c%c", s[i], t[i]);
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		ArrayList<Long> list = new ArrayList<>();
		int n = sc.nextInt();
		long[] a = new long[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
		}
		Arrays.sort(a);
		long check = 1, be = a[0];
		long ans = 0;
		for(int i = 1; i < n; i++) {
			if(a[i] == be) {
				check++;
			}else {
				if(check%2 != 0) {
					ans++;
				}
				check = 1;
			}
			be = a[i];
		}
		if(check%2 != 0) {
			ans++;
		}
		System.out.println(ans);
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 48272
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned short us;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll infll=(1ull<<63)-1;
const int inf=(1ull<<31)-1;
int n,a[100000];

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(18);
	cin>>n;
	for (int i=0,t;i<n;i++){
		cin>>t;
		a[--t]=i+1;
	}
	for (int i=0;i<n;i++)
		cout<<a[i]<<" ";
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int n,a[10],b[10],p[10];
int A,B;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++) cin>>b[i];
    for(int i=0;i<n;i++) p[i]=i+1;
    int j=0;
    do{
        bool x=true,y=true;
        for(int i=0;i<n;i++){
            if(a[i]!=p[i]) x=false;
        }
        if(x) A=j;
        for(int i=0;i<n;i++){
            if(b[i]!=p[i]) y=false;
        }
        if(y) B=j;
        j++;
    } while(next_permutation(p,p+n));
    cout<<abs(A-B)<<endl;

}


Measured memory_bytes: 3656
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().mainrun();
	}

	private Scanner scan;
	private int H,W;
	private Long[] Ans;
	private int[][] A;
	private void mainrun() {

		scan = new Scanner(System.in);
		H = scan.nextInt();
		W = scan.nextInt();
		
		Ans = new Long[H * W];
		
		A = new int[H][W];
		
		for(int i = 0;i < H;i++) {
			for(int j = 0;j < W;j++) {
				A[i][j] = scan.nextInt();
			}
		}
		
		for(int i = 0;i < H;i++) {
			for(int j = 0;j < W;j++) {
				Long ans = (long) 0;
				
				for(int k = 0;k < H;k++) {
					for(int l = 0;l < W;l++) {
						int h = 0,w = 0;
						
						h = Math.abs(k-i) * A[k][l];
						w = Math.abs(l-j) * A[k][l];
						ans += Math.min(h, w);
					}
				}
				
				Ans[W * i + j] = ans;
			}
		}
		
		System.out.println(Arrays.asList(Ans).parallelStream().mapToLong(e->e).min().getAsLong());
		scan.close();
	}
}


Measured memory_bytes: 43812
#include <algorithm>
#include <functional>
#include <iostream>
#include <tuple>
#include <vector>

template <typename T>
class SegmentTree {
 public:
  using Operation = std::function<T(T, T)>;

  SegmentTree(std::size_t size) : SegmentTree(size, std::plus<T>(), 0) {}

  SegmentTree(std::size_t size, Operation operation, T identity) :
      operation_(operation), identity_(identity),
      size_(size), data_(size_ * 2, identity_) {}

  void Update(std::size_t index, T value) {
    data_[index += size_] = value;
    while (index >>= 1) {
      data_[index] = operation_(data_[index << 1], data_[(index << 1) | 1]);
    }
  }

  T Fold(std::size_t begin, std::size_t end) const {
    T left_product = identity_;
    T right_product = identity_;
    for (begin += size_, end += size_; begin < end; begin >>= 1, end >>= 1) {
      if (begin & 1) {
        left_product = operation_(left_product, data_[begin++]);
      }
      if (end & 1) {
        right_product = operation_(data_[--end], right_product);
      }
    }
    return operation_(left_product, right_product);
  }

 private:
  const Operation operation_;
  const T identity_;
  const std::size_t size_;
  std::vector<T> data_;
};

int main() {
  int N, Q;
  std::cin >> N >> Q;
  std::vector<int> c(N);
  for (int i = 0; i < N; ++i) {
    std::cin >> c[i];
  }
  std::vector<std::tuple<int, int, int>> queries;
  for (int i = 0; i < Q; ++i) {
    int l, r;
    std::cin >> l >> r;
    queries.emplace_back(r, l - 1, i);
  }
  std::sort(queries.begin(), queries.end());
  std::vector<int> last(N + 1, -1);
  std::vector<int> counts(Q);
  SegmentTree<int> segment_tree(N);
  int index = 0;
  for (const auto [right, left, query_index] : queries) {
    while (index < right) {
      if (const auto prev = last[c[index]]; prev >= 0) {
        segment_tree.Update(prev, 0);
      }
      last[c[index]] = index;
      segment_tree.Update(index, 1);
      ++index;
    }
    counts[query_index] = segment_tree.Fold(left, right);
  }
  for (const auto count : counts) {
    std::cout << count << std::endl;
  }
  return 0;
}


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

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

	int ans = 0;
	for (int i = 0; i < 2; i++) {
		if (A > B) {
			ans = ans + A;
			A = A - 1;
		}
		else {
			ans = ans + B;
			B = B - 1;
		}
	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define RFOR(i,s,e) for(int (i) = (s);(i) >= (e);(i)--)
#define rep(i,n) FOR(i,0,n-1)
#define MOD 1000000007 

int a[100100];

signed main(){
	int n;cin>>n;
	string s,t;cin>>s>>t;
	if(n==1)
	{
		cout << 3 << endl;
		return 0;
	}
	
	int ans;
	bool tate;
	bool pretate;
	bool pass = true;
	FOR(i,1,n-1)
	{
		
		if(not pass) 
		{
			pass = true;
			continue;
		}
		
		
		if(s[i] == s[i-1]) tate = false;
		else tate = true;
		
		if(tate and i == 1) ans = 3;
		else if (not tate and i == 1) ans = 6;
		
		if(i == 1) 
		{
			if(not tate)pass =false;
			pretate = tate;
			continue;
		}
		
		if(tate)
		{
			if(pretate) (ans *= 2)%=MOD;
		}	
		else
		{
			if(pretate) (ans *= 2)%=MOD;
			else (ans *= 3)%=MOD;
			pass = false;
		}
		pretate = tate;
	}
  
  if(pass and pretate)(ans *= 2)%=MOD;
	
	
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    while(true){
        int n; cin >> n;
        if(n == 0) return 0;
        else{
            vector<int> num(n);
            num[0] = 0;
            int ans = 0;
            REP(i, n - 1) num[i + 1] += num[i] + (i + 1);
            REP(i, n){
                REP(j, i){
                    if(num[i] - num[j] == n) ans++;
                }
            }
            cout <<  ans << endl;
        }
    }    
}


Measured memory_bytes: 2996
from itertools import accumulate

N, K = map(int, input().split())
*A, = map(int, input().split())
acc = (0,) + tuple(accumulate(A))
acc_p = (0,) + tuple(accumulate(x if x > 0 else 0 for x in A))

ret = -10 ** 14
for i in range(N - (K - 1)):
    sum_ = acc[i + K] - acc[i]
    ret = max(ret, (acc_p[-1] - acc_p[i + K]) + acc_p[i] + (sum_ if sum_ > 0 else 0))

print(ret)

# 連続する長さKの区間を黒/白で塗る
# 残りを自由に塗る


Measured memory_bytes: 17804
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline().rstrip()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
#input = sys.stdin.readline
from bisect import bisect_left

L = I()
print((L/3)**3)


Measured memory_bytes: 60268
#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
    int N;
    char buf[32];
    scanf("%d", &N);

    sprintf(buf, "%d", N);
    if ( strchr(buf, '9') == NULL ){
        printf("No\n");
    } else {
        printf("Yes\n");
    }

    return 0;
}


Measured memory_bytes: 128
s = input()
n = len(s)

def dfs(i, f):
    if i == n - 1:
        return sum(list(map(int, f.split("+"))))

    # 式 f の末尾に "+" を追加するかしないかして次の数字を追加
    # 関数の足し算はメソッドを記憶したまま、各関数に分岐していく
    # → (2:返る関数が2個) ^ (n-1:再帰回数が i=0,1...でn-1回) ＝ 最終的な関数は2^(n-1)個
    return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1])
    
print(dfs(0, s[0]))

Measured memory_bytes: 38896
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
int n, k, a, h;
template <class T>
inline void _read(T &x)
{
	x = 0;
	char t = getchar();
	while(!isdigit(t) && t != '-') t = getchar();
	if(t == '-')
	{
		_read(x);
		x *= -1;
		return ;
	}
	while(isdigit(t))
	{
		x = x * 10 + t - '0';
		t = getchar();
	}
}
int main()
{
	_read(n), _read(k), _read(a);
	h = a;
	for(int i = 2, x; i <= n; ++i)
	{
		_read(x);
		a = __gcd(a, x);
		h = max(x, h);
	}
	if(k % a == 0 && k <= h) puts("POSSIBLE");
	else puts("IMPOSSIBLE");
}

Measured memory_bytes: 256
$a = []

def solve(n, left, right)
	return true if n == 10 
	return solve(n + 1, $a[n], right) if left < $a[n] 
	return solve(n + 1, left, $a[n]) if right < $a[n]
	false  
end

gets.to_i.times do 
	$a = gets.split.map(&:to_i)

	if solve(0, 0, 0)
		puts "YES"
	else
		puts "NO"
	end
end

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    set<string> se;
    rep(i, N) {
        string S;
        cin >> S;
        se.insert(S);
    }

    cout << se.size() << endl;
}


Measured memory_bytes: 19136
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

int main(){
    int h, w, ans = 0;
    cin >> h >> w;
    vector<string> s(h);
    for(int i = 0; i < h; i++){
        cin >> s[i];
    }
    vector<bool> is_white(w);
    for(int x = 0; x < w; x++){
        bool f = true;
        for(int y = 0; y < h; y++){
            if(s[y][x] == '#') f = false;
        }
        is_white[x] = f;
    }
    for(int y = 0; y < h; y++){
        if(count(begin(s[y]), end(s[y]), '#') == 0) continue;
        for(int x = 0; x < w; x++){
            if(is_white[x]) continue;
            cout << s[y][x];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
def grade(score_list):
    chukan = score_list[0]
    kimatu = score_list[1]
    saishi = score_list[2]
    pre_score = chukan + kimatu
    if chukan == -1 or kimatu == -1 or pre_score < 30:
        return "F"
    elif pre_score >= 80:
        return "A"
    elif 65 <= pre_score < 80:
        return "B"
    elif 50 <= pre_score < 65:
        return "C"
    elif 30 <= pre_score < 50:
        if saishi >= 50:
            return "C"
        else:
            return "D"

while True:
    score = list(map(int, list(input().split())))
    if score[0] == -1 and score[1] == -1 and score[2] == -1:
        break
    else:
        rate = grade(score)
        print(rate)



Measured memory_bytes: 5596
// -*- coding:utf-8-unix -*-

use proconio::{input, fastout};

// ABC086C - Traveling
// https://atcoder.jp/contests/abs/fasks/arc089_a
use num_traits::{pow, One};
use std::ops::{Add, Div, Mul, Sub};

const MODULUS: usize = 1000000007;

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [usize; n],  // Vec<(i32, i32, i32)>
    }

    let mut result = ModP(1);
    let mut counts :Vec<usize> = vec![0,0,0];
    for i in 0..n {
        let mut alternatives = Vec::new();
        for j in 0..3 {
            if a[i] == counts[j] {
                alternatives.push(j);
            }
        }
        if alternatives.len() == 0 {
            result = ModP(0);
            break;
        }
        result = result * ModP(alternatives.len());
        counts[alternatives[0]] += 1;
    }
    println!("{}", result.0);
}

#[derive(Clone, Copy, PartialEq, Debug)]
struct ModP(usize);

impl One for ModP {
    fn one() -> Self {
        return ModP(1);
    }
}
impl Add for ModP {
    type Output = Self;
    fn add(self, rhs: Self) -> Self {
        return ModP((self.0 + rhs.0) % MODULUS);
    }
}
impl Sub for ModP {
    type Output = Self;
    fn sub(self, rhs: Self) -> Self {
        return ModP((self.0 + MODULUS - rhs.0) % MODULUS);
    }
}
impl Mul for ModP {
    type Output = Self;
    fn mul(self, rhs: Self) -> Self {
        return ModP((self.0 * rhs.0) % MODULUS);
    }
}
impl Div for ModP {
    type Output = Self;
    fn div(self, rhs: Self) -> Self {
        if rhs.0 == 0 {
            panic!("Tried to divide by ModP(0)!");
        }
        let rhs_inv = pow(rhs, MODULUS - 2);
        return self * rhs_inv;
    }
}


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

#include <atcoder/all>
using namespace atcoder;

template<typename T, typename U> void cmax(T &a, U b) { if (a < b) a = b; }
template<typename T, typename U> void cmin(T &a, U b) { if (a > b) a = b; }

// constexpr int MOD = 1000000007;
constexpr int MOD = 998244353;

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

  int N, M;
  cin >> N >> M;
  vector<long> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  vector<long> B(M);
  for (int i = 0; i < M; i++) cin >> B.at(i);

  auto C = convolution<MOD>(A, B);

  for (int i = 0, n = C.size(); i < n; i++) {
    cout << C.at(i) << ((i == n - 1) ? "\n" : " ");
  }
}

Measured memory_bytes: 27228
n = int(input())
h = list(map(int,input().split()))

while h != []:
    ri = h.pop()
    if h == []:
        print('Yes')
        break
    v = h[len(h)-1] - ri
    if v >= 2:
        print('No')
        break
    elif v == 1:
        h[len(h)-1] -= 1
        if h[len(h)-1] < 0:
            print('No')
            break


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

int main() {
	int sum, sum2, num500, num100, num50, num10, num5, num1, numcoin;
	
	while (1) {
		cin >> sum;
		if (sum == 0) break;
		num500 = num100 = num50 = num10 = num5 = num1 = 0;
		
		sum2 = 1000 - sum;
		if (sum2 >= 500) {
			num500++;
			sum2 -= 500;
		}
		if(sum2 >= 100) {
			num100 += sum2 / 100;
			sum2 %= 100;
		}
		if (sum2 >= 50) {
			num50++;
			sum2 -= 50;
		}
		if (sum2 >= 10) {
			num10 += sum2 / 10;
			sum2 %= 10;
		}
		if (sum2 >= 5) {
			num5++;
			sum2 -= 5;
		}
		num1 = sum2;
		
		numcoin = num500 + num100 + num50 + num10 + num5 + num1;
		cout << numcoin <<endl;
	}
	return 0;
}

Measured memory_bytes: 2972
#include<bits/stdc++.h>
using namespace std;
set<int> st;
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=k;i++){
		int x;
		cin>>x;
		while(x--){
			int y;
			cin>>y;
			st.insert(y);
		}
	}
	cout<<n-st.size()<<endl;
	return  0;
}

Measured memory_bytes: 3640
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
long long a,b,n;
long long int dfs(long long int k){
  return a*k/b-a*(k/b);
}
int main(){
  long long int i;
  cin >> a >> b>> n;
  if(b-1<=n){
    printf("%lld\n",dfs(b-1));
  }
  else{
    printf("%lld\n",dfs(n));
  }
  return 0;
}

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

using namespace std;

const int max_n = -1, inf = 1000111222;

int w;
string s;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> s >> w;
    for (int i = 0; i < s.length(); i += w) {
        cout << s[i];
    }
    return 0;
}


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

#define ll long long
#define ld long double
#define F first
#define S second

//#define ONLINE_JUDGE 1

using namespace std;

const int mod = 1e9+7;

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

int main(){
//	#ifndef ONLINE_JUDGE	
//		freopen("in.txt","r",stdin);
//		freopen("out.txt","w",stdout);
//	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL),cout.tie(NULL);		
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}

Measured memory_bytes: 256
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/irange.hpp>
#include <cstdio>
#include <iostream>
using namespace std;
using ll = long long;
const int INF = 1e9;

int main() {
    boost::multiprecision::cpp_int a, b;
    cin >> a >> b;

    if (a > b) {
        cout << "GREATER" << endl;
    }
    else if (a < b) {
        cout << "LESS" << endl;
    }
    else {
        cout << "EQUAL" << endl;
    }
}

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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define maxn 1e9
#define int long long int
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

int lcm(int a, int b) { return a / gcd(a, b) * b; }

int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0) {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

signed main() {
    int N;
    vector<int> A;
    cin >> N;
    rep(i, N) {
        int a;
        cin >> a;
        A.push_back(a);
    }
    int ans = A[0];
    for(int i = 1;i < N;i++){
        ans = gcd(ans,A[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1400
#include <iostream>
#include <utility>
#include <stdint.h>

using namespace std;

int main()
{
  int N, L;
  cin >> N >> L;

  int64_t ans;
  if (L>0) {
    ans = 0;
    for (int n=1; n<N; ++n) {
      ans += L+n;
    }
  } else if ((L+N-1) < 0) {
    ans = 0;
    for (int n=0; n<N-1; ++n) {
      ans += L+n;
    }
  } else {
    ans = 0;
    for (int n=0; n<N; ++n) {
      ans += L+n;
    }
  }
  
  cout << ans << endl;

  return 0;
}


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


int main(){
    while(1){
        int x,y;
        cin>>x>>y;
        if(x == 0 && y == 0) break;
        
        
        if(x > y) swap(x,y);
        cout<<x<<" "<<y<<endl;
    }
    
    return 0;
}


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

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

int a[225816];
bool used[225816];

int main(void){
	int n,x,i,t,m,j=0;
	fill(used,used+225816,false);
	cin >> n >> x;
	n *= 2; --n;
	if(x == 1 || x == n){
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	if(n == 3){
		cout << 1 << endl << 2 << endl << 3 << endl;
		return 0;
	}
	--x;
	for(i=0; i<n; ++i){
		a[i] = i;
	}
	m = n/2;
	if(x == 1){
		a[m-1] = 2;
		a[m] = 0;
		a[m+1] = 1;
		a[m+2] = 3;
		++x;
	}else{
		a[m-1] = x-2;
		a[m] = x;
		a[m+1] = x+1;
		a[m+2] = x-1;
	}
	used[x-2] = true;
	used[x-1] = true;
	used[x] = true;
	used[x+1] = true;
	for(i=0; i<n; ++i){
		if(m-1<=i && i<=m+2){
			continue;
		}
		while(used[j]){
			++j;
		}
		a[i] = j;
		used[j] = true;
	}
	for(i=0; i<n; ++i){
		cout << (a[i]+1) << endl;
	}
	return 0;
}


Measured memory_bytes: 2560