akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
"""
D - Islands War
https://beta.atcoder.jp/contests/abc103/tasks/abc103_d

"""
import sys
from sys import stdin
input = stdin.readline


def solve(N, M, data):
    ans = 0
    data.sort(key=lambda x: x[1])
    removed = -1
    for a, b in data:
        if not a <= removed < b:
            ans += 1
            removed = b - 1
    return ans


def main(args):
    N, M = map(int, input().split())
    data = [list(map(int, input().split())) for _ in range(M)]
    ans = solve(N, M, data)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 29132
#include <stdio.h>
#include <stdlib.h>

int main()
{
    char ss[51];
    char t[51];
    scanf("%s", ss);
    scanf("\n");
    scanf("%s", t);
    int lens = strlen(ss);
    int lent = strlen(t);
    int check = 1;
    int start = -1;
    for(int i = 0; i < lens; i++){
        check = 1;
        for(int k = i, j = 0; j < lent; j++, k++){
            if(ss[k] == 0){
                check = 0;
                break;
            }
            if(!(ss[k] == t[j] || ss[k] == '?')){
                check = 0;
                break;
            }
        }
        if(check){
            start = i;
        }
    }
    if(start < 0){
        printf("UNRESTORABLE");
        return 0;
    }
    for(int i = 0; i < lens; i++){
        if(ss[i] == '?'){
            ss[i] = 'a';
        }
    }
    int i = start;
    int j = 0;
    while(lent--){
        ss[i] = t[j];
        i++;
        j++;
    }
    printf("%s", ss);
    return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

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

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
//#define endl '\n'

using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 1e7 + 5, LG = 19, MOD = 998244353;
const int SQ =225;
const long double EPS = 1e-6;
vector<int> ord;
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
  int A, B;
  int V, W;
  int T;
  cin >> A >> V;
  cin >> B >> W;
  cin >> T;
  V -= W;
  ///abs(A-B) / V <= T
  if(abs(A-B) <= 1ll * V*  T)
    cout << "YES\n";
  else
    cout << "NO\n";

  return 0;
}


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

h, w = map(int, input().split())
s = []

for i in range(h):
    s.append(list(input()))

for y, r in enumerate(s):
    for x, c in enumerate(r):
        if c == '#':
            check_str = ''
            
            if x > 0:
                check_str+=r[x-1]
            if x < len(r) - 1:
                check_str+=r[x+1]
            if y > 0:
                check_str+=s[y-1][x]
            if y < len(s) - 1:
                check_str+=s[y+1][x]
            
            if not '#' in check_str:
                print('No')
                exit()

print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
 
int main() {
	int D, N;
	cin>>D>>N;
	int val;
	if(D==0) val = 1;
	else if(D==1) val = 100;
	else if(D==2) val = 10000;
	printf("%d\n", N == 100 ? (N+1)*val : N*val); 
	return 0;
}

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

int main(){
    long int mod = 1000000007;
    int N, M;
    cin >> N >> M;
    vector<bool> floor(100001, true);
    for (int i = 0; i < M; i++) {
        int a;
        cin >> a;
        floor[a] = false;
    }
    vector<long int> ans(100001, 0);
    ans[0] = 1;
    for (int i = 1; i <= N; i++) {
        if (floor[i]) {
            if (i == 1) ans[i] = 1;
            else ans[i] = (ans[i-1] + ans[i-2]) % mod;
        }
    }
    cout << ans[N] << "\n";
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

int m;
int x[16],y[16];
int pairID[16] = {};

int dfs(int h = 0){
  int res = 0;
  
  if(h*2 == m){
    // dy1/dx1 == dy2/dx2
    int id = 0;
    int dx[8], dy[8];
    for(int i=0;i<m;i++){
      if(pairID[i] > i){
        dx[id] = x[pairID[i]] - x[i];
        dy[id] = y[pairID[i]] - y[i];
        id++;
      }
    }

    int counter = 0;
    
    for(int i=0;i<m/2;i++){
      for(int j=i+1;j<m/2;j++){
        if(dx[i] == 0 || dx[j] == 0 || dy[i] == 0 || dy[j] == 0){
          if(dx[i] == 0 && dx[j] == 0){
            counter++;
          }
          if(dy[i] == 0 && dy[j] == 0){
            counter++;
          }
        }else{
          if(dy[i] * dx[j] == dy[j] * dx[i]){
            counter++;
          }
        }
      }
    }

    return counter;
  }
  
  for(int i=0;i<m;i++){
    if(pairID[i] == -1){

      for(int j=i+1;j<m;j++){
        if(pairID[j] == -1){
          pairID[i] = j;
          pairID[j] = i;
          res = max(res,dfs(h+1));
          pairID[i] = -1;
          pairID[j] = -1;
        }
      }

      break;
    }
  }

  return res;
}

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

  for(int i=0;i<m;i++){
    scanf("%d%d",x+i, y+i);
    pairID[i] = -1;
  }

  printf("%d\n",dfs());
  
  return 0;
}



