akhauriyash/Code-Regression huggingface dataset:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
n = I()
s = Counter([input() for _ in range(n)])
m = I()
t = Counter([input() for _ in range(m)])
ans = 0
for k,v in s.items():
    ans = max(ans, max(0, v-t[k]))
print(ans)


Measured memory_bytes: 10344
s=input()
cnt=0
ans=0
atcg=['A','T','C','G']
for i in range(len(s)):
    if s[i] in atcg:
        cnt+=1
    elif s[i] not in atcg:
        ans=max(cnt,ans)
        cnt=0
ans=max(cnt,ans)
print(ans)

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop(i,b,n) for(int i=b;i<(n);++i)
#define each(e,v) for(auto &&e : v)

#define all(v) (v).begin(),(v).end()
#define sz(v) (int)v.size()

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const double EPS = 1e-9;

template<typename A,typename B> inline void chmin(A &a,B b){ if(a>b) a=b; }
template<typename A,typename B> inline void chmax(A &a,B b){ if(a<b) a=b; }
template <typename T> inline void print(const T& x) { cout << x << endl; }

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

    vector<int> d(n+1,2);
    d[0] = 0;
    d[1] = 1;
    for(ll i=2; i<=n; ++i){
        for(ll j=2; i*j<=n; ++j){
            ++d[i*j];
        }
    }

    ll res = 0;
    for(ll i=1; i<=n; ++i){
        res += i*d[i];
    }
    print(res);

    return 0;
}


Measured memory_bytes: 42324
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		long T = in.nextLong();
		long[] t = new long[N];
		for (int i = 0; i < N; i++) {
			t[i] = in.nextLong();
		}
		long ans = 0;
		for (int i = 0; i < N - 1; i++) {
			ans += Math.min(T, t[i + 1] - t[i]);
		}
		ans += T;
		System.out.println(ans);
		in.close();
	}
}

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

using namespace std;
using ll = long long;

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount


int main() {
    int N; cin>>N;
    vector<int> L(N);
    for(int i = 0; i < N; i++)
    {
        cin>>L[i];
    }
    sort(all(L));

    int sum=0;
    for(int i = 0; i < N-1; i++)
    {
        sum+=L[i];
    }
    if(sum>L[N-1])puts("Yes");
    else puts("No");
    

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++){
      int b;
      cin >> b;
      a.at(i) = b;
  }
  int  ans = 0;
  for(int i = 0; i < N; i++){
      ans += a.at(i) - 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
 
using namespace std;

#define MOD 1000000007
#define A first
#define B second

typedef long long ll;

inline int mulmd(ll a, ll b){
  ll ret = (a * b) % MOD;
  return (int) ret;
}

inline int power(ll x, ll y, int m){
  ll res = 1;
  x = x % m;
  while(y > 0){
    if(y & 1){
      res = mulmd(res, x);
    }
    y = y >> 1;
    x = mulmd(x, x);
  }
  return (int) res;
}

inline int submd(ll a, ll b){
  ll ret = (a - b);
  if(ret < 0) ret += MOD;
  return (int) ret;
}

inline int addmd(ll a, ll b){
  ll ret = (a + b) % MOD;
  return (int) ret;
}

inline int invPow(ll a){
  return power(a, MOD - 2, MOD);
}

inline int divmd(ll a, ll b){
  ll ret = mulmd(a, invPow(b));
  return (int) ret;
}

const int N = 1e5 + 5;

int arr[N];

void solve(){
  ll n;
  cin >> n;
  ll ans = 1;
  ll i = 1;
  while(n > 1){
    n /= 2;
    i <<= 1;
    ans += i;
  }
  cout << ans;
  

}


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



Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        if (reader.nextInt()+reader.nextInt() < reader.nextInt()) System.out.println("No");
        else System.out.println("Yes");
    }

    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
    
        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}



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

#define N 2005
#define ll long long

using namespace std;

const ll MOD = 1e9 + 7;
ll n, k;
ll c[N];

ll a[N], b[N];
ll num[N];
ll ans;

ll calc(int x) {
    ll res = 0;
    for (int i = n; i > x; --i)
        if (a[i] < a[x])
            ++res;
    return res;
}

int main() {

    ios::sync_with_stdio(false);

    cin >> n >> k;
    for (int i = 1; i <= n; ++i)
        cin >> a[i], b[i] = a[i];

    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        num[i] = lower_bound(b + 1, b + n + 1, a[i]) - b - 1;

    for (int i = n; i; --i) {
        (ans += calc(i) * k % MOD) %= MOD;
        (ans += k * (k - 1) / 2 % MOD * num[i] % MOD) %= MOD;
    }

    cout << ans << endl;
    return 0;
}


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

