akhauriyash/Code-Regression huggingface dataset:
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

template <class T>
ostream &operator<<(ostream &os, const set<T> &st) {
	for (const auto &e : st) os << e << " ";
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
	for (const auto &e : mp) os << e << " ";
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T = lint>
struct Edge {
	int to;
	T cost;
	int tank;
	Edge() {}
	Edge(int to, T cost, int tank = 0) : to(to), cost(cost), tank(tank) {}
	bool operator>(const Edge &r) const { return this->cost > r.cost; }
};

int main() {

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

	int N, M, L;
	cin >> N >> M >> L;

	vector<vector<Edge<int>>> edges(N);
	for (int i = 0; i < M; i++) {
		int u, v, len;
		cin >> u >> v >> len;
		u--, v--;
		if (len > L) continue;
		edges[u].emplace_back(v, len);
		edges[v].emplace_back(u, len);
	}

	auto bfs = [&](int st) {
		vector<pair<int, int>> dp(N, { INF, 0 });
		dp[st] = { 0, -L };
		using ppiii = pair<pair<int, int>,int> ;
		priority_queue<ppiii, vector<ppiii>, greater<ppiii>> que;
		que.emplace(dp[st], st);
		while (!que.empty()) {
			auto now = que.top();
			que.pop();

			if (now.first > dp[now.second]) continue;

			for (const auto &e : edges[now.second]) {

				if (now.first > dp[e.to]) continue;

				auto tmp = now.first;
				if (e.cost > -tmp.second) {
					tmp.first++;
					tmp.second = -L + e.cost;
				}
				else tmp.second += e.cost;

				if (tmp < dp[e.to]) {
					dp[e.to] = tmp;
					que.emplace(tmp, e.to);
				}

			}
		}
		return dp;
	};

	vector<vector<pair<int, int>>> memo(N);
	for (int i = 0; i < N; i++) memo[i] = bfs(i);

	int Q;
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		int s, t;
		cin >> s >> t;
		s--, t--;
		auto tmp = memo[s][t].first;
		if (tmp != INF) cout << tmp << "\n";
		else cout << -1 << "\n";
	}

	return 0;
}

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

int main(){
  int H,W,K;
  cin >> H >> W >> K;
  vector<vector<char>> C(H,vector<char>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> C.at(i).at(j);
    }
  }
  int count=0;
  for(int bith=0;bith<(1<<H);bith++){
    for(int bitw=0;bitw<(1<<W);bitw++){
      int kuro=0;
      for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
          if(bith &(1<<i)){
            continue;
          }
          if(bitw &(1<<j)){
            continue;
          }
          if(C.at(i).at(j)=='#'){
            kuro++;
          }
        }
      }
      if(kuro==K){
        count++;
      }
    }
  }
  cout << count << endl;
}
      

Measured memory_bytes: 3548
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
template<class T> ostream& operator<<(ostream& os, vector<T> const& v){
    rep(i,v.size()) os << v[i] << (i+1==v.size()?"":" ");
    return os;
}

int main(){
    string s;
    while(cin>>s){
    int n = s.size();
    vi l(n);
    l[0] = 1;
    rep(i,n-1){
        if(s[i+1]==s[i]) l[i+1]=l[i]+1;
        else l[i+1] = 1;
    }
    int ans = 0;
    dump(s);
    dump(l);
    loop(i,1,n-1){
        if(s[i]=='O' && s[i+1]!='O' && i+l[i]<n && i-l[i] >= 0 && l[i+l[i]]>=l[i] && l[i-l[i]]>=l[i] && s[i+l[i]]=='I' && s[i-l[i]]=='J'){
            ans = max(ans,l[i]);
        }
    }
    cout << ans << endl;
}
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int _StartTime_ = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(15);

    int n,m;
    while(cin >> n >> m) {
        if(!(n|m)) break;
        vi c(m);
        rep(i, m) cin >> c[i];
        vi x(n);
        rep(i, n) cin >> x[i];

        vii dp(n + 1, vi(256, inf));
        dp[0][128] = 0;

        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < 256; ++j) {
                if (dp[i][j] == inf) continue;
                rep(k, m) {
                    int x_ = j + c[k];
                    chmax(x_, 0);
                    chmin(x_, 255);

                    chmin(dp[i + 1][x_], dp[i][j] + (x[i] - x_) * (x[i] - x_));
                }
            }
        }

        //    rep(i,n+1)rep(j,256) cout << dp[i][j] << (j==255 ? '\n' : ' ');

        int ans = inf;
        for (int j = 0; j < 256; ++j) {
            chmin(ans, dp[n][j]);
        }
        cout << ans << '\n';
    }

    // printf("ExcutionTime: %d /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 23888
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;
bool my_compare(pair<ll, ll> a, pair<ll , ll> b) {
    // 基本はfirstで比較
    if(a.first != b.first){
         return a.first < b.first; // 昇順
        //return a.first > b.first; // 降順
    }

    // それ以外はsecondで比較
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        // どちらも同じ
        return true;
    }
}

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

    ll a,b,c,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    cin>>a>>b>>c;
    if(a%2&&b%2&&c%2) {
        if(a>b&&a>c){
            cout<<b*c<<endl;
        }else if(b>a&&b>c){
            cout<<a*c<<endl;
        }else{
            cout<<a*b<<endl;
        }
    }
    else cout<<0<<endl;

    return 0;
}