Measured memory_bytes: 3232
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

class Main {

    public static void main(String [] args){
        FastReader reader = new FastReader();
        int n = reader.nextInt();
        int[][] activities = new int[n][];
        for (int i = 0; i < n; i++) {
            activities[i] = new int [] {reader.nextInt(), reader.nextInt(), reader.nextInt()};
        }
        int [][] dp = new int [n][3];
        dp[0] = activities[0];
        for (int i = 1; i < n; i++) {
            int a = dp[i - 1][0];
            int b = dp[i - 1][1];
            int c = dp[i - 1][2];
            dp[i][0] = Math.max(b, c) + activities[i][0];
            dp[i][1] = Math.max(a, c) + activities[i][1];
            dp[i][2] = Math.max(b, a) + activities[i][2];
        }

        System.out.println(Math.max(dp[n - 1][0], Math.max(dp[n - 1][1], dp[n - 1][2])));
    }

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

}


Measured memory_bytes: 54368
#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-1;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define INF 999999999

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef unordered_map<ll, ll> ump;

const ll mod = 1e9+7;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, a;
	cin >> n >> a;
	if (a>=n%500){cout << "Yes" << endl;}
	else {cout << "No" << endl;}
}


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

using namespace std;

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

    int city[n + 1], b[n];
    long long answer = 0;

    for (int i = 0; i < n + 1; i++)
        cin >> city[i];

    for (int i = 0; i < n; i++)
        cin >> b[i];

    for (int i = 0; i < n; i++)
    {
        if (b[i] > city[i])
        {
            b[i] -= city[i];
            answer += city[i];
            city[i] = 0;

            if (b[i] > city[i + 1])
            {
                b[i] -= city[i + 1];
                answer += city[i + 1];
                city[i + 1] = 0;
            }
            else
            {
                city[i + 1] -= b[i];
                answer += b[i];
                b[i] = 0;
            }
        }
        else
        {
            city[i] -= b[i];
            answer += b[i];
            b[i] = 0;
        }
    }

    cout << answer << endl;
    return 0;
}

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

int main() {
    string s; cin >> s;
    bool ok = false;
    if (s[0] == s[1] && s[1] == s[2]) ok = true;
    if (s[1] == s[2] && s[1] == s[3]) ok = true;
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll n;
  cin >> n;

  vector<ll> a(n);
  map<ll, ll> amap;
  REP(i, n){
    cin >> a[i];
    amap[a[i]]++;
  }

  sort(a.begin(), a.end());
  decltype(a)::iterator result = unique(a.begin(), a.end());
  a.erase(result, a.end());

  ll ans = 1;
  ll count = 0;
  for(int i = a.size()-1; i >= 0; i--){
    while(amap[a[i]] > 1){
      ans *= a[i];
      amap[a[i]] -= 2;
      count++;
      if(count == 2){
        cout << ans << endl;
        return 0;
      }

    }
  }

  cout << 0 << endl;
  
  
}


Measured memory_bytes: 7296
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
int mod = 1e9 + 7;

int main() {
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> b(m);
	for (int i = 0; i < m; ++i) {
		cin >> b[i];
	}
	int cnt = 0;
	for (int i = 0; i < n; ++i) {
		int sum = c;
		for (int j = 0; j < m; ++j) {
			int x;
			cin >> x;
			sum += x * b[j];
		}
		if (sum > 0) {
			cnt++;
		}
	}
	
	cout << cnt;
}



















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

int main() {
    int n, m, c;

    std::cin >> n >> m >> c;
    
    std::vector<int> b(m);
    for (int i = 0; i < m; i++) {
        std::cin >> b[i];
    }

    int count = 0;
    for (int j = 0; j < n; j++) {
        int sum = 0;
        for (int i = 0; i < m; i++) {
            int a;
            std::cin >> a;
            sum += a * b[i];
        }
        if (sum + c > 0) {
            count++;
        }
    }

    std::cout << count << std::endl;

    return 0;
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



int n, a[202020];
int d[202020];
void solve(){
	cin >> n;
	i64 cnt = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		d[a[i]]++;
		if(d[a[i]] >= 2) cnt += d[a[i]]-1;
	}
	
	for(int i = 0; i < n; i++){
		if(d[a[i]] >= 2) cout << cnt - (d[a[i]]-1) << endl;
		else cout << cnt << endl;
	}
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3712
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
using namespace std;
typedef long long LL;
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
}
int n,m,k;
int main()
{
	read(n),read(m),read(k);
	For(x,0,n)
		For(y,0,m)
		{
			if((n-x)*y+x*(m-y)==k)
			{
				puts("Yes");
				return 0;
			}
		}
	puts("No");
	return 0;
}


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