int H, W;

void solve() {
	string b[100];
	for (int i = 0; i < H; i++) {
		cin >> b[i];
	}

	bool visited[100][100] = {0};
	int x = 0, y = 0;

	while (b[y][x] != '.') {
		if (visited[y][x]) {
			cout << "LOOP" << endl;
			return;
		}
		visited[y][x] = true;
		if (b[y][x] == '^') y--;
		if (b[y][x] == 'v') y++;
		if (b[y][x] == '<') x--;
		if (b[y][x] == '>') x++;
	}

	cout << x << " " << y << endl;
}

int main() {
	while (cin >> H >> W , H) {
		solve();
	}
}

Measured memory_bytes: 1248
#include<bits/stdc++.h>
//by Davidshx
using namespace std;
int n;
pair<int,int> dat[200100];
int main(){
	#ifdef FILIN
		#ifndef LOCAL
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>dat[i].second>>dat[i].first;
	sort(dat+1,dat+n+1);
	int curt=0;
	for(int i=1;i<=n;i++){
		if(curt+dat[i].second>dat[i].first){
			cout<<"No"<<endl;
			return 0;
		}
		curt+=dat[i].second;
	}
	cout<<"Yes"<<endl;
	return 0;
}



Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 100000000

typedef  long long ll;

using namespace std;

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r != 0){
        r = a % b;
        a = b;
        b = r;
    }
    return r;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}


void solve(void){
  int n;
  cin >> n;
  int t[n];
  int ans = 0;
  rep(i,0,n){
      cin >> t[i];
      ans+=t[i];
  }
  int m;
  cin >> m;
  int p[m],x[m];
  rep(i,0,m){
      cin >> p[i] >> x[i];
  }
rep(i,0,m){
    int tmp = ans;
    tmp-=t[p[i]-1];
    tmp+=x[i];
    cout << tmp << endl;
}
  
    
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
     public static void main(String[] args) throws IOException {
        FastReader f = new FastReader();
        Scanner input = new Scanner(System.in);
        HashMap<Integer,Integer> histogram = new HashMap<>();
        // fill in the dictionary with the initial value
        for (int letter = 97; letter < 123; letter++) {
            histogram.put(letter, 0);
        }

        while(input.hasNextLine()) {
            // grab and convert the string to lowercase
            String line = input.nextLine().toLowerCase();
         
            // iterate over the char
            for (char ch : line.toCharArray()) {
                int key = (int) ch;
                if (histogram.containsKey(key)) {
                    int temp = histogram.get(key) + 1;
                    histogram.replace(key, temp);
                }
            }
        }
        displayHisto(histogram);
    }

    // Helper function for displaying histogram
    private static void displayHisto(HashMap<Integer, Integer> histogram) {
        for(int letter = 97; letter < 123; letter++) {
            System.out.println(String.valueOf(Character.toChars(letter)) + " : " + histogram.get(letter));
        }
    }

    // Helper class to speed up IO
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

        boolean hasNext(){
            return st.hasMoreTokens();
        }

        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) {
                str = "null";
                e.printStackTrace();
            }
            return str;
        }
    }
}



Measured memory_bytes: 26208
#include <bits/stdc++.h>
int main(void)
{
  int n, m, k, tmp, ans = 0;
  unsigned long a = 0x3FFFFFFF;
  std::cin >> n >> m;
  for(int i = 0; i != n; i++){
    unsigned long b = 0;
    std::cin >> k;
    for(int j = 0; j != k; j++){
      std::cin >> tmp;
      b |= (1 << (tmp - 1));
    }
    a &= b;
  }
  for(int i = 0; i != m; i++) ans += (a >> i) % 2;
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 256
n=int(input())

if (81<n):
    print('No')
else:
    isOk=False  
  
    for i in range(1,10):
        if (n%i==0 and 1<=(n/i)<=9):
            isOk=True
            break
    
    if isOk:
        print('Yes')
    else:
        print('No')


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

int main(){
  int H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  int getup, sleep, limit;
  getup = 60 * H1 + M1;
  sleep = 60 * H2 + M2;
  limit = sleep - K;
  cout << limit - getup << endl;
  return 0;


}


Measured memory_bytes: 3604
n,k,*A=map(int,open(0).read().split());e=enumerate
for _ in '_'*min(k,99):
  S=[0]*(n+1)
  B=[0]*(n+1)
  for i,a in e(A):S[max(0,i-a)]+=1;S[min(n,i+a+1)]-=1
  for i,s in e(S[:-1]):B[i+1]=B[i]+s
  A=B[1:]
print(*A)

Measured memory_bytes: 221908
import collections
from functools import reduce

S = input()
Q = int(input())

deque = collections.deque(S)

is_reverse = False
for _ in range(Q):
    query = input().split()
    if query[0] == '1':
        is_reverse = not is_reverse
    else:
        if (query[1] == '1' and not is_reverse) or (query[1] =='2' and is_reverse):
            deque.appendleft(query[2])
        else:
            deque.append(query[2])
if is_reverse:
    deque.reverse()

res = list(deque)

print("".join(res))


Measured memory_bytes: 9452
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


int main() {
	int a, b; cin >> a >> b;
	for (int i = 1; i <= 3; i++) {
		if (i == a || i == b) continue;
		cout << i << endl;
	}
	return 0;
}


Measured memory_bytes: 764
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int d[] = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = sc.nextInt();
        }

        int ans = 0;

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (i != j) {
                    ans += d[i]*d[j];
                } 
            }
        }

        System.out.println(ans/2);


}}


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

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

