akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

class SegTree {
public:
  int N;
  int* dat;
  static int INT_MAX; // (1 << 31) - 1;

  SegTree(int n) {
    N = 1;
    while (N < n) N *= 2;
    dat = new int[2 * N - 1];
    for (auto i = 0; i < 2 * N - 1; ++i) {
      dat[i] = INT_MAX;
    }
  }

  ~SegTree() {
    delete[] dat;
  }

  void update(int k, int a) {
    k += N - 1;
    dat[k] = a;
    while (k > 0) {
      k = (k - 1)/2;
      dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }

  int find(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return INT_MAX;
    if (a <= l && r <= b) return dat[k];
    int vl = find(a, b, k * 2 + 1, l, (l + r) / 2);
    int vr = find(a, b, k * 2 + 2, (l + r) / 2, r);
    return min(vl, vr);
  }

  int find(int a, int b) {
    return find(a, b, 0, 0, N);
  }
  
};

int SegTree::INT_MAX = 2147483647; // (1 << 31) - 1;

int main () {
  int n, q;
  cin >> n >> q;
  SegTree st(n);
  for (auto i = 0; i < q; ++i) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com == 0) {
      st.update(x, y);
    } else {
      cout << st.find(x, y+1) << endl;
    }
  }
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define MOD 1e9+7
#define sp ' '


using ll = long long;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

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

    map<ll,ll> mp;
    int n;
    cin >> n;

    ll s[n+1];
    s[0] = 0;
    mp[0]++;

    rep(i, n) {
        ll a;
        cin >> a;
        s[i+1] = s[i] + a;
        mp[s[i+1]]++;
    }

    ll cnt = 0LL;
    for(auto x : mp)
        cnt += x.second*(x.second-1LL)/2LL;
    
    ppp(cnt);

    return 0;
}


Measured memory_bytes: 14336
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

// sort map

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	es := make(entries, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		s := sc.Text()

		sc.Scan()
		p, _ := strconv.Atoi(sc.Text())
		e := entry{s, p, i+1}
		es[i] = e
	}
	sort.Sort(es)
	for i := 0; i< n; i++ {
		fmt.Println(es[i].id)
	}
}

type entry struct {
	key string
	value int
	id int
}

type entries []entry

func(es entries) Len() int {
	return len(es)
}

func (es entries) Swap(i, j int) {
	es[i], es[j] = es[j], es[i]
}
func (es entries) Less(i, j int) bool {
	if es[i].key != es[j].key {
		return es[i].key < es[j].key
	}
	return es[i].value > es[j].value
}


Measured memory_bytes: 1844
import java.util.*;

public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int INF=1000000000;
        int h[]=new int[n];
        for(int i=0;i<n;i++){
            h[i]=sc.nextInt();
        }
        int dp[]=new int[n];
        for(int i=0;i<n;i++){
            dp[i]=INF;
        }
        for(int i=0;i<n;i++){
            if(i==0) dp[i]=0;
            if(i>=1) dp[i]=Math.min(dp[i],dp[i-1]+Math.abs(h[i]-h[i-1]));
            if(i>=2) dp[i]=Math.min(dp[i],dp[i-2]+Math.abs(h[i]-h[i-2]));
        }
        System.out.println(dp[n-1]);
    }
}

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

k = 0
a = [0]
for t in s:
 if t == "#":
  k += 1
 a.append(k)
#print(a)

m = a[n]
p = n
for i in range(n+1):
 p = min(p, a[i] + (n-i) - (m-a[i]))
print(p)


Measured memory_bytes: 11136
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < 5; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		sc.close();

		for(int i = 0; i < 5; i++) {
			if(list.get(i) == 0) {
				int ans = i + 1;
				System.out.println(ans);
				return;
			}
		}
	}

}

Measured memory_bytes: 35644
#include<stdio.h>
#include <string.h>
#include<math.h>

int main(){
	long n;
	int i;
	
	scanf("%d",&n);
	i=n-1;
	while(i>1){
		n*=i;
		i--;
	}
	printf("%lld\n",n);
	
	return 0;
}

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