int main() {
    int n;
    cin>>n;
    vector<vector<int> > arr(n);
    vector<int> tmparr;
    int u, k;
    int tmp;
    for(int i=0;i<n;++i){
        cin>>u>>k;
        u--;
        tmparr.clear();
        for(int j=0;j<k;++j){
            cin>>tmp;
            tmp--;
            tmparr.push_back(tmp);
        }
        arr[u] = tmparr;
    }
    stack<int> stack;
    stack.push(0);
    map<int, int> used;
    map<int, int> owari;
    map<int, pair<int, int> > ans;
    int state;
    int time = 1;
    while(!stack.empty()){
        while(!stack.empty()){
            state = stack.top();
            if(used[state]>0){
                if(owari[state]==0){
                    ans[state].second = time;
                    owari[state]++;
                    time++;
                }
                stack.pop();
            }
            else {
                ans[state].first = time;
                time++;
            }
            used[state]++;
            for(int i=arr[state].size()-1;i>=0;--i){
                if(used[arr[state][i]]==0){
                    stack.push(arr[state][i]);
                }
            }
        }
        for(int i=0;i<n;++i){
            if(used[i]==0){
                stack.push(i);
                break;
            }
        }
    }
    for(int i=0;i<n;++i){
        cout<<i+1<<" "<<ans[i].first<<" "<<ans[i].second<<endl;
    }
}



Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC

const int N = 1e6 + 7;

void slow(int a[N], int n) {
    for (int len = n - 1; len; --len) 
        for (int i = 0; i < len; ++i)
            a[i] = abs(a[i] - a[i + 1]);
}

int pref[N], post[N];
int mod2(int a[N], int n) {
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        a[i] &= 1;
        if (a[i]) {
            ans ^= post[i + 1] == pref[n - 1 - i];
        }   
    }   
    return ans;
}   

int pw(int n) {
    int ans = 0;
    while (n % 2 == 0) {
        ++ans;
        n >>= 1;
    }   
    return ans;
}   

int a[N];
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    
    int n;
    cin >> n;

    for (int i = n - 1; i; --i)
        post[i] = post[i + 1] + pw(i);
    for (int i = 1; i < n; ++i)
        pref[i] = pref[i - 1] + pw(i);               

    bool h = 0;            
    for (int i = 0; i < n; ++i) {
        char c; cin >> c;
        a[i] = c - '1';
        h |= a[i] == 1;
    }
        
    if (h) {
        cout << mod2(a, n) << endl;
    }   
    else {
        for (int i = 0; i < n; ++i)
            a[i] >>= 1;
        cout << mod2(a, n) * 2 << endl;
    }   
}   


Measured memory_bytes: 23680
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
const int mod = 1000000007;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll ans = 0;
  int N; cin >> N;
  string s1, s2; cin >> s1 >> s2;
  bool tate = false;
  int j = 0;
  if(s1[0] == s2[0]) {
    tate = true;
    ans = 3;
    j = 1;
  } else {
    tate = false;
    ans = 6;
    j = 2;
  }
  while(j < N) {
    if(s1[j] == s2[j]) {
      // 縦->縦
      if(tate) {
        ans *= 2;
      } else {
        ans *= 1;
      }
      j++;
      tate = true;
    } else {
      // 縦->横
      if(tate) {
        ans *= 2;
      } else {
        ans *= 3;
      }
      j += 2;
      tate = false;
    }
    ans %= mod;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<queue>
#include<unordered_set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull; 
const ll maxn = 100000 + 5;
int main(){
//	ios::sync_with_stdio(false);
//	ifstream cin("data.txt");
//	freopen("data.txt", "r", stdin);
    int a, b;
    cin >> a >> b;
    if(b % a == 0)cout << a + b;
    else cout << b - a;
	return 0;
} 

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

namespace _0085
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                int[] items = RIntAr();
                if (items.Sum() == 0) break;

                int res = 1;
                for (int i = 2 ; i <= items[0] ; i++)
                {
                    res = (res + items[1]) % i;
                    if (res == 0) res = i;
                }
                Console.WriteLine(res);
            } 
        }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
    }

}



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

using namespace std;

void solve(int N, long x, vector<long> a) {
  sort(a.begin(), a.end());
  int ans = 0;
  rep (i, N) {
    x -= a[i];
    if (x >= 0)
      ans++;
    if (x <= 0)
      break;
  }
  if (x > 0)
    ans--;
  cout << ans << endl;
}

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

  int N;
  long x;
  cin >> N >> x;
  vector<long> a(N);
  for(int i = 0 ; i < N ; i++)
    cin >> a[i];

  solve(N, x, move(a));
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fst first
#define snd second
#define pb push_back
#define IO ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'
using namespace std;