#define mp make_pair
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define swap(a,b) {a=a^b;b=a^b;a=a^b;}
ll gcd(ll a, ll b){ return b==0 ? a : gcd(b, a%b); }

ll ans[100005][3],a[100005],b[100005],c[100005];
ll n;





int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
/*
	freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
*/
    int t=1;

    //cin >> t;
    while(t-->0){
        cin>>n;
        

        for(int i=0;i<n;i++){
            cin>>a[i]>>b[i]>>c[i];
        }	  
        ans[0][0]=a[0];
        ans[0][1]=b[0] ;           
        ans[0][2]=c[0]; 
        fr(i,1,n-1){
            ans[i][0]=max(ans[i-1][1],ans[i-1][2]) + a[i];
            ans[i][1]=max(ans[i-1][0],ans[i-1][2]) + b[i];
            ans[i][2]=max(ans[i-1][1],ans[i-1][0]) + c[i];
        }   

        cout << max(ans[n-1][0],max(ans[n-1][1],ans[n-1][2]))<<"\n";
    }
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <queue>
#include <string>
#define ll long long
using namespace std;
 
int main() {
  string str; cin >> str;
  for(int i=0; i< str.length(); i++){
    if(str.at(i)=='?'){
        str.replace(i, 1, "D");
    }
  }
  cout << str;
}


Measured memory_bytes: 3720
#include <iostream>
#include <vector>
#include <map>


using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; ++i)

const int MAX = 1e4+10;

int N;
string S[MAX];

int main() {
    cin >> N;
    ll ans = 0;
    ll front = 0;
    ll back = 0;
    ll both = 0;
    REP (i, N) {
        string s;
        cin >> s;
        REP (i, s.length()-1) {
            if (s[i] == 'A' && s[i+1] == 'B') ans++;
        }
        if (s[0] == 'B') {
            if (s[s.length()-1] == 'A') both++;
            else front++;
        } else if (s[s.length()-1] == 'A') back++;
    }
    ans += max(both-1, 0ll);
    if (both > 0) {
        if (front > 0) {
            ans++;
            front--;
        }
        if (back > 0) {
            ans++;
            back--;
        }
    }
    ans += min(front, back);
    cout << ans << endl;
}

Measured memory_bytes: 384
# -*- coding: utf-8 -*-
"""
Created on Thu May  7 22:21:06 2020

@author: shinba
"""
import sys

N = int(input())
A = list(map(int,input().split()))

for i in A:
    if i % 2 == 0:
        if (i % 5 != 0) and (i % 3 != 0):
            break
else:
    print("APPROVED")
    sys.exit()
    
print("DENIED")
            


Measured memory_bytes: 3060
#include<stdio.h>

int main(void){
    int w,h,x,y,n;
    double s;
    scanf("%d%d%d%d",&w,&h,&x,&y);
    s = (double) w*h/2;
    if(w==2*x && h == 2*y){
        n = 1;
    }else{
        n=0;
    }
    printf("%lf %d\n",s,n);
    

    return 0;
}

Measured memory_bytes: 128
// Aizu Vol-1 0112: A Milk Shop
// 2017.8.3

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

char *gets(char *);
char buf[100];

int f[65];