Measured memory_bytes: 256
def main():
    S = input()
    k = int(input())

    for i,s in enumerate(S):
        s = int(s)
        if s != 1:
            print(s)
            return
        if i+1 == k:
            print(1)
            return
    print(1)


if __name__ == '__main__':
    main()


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

string strmax(string a, string b){
  if(a.size() > b.size()) return a;
  else if(a.size() < b.size()) return b;
  else{
    if(a > b) return a;
    else return b;
  }
}

int main(){
  int N,M; cin>>N>>M;
  vector<int> A(M);
  for(int i=0;i<M;i++) cin>>A[i];
  int cost[9] = {2,5,5,4,5,6,3,7,6};
  vector<string> dp(10100,"0");
  dp[0] = "";
  for(int i=0;i<N;i++){
    if(dp[i] == "0") continue;
    for(int j=0;j<M;j++){
      dp[i+cost[A[j]-1]] = strmax(dp[i+cost[A[j]-1]], dp[i] + (char)('0' + A[j]));
    }
  }
  cout<<dp[N]<<endl;
  return 0;
}


Measured memory_bytes: 43776
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i,n) for(int i = 1; i < n+1 ;i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;

int main(){
    int a,b;cin >> a >> b;
    REP1(i,3){
        if(a!=i and b !=i){
            cout << i <<endl;
            return 0;
        }
    }

}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<cmath>
#include<vector>
#define MAX 30000
using namespace std;
vector<int> prime;
bool isntprime[30001];
typedef pair<int,int> P;
typedef pair<P,int> Pi;

void sieve()
{
 
  isntprime[0] = isntprime[1] = true;
  int j;
  for(int i=2;i<= MAX;i++)if(!isntprime[i])for(prime.push_back(i),j=i*i;j<=MAX;j+=i)isntprime[j] = true;

 

  /*
  int n = MAX;
  int p = 0;
  for(int i=0;i<=n;i++)
    isprime[i] = true;

  isprime[0] = isprime[1] = false;

  for(int i=2;i<=n;i++)
    {
      if(isprime[i])
	{
	  prime.push_back(i);
	  for(int j=2*i;j<=n;j+=i)
	    isprime[j] = false;
	}
    }
  */
}

bool isTriangle(int a,int b,int c)
{
  if(a >= b+c || b >= a+c || c >= a+b)
    return false;
  return true;
}

int main()
{
  sieve();
  int T;

  while(cin >> T,T)
    {
      int cnt = 0;
      for(int i=0;i<prime.size() && prime[i] < T;i++)
	for(int j=i;j<prime.size() && prime[i]+prime[j] < T;j++)  
	  if(T-(prime[i]+prime[j]) >= prime[j] && !isntprime[T-(prime[i]+prime[j])] && isTriangle(prime[i],prime[j],T-(prime[i]+prime[j])))
	    cnt++;
	    
      cout << cnt << endl;
    }
  return 0;
}

Measured memory_bytes: 1276
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}

// insert→solveでansに全クエリに対する結果が格納
// add,del を変更していろいろなクエリに対応する
// 以下は区間内の数の種類数についてのクエリが飛んでくる場合
 
//現在の状態および値
const int MAX_VAL = 500001;
int a[MAX_VAL]; //要素
int cnt[MAX_VAL]; //区間内のiの個数
int res;        //区間内の種類の数
 
class Mo{
private:
    vector<int> left, right;
    const int width;
    void add(const int id);
    void del(const int id);
 
public:
    vector<int> ans;
 