string a,b,c;

int main()
{
	IO
	cin>>a>>b>>c;
	if(a[a.size()-1]==b[0] && b[b.size()-1] == c[0]){
		cout<<"YES"<<endl;
	}
	else
		cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios_base::sync_with_stdio(0);
    string s; cin >> s;
    if (s.find("RRR")!=-1) cout << 3 << endl; else
    if (s.find("RR")!=-1) cout << 2 << endl; else
    cout << (s.find("R")!=-1) << endl;
}


Measured memory_bytes: 3656
int digit(long long a){
    long long x=0;
    while(a>0){
        x++;
        a=a/10;
    }
    return x;
}

#include<stdio.h>
#include<string.h>

int main()
{
   long long n;
    while(scanf("%lld",&n)!=EOF){

            long long x,c=0;
            for(long long i=n;i>0;i--){
                x=digit(i);
                if(x%2!=0) c++;

            }
            printf("%lld\n",c);
    }
}


Measured memory_bytes: 128
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
		String s=sc.next();
        String t=sc.next();
  
  	String[] s1=s.split("");
  	String[] t1=t.split("");
  	String ans="";
  
    for(int c=0;c<n;c++){
      ans+=s1[c]+t1[c];
    }
 	

    	System.out.println(ans);
    }
}


Measured memory_bytes: 21716
import sys

cnt = {}

for line in sys.stdin:
  for l in line:
    if l.isalpha():
      c = l.lower()
      cnt[c] = cnt.get(c,0)+1

for i in range(26):
  c = chr(ord('a')+i)
  print( c, " : ", cnt.get(c,0), sep = '' )



Measured memory_bytes: 5568
#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 pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}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)...);}

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

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

	ll N=in<ll>();
	vector<ll> C=vecin<ll>(N);
	REP(i,N){
		if(C[i]%2){
			out("first");
			return 0;
		}
	}
	out("second");
	return 0;
}


Measured memory_bytes: 1024
import sys, math, re
from functools import lru_cache
from collections import defaultdict
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    X, Y = mi()
    if X%Y == 0:
        print(-1)
    else:
        print(X)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9948
<?php

  $stdin = fopen('php://stdin', "r");
  
  while(true) {
      fscanf($stdin, "%d", $num);
      if($num === 0) {
          break;
      }
      
      echo isPerfectNumber($num) . PHP_EOL;
  }
  
  function isPerfectNumber($num) {
      $mean = floor(sqrt($num));
      $divPlus = 1;
      if($num === 1) {
          return "deficient number";
      }
      for($i = 2; $i <= $mean; $i++) {
          $tmp = $num/$i;
          if(is_int($tmp)) {
              if($tmp === $i){
                $divPlus = $divPlus + $tmp;
              } else {
                $divPlus = $divPlus + $tmp + $i;
              }
              if($divPlus > $num) {
                  return "abundant number";
              }
          }
      }
      
      if($divPlus === $num) {
          return "perfect number";
      } else {
          return "deficient number";
      }
  }
  

?>

Measured memory_bytes: 6620
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

  string s;
  cin >> s;
  
  int zeroN = 0;
  int oneN = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '0') ++zeroN;
    if (s[i] == '1') ++oneN;
  }
  cout << min(zeroN, oneN)*2;
}

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

#define rep(i,a,b) for(i=(a);i<=(b);++i)
#define rev(i,a,b) for(i=(a);i>=(b);--i)
#define max2(a,b)  ((a)>(b)?(a):(b))
#define min2(a,b)  ((a)<(b)?(a):(b))
#define all(x) x.begin(),x.end()
#define sz(x) (long long)x.size()
#define fi first
#define se second
#define pb emplace_back // push_back
#define mp make_pair
#define endl '\n'

#ifdef Wild4Stone
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.fi); __p(a.se); cout << "}"; }
template<typename T>
void __f(const char* s, T t) { cout << s << " : "; __p(t); }
template<typename T>
void __t(const char* s, const T &x) { cout << s << " : { "; for (auto it : x) __p(it); cout << "} ";}
template<typename T, typename ... F>
void __f(const char* s, T t, F ... f) {
	int i = 0; for (;; ++i) if (s[i] == ',') break;
	cout.write(s, i) << " : "; __p(t); cout << " | "; __f(s + i + 1, f...);
}
#define trace(...) { cout<<"LINE: "<<__LINE__<<" || "; __f(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
#define autra(...) { cout<<"LINE: "<<__LINE__<<" || "; __t(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
#else
#define trace(...) {}
#define autra(...) {}
#endif

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

const ll mod = 1000000007;  //998244353;
const ll inf = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
const double PI = acos(-1);