int main()
{
	int i, n;
	unsigned m, k, ans, a;

	while (1) {
		gets(buf);
		if (!(n = atoi(buf))) break;
		memset(f, 0, sizeof(f));
		for (i = 0; i < n; i++) {
			gets(buf);
			f[atoi(buf)]++;
		}
		if (n == 1) { puts("0"); continue; }
		n -= f[0];
		for (i = 1, ans = 0, m = n; m > 0; i++) {
			k = f[i];
			if (k == 1) ans += (m - 1) * i;
			else if (k > 1) {
				a = m*k - ((k*(k + 1)) >> 1);
				ans += a * i;
			}
			m -= k;
		}
		printf("%u\n", ans);
	}
	return 0;
}

Measured memory_bytes: 536
#include <functional>
#include <iostream>
#include <algorithm>
#include <cmath>

#define ll long long

using namespace std;

int main(int argc, char *argv[])
{
  ll N, L;
  cin >> N >> L;
  string S[N];

  for (auto i = 0; i < N; ++i) {
    cin >> S[i];
  }

  sort(S, S+N);

  for (auto i = 0; i < N; ++i) {
    cout << S[i];
  }

  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<cstring>
#include<sstream>
using namespace std;

typedef long long ll;

int main() {
  int N; cin >> N;
  int H[101];
  for ( int i = 0 ; i < N; i++ )  cin >> H[i];
  int cnt = 1;

  for ( int i = N-1; i > 0; i-- ) {
    bool f = true;
    int tmp = H[i];
    for ( int j = i-1; j >= 0 ; j-- ) {
      if ( tmp < H[j] ) f = false; 
    }
    if (f)cnt++;
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

struct mint {
    const int mod = 1e9 + 7;
    long long x;
    
    mint (long long x = 0) : x((x % mod + mod) % mod) {
        
    }
    
    mint& operator=(const long long a) {
        x = a % mod;
        return *this;
    }
    
    mint& operator=(const mint a) {
        x = a.x % mod;
        return *this;
    }
    
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    
    mint& operator-=(const mint a) {
        if ((x += (mod - a.x)) >= mod) x -= mod;
        return *this;
    }
    
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    
    mint inv() const {
        return pow(mod - 2);
    }
    
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

vector<mint> bs;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, a, b;
    cin >> n >> a >> b;
    ll s = max(a, b);
    bs.resize(s);
    rep(i, s) {
        if (i == 0) bs[i] = n;
        else bs[i] = bs[i - 1] * (n - i);
    }
    vector<mint> two(10002);
    two[0] = 1;
    two[1] = 2;
    rep(i, 10000) two[i + 2] = two[i + 1] * 2;
    mint ans = 1;
    ll cur = n;
    while(cur > 0) {
        if (cur >= 10000) {
            ans *= two[10000];
            cur -= 10000;
        }
        else {
            ans *= two[cur];
            break;
        }
    }
    ans -= 1;
    mint bb = 1;
    rep(i, a) {
        bb *= a - i;
    }
    ans -= bs[a - 1] / bb;
    bb = 1;
    rep(i, b) {
        bb *= b - i;
    }
    ans -= bs[b - 1] / bb;
    cout << max(0LL, ans.x) << endl;
    return 0;
}


Measured memory_bytes: 3584
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, M = list(map(int, sys.stdin.buffer.readline().split()))
SC = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(M)]

ans = 10 ** (N - 1)
E = 10 ** N


def test(n):
    if len(str(n)) != N:
        return False
    ok = True
    for s, c in SC:
        ok &= str(n)[s - 1] == str(c)
    return ok


i = 0
for i in range( 10 ** N):
    if test(i):
        print(i)
        break
else:
    print(-1)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+100,mod=998244353;
void plusle(int &a,int b){
    a+=b;if(a>=mod)a-=mod; return;
}
void minun(int &a,int b){
    a-=b; if(a<0)a+=mod; return;
}
int add(int a,int b) {
  a+=b;
  return a>=mod?a-mod:a;
}
int sub(int a,int b) {
  a-=b;
  return a<0?a+mod:a;
}
int mul(int a,int b) {
  return (int)((long long)a*b%mod);
}
struct BIT{
    int bit[maxn];
    int n;
    BIT(int _n){
            n=_n+1;
            for(int i=0;i<=n;i++)
                bit[i]=0;
    }
    void update(int idx,int val){
        for(;idx<n;idx+=(idx&(-idx)))
            bit[idx]+=val;
        return;
    }
    int get(int idx){
        int sum=0;
        for(;idx>0;idx-=(idx&(-idx)))
            sum+=bit[idx];
        return sum;
    }
    int get(int l,int r){
        return get(r)-get(l-1);
    }
};
struct pt{
    int x,y;
    pt():x(0),y(0){}
    void read(){
        scanf("%d%d",&x,&y);
    }
    friend bool operator <(const pt &a,const pt &b){
        return a.x==b.x?a.y<b.y:a.x<b.x;
    }
}p[maxn];
vector<int> ss,sss;
int ans,n;
int p2[maxn];

int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        p[i].read();
        ss.push_back(p[i].x);
        sss.push_back(p[i].y);
    }
    ss.push_back((int)(-1e9-7));
    sss.push_back((int)(-1e9-7));
    sort(ss.begin(),ss.end());
    sort(sss.begin(),sss.end());
    ss.erase(unique(ss.begin(),ss.end()),ss.end());
    sss.erase(unique(sss.begin(),sss.end()),sss.end());
    for(int i=1;i<=n;i++){
        p[i].x=(int)(lower_bound(ss.begin(),ss.end(),p[i].x)-ss.begin());
        p[i].y=(int)(lower_bound(sss.begin(),sss.end(),p[i].y)-sss.begin());
    }
    p2[0]=1;
    for(int i=1;i<=n;i++){
        p2[i]=add(p2[i-1],p2[i-1]);
    }
    sort(p+1,p+1+n);
    int cur=0,u1,u2,d1,d2;
    BIT f1(n),f2(n);
    for(int i=1;i<=n;i++)
        f1.update(p[i].y,1);
    for(int i=1;i<=n;i++){
        int j=i,ct=0;
        while(p[j].x==p[i].x&&j<=n){
            f1.update(p[j].y,-1);
            ct++;
            j++;
        }
        j--;
        for(int k=i;k<=j;k++){
        u1=f1.get(p[k].y+1,n),u2=f2.get(p[k].y+1,n);
        d1=f1.get(p[k].y-1),d2=f2.get(p[k].y-1);
        plusle(ans,p2[n]-1);
        ///completely above
        cur = u1 + u2 + (j-k);
        minun(ans,p2[cur]-1);
        ///completely below
        cur = d1 + d2 + (k-i);
        minun(ans,p2[cur]-1);
        ///completely left
        minun(ans,p2[i-1]-1);
        ///completely right
        minun(ans,p2[n-j]-1);
        ///shitty four corners
        ///left-up
        plusle (ans,p2[u2]-1);
        ///left down
        plusle(ans,p2[d2]-1);
        ///right up
        plusle(ans,p2[u1]-1);
        ///right down
        plusle(ans,p2[d1]-1);
        }
        for(int k=i;k<=j;k++){
            f2.update(p[k].y,1);
        }
        i=j;
    }
    printf("%d\n",ans);
}