    Mo(const int n) : width((int)sqrt(n)){}
    //クエリ[l,r)
    void insert(const int l, const int r){
        left.push_back(l), right.push_back(r);
    }
    void solve(){
        const int sz = (int)left.size();
        int nl = 0, nr = 0;
        vector<int> ord(sz);
        iota(ord.begin(), ord.end(), 0);
        sort(ord.begin(), ord.end(), [&](const int a, const int b){
            const int c = left[a] / width, d = left[b] / width;
            return (c == d) ? ((c & 1) ? (right[b] < right[a]) : (right[a] < right[b])) : (c < d);
        });
        ans.resize(sz);
        for(const int id : ord){
            while(nl > left[id]) add(--nl);
            while(nr < right[id]) add(nr++);  //add
            while(nl < left[id]) del(nl++);
            while(nr > right[id]) del(--nr);  //del
            ans[id] = res;
        }
    }
};
 
//idは元の配列のインデックス
void Mo::add(const int id)
{
    if(cnt[a[id]] == 0){
        cnt[a[id]]++;
        res++;
    }else{
        cnt[a[id]]++;
    }
}
 
void Mo::del(const int id)
{
    if(cnt[a[id]] == 1){
        cnt[a[id]]--;
        res--;
    }else if(cnt[a[id]] > 1)cnt[a[id]]--;
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    Mo mo(5e5);
    rep(i,n)cin >> a[i];
    rep(i,q){
        int l,r ;
        cin >> l >> r;
        l--;
        mo.insert(l,r);
    }
    mo.solve();
    rep(i,q)cout << mo.ans[i] << "\n";
}


Measured memory_bytes: 15168
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define INF int(1e9)
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(ll i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = int(1e5);
ll n, a[MAX_N], dp[MAX_N], dp1[MAX_N];

void solve() {
    ll even_plus = 0, even_minus = 0;
    ll diffs = 0;
    REP(i, n) {
        ll diff = 0;
        dp1[i] += diffs;
        if (i % 2 == 0 && dp1[i] <= 0) {
            diff = 1 - dp1[i];
            diffs += diff;
            dp1[i] = 1;
        } else if (i % 2 != 0 && dp1[i] >= 0) {
            diff = -1 - dp1[i];
            diffs += diff;
            dp1[i] = -1;
        }
        even_plus += abs(diff);
    }
    diffs = 0;
    REP(i, n) {
        ll diff = 0;
        dp[i] += diffs;
        if (i % 2 == 0 && dp[i] >= 0) {
            diff = -1 - dp[i];
            diffs += diff;
            dp[i] = -1;
        } else if (i % 2 != 0 && dp[i] <= 0) {
            diff = 1 - dp[i];
            diffs += diff;
            dp[i] = 1;
        }
        even_minus += abs(diff);
    }
    cout << (even_minus < even_plus ? even_minus : even_plus) << endl;
}

int main() {
    cin >> n;
    REP(i, n) {
        cin >> a[i];
        if (i == 0) dp[0] = a[0];
        else dp[i] = dp[i - 1] + a[i];
    }
    memcpy(dp1, dp, sizeof(dp));
    solve();
    return 0;
}

Measured memory_bytes: 2560
import sys
def input():
  return sys.stdin.readline().rstrip()

N=int(input())
S=input()

w_sum,e_sum=[0],[0]

for x in S:
  if x=="W":
    w_sum.append(w_sum[-1]+1)
  else:
    w_sum.append(w_sum[-1])
w_sum.append(0)

RS=S[::-1]
for x in RS:
  if x=="E":
    e_sum.append(e_sum[-1]+1)
  else:
    e_sum.append(e_sum[-1])
e_sum.append(0)
e_sum.reverse()

ans=float("inf")
for i in range(1,N+1):
  ans=min(ans,w_sum[i-1]+e_sum[i+1])

print(ans)


Measured memory_bytes: 110408
#include<stdio.h>

int search(int A[], int n, int key){
  int i=0;
  A[n]=key;
  while(A[i]!=key){
    i++;
  }
  return i!=n;
}

int main(){
  int i,n,A[10001],q,key,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(search(A,n,key))sum++;
  }
  printf("%d\n",sum);
  return 0;
}



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

int N, C;
int c[501][5001];
int D[1001][10001];
int DS[2001][31];