ll i, j, k;
void solve(void);
inline bool equal(double a, double b) { return fabs(a - b) < eps; }
// inline ll gcd(ll a, ll b) { a=abs(a); b=abs(b); while(a>0 && b>0) (a>b?a%=b:b%=a); return (a==0?b:a); }
// inline ll power(ll x, ll n, ll m = LLONG_MAX)
//        {  ll res=1; x = (x%m + m)%m;
//             while(n) { if(n&1) res=(res*x)%m;  x=(x*x)%m;  n >>= 1; }  return res;
//        }

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	int t = 1;
	// cin>>t;
	while (t--)  solve();
	return 0;
}

//***************** Code Starts Here *******************//

void solve()
{
	ll x; cin >> x;
	ll ct = 0;
	ct += (x / 500);
	x = x - (x / 500) * 500;
	ct *= 1000;

	ct += (x / 5) * 5;
	cout << ct << endl;
}

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

int sq_distance(vector<int> x1, vector<int> x2);

int main() {
  int n, d;
  cin >> n >> d;
  vector<vector<int> > x(n, vector<int>(d, 0));
  for(int i = 0; i < n; i++){
    for(int j = 0; j < d; j++){
      cin >> x.at(i).at(j);
    }
  }

  int count = 0;
  for(int i = 0; i < n; i++){
    for(int j = i+1; j < n; j++){
      int d2 = sq_distance(x.at(i), x.at(j));
      int m = sqrt(d2);
      int k = 0;
      while(k*k <= d2){
        if(k*k == d2){
          count++;
          break;
        }
        else if(k*k > d2) break;
        else k++;
      }
    }
  }
  cout << count << endl;
}

int sq_distance(vector<int> x1, vector<int> x2){
  int sum = 0;
  for(int i = 0; i < x1.size(); i++){
    sum += pow(x1.at(i)-x2.at(i), 2);
  }
  return sum;
}


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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

signed main(){
	string S;
	cin >> S;
	int w;
	cin >> w;
	for(int i=0;i<S.length();i+=w){
		cout << S[i];
	}
}

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

int a, b, c;

int main() { 
	cin >> a >> b >> c;

	if ((c > a &&  c < b) || (c<a && c>b)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys

line = sys.stdin.readline().strip()
N, A, B = [int(x) for x in line.split()]

r = 0
for i in range(1, N + 1):
    s = str(i)
    csum = sum(int(c) for c in s)
    if A <= csum <= B:
        r += i

print(r)


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

using namespace std;

struct INIT{INIT(){ios::sync_with_stdio(false);cin.tie(0);}}init;

typedef long long LL;

#define rep(i,n) for(auto i=(n)*0;i<n;i++)
#define range(it,v) for(auto &it:v)
typedef vector<int> V;
typedef vector<V> graph;



int dfs(int v,int p,int K,graph& g){
    if(K<0)return 0;
    int res=1;
    range(u,g[v])if(u!=p)res+=dfs(u,v,K-1,g);
    return res;
}

int main(){
    int N,K;
    cin>>N>>K;
    graph g(N);
    rep(i,N-1){
	int A,B;cin>>A>>B;A--;B--;
	g[A].push_back(B);
	g[B].push_back(A);
    }
    int res=0;
    if(K%2==1){
	rep(i,N)range(it,g[i]){
	    res=max(res,dfs(i,it,K/2,g)+dfs(it,i,K/2,g));
	    //cout<<i<<" "<<it<<" "<<dfs(it,i,1,K,g)<<endl; 
	}
    }
    else{
	rep(i,N)res=max(res,dfs(i,i,K/2,g));
    }
    cout<<N-res<<endl;

    
    return 0;
}


Measured memory_bytes: 384
def main():
    M=10**9+7
    r=tuple(tuple((j-k)*9%13for j in range(10))for k in range(13))
    d=[1]+[0]*12
    for c in input():
        if c > '9':
            d = [sum(d[j] for j in k)%M for k in r] 
        else:
            d = [d[(int(c)-k)*9%13] for k in range(13)]
    print(d[5])
main()


Measured memory_bytes: 3240
"""
https://atcoder.jp/contests/abc127/submissions/5620648
"""
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
bc = [list(map(int, input().split())) for _ in range(m)]

bc.sort(reverse=True, key=lambda x:x[1])

i = 0
for b,c in bc:
    for j in range(i, min(n, i+b)):
        if a[j] < c:
            a[j] = c
    i = i+b
print(sum(a))


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

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

ll N,P;
char S[202020];
ll mk[20202];
ll i, j, k;
int main(){
    scanf("%lld%lld%s", &N,&P,S);
    if(P==2||P==5){
        ll ans = 0;
        fornum(i,0,N){
            if((S[i]-'0')%P==0){
                ans += i+1;
            }
        }
        printf("%lld", ans);
        return 0;
    }
    j = 1;
    k = 0;
    ++mk[0];
    fornum(i,0,N){
        k += (S[N - 1 - i] - '0') * j;
        k %= P;
        ++mk[k];
        j *= 10;
        j %= P;
    }
    ll ans = 0;
    fornum(i,0,P){
        ans += (mk[i] - 1) * mk[i] / 2;
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 512
using System;

namespace ConsoleAppCSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] HW = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int h = HW[0], w = HW[1];
            int n = int.Parse(Console.ReadLine());
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int[][] ret = new int[h][];
            for (int i = 0; i < h; i++) ret[i] = new int[w];
            int x = 0, y = 0;
            for (int i = 0; i < n; i++)
            {
                int cnt = 0;
                while (cnt++ < a[i])
                {
                    ret[y][x] = i + 1;
                    if (y % 2 == 0)
                    {
                        if (x == w - 1)
                        {
                            y++;
                        }
                        else
                        {
                            x++;
                        }
                    }
                    else
                    {
                        if (x == 0)
                        {
                            y++;
                        }
                        else
                        {
                            x--;
                        }
                    }
                }
            }
            for(int i = 0; i < h; i++)
            {
                Console.WriteLine(string.Join(" ", ret[i]));
            }
        }
    }
}