/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 5996
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include <map>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include"time.h"
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define dump(x)  cerr << #x << " = " << (x) << endl
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
const int INF = (1 << 30);

//毎回変える定数
#define N_MAX 200


//問題文のとおりの変数
int N, C;

vector<pair<int, int>> stc[30];

//オリジナル変数
int times[210000];


//サブ関数




//メイン関数
int main() {
	cin >> N >> C;
	REP(i, N) {
		int s, t, c;
		cin >> s >> t >> c;
		c--;
		stc[c].push_back(make_pair(s, t));
	}
	REP(i, C) {
		sort(stc[i].begin(), stc[i].end());

		vector<int> delList;
		REP(j, (int)stc[i].size() - 1) {
			if (stc[i][j].second == stc[i][j+1].first) {
				stc[i][j+1].first = stc[i][j].first;
				
				delList.push_back(j);
			}
		}
		reverse(delList.begin(), delList.end());
		for (int var : delList) {
			stc[i].erase(stc[i].begin() + var);
		}
	}

	REP(i, C) {
		for (auto var : stc[i]) {
			//cout << var.first << " " << var.second << endl;
			times[var.first * 2 - 1]++;
			times[var.second * 2]--;
		}
	}

	int ans = 0;
	REP(i, 201000) {
		times[i + 1] += times[i];
		ans = max(ans, times[i]);
	}
	cout << ans << endl;
	cin >> N;
	return 0;
}





Measured memory_bytes: 2304
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEL 2e9
#define PIE 3.14159265358979323

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>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}

int main(){
    bool yymm = true;
    bool mmyy = true;
    string s;
    cin >> s;
    if (s[2] == '1' && s[3] > '2')
        yymm = false;
    if (s[2] == '0' && s[3] == '0')
        yymm = false;
    if (s[2] > '1')
        yymm = false;
    if (s[0] == '1' && s[1] > '2')
        mmyy = false;
    if (s[0] == '0' && s[1] == '0')
        mmyy = false;
    if (s[0] > '1')
        mmyy = false;
    if (yymm && mmyy)
        cout << "AMBIGUOUS" << endl;
    else if (yymm)
        cout << "YYMM" << endl;
    else if (mmyy)
        cout << "MMYY" << endl;
    else
        cout << "NA" << endl;
}