int main(){
    int n,d;
    cin>>n>>d;
    int ans=0;
    int a[n][d];
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int len=0;
            for(int k=0;k<d;k++){
                len+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
            }
            for(int k=0;k*k<=len;k++){
                if(k*k==len)ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <iostream>
using namespace std;
int main(){
    int n,m,d;
    cin>>n>>m>>d;
    if(d==0){
        printf("%.8f\n",(1.0)*(m-1)/n);
    }else{
        printf("%.8f\n",(1.0)*2*(m-1)*(n-d)/n/n);
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>



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

  string s,t;
  cin>>s>>t;

  int ans=0;
  rep(i,3){
    if(s[i]==t[i]) ans++;
  }
  cout<<ans<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define sc second
#define fr first
#define mk make_pair
#define ll long long
#define ii pair<int,int>
#define mp make_pair
using namespace std;
int n,m;
int memo[3005][3005];
string s[3005];
int mod = 1e9+7;
int solve(int i,int j)
{
    if(i == n-1 && j == m-1)
    {
        return 1;
    }
    int &ret = memo[i][j];
    if(ret != -1)
        return ret;
    ret = 0;
    if(i < n-1)
    {
        if(s[i+1][j] == '.')
            ret +=solve(i+1,j);
        ret %=mod;
    }
    if(j < m-1)
    {

        if(s[i][j+1] == '.')
            ret +=solve(i,j+1);
        ret%=mod;
    }
    ret%=mod;
    return ret;
}
int main()
{
    cin>>n>>m;
    memset(memo,-1,sizeof(memo));
    for(int i=0; i<n; i++)
    {
        char ch[m+1];
        scanf("%s",ch);
        s[i] = (string) ch;
    }
    cout<<solve(0,0);
}


Measured memory_bytes: 36736
N = int(input())
A = list(map(int,input().split())) + [0]
ans = 0
while sum(A) > 0:
    f = 0
    for k in range(N+1):
        if A[k] > 0:
            f = 1
            A[k] -= 1
        elif A[k] == 0:
            ans += f
            f = 0
#    print(A)
print(ans)


Measured memory_bytes: 38896
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int a,b,c,k; 
    cin>>a>>b>>c>>k; 
    while (a>=b and k-->0){
        b *= 2;
    }
    while (b>=c and k-->0){
        c *= 2;
    }
    if (c>b and b>a) cout << "Yes" << endl;
    else cout << "No" << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3628
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[]$) {
        List<Integer> list = IntStream.range(0, 5).map(i -> scanner.nextInt())
                .boxed()
                .sorted(Comparator.comparingInt(i -> (i - 1) % 10))
                .collect(Collectors.toList());
        System.out.println(list.get(0) + list.subList(1, list.size()).stream().mapToInt(i -> (i - 1) / 10 * 10 + 10).sum());
    }
}

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

n = int(input())
a = ['']*n
b = [0]*n
for i in range(n):
    a[i],b[i] = input().split()

array_S = []
for i in range(14):
    count = 0
    for j in range(n):
        if i == int(b[j]):
            if a[j] == 'S':
                break
        count += 1
        if count == n:
            array_S.append(i)
            
array_H = []
for i in range(14):
    count = 0
    for j in range(n):
        if i == int(b[j]):
            if a[j] == 'H':
                break
        count += 1
        if count == n:
            array_H.append(i)

array_C = []
for i in range(14):
    count = 0
    for j in range(n):
        if i == int(b[j]):
            if a[j] == 'C':
                break
        count += 1
        if count == n:
            array_C.append(i)
            
array_D = []
for i in range(14):
    count = 0
    for j in range(n):
        if i == int(b[j]):
            if a[j] == 'D':
                break
        count += 1
        if count == n:
            array_D.append(i)
            
for i in range(1,len(array_S)):
    print('S',array_S[i],sep =' ')
for i in range(1,len(array_H)):
    print('H',array_H[i],sep =' ')
for i in range(1,len(array_C)):
    print('C',array_C[i],sep =' ')
for i in range(1,len(array_D)):
    print('D',array_D[i],sep =' ')

Measured memory_bytes: 7804
import numpy as np

s = [w for w in input()]
length = len(s)

for i in range(2 ** (length-1)):
    b = format(i, 'b')
    b_len = len(b)
    pad_width = ((length-1) - b_len, 0)
    b_pad = np.pad([int(n) for n in b], pad_width, 'constant')
    score = int(s[0])
    result = s[0]
    for flag, num in zip(b_pad, s[1:]):
        if flag == 1:
            score += int(num)
            result += '+' + num
        else:
            score -= int(num)
            result += '-' + num

    if score == 7:
        print(result+'=7')
        break


Measured memory_bytes: 13176
#include <bits/stdc++.h>
using namespace std;
#define MAXN 200002

int n;
bool vis[MAXN] = {false}, use[MAXN] = {false};
vector <int> e[MAXN], r[3], g[2];
int col[MAXN] = {0}, p[3] = {0};

void color (int x, int sig) {
    g[sig & 1].push_back (x);
    vis[x] = true;
    for (int i = 0; i < e[x].size (); i ++)
        if (!vis[e[x][i]])
            color (e[x][i], sig ^ 1);
}

int main () {
    cin >> n;
    for (int i = 1; i < n; i ++) {
        int u, v; cin >> u >> v;
        e[u].push_back (v); e[v].push_back (u);
        r[i % 3].push_back (i);
    }
    r[n % 3].push_back (n);
    
    color (1, 1);
    
    if (g[0].size () > g[1].size ()) {
        vector <int> tmp = g[0];
        g[0] = g[1]; g[1] = tmp;
    }

    if (g[0].size () <= n / 3) {
        for (int i = 0; i < g[0].size (); i ++) 
            col[g[0][i]] = r[0][p[0]], use[r[0][p[0] ++]] = true; 
        int pf = 1;
        for (int i = 0; i < g[1].size (); i ++) {
            if (use[pf]) pf ++;
            col[g[1][i]] = pf ++;
        } 
    }
    else {
        for (int i = 0; i < g[0].size (); i ++)
            if (p[1] < r[1].size ())
                col[g[0][i]] = r[1][p[1] ++];
            else col[g[0][i]] = r[0][p[0] ++];
        
        for (int i = 0; i < g[1].size (); i ++)
            if (p[2] < r[2].size ())
                col[g[1][i]] = r[2][p[2] ++];
            else col[g[1][i]] = r[0][p[0] ++];        
    }

    for (int i = 1; i <= n; i ++)
        cout << col[i] << " ";

    return 0;
}

Measured memory_bytes: 19988
#include <cstdio>
#include <algorithm>
#include <numeric>
#include <map>
#define fail return puts("-1"), 0

const int N = 1e5 + 5, M = 2e5 + 5;

int n, tot, lnk[N], ter[M], nxt[M], sz[N];
long long dis[N], d[N];
std::map<long long, int> mp;

void add(int u, int v) {
	ter[++tot] = v, nxt[tot] = lnk[u], lnk[u] = tot;
}
void dfs(int u, int p) {
	for (int i = lnk[u]; i; i = nxt[i]) {
		int v = ter[i];
		if (v == p) continue;
		dis[v] = dis[u] + 1;
		dfs(v, u);
	}
}
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%lld", &d[i]);
		mp[d[i]] = i, sz[i] = 1;
	}
	int cnt = 0;
	for (auto it = mp.rbegin(); it != mp.rend(); it++) {
		int v = it->second, u = mp[it->first + 2 * sz[v] - n];
		if (!u || u == v) fail;
		add(u, v), add(v, u), sz[u] += sz[v];
		if (++cnt == n - 1) break;
	}
	int rt = mp.begin()->second;
	dfs(rt, 0);
	if (std::accumulate(dis + 1, dis + n + 1, 0LL) != d[rt]) fail;
	for (int i = 1; i <= tot; i += 2) {
		printf("%d %d\n", ter[i], ter[i + 1]);
	}
	return 0;
}

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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */

int main() {
    /* code */
    string S;
    cin >> S;
    string S_1 = S.substr(0, (S.length() - 1) / 2);
    string S_1r = S_1;
    std::reverse(S_1r.begin(), S_1r.end());
    string S_2 = S.substr((S.length() + 3) / 2 - 1, S.length() - 1);
    string S_2r = S_2;
    std::reverse(S_2r.begin(), S_2r.end());
    string S_r = S;
    std::reverse(S_r.begin(), S_r.end());
    if (S_1 == S_1r && S_2 == S_2r && S_r == S) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<algorithm>

using namespace std;

const int MAX_E = 1e5 + 1;

class KRUSKAL {

   public: 
      int par[MAX_E];
      int UFTrank[MAX_E];
      struct edge { int u, v, cost; };
      edge es[MAX_E * 2];
      int E, V;

      bool comp(const edge& e1, const edge& e2) {
         return e1.cost < e2.cost;
      }
      
      void init(int e, int v) {
         E = e;
         V = v;
         // sort(es, es + E, comp);
         sort(es, es + E, [this] (edge& e1, edge& e2) { return  comp(e1, e2); } );
         for (int i = 0; i < V; i++) {
            par[i] = i;
            UFTrank[i] = 0;
         }
      }

      int find(int x) {
         if (par[x] == x) {
            return x;
         } else {
            return par[x] = find(par[x]);
         }
      }

      void unite(int x, int y) {
         x = find(x);
         y = find(y);
         if (x == y) return;

         if (UFTrank[x] < UFTrank[y]) {
            par[x] = y;
         } else {
            par[y] = x;
            if (UFTrank[x] == UFTrank[y]) UFTrank[x]++;
         }
      }

      bool same(int x, int y) {
         return find(x) == find(y);
      }       

      int getmin() {
         int ans = 0;
         for (int i = 0; i < E; i++) {
            edge e = es[i];
            if (!same(e.u, e.v)) {
               unite(e.u, e.v);
               ans += e.cost;
            }
         }
         return ans;
      }
};



int main() {
   int V, E;
   cin >> V >> E;
   KRUSKAL mst;
   int s, t, w;
   for (int i = 0; i < E; i++) {
      cin >> s >> t >> w;
      mst.es[i].u = s;
      mst.es[i].v = t;
      mst.es[i].cost = w;
   }
   mst.init(E, V);
   int ans = mst.getmin();
   cout << ans << endl;
   return 0;
}



Measured memory_bytes: 4364
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;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 itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;


int main(){
    string s;
    cin >> s;
    if(s.length() == 2){
        if(s[0] == s[1]){
            cout << "1 2" << endl;
            return 0;
        }
        else{
            cout << "-1 -1" << endl;
            return 0;
        }
    }
    REP(i,s.length()-2){
        set<char> t;
        FOR(j,i,i+3) t.insert(s[j]);
        if( t.size() <=2){
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }
    cout << -1 << " -1" <<endl;
}

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

int main(){
  string s,t;
  cin>>s>>t;
  if(t.find(s)!=-1&&s.size()+1==t.size()&&s[0]==t[0] ){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
  


Measured memory_bytes: 3624
Q = int(input())

def is_prime(n):
    if n == 1: return False
    for k in range(2, int(n**0.5)+1):
        if n % k == 0:
            return 0
    return n

prime_numbers = [is_prime(i) for i in range(2, 10**5 + 1) if is_prime(i) != 0]
same = [0]*(10**5 + 1)
for n in prime_numbers:
    if (n+1) // 2 in prime_numbers:
        same[n] += 1

for i in range(10**5):
    same[i+1] += same[i]

ans = []
for _ in range(Q):
    l, r = map(int, input().split())
    N = same[r] - same[l-1]
    ans.append(N)

print(*ans, sep='\n')


Measured memory_bytes: 59100
N = gets.to_i
POINTS = N.times.map { gets.split.map(&:to_i) }

V = X = 0
U = Y = 1

mods = POINTS.map { |point| (point[X] + point[Y]) % 2 }

if mods.uniq.size != 1
  puts -1
  exit
end

max_s = 0
vu_points = POINTS.map do |point|
  v = point[X] - point[Y]
  u = point[X] + point[Y]

  u_s = u == 0 ? 0 : Math.log2(u.abs).floor
  v_s = v == 0 ? 0 : Math.log2(v.abs).floor
  max_s = [max_s, u_s, v_s].max # どの領域の座標か

  [v, u]
end

arms = (max_s + 1).times.map { |i| 2 ** i }
arms.unshift(1) if mods[0] == 0

puts arms.size
puts arms.join(' ')

vu_points.each do |point|
  v = point[V]
  u = point[U]
  modes = []
  arms.reverse_each do |arm|
    if u > 0 && v > 0
      modes.unshift('R')
      v -= arm
      u -= arm
    elsif u > 0 && v <= 0
      modes.unshift('U')
      v += arm
      u -= arm
    elsif u <= 0 && v > 0
      modes.unshift('D')
      v -= arm
      u += arm
    else
      modes.unshift('L')
      v += arm
      u += arm
    end
  end

  puts modes.join
end

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

int main(void){

	int R,G,B,N;
	cin >> R >> G >> B >> N;
	int r=0,g=0,b=0;
	int count=0;

	int maxr,maxg;
	maxr=N/R;

	for(r=maxr;r>=0;r--){
		maxg=(N-(R*r))/G;
		for(g=maxg;g>=0;g--){
			b=(N-((R*r)+(G*g)))%B;
			if(b==0)
				count++;
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const LL INF = 1LL << 60;
char s[10];

int main() {
	scanf("%s", s + 1);
	bool flg = 1;
	if(s[3] != s[4] || s[5] != s[6]) flg = 0;
	if(flg) puts("Yes");
	else puts("No");
	return 0;
}

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

//AtCoder Beginner Contest 153
//C - Fennec vs Monster
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int K = Integer.parseInt(sc.next());
		int[] arrH = new int[N];
		for (int i = 0; i < N; i++) {
			arrH[i] = Integer.parseInt(sc.next());
		}
		sc.close();

		long ans = 0;
		Arrays.sort(arrH);
		for (int i = 0; i < N - K; i++) {
			ans += arrH[i];
		}
		System.out.println(ans);
	}
}


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

int n;
vector <int> a ,ans;
vector <vector<int>> adj;

set <int> lis;
void dfs(int u ,int p){
    int bef = -1;
    auto it = lis.lower_bound(a[u]);
    if(it != lis.end())
        lis.erase(it) ,bef = *it;
    lis.insert(a[u]);
    ans[u] = lis.size();
    for(int&v : adj[u]) if(v != p)
        dfs(v ,u);
    if(lis.count(a[u]))
        lis.erase(a[u]);
    if(~bef)
        lis.insert(bef);
}

int main()
{
    scanf("%d",&n);
    a.resize(n+1);
    ans.resize(n+1);
    adj.resize(n+1);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(int a,b,i=1; i<n; i++){
        scanf("%d%d",&a,&b);
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    dfs(1 ,-1);

    for(int i=1; i<=n; i++)
        printf("%d\n",ans[i]);
}


Measured memory_bytes: 27712
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}

func scanInt64() int64 {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return int64(a)
}

func scanFloat() float64 {
	sc.Scan()
	a, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		fmt.Println(err)
	}
	return a
}

func scanTextSlice(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = scanText()
	}
	return a
}

func scanSlice(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func scanFloatSlice(n int) []float64 {
	a := make([]float64, n)
	for i := 0; i < n; i++ {
		a[i] = scanFloat()
	}
	return a
}

func scanInt64Slice(n int64) []int64 {
	a := make([]int64, n)
	for i := int64(0); i < n; i++ {
		a[i] = scanInt64()
	}
	return a
}

// var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	// n := scanInt()

	input := scanSlice(2)
	h := input[0]
	a := input[1]

	// maze := make([]string, 0)

	// for i := 0; i < n; i++ {
	// 	maze[i] = make([]string, m)
	// }
	ans := h / a
	if h%a > 0 {
		ans++
	}

	// for i := 0; i < n; i++ {

	// }

	fmt.Println(ans)

}

func calc() int {

	return 0

}

type position struct {
	x        int
	y        int
	distanse int
}

func binarySearch(arr []int, number int) int {

	l := -1
	r := len(arr)
	index := 0
	for {
		mid := l + (r-l)/2
		tmp := arr[mid]

		if r-l <= 1 || tmp == number {
			index = mid
			break
		} else if tmp < number {
			l = mid
		} else {
			r = mid
		}
	}
	return index
}

func factorial(n int) int64 {
	sum := int64(1)
	for i := 2; i <= n; i++ {
		sum *= int64(i)
	}
	return sum
}

func deleteNumOfArray(arr []int, position int) []int {
	left := arr[:position]
	r := arr[position+1:]
	appendArr := append(left, r...)
	return appendArr
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(){
  int n;cin>>n;
  long long a[n];
  for(int i = 0; n > i; i++){
    cin>>a[i];
  }
  if(n==2){
    cout << abs(a[1]-a[0]) << endl;
    return 0;
  }
  long long b[n];
  b[0]=0;
  for(int i = 1; n-1 > i; i++){
    b[i]=a[i]+b[i-1];
  }
  long long ans = abs((a[n-1]+b[n-2]-b[1])-(a[0]+b[1]));
  for(int i = 1; n-1 > i; i++){
    ans = min(ans,abs((a[n-1]+b[n-2]-b[i])-(a[0]+b[i])));
  }
  cout << ans << endl;
}
  
  

Measured memory_bytes: 3328
#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++)

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

    ll ans = 0;
    rep(i, 1, 43){
        ll rem = B % (1LL<<i);
        ll b = (ll)(B/(1LL<<i)) * (1LL<<(i-1)) + max(0LL, rem+1 - (1LL<<(i-1)));
        rem = (A-1) % (1LL<<i);
        ll a = (ll)((A-1)/(1LL<<i)) * (1LL<<(i-1)) + max(0LL, rem+1 - (1LL<<(i-1)));
        //cerr << a << " " << b << endl;
        ll one = b - a;
        if(one % 2 == 1) ans += (1LL<<(i-1));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import math
import sys
input = sys.stdin.readline


def main():
    a, b, x = map(int, input().split())
    x /= a
    h = x / a
    if h < b/2:
        t = 2 * x / b
        ans = math.degrees(math.atan(b/t))
    else:
        ans = math.degrees(math.atan(2*(b-h)/a))
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9360
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

char dp[1000001];

int main(){
	int n, a, b;
	cin >> n >> a >> b;
	while(n | a | b){
		memset(dp, 0, sizeof dp);
		dp[0] = 1;

		for(int i = 1; i <= n; ++i){
			if(i-a >= 0 && dp[i-a]){
				dp[i] = 1;
			}
			if(i-b >= 0 && dp[i-b]){
				dp[i] = 1;
			}
		}
		int canDo = 0;
		for(int i = 1; i <= n; ++i){
			canDo += dp[i];
		}
		cout << n-canDo << endl;

		cin >> n >> a >> b;
	}
}

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

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

#define int64 int64_t
#define uint64 uint64_t
#define uint unsigned

short a[10000], b[10000];
int n;

int main()
{
    while(cin >> n){
        if(n <= 0) break;

        REP(i, n)
            cin >> a[i] >> b[i];
        uint ap = 0;
        uint bp = 0;

        REP(i, n){
            if(a[i] > b[i])
                ap += a[i] + b[i];
            else if(a[i] < b[i])
                bp += a[i] + b[i];
            else{
                ap += a[i];
                bp += b[i];
            }
        }
        cout << ap << ' ' << bp << endl;
    }
}

Measured memory_bytes: 3088
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;

public class Program
{
    public void Proc() {

        Reader.IsDebug = false;
        int inpt = int.Parse(Reader.ReadLine());
        List<int> tmp = new List<int>();
        for(int i=2;i<=inpt; i++) {
            tmp.Add(i);
        }
        
        for(int i=0; i<tmp.Count; i++) {
            if(tmp[i] > 1) {
                int nm = tmp[i];
                for(int j=i; j<tmp.Count; j+=nm) {
                    if(tmp[j]%nm==0) {
                        if(!yakusu.ContainsKey(nm)) {
                            yakusu.Add(nm, 0);
                        }
                        while(tmp[j] % nm == 0) {
                            yakusu[nm]++;
                            tmp[j] = tmp[j] / nm;
                        }
                    }
                }
            }
        }
        
        long ans = 1;
        yakusu.ToList().ForEach(a=>{
            ans*=(a.Value+1);
            ans = ans % mod;
        });
        Console.WriteLine(ans);
    }


    private Dictionary<int, int> yakusu = new Dictionary<int, int>();
    
    private const long mod = 1000000000 + 7;

    public class Reader {
        public static bool IsDebug = true;
        private static System.IO.StringReader SReader;
        private static string InitText = @"


1000


";
        public static string ReadLine() {
            if(IsDebug) {
                if(SReader == null) {
                    SReader = new System.IO.StringReader(InitText.Trim());
                }
                return SReader.ReadLine();
            } else {
                return Console.ReadLine();
            }
        }
    }
    public static void Main(string[] args)
    {
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 3288
N = int(input())
D,X = map(int,input().split())
A = [int(input()) for i in range(N)]
sum = N

for i in A:
    day = i
    d = 1
    while day <= D:
        day = d*i+1
        d += 1
        if day <= D:
            sum += 1
        else:
            break

sum += X
print(sum)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#include <stdint.h>

#pragma optimize("O3")

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;

#define sync                    \
ios_base::sync_with_stdio(0); \
cin.tie(0);                   \
cout.tie(0)
#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define pb push_back
#define mp make_pair
#define fopen freopen("input.txt", "r", stdin); freopen("output.txt","w", stdout)
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, b, a) for(ll i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define REPR(i, N) RFOR(i, N, 0)
#define FILL(A,value) memset(A,value,sizeof(A))
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll, ll>
#define MP make_pair
#define endl '\n'

const ll MOD = 1e9 + 7;
const ll INF = 2*1e12 + 7;
const int base = 2e5+1;
const int MAX =1e4+2;
const double EPS = 1e-9;
const double PI = acos(-1.);
const int MAXN = 2*1e6+1;




int main()
{
    int n;
    cin >> n;
    vl a(n), b(n), c(n), cnt(n,0);
    FOR(i,0,n) cin >> a[i];
    FOR(i,0,n) cin >> b[i];
    FOR(i,0,n) cin >> c[i];
    sort(ALL(a));
    sort(ALL(b));
    sort(ALL(c));
    FOR(i,0,n)
    {
        int x = c.end() - upper_bound(ALL(c), b[i]);
        if(x < 0) continue;
        cnt[i] = x;
    }
    FORR(i,n-1,0)
    {
        cnt[i] += cnt[i+1];
    }
    ll res = 0;
    FOR(i,0,n)
    {
        int x = upper_bound(ALL(b), a[i]) - b.begin();
        if(x >= n) continue;
        res += cnt[x];
    }
    cout << res;
    return 0;
}





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

using namespace std;

void solve(void)
{
	int n, q;
	string s;
	cin >> n >> q >> s;
	vector<char> ts(q), ds(q);
	for (int i = 0; i < q; i++)
	{
		cin >> ts[i] >> ds[i];
	}
	int l = -1, r = n;
	while(l+1<r)
	{
		int m = (l + r) / 2, p = m;
		char t = s[p];
		for (int i = 0; i < q; i++)
		{
			if (ts[i] == t)
			{
				if (ds[i] == 'L')
				{
					p--;
				}
				else p++;
			}
			if (p < 0 || p >= n) break;
			t = s[p];
		}
		if (p < 0) l = m;
		else r = m;
	}
	int ans = n - l - 1;
	l = -1, r = n;
	while(l+1<r)
	{
		int m = (l + r) / 2, p = m;
		char t = s[p];
		for (int i = 0; i < q; i++)
		{
			if (ts[i] == t)
			{
				if (ds[i] == 'L')
				{
					p--;
				}
				else p++;
			}
			if (p < 0 || p >= n) break;
			t = s[p];
		}
		if (p >= n) r = m;
		else l = m;
	}
	ans -= n - r;
	cout << ans << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from bisect import bisect_left

def main():
    n=int(input())
    A=list(map(int, input().split()))
    Edges=[[] for _ in range(n)]
    for _ in range(n-1):
        u,v=map(int,input().split())
        u-=1; v-=1
        Edges[u].append(v)
        Edges[v].append(u)
    LIS=[10**11]*n
    Ans=[0]*n

    def dfs(v,par):
        idx=bisect_left(LIS,A[v])
        tmp=LIS[idx]
        LIS[idx]=A[v]
        Ans[v]=bisect_left(LIS,10**10)
        for chi in Edges[v]:
            if chi==par:
                continue
            dfs(chi,v)
        LIS[idx]=tmp

    dfs(0,-1)
    print(*Ans,sep='\n')

if __name__=='__main__':
    main()

Measured memory_bytes: 362092
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a>0) cout<<"Positive"<<endl;
    else if(b>=0) cout<<"Zero"<<endl;
    else if((a-b)%2) cout<<"Positive"<<endl;
    else cout<<"Negative"<<endl;
}


Measured memory_bytes: 384
import math
N, D = map(int, input().split())
P = [list(map(int,input().split())) for i in range(N)]

cnt = 0
for i in range(N):
    d = math.sqrt(int(P[i][0])**2 + int(P[i][1])**2)
    if d <= D:
        cnt += 1

print(cnt)

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

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

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

const ll INF=(ll)1e19;
//const int INF=(1<<30);

int main(){
  int a,b,k;
  VI ans;
  cin >> a >> b >> k;
  FOR(i,1,101){
    if(a%i == 0 && b%i == 0){
      ans.emplace_back(i);
    }
  }
  cout << ans[ans.size()-k] << endl;
}



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

int main(){
  int n;
  cin>>n;
  bool flag = false;
  int a = n%10;
  int b = (n/10)%10;
  int c = (n/100)%10;
  int d = (n/1000)%10;
  if(a!=b && b!=c && c!=d)
    cout<<"Good";
  else
    cout<<"Bad";
}

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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());

signed main()
{   
    gearup;
    int n,t; cin >> n >> t;
    vl a(n);
    rep(i,n)cin>>a[i];
    ll mi = L_INF,ma = 0;
    mi = a[0];
    map<int,int> mp;
    rep1(i,n){
        ll num = a[i] - mi;
        if(num > 0){
            ma = max(ma,num);
            mp[num]++;
        }
        mi = min(mi,a[i]);
    }
    out(mp[ma]);
    //out(ma);
}

Measured memory_bytes: 10316
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#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++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
typedef priority_queue<string> priquest;
typedef priority_queue<string,vector<string>,greater<string>> rpriquest;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}

const ll big=1000000007;
ll exp(ll x,ll y){
    if(y==0)return 1;
    if(x==1||x==0)return x;
    if(y%2==1)return (exp(x,y-1)*x);
    ll t=exp(x,y/2);
    return (t*t);
}
void chmin(ll a,ll b){
    if(a>b)a=b;
    return;
}



int main(){
  //cout << fixed << setprecision(10);
  int n;scanf("%d",&n);
  map<ll,ll> ans1;
  map<ll,ll> ans2;
  for(int i=0;i<n;i++){
    int h;cin >> h;
    ans1[h+i]++;
    if(i<h)continue;
    ans2[i-h]++;
  }
  ll cnt=0;
  for(auto v : ans1){
    //cout << v.first << ' ' << v.second << endl;
    if(!ans2.count(v.first))continue;
    else cnt+=(v.second)*ans2[v.first];
  }
  
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 19792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>
#include <stack>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll x,n;
  cin >> x >> n;
  set<ll> not_avail;
  rep(i,n) {
    ll v;
    cin >> v;
    not_avail.insert(v);
  }

  ll l = x;
  ll r = x;
  while (true) {
    if (not_avail.find(l) == not_avail.end()) {
      cout << l << endl;
      return 0;
    }
    if (not_avail.find(r) == not_avail.end()) {
      cout << r << endl;
      return 0;
    }
    --l;
    ++r;
  }

  // Must not reach here
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int n;
const int maxN = 55;
vector < pair < int, int > > g[maxN];
int bits[maxN];
int main() {
    srand(time(0));
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    cin >> n;
    int last = -1;
    for (int i = 0; i < 20; i++) {
        if (n & (1 << i)) {
            last = i;
            bits[i] = 1;
        }
    }
    int ver = last + 1;
    int edges = 0;
    for (int j = last - 1; j >= 0; j--) {
        g[last - j].emplace_back(make_pair(last - j + 1, 1 << j));
        g[last - j].emplace_back(make_pair(last - j + 1, 0));
        edges += 2;
    }
    int cur = 1 << last;
    for (int i = last - 1; i >= 0; i--) {
        if (bits[i] == 1) {
            g[1].emplace_back(make_pair(last - i + 1, cur));
            cur += 1 << i;
            edges++;
        }
    }
    cout << ver << " " << edges << '\n';
    for (int i = 1; i <= ver; i++) {
        for (auto t : g[i]) cout << i << " " << t.first << " " << t.second << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)

void debug_out() {}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif

int run(istream& in, ostream& out) {
    char c{};
    in >> c;
    char ans = c+1;
    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 256
AA, BB, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
res = min(A) + min(B)
for i in range(M):
  x, y, c = list(map(int, input().split()))
  x-=1
  y-=1
  discount = A[x] + B[y] - c
  if discount < res:
    res = discount

print(res)


Measured memory_bytes: 71508
K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()
now = 0
count = 0
while True:
    now = (now * 10 + 7) % K
    count += 1
    if now % K == 0:
        print(count)
        exit()


Measured memory_bytes: 9120
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
bool isPrime(int n){
    if(n==1||n==1){
        return false;
    }
    for(int i=2;i<n;++i){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
int fact(int n){
    int ans = 1;
    for(int i = 1; i<= n; ++i){
        ans *= i;
    }
    return ans;
}


int main()
{
    int n;
    string s;
    cin>>n;
    set<string> c;
    for(int i = 0; i < n;++i){
        cin>>s;
        c.insert(s);
    }
    cout<<c.size()<<endl;
}

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

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
	ll N,z=0,A=0,B=0;
	string X;
	cin >> N >> X;
	vector<ll> f(N+1),a(N),b(N);

	f.at(0) = 0;
	rep(i,N) {
		ll x=i+1,c=0;
		rep(j,18)
			if(x & 1<<j)
				++c;
		f.at(x) = f.at(x%c)+1;
	}

	rep(i,N)
		z += (X.at(i) == '1');
	rep(i,N)
		if(X.at(i) == '1') {
			if(z != 1)
				A += modpow(2,N-i-1,z-1);
			B += modpow(2,N-i-1,z+1);
		}

	rep(i,N) {
		if(X.at(i) == '1') {
			if(z == 1)
				cout << 0;
			else
				cout << f.at((A-modpow(2,N-i-1,z-1))%(z-1))+1;
		} else
			cout << f.at((B+modpow(2,N-i-1,z+1))%(z+1))+1;
		cout << endl;
	}
}

Measured memory_bytes: 8400
#include<bits/stdc++.h>
#define lint long long int
#define rep(i,n) for(int i=0;i<int(n);i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define arep(i,a,n) for(int i=a;i<n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define fill(a,x) fill(a.begin(),a.end(),x)
#define eb(data) emplace_back(data)
#define pb(data) emplace_back(data)
#define mp make_pair
#define ALNUM 26
#define vint vector<int>
#define vlint vector<lint>
#define F first
#define S second
#define ALL(data) data.begin(),data.end()
#define GEts(s) getline(cin,s);
#define UNIQUE(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
using namespace std;
template<typename Rast>inline void out(Rast rast){cout<<rast<<"\n";return;}
template<typename Rast>inline void in(Rast& rast){cin>>rast;return;}
template<typename T>istream& operator >> (istream& is, vector<T>& vec){for(T& x: vec) is >> x;return is;}
template<typename First, typename... Rest>void in(First& first, Rest&... rest){cin >> first;in(rest...);return;}
template<typename First, typename... Rest>void out(First first, Rest... rest){cout << first<<" ";out(rest...);return;}
template<typename T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<typename T1,typename T2>bool chmax(T1& a,T2 b){if(a<b){a=b;return true;}else{return false;}}
template<typename T1,typename T2>bool chmin(T1& a,T2 b){if(a>b){a=b;return true;}else{return false;}}
template<typename T>T lcm(T a, T b){return a * b / gcd(a, b);}
static const double pi = 3.141592653589793;
lint modpow(lint a,lint n,lint p){if(n==1)return a%p;if(n%2==1)return (a*modpow(a,n-1,p))%p;lint t=modpow(a,n/2,p);return (t*t)%p;}//a^n%p
lint MOD=pow(10,9)+7;
//lint MOD=998244353;
lint inf=pow(2,50);
int intinf=pow(2,30);
/**/int dirx[]={1,0};int diry[]={0,1};//*///右、下
/**int dirx[]={0,1,0,-1};int diry[]={-1,0,1,0};//*///四方位
/**int dirx[]={-1,0,1,1,1,0,-1,-1};int diry[]={-1,-1,-1,0,1,1,1,0};//*///八方位

class unionfind{
public:
	vector<int> table;
	vector<int> wod;
	void init(int size){
		table.resize(size);
		wod.resize(size);
		rep(i,size)table[i]=i,wod[i]=i;
	};
	int root(int index){
		if(table[index]==index)return index;
		else{
			int hoge=root(table[index]);
			table[index]=hoge;
			return hoge;
		}
	};
	bool same(int x,int y){
		return(root(x)==root(y));
	};
	int marge(int x,int y){
		int yroot=root(y);
		int xroot=root(x);
		if(xroot==yroot)return 0;
		table[yroot]=xroot;
		return 0;
	}
};



int main(){
	cin.tie(0);ios::sync_with_stdio(false);cout<<std::fixed<<std::setprecision(12);
	int n;
	in(n);
	map<string,int> m;
	rep(i,n){
		string a;
		in(a);
		m[a]+=1;
	}
	out("AC x",m["AC"]);
	out("WA x",m["WA"]);
	out("TLE x",m["TLE"]);
	out("RE x",m["RE"]);
	return 0;
}


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

using namespace std;
typedef long long int ll;


int main() {
  string s;
  int n;
  string res;
  cin>>s>>n;
  for(int i = 0;i<s.size();i+=n){
    res+=s[i];
  }
  cout<<res<<endl;
  
  return 0;
}


Measured memory_bytes: 256
N ,K = list(map(int, input().split()))
p = list(map(lambda x: (1+int(x))/2, input().split()))
s = [0]*N
s[0]=p[0]
for i in range(1,N):
  s[i] = s[i-1]+p[i]

l = [s[K-1]]
for i in range(N-K):
  l.append(s[i+K]-s[i])

print(max(l))

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

int main() {

    int N; cin >> N;
    vector<int> A(N, 0);
    vector<int> B(N, 0);
    vector<int> C(N-1, 0);

    for (auto &a: A) cin >> a;
    for (auto &b: B) cin >> b;
    for (auto &c: C) cin >> c;

    int sum = 0;
    int before, current;
    before = -10;
    for (size_t i = 0; i < A.size(); i++) {
        current = A[i] - 1;
        sum += B[current];
        if ((before + 1) == current) sum += C[before];
        before = current;
    }

    cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll pow5(ll x){
    return x*x*x*x*x;
}


int main(){
    ll x;
    cin >> x;
    for(int a = -200; a <= 200; a++){
        for(int b = -200; b < a; b++){
            if(pow5(a) - pow5(b) == x){
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3524
#include<stdio.h>

int main(){
	int y,m,d,i,j,t=0,n;
	scanf("%d",&n);
	while(n--){
		scanf("%d %d %d",&y,&m,&d);
		if(!(y%3))t=20-d+1+20*(10-m);
		else{
			if(!(m%2))t=19-d+1+39*(5-m/2);
			else t=20-d+1+19+39*(4-m/2);
		}
		for(i=y+1;i<1000;i++){
			if(!(i%3))t+=200;
			else t+=195;
		}
		printf("%d\n",t);
	}
	return 0;
}

Measured memory_bytes: 1024