Measured memory_bytes: 13408
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    string s;
    cin >> s;
    int n = s.size();

    cout << s[0] << n - 2 << s.back() << endl;
}

Measured memory_bytes: 888
#include <stdio.h>
int main(void){
    int n = 0;
    int max = 0;
    int temp = 0;
    long long sum = 0;
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", &temp);
        if(temp < max){
            sum += (max - temp);
        } else {
            max = temp;
        }
    }
    printf("%lld",sum);
    return 0;
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  long long A = a * 60 + b;
  long long B = c * 60 + d;
  cout << max(B - A - e, 0LL) << '\n';
  return 0;
}

Measured memory_bytes: 3596
<?php 
$array=explode(" ",fgets(STDIN));
$array=filter_var_array($array,FILTER_SANITIZE_NUMBER_INT);
$N=$array[0]; // 1~NからKこ
$K=$array[1];
$num=0;

if ($N%2==1) {
  $num=($N+1)/2;
}else{
  $num=$N/2;
}

if ($num >= $K) {
	echo "YES\n";
}else{
	echo "NO\n";
}

Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <set>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b+1;i++)
#define Per(i,b,a) for(int i=b;i>=a;i--)
int main(){
    ll H,W;
    cin>>H>>W;
    ll ans = (H*W+1) /2;
    if(H==1 || W == 1) ans = 1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
#以下てんぷら
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


#n = ip()                                     #入力整数1つ
x,y= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しに4 3sum変数使用はsum関数使用できないので注意
for i in range(x):
    if i == y-1:
        print(a[i].lower(),end='')
    else:
        print(a[i],end='')

Measured memory_bytes: 22948
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N, M;
    cin >> N >> M;
    vector<ll> L(M),R(M),D(M);
    vector<vector<Pll>> G(N);
    rep(i,M){
        cin >> L[i] >> R[i] >> D[i];
        L[i]--;R[i]--;
        G[L[i]].push_back(Pll(R[i],D[i]));
        G[R[i]].push_back(Pll(L[i],-D[i]));
    }
    queue<Pll> que;
    vector<ll> memo(N,1e18);
    rep(i,N){
        if(memo[i] != 1e18) continue;
        memo[i] = 0;
        que.push(Pll(i,0));
        while(!que.empty()){
            ll v = que.front().first;
            ll c = que.front().second;
            que.pop();
            for(auto& p:G[v]){
                ll u = p.first;
                ll d = p.second;
                if(memo[u] != 1e18)continue;
                memo[u] = c+d;
                que.push(Pll(u,c+d));
            }
        }
    }
    bool flag = true;
    rep(i,M){
        if(memo[L[i]] + D[i] != memo[R[i]]){
            flag = false;
            break;
        }
    }
    cout << ((flag)?"Yes":"No") << endl;
    /*
    vector<pair<Pll,ll>> P(M);
    vector<ll> LL(N+1), RR(N+1);
    rep(i,M){
        cin >> P[i].first.first >> P[i].first.second >> P[i].second;
    }
    sort(P.begin(), P.end());
    map<ll,ll> mp;
    bool flag = true;
    rep(i,M){
        ll L = P[i].first.first;
        ll R = P[i].first.second;
        ll D = P[i].second;
        if(mp[L] == 0 && mp[R] == 0){
            mp[L] = 1000000000;
            mp[R] = 1000000000 + D;
        }else if(mp[L] == 0 && mp[R] > 0){
            mp[L] = mp[R] - D;
        }else if(mp[L] > 0 && mp[R] == 0){
            mp[R] = mp[L] + D;
        }else{
            if(mp[L] + D != mp[R]){
                flag = false;
                break;
            }
        }
    }
    ll MM=0,m=1e18;
    for(auto& p:mp){
        cmax(MM,p.second);
        cmin(m,p.second);
    }
    if(MM-m>1000000000){
        flag = false;
    }
    cout << ((flag)?"Yes":"No") << endl;*/
}