Measured memory_bytes: 256
const main = (input) => {
  const [, n] = input.trim().split('\n')
  const nums = n.split(' ').map(v => Number(v)).sort((a, b) => a - b)

  const max = nums[nums.length - 1]
  const arr = new Array(max+1).fill(0)

  for (let v of nums) {
    if (arr[v] !== 0) {
      arr[v] = 2
      continue
    }

    for (let i=v; i<=max; i+=v) arr[i]++
  }

  let ans = 0
  for (let v of nums) {
    if (arr[v] === 1) ans++
  }
  console.log(ans)
}

process.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 67288
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    #n = int(stdin.readline().rstrip())
    s,t = map(str, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    print(t+s)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 9072
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AGC007
{
    public class A
    {
        private const string Impossible = "Impossible ";
        private const string Possible = "Possible ";

        private void Run()
        {
            var input = Console.ReadLine().Trim().Split();
            var H = int.Parse(input[0]);
            var W = int.Parse(input[1]);
            var A = Enumerable.Range(0, H).Select(_ => Console.ReadLine().Trim()).ToArray();

            var count = A.Sum(row => row.Count(c => c == '#'));
            if (H + W - 1 != count) { Console.WriteLine(Impossible); }
            else
            {
                int x = 0, y = 0;
                while (true)
                {
                    if (x + 1 < W && A[y][x + 1] == '#') { x++; }
                    else if (y + 1 < H && A[y + 1][x] == '#') { y++; }
                    else { break; }
                }
                Console.WriteLine(y + 1 == H && x + 1 == W ? Possible : Impossible);
            }
        }

        public static void Main()
        {
            var old = Console.Out;
            using (var writer = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })
            {
                Console.SetOut(writer);
                new A().Run();
                Console.Out.Flush();
                Console.SetOut(old);
            }
        }
    }
}


Measured memory_bytes: 2904
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>

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

using namespace std;

int main(){
    int n;
    int A[100];
    double sum = 0;
    
    cin >> n;
    rep(i, n){
        cin >> A[i];
        sum += 1.0/A[i];
    }

    cout << setprecision(15) << 1.0/sum << endl;

    return 0;
}



Measured memory_bytes: 256
import Data.List
main = interact $ show.solve.(map read).words
solve (a:b:[]) = intersectMin [rev 8 a..(rev 8 (a+1))-1] [rev 10 b..(rev 10 (b+1))-1]
rev::Int->Int->Int
rev t a = b t a (-1) (10^6)
intersectMin::[Int]->[Int]->Int
intersectMin as bs = head $ sort [a | a<-as, b<-bs, a==b]++[-1]
b t a l r
    | l+1==r = r
    | z t a m = b t a l m
    | otherwise = b t a m r
    where m = div (l+r) 2

z t a x = (flip div 100 $ t*x) >= a

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

template <typename T>
T func_min(const std::vector<T> &n){
    T min = n.at(0);
    for(T x : n){
        if(min > x) min = x;
    }
    return min;
}

template <typename T>
T func_max(const std::vector<T> &n){
    T max = n.at(0);
    for(T x : n){
        if(max < x) max = x;
    }
    return max;
}

using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> x(N);
    for(int i = 0; i < N; i++) cin >> x.at(i);
    __int64_t sum = 0;
    for(int n : x){
        sum += n;
    }
    cout << func_min<int>(x) << ' ' << func_max<int>(x) << ' ' << sum << endl;
    return 0;
}




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

typedef long long ll;

ll gcd(ll n,ll m){
  if(m==0) return n;
  else return gcd(m,n%m);
}