int main () {
  cin >> N >> C;
  for(int i = 1; i <= C; i++) {
    for(int j = 1; j <= C; j++) {
      cin >> D[i][j];
    }
  }

  for(int i = 1; i <= N; i++) {
    for(int j = 1; j <= N; j++) {
      cin >> c[i][j];
    }
  }

  for(int k = 1; k <= C; k++) {
    for(int i = 1; i <= N; i++) {
      for(int j = 1; j <= N; j++) {
        DS[i+j-1][k] += D[c[i][j]][k];
      }
    }
  }

  ll ans = 1e15;
  for(int c1 = 1; c1 <= C; c1++) {
    for(int c2 = 1; c2 <= C; c2++) {
      if(c1 == c2) continue;
      for(int c3 = 1; c3 <= C; c3++) {
        if(c1 == c3 || c2 == c3) continue;

        ll res = 0;
        for(int l = 1; l <= 2*N-1; l++) {
          if(l % 3 == 0) {
            res += DS[l][c1];
          } else if (l % 3 == 1){
            res += DS[l][c2];
          } else {
            res += DS[l][c3];
          }
        }
        ans = min(ans, res);
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9344
b = list(map(int, input().split()))
a = list(map(int, input().split()))
x = b[0]-b[1]+1
res = 10**15
 
for i in range(x):
    tmp = i + b[1] - 1
    if res > (a[tmp]-a[i] + min(abs(a[i]),abs(a[tmp]))):
	    res = a[tmp]-a[i] + min(abs(a[i]),abs(a[tmp]))
        
print(res)

Measured memory_bytes: 14224
#include <iostream>
#include <algorithm>
#include<string>
#include<cmath>
#include<stack>
#include <vector>
#include<queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
using namespace std;

int main() {
	long long a, b, c, k;
	cin >> a >> b >> c>>k;
	cout << (k % 2 == 0 ? (a - b) : (b - a)) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <assert.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<set<int> > A(N);
	vector<int> B(N);
	int res = 0;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		A[i].insert(a);
	}
	for (int i = 0; i < N; i++) {
		cin >> B[i];
	}
	bool f;
	set<int> st;
	int ii;
	int c;
	int mx = -1;
	vector<int> ok(N, 0);
	int okc = 0;
	for (int i = 0; i < N; i++) {
		if ((*A[i].begin()) == B[i]) {
			ok[i] = 1;
		}
		if ((*A[i].begin()) < B[i] * 2 && (*A[i].begin()) != B[i]) {
			cout << -1 << endl;
			return 0;
		}
	}
	int beforem;
	vector<int> v(50);
	int vsz = 0;
	int cnt = 0;
	
	while (true) {
		cnt++;
		if (cnt >= 50) {
			res = -1;
			break;
			//assert(false);
		}
		bool ff = false;
		for (int i = 0; i < N; i++) {
			if (ok[i] == 0) {
				ff = true;
				break;
			}
		}
		if (!ff) {
			break;
		}
		mx = -1;
		vsz = 0;
		for (int i = 0; i < N; i++) {
			if (ok[i] == 0) {
				v[vsz] = i;
				vsz++;
				int mn = 50;
				for (auto j : A[i]) {
					for (int k = 1; k <= mn; k++) {
						if ((j % k) > 2 * B[i] || (j % k) == B[i]) {
							mn = min(mn, k);
							break;
						}
					}
				}
				//cerr << i << " mn= " << mn << endl;
				mx = max(mx, mn);
			}
		}
		for (int ii = 0; ii < vsz; ii++) {
			int i = v[ii];
			set<int> st = A[i];
			for (int j : st) {
				//cerr << i << "  " << j << endl;
				if ((j % mx) > 2 * B[i] || (j % mx) == B[i]) {
					A[i].insert(j % mx);
					if ((j % mx) == B[i]) {
						ok[i] = 1;
						break;
					}
				}
			
			}
		}
		res +=( (int)1 << mx);
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <iomanip>
using namespace std;

int main(){
	int a,b;
	cin>>a>>b;
	if(a<9&&b<9){
		cout<<"Yay!"<<endl;
	}
	else{
		cout<<":("<<endl;
	}
    return 0;
}

Measured memory_bytes: 256
// helloworld.cpp : アプリケーションのエントリ ポイントを定義します。
//
/*#include "stdafx.h"*/
//
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <cstring>
#include <iterator>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define POF pop_front
#define POB pop_back
#define MA make_pair
#define ll long long
#define VE vector<int>
#define VP vector<pair<int,int> >
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF = 1e9 + 7;
const int mod = 1e9 + 7;
//
int main() {
    int N, M;
    int A[100];
    cin >> N >> M;
    FOR(i, 0, N) {
        cin >> A[i];
    }
    FOR(i, 2, M + 1) {
        FOR(j, 0, N - 1 ) {
            if (A[j] % i > A[j + 1] % i) {
                swap(A[j], A[j + 1]);
            }
        }
    }
    FOR(i, 0, N) {
        cout << A[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 3084
import Control.Monad.Primitive (PrimState)
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as MV
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)

main :: IO ()
main = do
    _ <- B.getLine
    vs <- V.fromList . map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    mv <- MV.replicate (V.maximum vs + 3) 0 :: IO (MV.MVector (PrimState IO) Int)
    V.forM_ vs $ \i -> MV.unsafeModify mv succ (i + 1)
    v <- V.unsafeFreeze mv
    let v1 = v
        v2 = V.tail v1
        v3 = V.tail v2
    print $ V.maximum $ V.zipWith3 (\x y z -> x + y + z) v1 v2 v3


Measured memory_bytes: 5372
#include<stdio.h>
int lis[200020],r=0,ans[200020],d[200020];
int ta[200020],nt[400040],to[400040];
int lb(int l,int r,int n,int *d){
  int m=(l+r)/2;
  if(l==r)return m;
  return n<=d[m]?lb(l,m,n,d):lb(m+1,r,n,d);
}
void f(int s,int t){//printf("%d %d\n",s,t);
  int rn,rp,i;
  ans[s]=r;
  for(i=ta[s];i+1;i=nt[i]){
    if(to[i]==t)continue;
    //int j;printf("lis %d:",s);
    //for(j=0;j<r;j++)printf("%d ",lis[j]);printf("\n");
    if(lis[r-1]<d[to[i]]){
      rn=-1;
      rp=-1;
      lis[r++]=d[to[i]];
    }
    else{
      rp=lb(0,r,d[to[i]],lis);
      rn=lis[rp];
      lis[rp]=d[to[i]];
    }
    f(to[i],s);
    if(rp+1)lis[rp]=rn;
    else    r--;
  }
}    
int main(){
  int n,i,a,b;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&d[i+1]);
  for(i=0;i<n;i++)ta[i+1]=-1;
  for(i=0;i<n-1;i++){
    scanf("%d %d",&a,&b);
    nt[i    ]=ta[to[n-1+i]=a];
    nt[n-1+i]=ta[to[i    ]=b];
    ta[a]=i;
    ta[b]=n-1+i;
  }
  lis[r++]=d[1];
  f(1,0);
  for(i=0;i<n;i++)printf("%d\n",ans[i+1]);
  return 0;
}

Measured memory_bytes: 21536
#include <iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int cnt = 0;
	for (int i = 0; i + 2 < n; i++) {
		if (s[i] == 'A'&&s[i + 1] == 'B'&&s[i + 2] == 'C') {
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	auto T=vecin(4);
	int sum = accumulate(ALL(T),0);
	
	out(sum/60);
	out(sum%60);
	return 0;
}


Measured memory_bytes: 3212
#include <stdio.h>
#define max(a, b) ((a) >= (b) ? (a) : (b))
#define abs(a) ((a) >= 0 ? (a) : -(a))

int main(void)
{
	int W, a, b;
	scanf("%d %d %d", &W, &a, &b);
	printf("%d", max(abs(a - b) - W, 0));
	return 0;
}


Measured memory_bytes: 128
inf = float('inf')

n = int(input())

r = [0] * n         # 行数
c = [0] * n         # 列数

for i in range(n):
    ri, ci = map(int, input().split())
    r[i] = ri
    c[i] = ci

dp = [[0]*(n+1) for _ in range(n+1)]  # (n+1)*(n+1)のゼロ行列生成

for ls in range(2, n+1):        # 対象とする行列の数をlsとした。
    for i in range(n+1-ls):
        dp[i][i+ls] = inf
        for j in range(i+1, i+ls):  # 働きとしてはkに該当？
            dp[i][i+ls] = min(dp[i][i+ls], dp[i][j] + dp[j][i+ls] + r[i]*r[j]*c[i+ls-1])

ans = dp[0][n]

print(ans)





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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n; std::cin >> n;
  char pe;
  string str;
  set<string> s;
  std::cin >> str;
  pe = str.back();
  s.insert(str);
  bool ok = true;
  rep(i, n-1) {
    std::cin >> str;
    if (str[0] != pe || s.count(str)) ok = false;
    pe = str.back();
    s.insert(str);
  }
  std::cout << (ok ? "Yes" : "No") << "\n";
}


Measured memory_bytes: 256
N,M,C=map(int,input().split())
ListB = list(map(int, input().split()))
ListA = []
for i in range (N):
  ListA.append(list(map(int, input().split())))
res =0
mid = 0
for i in range(N):
  for j in range(M):
    mid += ListA[i][j]*ListB[j]
  mid += C
  if mid > 0:
    res+=1
  mid = 0
print(res)

Measured memory_bytes: 9140
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

m = float('inf')
n = ri()
for i in range(1, int(n**0.5) + 1):
  a = n//i
  if a*i == n:
    if m > a+i:
      m = a+i
else:
  print(m-2)




Measured memory_bytes: 12584
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <numeric>
#include <climits>
using namespace std;
//using ll = long long;
//const ll mod = 1000000007;
int n, m;
string s, t;
const int n_max = 1000;
const int m_max = 1000;

int main() {
	cin >> n;
	for(int k=0; k<n; ++k){
        cin >> s >> t;
        int dp[n_max+1][m_max+1] = {0};
	for (int i = 0; i < s.size(); ++i) {
		for (int j = 0; j < t.size(); ++j) {
			if (s[i] == t[j]) {
				dp[i + 1][j + 1] = dp[i][j] + 1;
			}
			else {
				dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
			}
		}
	}
        cout << dp[s.size()][t.size()] << endl;
    }
	

	return 0;
}


Measured memory_bytes: 7132
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;

int main()
{   int a,b,c,d;
    cin>>a>>b>>c;
    d=a>b?a:b;
    c=(c-1)/d+1;
    cout<<c;
    return 0;
    }


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<b;i++)
int main(){
    int n,m;
    cin>>n>>m;
    vector <int> cnt(m);
    rep(i,0,n){
        int k;
        cin>>k;
        rep(j,0,k){
            int a;
            cin>>a;
            cnt[a-1]++;
        }
    }
    int s=0;
    rep(i,0,m){
        if(cnt[i]==n) s++;
    }
    cout<<s;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
#define flash ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define ll long long int
#include <tr1/unordered_map>
#define ld long double
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define f(i,a,b)  for(long long i=a;i<b;i++)
#define all(c) (c).begin(),(c).end()
#include <map>
using namespace std;



int main()
{




     flash;
     ///////////////////////////////////////////////////////////////////////////////////////

     

ll r;
cin>>r;
cout<<r*r<<endl;




    ///////////////////////////////////////////////////////////////////////////////////////

     return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}

  
  int main(){
      lint N;
      cin>>N;
      lint x[N][26];
      rep(i,N){
          rep(j,26){
              x[i][j]=0;
          }
      }
        rep(i,N){
            string s;
            cin>>s;
            rep(j,s.size()){
                lint g=s[j]-'a';
                x[i][g]++;
            }
        }
       string p="";
        rep(i,26){
            lint l=INF;
            rep(j,N){
                l=min(x[j][i],l);
            }
        
            rep(k,l){
                cout<<(char)('a'+i);
            }
        }
       
  }


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

const int N = 2e5 + 5;
int n;
string s;
int f[N];

main()
{
    cin >> s;
    f[1] = 1;
    if(s.size() == 1) return cout << 1, 0;
    s = ' ' + s;
    string tmp = "", pre = "";
    pre += s[1];
    int kq = 1;
    for(int i = 2; i < s.size(); ++i)
    {
        tmp += s[i];
        if(pre != tmp)
        {
            kq++;
            pre = tmp;
            tmp = "";
        }
    }
    cout << kq;
}


Measured memory_bytes: 772
S=list(input())
nmin=len(S)
for c in set(S):
    arr=S[:]
    for n in range(len(S)):
        if all([cc==c for cc in arr]):
            nmin=min(nmin, n)
            break
        for i in range(len(arr)-1):
            if arr[i]!=c and arr[i+1]==c:
                arr[i]=c
        arr=arr[:-1]
print(nmin)

Measured memory_bytes: 42348
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
  int a,b,c,x,y;
  cin >> a >> b >> c >> x >> y;
  int ans=0;
  if(x==y)
    ans = min({ a*x+b*y, c*x*2});
  else if(x>y)
    ans = min({ a*x+b*y, c*x*2, c*y*2+a*(x-y)});
  else
    ans = min({ a*x+b*y, c*y*2, c*x*2+b*(y-x)});
  cout << ans << endl;
  return 0;
}

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


int main(){
    int n;
    cin >> n;
    vector<tuple<string,int,int>> vec(n);
    rep(i,n){
        string mise;
        int score;
        int id=i+1;
        cin >> mise >> score;
        score=-score;
        vec[i]=tie(mise,score,id);
    }
    sort(vec.begin(),vec.end());
    rep(i,n){
        cout << get<2>(vec[i]) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n;
int a[100], b[100];
int main()
{
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin >> a[i];
  }
  for (int i = 0; i < n;i++)
  {
    cin >> b[i];
  }
  int cnt = 0;
  for(int i=0;i<n;i++)
  {
    cnt += a[i];
  }
  
  for(int i=0;i<n;i++)
  {
    int ans = 0;
    int ss=0;int dd=0;
    for(int j=0;j<=i;j++)ss+=a[j];
    for(int j=i;j<n;j++)
    {
      dd+=b[j];
    }
    ans += ss + dd;
    if(ans>cnt)
      cnt = ans;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int n;
	bool card[4][13];
	int i,j;
	for (i=0;i<4;i++){
		for (j=0;j<13;j++){
			card[i][j]=false;
		}
	}
	cin>>n;
	for (i=0;i<n;i++){
		char type;
		int number;
		int index;
		cin>>type>>number;
		switch (type){
			case 'S':
				index=0;
				break;
			case 'H':
				index=1;
				break;
			case 'C':
				index=2;
				break;
			case 'D':
				index=3;
				break;
		}
		card[index][number-1]=true;
	}
	for (i=0;i<4;i++){
		for (j=0;j<13;j++){
			if (!card[i][j]){
				switch (i){
					case 0:
						cout<<"S "<<j+1<<endl;
						break;
					case 1:
						cout<<"H "<<j+1<<endl;
						break;
					case 2:
						cout<<"C "<<j+1<<endl;
						break;
					case 3:
						cout<<"D "<<j+1<<endl;
						break;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
#define N 262144
int dat[2][N*2+10];
int inf=1000000000;
//[a,b)の最小値
//外からは(a,b,0,0,n)として呼ぶ
int query(int id,int a,int b,int k=0,int l=0,int r=N){
	if(r<=a || b<=l) return inf;
	if(a<=l && r<=b) return dat[id][k];
	int vl=query(id,a,b,k*2+1,l,(l+r)/2);
	int vr=query(id,a,b,k*2+2,(l+r)/2,r);
	return min(vl,vr);
}
void update(int id,int k,int a){
	k+=N-1;
	dat[id][k]=a;
	while(k>0){
		k=(k-1)/2;
		dat[id][k]=min(dat[id][k*2+1],dat[id][k*2+2]);
	}
	return;
}
int a[N+10];
int main()
{
	int n,k;cin>>n>>k;
	rep(i,n+10) dat[0][i]=dat[1][i]=inf;
	rep(i,n){
		cin>>a[i];
		update(0,i,a[i]);update(1,i,-a[i]);
	}
	int out=n-k+1;
	rep(i,n-k){
		int lo=query(0,i,i+k+1),hi=-query(1,i,i+k+1);
		if(lo==a[i] && hi==a[i+k]) out--;
	}
	int now=1,ns=0;
	rep(i,n){
		if(a[i]>a[i+1]){
			if(now>=k) ns=1;
			now=1;
		}
		else{
			now++;if(now==k && ns>0) out--;
		}
	}
	cout<<out<<endl;
	
	/*int b[100];
	rep(i,n-k+1){
		rep(j,n) b[j]=a[j];
		sort(b+i,b+i+k);
		rep(j,n) cout<<b[j]<<' ';cout<<endl;
	}*/
}


Measured memory_bytes: 4736
#include <cstdio>
#include <functional>
#include <vector>

using namespace std;

#define int long long
#define dotimes(i, n) for (int i = 0, i##max__ = (n); i < i##max__; i++)
#define whole(f, x, ...) ([&](decltype((x)) c) { return (f)(begin(c), end(c), ## __VA_ARGS__); })(x)

int rint() {
  int x;
  scanf("%lld", &x);
  return x;
}

void wint(int x) {
  printf("%lld\n", x);
}

template<typename T> int size(T const& c) { return static_cast<int>(c.size()); }
template <typename T> bool maxs(T& a, T const& b) { return a < b ? a = b, true : false; }
template <typename T> bool mins(T& a, T const& b) { return a > b ? a = b, true : false; }
inline int lg(int x) { return 63 - __builtin_clzll(static_cast<unsigned int>(x)); }

class segment_tree {
  // Negative nodes delegate to their children
  vector<int> xs;
public:
  segment_tree(int n) : xs(1 << (lg(2 * n - 1) + 1), (1LL << 31) - 1) {}
  void update(int i, int j, int x) {
    function<void(int, int, int)> rec;
    rec =
      [&](int k, int a, int b) {
        if (i <= a && b <= j)
          xs[k] = x;
        else {
          if (xs[k] >= 0)
            xs[2*k] = xs[2*k+1] = xs[k];
          int c = a + (b - a) / 2;
          if (j <= c)
            rec(2*k, a, c);
          else if (c <= i)
            rec(2*k+1, c, b);
          else {
            rec(2*k, a, c);
            rec(2*k+1, c, b);
          }
          xs[k] = -1;
        }
      };
    rec(1, 0, ::size(xs)/2);
  }
  int query(const int i) {
    function<int(int, int, int)> rec;
    rec =
      [&](int k, int a, int b) {
        if (xs[k] >= 0)
          return xs[k];
        int c = a + (b - a) / 2;
        return i < c ? rec(2*k, a, c) : rec(2*k+1, c, b);
      };
    return rec(1, 0, ::size(xs)/2);
  }
};

signed main() {
  const int n = rint();
  const int q = rint();
  segment_tree st(n);
  dotimes(i, q)
    if (rint()) {
      int i = rint();
      wint(st.query(i));
    } else {
      int s = rint();
      int t = rint();
      int x = rint();
      st.update(s, t+1, x);
    }
  return 0;
}



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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

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

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

    ll N;
    string S;
    cin >> S;

    cout << S.at(0) << S.at(1) << S.at(2) << endl;

}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
int main()
{
	ll a,b,sum;
	while (scanf("%lld %lld",&a, &b)!=EOF){
		ll c=0;
		sum=a+b;
		while(sum!=0){
			sum=sum/10;
			c++;
		}
		printf("%lld\n",c);	
	}
	return 0;
}

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

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

#define inf INT_MAX/3
#define INF INT_MAX/3
#define PB push_back
#define pb push_back
#define MP make_pair
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
#define all(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define PII pair<int,int>
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define in scanf
#define out printf
#define LL long long
#define ll long long
#define ULL unsigned long long
#define ull unsigned long long
#define eps 1e-14
#define FST first
#define SEC second


int N;
long long K;
typedef pair <int,int> P;
vector <P> a;


int main(){

	cin >> N >> K;
	a.resize(N);
	REP(i,N){
		cin >> a[i].first;
		cin >> a[i].second;
	}
	sort(a.begin(),a.end());
	int i=0;
	while(i<N){
		K-=a[i].second;
		if(K<=0)
			break;
		i++;
	}
	cout << a[i].first;

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,s1;
    int k,l;
    cin>>s;
    cin>>s1;
    //getchar();
    if(s.size()==s1.size())
    {
        for(int i = 0; i < s.size(); i++)
        {
            cout<<s[i]<<s1[i];
        }
    }
    else
    {
        for(int i = 0; i < s1.size(); i++)
        {
            cout<<s[i]<<s1[i];

        }
        k = s.size();
        cout<<s[k-1];
    }


}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }

    #[allow(dead_code)]
    pub fn get2<T: FromStr, U: FromStr>() -> (T, U)
    where
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }

    #[allow(dead_code)]
    pub fn get3<S: FromStr, T: FromStr, U: FromStr>() -> (S, T, U)
    where
        <S as FromStr>::Err: Debug,
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }
}

// std::cmp::Reverse doesn't have Clone.
#[derive(Eq, PartialEq, Clone)]
struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

#[allow(unused_macros)]
macro_rules! debug {
    ($x: expr) => {
        println!("{}: {:?}", stringify!($x), $x)
    }
}

fn main() {
    let s: Vec<char> = util::line().chars().collect();

    if s.windows(2).any(|v| v[0] == 'A' && v[1] == 'C') {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    ll a, b, c;
    char d;
    cin >> a >> b >> d >> c;

    b = b * 100 + c;
    put((a * b) / 100); 
    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include<queue>

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
int gcd(int a, int b){return b ? gcd(b, a%b) : a;}
int lcm(int a, int b){return a*b / gcd(a, b);}

int main(){
    int n;
    cin >> n;
    vector<ll> a(n), sum(n+1); //n番目までの累積和
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++){
        sum[i+1] = sum[i]+a[i];
    }
    ll ans = 20202020202020;
    for(int i = 1; i < n; i++){
        ll low = sum[i];
        ll high = sum[n]-sum[i];
        ans = min(ans, abs(low-high));
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
    int h, w, n;
    cin >> h >> w >> n;
    int s1, s2;
    cin >> s1 >> s2;
    s1--; s2--;
    string S, T;
    cin >> S >> T;

    int judge = 1;
    int p = 0;
    rep(i, n){
        if (S[i] == 'R') p++;
        if (s2 + p >= w) judge = 0;
        if (s2 + p) if (T[i] == 'L') p--;
    }
    p = 0;
    rep(i, n){
        if (S[i] == 'L') p--;
        if (s2 + p < 0) judge = 0;
        if (s2 + p < w - 1) if (T[i] == 'R') p++;
    }
    p = 0;
    rep(i, n){
        if (S[i] == 'U') p--;
        if (s1 + p < 0) judge = 0;
        if (s1 + p < h - 1) if (T[i] == 'D') p++;
    }
    p = 0;
    rep(i, n){
        if (S[i] == 'D') p++;
        if (s1 + p >= h) judge = 0;
        if (s1 + p) if (T[i] == 'U') p--;
    }
    if (judge) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 3932