Measured memory_bytes: 22120
#include <stdio.h>
typedef long long ll;
#define rep(i,a,b,c) for(ll i=(a);i<(b);i+=(c))

int main(void){
    ll K,N,ans;
    scanf("%lld %lld",&N,&K);
    ans=K;
    rep(i,1,N,1){
        ans*=K-1;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1696
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1 << 29
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll fact(ll a){ll b=1;FOR(i,1,a)b*=i;return b;}
ll power(ll x,ll n){ll a=1;REP(i,n)a*=x;return a;}

template<typename T> struct Edge
{
  int src, dst; T w;
  Edge() {};
  Edge(int src, int dst): src(src), dst(dst) {w=1;}
  Edge(int src, int dst, T w): src(src), dst(dst), w(w){}
  bool operator<(const Edge &e)const{return w != e.w ? w > e.w : dst < e.dst;}
  bool operator==(const Edge &e){return dst == e.dst;}
};

template<typename T> class Graph : public vector<vector<Edge<T>>>
{
private:
  pair<T,int> visit(int p, int v)
  {
    pair<T,int> r(0,v);
    for(auto e : (*this)[v]) if(e.dst != p)
    {
      auto t = visit(v,e.dst);
      t.first += e.w;
      if(t.first > r.first) r=t;
    }
    return r;
  }
public:
  Graph(int n){(*this).resize(n);}
  void direct(int s, int t, T w){(*this)[s].push_back(Edge<T>(s,t,w));}
  void undirect(int s, int t, T w){direct(s,t,w);direct(t,s,w);}
  T diameter(void)
  {
    auto r = visit(-1,0);
    auto t = visit(-1,r.second);
    return t.first;
  }
};

int main()
{
  int n; cin >> n;
  Graph<int> g(n);
  REP(i,n-1)
  {
    int s,t,w; cin>>s>>t>>w;
    g.undirect(s,t,w);
  }
  cout << g.diameter() << endl;
  return 0;
}

Measured memory_bytes: 12296
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int in() {int x; cin>>x; return x;}
ll lin() {ll x; cin>>x; return x;}
string sin() {string x;cin>>x;return x;}
using graph = vector<vector<int>>;
using graph2 = vector<vector<pair<int, int>>>;

bool ifprime(int x){
    if (x==1){
        return false;
    }
    if(x==2){
        return true;
    }
    else if (x%2==0){
        return false;
    }
    else{
        for(int i=2;i*i<=x;i++){
            if(x%i==0){
                return false;
            }
        }
        return true;
    }
}

int main(){
    int Q=in();
    int a[50000];
    rep(i, 50000){
        a[i]=0;
    }
    rep(i, 50000){
        if(ifprime(2*i+1)==true&&ifprime(i+1)==true){
            a[i]=a[i-1]+1;
        }
        else{
            a[i]=a[i-1];
        }
    }
    int l, r;
    rep(i, Q){
        cin>>l>>r;
        if(l==1){
            cout<<a[(r-1)/2]<<endl;
        }
        else{
            cout<<a[(r-1)/2]-a[(l-1)/2-1]<<endl;
        }
    }
}

Measured memory_bytes: 768
//#include <bits/stdc++.h>
//#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <bitset>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <cctype>
#include <fstream>

#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000			 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979
#define MAXI 7500000

//.size()はunsigned int　0-1をするとオーバーフローする

using namespace std;
typedef long long int ll;
typedef pair<double, int> P;

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

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

struct edge
{
	int to;
	double cost;
};

int main(void)
{
	int n, x;
	int l[101];
	int count = 1;
	int high = 0;

	cin >> n >> x;
	FOR(i,1,n){
		cin >> l[i];
	}

	FOR(i,1,n){
		high += l[i];
		if(high<=x){
			count++;
		}
	}

	cout << count << endl;
}


Measured memory_bytes: 256
gets
a = gets.split(' ').map(&:to_i)
gets
b = gets.split(' ').map(&:to_i)
def bi(a, b)
  cnt = 0
  b.each do |key|
    left = 0
    right = a.length
    while left < right
      mid = (left + right) / 2
      if a[mid] == key
        cnt += 1
        break
      elsif a[mid] < key
        left = mid + 1
      else
        right = mid
      end
    end
  end
  cnt
end

puts bi(a, b)

Measured memory_bytes: 17964
/*

*/
#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)
#define repe(i,a)for(auto &i:a)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  string s;
  cin>>s;
  int cnt=0,hoge=0;
  repe(i,s){
    //cout<<i<<" ";
    if(i=='R'){
      hoge++;
    }else{
      hoge=0;
    }
    cnt=max(cnt,hoge);
  }
  cout<<cnt<<endl;
}


Measured memory_bytes: 3652
//Patwari26
//#include template<t> as mine
#include<bits/stdc++.h>
using namespace std;

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    string s;
    cin>>s;
    if(s[sz(s)-1]=='s'){
        cout<<s<<"es"<<endl;
    }
    else{
        cout<<s<<'s'<<endl;
    }
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    // time
    return 0;
}