int main(){
  ll n,a,b,c,d,ok;
  cin >> n;
  for(ll i=0;i<n;i++){
    cin >> a >> b >> c >> d;
    ll x=gcd(b,d);
    ll ok=b-x+a%x;
    if(a<b||d<b) cout << "No" << endl;
    else if(c>=b) cout << "Yes" << endl;
    else if(c>=ok) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


class Program
{


    static void Main(string[] args)
    {
        Solve();
    }

    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();

        var s = sc.intarr;
        int a = s[0];
        int b = s[1];
        long ans = 0;

        for(int i = a; i <= b; ++i)
        {
            string c = i.ToString();
            if (c[0] == c[4] && c[1] == c[3]) ans++;
        }
        wr.wri(ans);
    }

}
    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => strarr.Select(char.Parse).ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


Measured memory_bytes: 13396
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var s = Console.ReadLine();
            var max = 0;
            var current = 0;
            for (var i = 0; i < s.Length; i++)
            {
                if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') current++;
                else current = 0;

                max = Math.Max(max, current);
            }
            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 13140
# 3_4_selectionsort
# ALDS_1_2_B: Selection Sort
N = gets.to_i
a = gets.split.map(&:to_i)
# N = 6
# a = [5,6,4,2,1,3]

def selection_sort(n,a)
  count = 0
  a.each_with_index do |val,i|

    min_j = i
    i.upto(n-1) do |j|
      min_j = j if a[j] < a[min_j]
    end
    if min_j != i
      a[i],a[min_j] = a[min_j],a[i]
      count += 1
    end

  end
  puts a.join(' ')
  puts count
end
selection_sort(N,a)


Measured memory_bytes: 6868
N, M, X = map(int, input().split())

C = [0] * N
A = [[0] * M for _ in range(N)]
for i in range(N):
    B = list(map(int, input().split()))
    C[i] = B[0]
    A[i] = B[1:]

ans = 1e20
for i in range(2**N):
    cost = 0
    vals = [0] * M
    for j in range(N):
        if (i >> j & 1) == 1:
            cost += C[j]
            vals = [vals[k] + A[j][k] for k in range(M)]
    if min(vals) >= X and cost <= ans:
        ans = cost 

if ans == 1e20:
    ans = -1

print(ans)

Measured memory_bytes: 74052
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: u64,
        b: u64,
    }
    let val = a * b;
    if val % 2 == 0 {
        println!("Even");
    } else {
        println!("Odd");
    }
}

Measured memory_bytes: 4352
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Long[] array = new Long[6];
		int n = sc.nextInt();
		List<Integer> list=new ArrayList<Integer>();
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		Collections.sort(list, Collections.reverseOrder());
		List<Integer> list_kou=new ArrayList<Integer>();
		for(int i=0;n-1>i;i++) {
			int a = list.get(i);
			int b = list.get(i+1);
			while(true) {
				int c = a%b;
				if(c==0) {
					list_kou.add(b);
					break;
				}
				a=b;
				b=c;
			}
		}
		int answer=Collections.min(list_kou);
		System.out.println(answer);
	}
}

Measured memory_bytes: 61844
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
//#include <tuple>
#include <set>
#include <string.h>
#include <functional>

#define X first
#define Y second
#define MP make_pair
//#define MT make_tuple
#define REP(i, a, n) for(int (i) = (a); (i) < (n); ++(i))
#define FOR(i, n) REP(i, 0, n)
typedef long long ll;
using namespace std;
const int MAX = 500;

template<class T, class U>
void convert(T &t, U &u)
{
	stringstream ss;
	ss << t;
	ss >> u;
}

class Pair
{
public:
	int a, b;
	Pair(int a, int b) : a(a), b(b){}
	~Pair(){}

	bool operator < (const Pair& e) const {
		if (e.a > a) return true;
		else if (e.a == a){
			if (e.b < b) return true;
		}
		return false;
	}

	bool operator > (const Pair& e) const {
		if (e.a < a) return true;
		else if (e.a == a){
			if (e.b > b) return true;
		}
		return false;
	}
};

int main()
{
	int n, m;
	while (cin >> n >> m && n | m){
		vector< Pair > tb(m, Pair( 0, 0 ));
		FOR(i, n){
			FOR(j, m){
				if (i == 0){
					//候補地の番号を初期化.
					tb[j].b = j + 1;
				}

				//入力が1なら投票数を加算.
				int t; cin >> t;
				if (t == 1) ++tb[j].a;
			}
		}

		//投票が多い順にソート.
		sort(tb.begin(), tb.end(), greater<Pair>());

		//先頭から候補地を出力.
		FOR(i, m){
			if (i) cout << " ";
			cout << tb[i].b;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
N = int(input())

def calc_order(n):
    o = 0
    while 1<=n:
        n //= 10
        o+=1
    return o

N_order = calc_order(N)

num_list = []
for n in range(N_order-1):
    num_list.append(9 * (10**n))
num_list.append(N - (10**(N_order-1)-1))

odd_part = num_list[0::2]
print(sum(odd_part))

Measured memory_bytes: 3064
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    t = 0
    for i in range(n):
        l, r = list(map(int, input().rstrip('\n').split()))
        t += (abs(r - l) + 1)
    print(t)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38896
#include<bits/stdc++.h>
using namespace std;
long long dp[100001];
long long solve(long long a[],long long n)
{
    if(n<=0)
    return 0;
    if(dp[n]!=-1)
    return dp[n];
    long long d=abs(a[n]-a[n-1]);
    long long p=abs(a[n-2]-a[n]);
    long long ans=min(p+solve(a,n-2),d+solve(a,n-1));
    dp[n]=ans;
    return dp[n];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long n;
    cin>>n;
    long long a[n],i;
    for(i=0;i<=100000;i++)
    dp[i]=-1;
    for(i=0;i<n;i++)
    cin>>a[i];
    cout<<solve(a,n-1);
}

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

int main(){
  int h,w;
  cin >> h >> w;
  char alp[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      string in;
      cin >> in;
      if(in=="snuke"){
        cout << alp[j] << i+1 << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define maxN 20
#define maxQ 200
#define maxBox 2000
int lengthN, dataM, integerQ;
int boxA[maxBox];
bool resultBox[maxBox];

void search(int data, int nowData)
{
//	cout << "data = " << data << endl;		// Debug
	if(data)
	{	/* data??????????????????????????§?????????data??§????????´???????????????true???????´? */
		resultBox[nowData] = true;
//		cout << "resultBox[" << nowData << "] = "<< resultBox[nowData] << endl;		// Debug
	}
	
	if(data == lengthN)
	{	/* ????????????????¢??????????????????????return?????? */
		return;
	}
	else
	{
		search(data+1, nowData+boxA[data]);		/* ?¬????????´??????????????????????????????§??????????¢?????????? */
		search(data+1, nowData);				/* ?????????????´????????????????????????§??????????¢?????????? */
	}
	return;
}


int main(void)
{
/*   ** initialize **   */
	boxA[maxBox] = {0};
	resultBox[maxBox] = {false};

/*   ** input data **   */
	cin >> lengthN;							/* ??????n?????\??? */
//	cout << "lengthN = " << lengthN << endl;		// Debug
	if(lengthN > maxN)
	{
		cout << "lengthN - Invalid Value!!" << endl;
		return 0;
	}
	else
	{
//	    cout << "boxA = ";      // Debug
		for(int n = 0; n < lengthN; n++)	/* n????????´??°?????????boxA???????´? */
		{
			cin >> boxA[n];
//			cout << boxA[n] << " ";		// Debug
		}
//		cout << endl;		// Debug
	}
	
/*   ** search **   */
	/* ??????boxA???????´????????????????????????????????????????????????????????????????????¢???? */
	search(0, 0);

//	cout << endl << endl;		// Debug
/*   ** result **   */
	cin >> integerQ;					/* ??????q?????\??? */
//	cout << "integerQ = " << integerQ << endl;		// Debug
	if(integerQ > maxQ)
	{
		cout << "integerQ - Invalid Value!!" << endl;
		return 0;
	}
	else
	{
		for(int q = 0; q < integerQ; q++)		/* q????????´??°?????????boxM???????´? */
		{
			cin >> dataM;
//			cout << "dataM = " << dataM << endl;		// Debug
//			cout << "resultBox[" << dataM << "] = " << resultBox[dataM] << endl;		// Debug
			if(resultBox[dataM] == true)		/* dataM???????´???°??¨??????resultBox????¢???? */
			{
				cout << "yes" << endl;
			}
			else
			{
				cout << "no" << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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()
{
  ll x;
  cin >> x;
  ll tmp = 100;
  int ans = 0;
  for (;;)
  {
    if (tmp >= x)
    {
      cout << ans << endl;
      return 0;
    }
    tmp *= 1.01;
    ans++;
  }
  return 0;
}


Measured memory_bytes: 3672
#include <string.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <istream>
#define INF 2147483647
#define LLINF 9223372036854775807
typedef long long ll;
using namespace std;
int dpl[110][5];
int dpe[110][5];
int main(){
	string s;
	int k;
	cin>>s>>k;
	for(int i=0;i<s.size();i++){
		int c=(int)(s[i]-'0');
		if(!i){
			for(int j=1;j<c;j++)dpl[1][1]++;
			dpe[1][1]++;
		}
		else{
			for(int j=1;j<10;j++)dpl[i+1][1]++;
			for(int j=0;j<=k;j++){
				dpe[i+1][j+(c>0)]+=dpe[i][j];
				for(int l=0;l<c;l++){
					dpl[i+1][j+(l>0)]+=dpe[i][j];
				}
				for(int l=0;l<10;l++){
					dpl[i+1][j+(l>0)]+=dpl[i][j];
				}
			}
		}
	}
	cout<<dpl[s.size()][k]+dpe[s.size()][k]<<endl;
	return 0;
}

Measured memory_bytes: 256