Measured memory_bytes: 3664
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using LLONG = long long;
const LLONG MOD = 998244353;

class ModCalc
{
	LLONG m_mod = MOD;
	vector<LLONG> m_fac;
	vector<LLONG> m_ifac;

public:
	ModCalc(const LLONG mod)
	{
		m_mod = mod;
	}

	// Combinationを計算したいときの前処理：O(max)
	ModCalc(const int max, const LLONG mod)
	{
		m_mod = mod;
		m_fac = vector<LLONG>(max + 1);
		m_ifac = vector<LLONG>(max + 1);
		m_fac[0] = m_ifac[0] = 1;
		for (int i = 0; i < max; ++i)
		{
			m_fac[i + 1] = m_fac[i] * (i + 1) % mod;    // n! (mod M)
			m_ifac[i + 1] = m_ifac[i] * ModPow(i + 1, mod - 2) % mod;   // k!^(M-2) (mod M)
		}
	}

	const LLONG ModAdd(LLONG a, LLONG b) const
	{
		return (a + b) % m_mod;
	}

	const LLONG ModSubtract(LLONG a, LLONG b) const
	{
		LLONG diff = a - b;
		return diff >= 0 ? diff : diff + m_mod;
	}

	const LLONG ModMulti(LLONG a, LLONG b) const
	{
		LLONG prod = a * b % m_mod;
		return prod >= 0 ? prod : prod + m_mod;
	}

	const LLONG ModDiv(LLONG a, LLONG b) const
	{
		LLONG c = m_mod, u = 1, v = 0;
		while (c)
		{
			LLONG t = b / c;
			b -= t * c; swap(b, c);
			u -= t * v; swap(u, v);
		}
		u %= m_mod;
		if (u < 0) u += m_mod;
		return (a % m_mod) * u % m_mod;
	}

	const LLONG ModPow(LLONG x, LLONG n) const
	{
		LLONG ret = 1;
		while (n != 0)
		{
			if (n & 1) ret = ret * x % m_mod;
			x = x * x % m_mod;
			n = n >> 1;
		}
		return ret;
	}

	const LLONG ModComb(LLONG n, LLONG r) const
	{
		if (n == 0 && r == 0) return 1;
		if (n < r || n < 0) return 0;
		LLONG tmp = m_ifac[n - r] * m_ifac[r] % m_mod;
		return tmp * m_fac[n] % m_mod;
	}
};

int main()
{
	int N; cin >> N;
	vector<int> ds(N); REP(i, N) cin >> ds[i];
	map<int, int> d2NumMap;
	REP(i, N)
	{
		++d2NumMap[ds[i]];
	}
	if (ds.front() != 0 || d2NumMap[0] > 1)
	{
		cout << 0 << endl;
	}
	else
	{
		int maxD = d2NumMap.rbegin()->first;
		LLONG ans = 1;
		ModCalc mod(MOD);
		for (int d = 1; d <= maxD; ++d)
		{
			if (d2NumMap.count(d) == 0)
			{
				ans = 0;
				break;
			}

			ans = mod.ModMulti(ans, mod.ModPow(d2NumMap[d - 1], d2NumMap[d]));
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 8156
import sys

k = int(input())

if k % 2 == 0:
    print(-1)
    sys.exit()

rest = [7 % k]


for i in range(k):
    rest.append(rest[-1] * 10 % k)

tmp = 0
for i in range(k):
    if (tmp + rest[i]) % k == 0:
        print(i + 1)
        sys.exit()
    else:
        tmp = (tmp + rest[i]) % k
else:
    print(-1)

Measured memory_bytes: 48524
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long long N, n[5];
    cin >> N;
    long long c; //一番小さいキャパ
    for (int i=0; i<5; i++) {
        cin >> n[i];
    }
    c = n[0];
    for (int i=1; i<5; i++) {
        if(c>n[i]) {
            c = n[i];
        }
    }
    long long t; //一番小さいキャパのところで何分かかるか
    if (N%c == 0) {
        t = N/c;
    } else {
        t = N/c + 1;
    }
    long long ans;
    ans = t + 4;
    cout << ans << endl;
}

Measured memory_bytes: 256