akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <map>


class Combination {
	int MAX;
	int mod;
	long long *kai;
	long long *kai_inv;
	long long modpow(long long a, long long n) {
		long long res = 1;
		while (n > 0) {
			if (n & 1) res = res * a % mod;
			a = a * a % mod;
			n >>= 1;
		}
		return res;
	}
	long long modinv(long long a) {
		return modpow(a, mod - 2);
	}
	void Init() {
		for (int i = 1; i < MAX; i++) {
			kai[i] = kai[i - 1] * i;
			kai[i] %= mod;
			kai_inv[i] = modinv(kai[i]);
		}
	}
public:
	Combination(int max, int mod) :mod(mod), MAX(max + 5) {
		kai = new long long[max + 5]{ 1 };
		kai_inv = new long long[max + 5]{ 1 };
		Init();
	}
	~Combination() {
		delete[] kai;
	}
	long long operator()(int n, int k) {
		if (n < 0 || k < 0 || n < k)return 0;
		long long res = kai[n];
		res *= kai_inv[k];
		res %= mod;
		res *= kai_inv[n - k];
		res %= mod;
		//printf("%d C %d = %d\n", n, k, res);
		return res;
	}
};
const int mod = 1000000007;
//const int mod = 998244353;
int maximum(int a, int b) { return a < b ? b : a; }
int main() {
	int r1, r2, c1, c2;
	scanf("%d %d %d %d", &r1, &c1, &r2, &c2);
	long long res = 0;
	Combination nCk(r2 + c2, mod);
	for (int i = c1; i <= c2; i++) {
		res += mod + nCk(r2 + i + 1, 1 + i) - nCk(r1 + i, 1 + i);
		res %= mod;
	}
	printf("%lld", res);
	return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  char c;
  cin >> c;
  cout << (char)( c + 1) << endl;
  return 0;
}


Measured memory_bytes: 256
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


SIZE_2 = 20
SIZE_3 = 13
SIZE_5 = 9
NUM = 1000001

POW_2 = [1]*SIZE_2
for i in range(1,SIZE_2):
    POW_2[i] = POW_2[i-1]*2

POW_3 = [1]*SIZE_3
for i in range(1,SIZE_3):
    POW_3[i] = POW_3[i-1]*3

POW_5 = [1]*SIZE_5
for i in range(1,SIZE_5):
    POW_5[i] = POW_5[i-1]*5

table = [0]*(NUM)

for i in range(SIZE_2):
    for k in range(SIZE_3):
        if POW_2[i]*POW_3[k] >= NUM:
            break
        for p in range(SIZE_5):
            if POW_2[i]*POW_3[k]*POW_5[p] >= NUM:
                break
            table[POW_2[i]*POW_3[k]*POW_5[p]] = 1

for i in range(1,NUM):
    table[i] += table[i-1]

while True:
    tmp_str = input()
    if len(tmp_str) == 1 and tmp_str[0] == "0":
        break
    left,right = map(int,tmp_str.split())
    print("%d"%(table[right]-table[left-1]))



Measured memory_bytes: 51936
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int n;
V< V<int> > edges;
V<int> match;

void dfs(int i, int p) {
    if (match[i] != -1) return;
    for (int e: edges[i]) {
        if (e != p) dfs(e, i);
    }
    if (match[i] == -1 && p != -1 && match[p] == -1) {
        match[i] = p;
        match[p] = i;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    edges.resize(n);
    for (int i = 0; i < n - 1; i++) {
        int a, b; cin >> a >> b;
        a--, b--;
        edges[a].emplace_back(b);
        edges[b].emplace_back(a);
    }

    match.resize(n, -1);
    dfs(0, -1);

    for (int i = 0; i < n; i++) {
        if (match[i] == -1) {
            cout << "First\n";
            return 0;
        }
    }
    cout << "Second\n";
    return 0;
}


Measured memory_bytes: 6272
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code ---*/
	s := next()
	c := 0
	for _, v := range s {
		if v == '1' {
			c++
		}
	}
	fmt.Println(c)
}

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// Genericsがないので筋肉で...
// interfaceでの取扱がようわからんし
func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}

// mapからkeysとvaluesを返す感じのやつ
// なんかしらんけどmap[interface{}]interface{}しか受け付けない。なんのためのinterface{}やねん
// なので呼ぶときのmapはmap[int]stringとかじゃダメ
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
	return
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  int n,k,di,a,b,c;
  cin>>n>>k;
  set<int>s;
  for(int i=0;i<k;i++)
  {
  	cin>>a;
  	for(int j=0;j<a;j++)
  	{
	  cin>>b;
	  s.insert(b);
	}
  	
  }
  cout<<n-s.size();
}

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

long long gcd(long long a, long long b) {
    if (a % b) return gcd(b, a % b);
    else return b;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    long long a, b; cin >> a >> b;
    cout << a * b / gcd(a, b) << "\n";
    return 0;
}

Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

int main()
{
	
	int W, N;
	int count = 1;
	while (1)
	{
		int data[1001][2] = {};
		cin >> W;
		if (W == 0)break;
		cin >> N;
		int a, b;

		for (size_t i = 0; i < N; i++)
		{
			scanf("%d,%d", &a, &b);
			for (size_t j = 0; j < 1001; j++)
			{

				data[j][1] = max(data[j][1], data[j][0]);
				if (j + b <= W)
				{
					data[j + b][1] = max(data[j + b][1], data[j][0] + a);
				}

			}
			for (size_t j = 0; j < 1001; j++)
			{
				data[j][0] = data[j][1];
			}
		}
		int ans = 0, memo;
		for (size_t i = 0; i < 1001; i++)
		{
			if (ans < data[i][0])
			{
				ans = data[i][0];
				memo = i;
			}
		}
		cout << "Case "<<count<<":"<<endl << ans << endl << memo << endl;
		count++;
	}return 0;
}

Measured memory_bytes: 1248
#include<bits/stdc++.h>
using namespace std;
vector<int> v[100010];
int fa[100010],d[100010],deep;
void dfs(int id,int f)
{
    fa[id]=f;deep++;d[id]=deep;
    for(int i=0;i<v[id].size();i++)
    {
        if (v[id][i]==f) continue;
        dfs(v[id][i],id);
    }
    deep--;
}
int dfs2(int id)
{
    int res=1;
    for(int i=0;i<v[id].size();i++)
    {
        if (v[id][i]==fa[id]) continue;
        res+=dfs2(v[id][i]);
    }
    return res;
}
int main()
{
    int n,i,a,b,p,ans2,ans1;
    cin>>n;
    for(i=1;i<=n-1;i++)
    {
        scanf("%d%d",&a,&b);
        v[a].push_back(b);
        v[b].push_back(a);
    }
    dfs(1,-1);p=n;
    for(i=1;i<=d[n]/2-1;i++)
        p=fa[p];
    ans2=dfs2(p);ans1=n-ans2;
    if (ans1>ans2) cout<<"Fennec"<<endl;
    else cout<<"Snuke"<<endl;
    return 0;
}

Measured memory_bytes: 11136
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define rep(index,num) for(int index=0;index<num;index++)
#define scan(argument) scanf("%d",&argument)
#define prin(argument) printf("%d\n",argument)
#define eps 1e-15
typedef long long ll;
int main(){
	char str[1001];
	int w;
	scanf("%s",str);
	scan(w);
	rep(i,1000){
		if(str[i]=='\0'){
			break;
		}
		else if(i%w==0){
			printf("%c",str[i]);
		}
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <queue>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ul;
typedef pair<int,int> P;
#define X first
#define Y second

void go() {
	int n,h;
	cin >> n >> h;
	vector<int> a(n),b(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	sort(a.begin(),a.end());
	reverse(a.begin(),a.end());
	sort(b.begin(),b.end());
	reverse(b.begin(),b.end());
	int res = 0;
	int i = 0;
	for(;h>0;) {
		res ++;
		if(i<n && b[i] > a[0]) {
			h -= b[i];
			i++;
		} else {
			h -= a[0];
		}
	}
	cout << res << endl;
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	// int t; cin >> t; for(;t--;)
	go();
	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int h,w;
    cin >> h >> w;
    int n;
    cin >> n;
    vi a(n);
    rep(i,n) cin >> a[i];
    vi ans (h*w);
    int ind = 0;
    int ai = 0;
    int sum = 0;
    rep(i,h*w){
        ans[i] = ai+1;
        sum++;
        if(a[ai]==sum){
            ai++;
            sum = 0;
        }
    }
    vector<vi> res(h,vi(w));
    rep(i,h){
        rep(j,w){
            if(i%2==0){
                res[i][j] = ans[i*w + j];
            }else{
                res[i][w-j-1] = ans[i*w + j];
            }
        }
    }
    rep(i,h){
        rep(j,w){
            cout << res[i][j] << " ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 384
from functools import reduce

DEBUG = False
H, W = map(int, input().split())

A = []
is_colm_black = [True] * W
for _ in range(H):
    a = list(input())
    if DEBUG:
        print("a: {}".format(a))
    if not reduce(lambda x, y: x and (y == "."), a, True):
        A.append(a)
        for i, j in enumerate(a):
            is_colm_black[i] &= (j == '.')

if DEBUG:
    print("A: {}".format(A))
    print("is_colm_black: {}".format(is_colm_black))

ans = []
for i in range(len(A)):
    a = ""
    for j, f in enumerate(is_colm_black):
        if not f:
            a += A[i][j]
    if a:
        ans.append(a)
    if DEBUG:
        print("i: {}, a: {}".format(i, a))
print(*ans, sep="\n")


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

int main(){
    int n,x;
    int counter;
    
    while(true){
        cin >> n >> x;
        counter = 0;
        if(n==0&&x==0)break;
        for(int i=1;i<=n-2;i++){
            for(int j=i+1;j<=n-1;j++){
                for(int k=j+1;k<=n;k++){
                    if(i+j+k==x)counter += 1;
                }
            }
        }
        cout << counter <<endl;
    }

}

Measured memory_bytes: 1160
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int D = sc.nextInt();
		int T = sc.nextInt();
		int S = sc.nextInt();
		if(D <= T*S) System.out.println("Yes");
		else System.out.println("No");
		sc.close();
	}

}


Measured memory_bytes: 35540
n, m = map(int, input().split())
h = []
for i in range(m):
    a, b = map(int, input().split())
    a, b = min(a, b), max(a, b)
    h.append((a,b))
h = sorted(h, key=lambda x: (x[0], x[1]))
r = 0
l = 0
cnt = 0
for a, b in h:
    if a >= r:
        cnt += 1
        l = a
        r = b
    elif b < r:
        r = b
    else:
        continue        
print(cnt)

Measured memory_bytes: 59076
#include <stdio.h>

int mem[101], turn;

int main(void)
{
    int i, j, n, tmp, turg[100], count;
    scanf("%d",&n);
    for (i = 0; i <= n; i++) {
        mem[i] = 0;
    }
    scanf("%d",&turn);
    for (i = 0; i < turn; i++) {
        scanf("%d",&turg[i]);
    }
    for (i = 0; i < turn; i++) {
        count = 0;
        for (j = 1; j <= n; j++) {
            scanf("%d",&tmp);
            if (tmp != turg[i]) {
                count++;
            } else {
                mem[j]++;
            }
        }
        mem[turg[i]] += count;
/*
        printf("point:");
        for (j = 1; j <= n; j++) {
            printf("%d ",mem[j]);
        }
        puts("");
*/
    }
    for (i = 1; i <= n; i++) {
        printf("%d\n",mem[i]);
    }
    return 0;
}

Measured memory_bytes: 596
/*
          , -- 、
        /;;;;;;', 　　　
        i二二二i
      , ' 　    ヽ ???
     i　ﾉﾉﾉﾉﾉﾍ .', 　　
     〉ﾘi' ﾟ ヮﾟﾉﾚく　 WAyon..........
  ○⊂}〈lﾄ--ｲl〉{つ● 　　
      ,ｒ/ー i-ヽヽ 　　　
     ｀｀i_ﾗi_ﾗ
*/

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
const int INF=(int)1e12;
const int mod=(int)1e9+7;
#define all(a) (a).begin(),(a).end()
typedef vector<vector<int>> graph;

#define pb push_back

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int gcd(int a,int b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}


signed main() {
    int n,k;cin >>n>>k;
    vector<int> a(n);
    rep(i,k){
        int d;cin >>d;
        rep(j,d){
            int m;cin >>m;
            a[m-1]=1;
        }
    }int ans=0;
    rep(i,n){
        if(a[i]==0)ans++;
    }
    cout <<ans<<endl;
}

















Measured memory_bytes: 3636
s = list(input())
K = int(input())
zp1 = 1+ord('z')
for i in range(len(s)):
    si = s[i]
    cost = (zp1-ord(si))%26
    if cost <= K:
        K -= cost
        s[i] = 'a'
s[-1] = chr(ord('a') + (K + ord(s[-1]) - ord('a')) % 26)
print(''.join(s))


Measured memory_bytes: 73104
n = int(input())
ans = [0]*10001

for i in range(1, 101):
    for j in range(1, 101):
        for z in range(1, 101):
            aaa = i**2+j**2+z**2+i*j+j*z+z*i
            if aaa <= 10**4:
                ans[aaa] += 1
for i in range(n):
    print(ans[i+1])


Measured memory_bytes: 69060
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
    char a[8]={'F','E','S','T','I','V','A','L'};
    string s;
    cin>>s;
    int l=s.size(),g=0,i;
    for(i=l-1;i>=0;i--)
    {
        if(s[i]=='L')
        {
            i--;
            int j=6;
            while(j>=0)
            {
                if(s[i]==a[j])
                    {j--;i--;}
                else
                    break;
            }
            i++;
            if(j==-1){g=1;break;}
        }
        if(g==1)break;
    }
    if(g==1)
    {
        for(int j=0;j<i;j++)
            cout<<s[j];
            cout<<endl;
    }
    return 0;
}


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

int main()
{
    string s,s1;
    while(cin>>s>>s1)
    {

        double y = 0;
        int z;


        // object from the class stringstream
        stringstream geek(s+s1);

        // The object has the value 12345 and stream
        // it to the integer x
        int x = 0;
        geek >> x;

        // Now the variable x holds the value 12345
        y = sqrt(x);
        z = y;

        if((y-z)==0)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }

    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int a,b;
    while(cin>>a>>b)
    {
        if(a%3==0||b%3==0||(a+b)%3==0)
            cout<<"Possible"<<endl;
        else
            cout<<"Impossible"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
A.sort()

S = [0]*(N+1)
for i in range(1, N+1):
    S[i] = S[i-1] + A[i-1]

for i in range(N)[::-1]:
    if S[i]*2 < A[i]:
        print(N-i)
        exit()

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

    class Program
    {

        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            decimal n = decimal.Parse(input);
            decimal ans = 0;
            for (int i = 1; i <= n; i++)
            {
                if ((i % 3 != 0) && (i % 5 != 0))
                {
                    ans += i;
                }
            }

            Console.WriteLine(ans.ToString());
        }
    }

Measured memory_bytes: 17968
fun main(args:Array<String>) {
	val n=readLine()!!.toInt()
	val l=mutableListOf<String>()

	val f=if(n%2==0) n+1 else n
	
	for(i in 1..n)
		for(j in i+1..n)
			if(i+j!=f)
				l.add("$i $j")

	println(l.size)
	for(t in l)
		println(t)
}


Measured memory_bytes: 31852
import queue
n = int(input())
a = sorted(list(map(int,input().split())), reverse=True)
ans = 0
b = queue.Queue()
b.put(a[0])
for x in a[1:]:
    y = b.get()
    ans += y
    b.put(x)
    b.put(x)
print(ans)

Measured memory_bytes: 31972
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};


void solve(){
    ll n;
    cin>>n;
    cout<<"ABC"<<n<<endl;

}



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    

    solve();


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int p,q,r;
    cin >> p >> q >> r;
    cout << min(p+q,min(q+r,p+r)) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 998244353
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=200001 ;
int main()
{
   fast ;
   ll n ;
   cin>>n ;
   ll ans[n+1] ;
   memset(ans,0,sizeof(ans)) ;
   for(ll i=1;i<n;i++)
   {
       ll x ;
       cin>>x ;
       ans[x]++ ;
   }
   for(ll i=1;i<=n;i++)
   {
       cout<<ans[i]<<endl ;
   }




}


Measured memory_bytes: 5204
class UnionFind
  def initialize(n)
    @data = Array.new(n,&:itself)
  end
  def root(i)
    _compact!(i, _root(i))
  end
  def same?(i,j)
    root(i) == root(j)
  end
  def unite!(i,j)
    _compact!(i, root(j))
  end
  def _root(i)
    i = @data[i] until i == @data[i]
    return i
  end
  def _compact!(i,r)
    until @data[i] == r
      tmp = @data[i]
      @data[i] = r
      i = tmp
    end
    return r
  end
end
N, M = gets.split.map(&:to_i)
uf = UnionFind.new(N + 1)
M.times do
  a,b = gets.split.map(&:to_i)
  uf.unite!(a,b)
end
G = (1 .. N).group_by{|i| uf.root(i) }
puts G.transform_values(&:size).values.max


Measured memory_bytes: 40952
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1E9;

int main() {
    int N, K; cin >> N >> K;
    int H[N];
    for (int i=0; i<N; i++){
        cin >> H[i];
    }
    int dp[N];
    for (int i=0; i<N; i++){
        dp[i] = INF;
    }
    dp[0] = 0;
    for (int i=0; i<N; i++){
        for (int k=1; k<K+1; k++){
            if (i+k > N-1){
                dp[N-1] = min(dp[N-1], dp[i] + abs(H[N-1]-H[i]));
            }
            else{
                dp[i+k] = min(dp[i+k], dp[i] + abs(H[i+k]-H[i]));
            }
        }
    }
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)//rep(i,回数){処理}
using namespace std;
using ll = long long int;
using P = pair<int, int>;

int main() {
    int n,ans;
    cin >> n;
    ans = 0;
    rep(i,11) {
        if (i*1000 >= n) {
            ans = i*1000 - n;
            break;
        }
    }    
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3616
#include <iostream>
#include <queue>
#include <vector>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;

int main(){
  int N, M, K;
  cin >> N >> M >> K;
  int A[M], B[M];
  rep(i, M)
    cin >> A[i] >> B[i];
  int C[K], D[K];
  rep(i, K)
    cin >> C[i] >> D[i];
  //ここまで入力

  //無向グラフの作成
  vector<vector<int> > G(N);
  rep(i, M){
    G[A[i]-1 ].push_back(B[i] );
    G[B[i]-1 ].push_back(A[i] );
  }

  /* rep(i, N){
    cout << i+1<<" : ";
    rep(j, G[i].size())
      cout << G[i][j]<<" ";
    cout << endl;  
    }*/
  
  //頂点firstが連結成分secondに属している
  //連結成分の初期値は-1にしておく
  pair<int, int> vl[N]; //vertex label
  rep(i, N)
    vl[i] = make_pair(i+1, -1);
  
  queue<int> q;
  int label = 0;
  rep(i, N){
    //ラベルがついていない頂点は処理をする
    //BFSにより，連結成分にラベルlabelをつける
    if(vl[i].second == -1){
      q.push(i+1);
      //頂点iのラベル更新
      vl[i].second = label;
      //連結成分を探索(BFS)
      while(q.empty() != 1){
	int now = q.front();
	q.pop();
	rep(j, G[now-1 ].size() ){
	  int next = G[now-1][j];
	  //頂点nextが未訪問であればキューに追加
	  if(vl[next-1 ].second == -1){
	    q.push(next);
	    //ラベル更新
	    vl[next-1 ].second = label;
	  }
	}
      }
      //連結成分の探索が終わった段階でラベル番号を増やす
      label++;
    }
  }

  //ラベルlabelの頂点がいくつあるか数える
  int count[label];
  rep(i, label)
    count[i] = 0;
  rep(i, N)
    count[vl[i].second ]++;

  //ブロック関係の作成
  vector<vector<int> > Block(N);
  rep(i, K)
    if(vl[C[i]-1 ].second == vl[D[i]-1 ].second ){
      Block[C[i]-1 ].push_back(D[i] );
      Block[D[i]-1 ].push_back(C[i] );
  }
    
  rep(i, N){
    //連結成分の頂点数
    int num = count[vl[i].second ];
    //頂点iと友達である頂点の数
    int friends = G[i].size();
    //頂点iとブロックしあっている頂点の数
    int block = Block[i].size();
    cout << num - friends - block -1 << " ";
  }

  cout << endl;
  
  return 0;
}


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

struct Arm{
  int left, right;
};

bool cmp_Arm(Arm l, Arm r) {
  return l.right < r.right;
}
int main(int argc, char** argv) {
  int N;
  std::cin >> N;
  std::vector<Arm> P(N);
  for (auto& e : P) {
    int X, L;
    std::cin >> X >> L;
    e.left = X-L;
    e.right = X+L;
  }
  std::sort(P.begin(), P.end(), cmp_Arm);
  int num {0};
  int cnt {1};
  for (auto i = 1;i < N;++i) {
    if (P[num].right <= P[i].left) {
      ++cnt;
      num = i;
    }
  }
  std::cout << cnt << '\n';
}


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

using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	int arr[n];
	for(int i = 0; i<n; i++){
		cin >> arr[i];
	}
	sort(arr, arr+n);
	int sum = 0;
	for(int i = 0; i<k; i++)
		sum+=arr[i];
	cout << sum<<endl;

return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) {
    cin >> a.at(i);
    a.at(i)--;
  }
  int x = 0, j = -1;
  rep(i, n) {
    x = a.at(x);
    if (x == 1) {
      j = i + 1;
      break;
    }
  };
  cout << j << endl;
}


Measured memory_bytes: 3724
#include <iostream>
#include <string>

int main(void){
    using namespace std;

    string str, left, right;
    int m, i, h;
    
    while (cin >> str) {
        if (str == "-") break;
        cin >> m;
        for (i = 0; i < m; ++i) {
            cin >> h;
            left = str.substr(0, h);
            right = str.substr(h, str.size());
            str = right + left;
        }
        cout << str << endl;
    }
    
    return 0;
}

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

int main(){
	int x, y;
	int a[10];
	cin>>a[0]>>a[1]>>a[2];
	sort(a, a+3);
	x=a[2]-a[0];
	y=a[2]-a[1];
	if(x%2==0 && y%2==0){
		cout<<x/2+y/2<<endl;
		return 0;
	}
	if(x%2==0 || y%2==0){
		cout<<(x+1)/2+(y+1)/2+1<<endl;
		return 0;
	}
	else{
		cout<<x/2+y/2+1<<endl;
		return 0;
	}
}


Measured memory_bytes: 256
import Control.Applicative
import Data.Bits

logBase2 :: Int -> Int
logBase2 x = finiteBitSize x - 1 - countLeadingZeros x

-- 00
-- 01
-- 10
--
solve :: Int -> Int
solve n 
    | n <= 0 = 0
    | otherwise = 
        foldr (\(i, b) acc -> if b then setBit acc i else acc) 0 [ (i,  calc i) | i <- [0..logBase2 n] ]
    where
    calc 0 = [False,True,True,False] !! (n `mod` 4)
    calc i | even q = False
           | otherwise = even r
        where
        (q,r) = divMod n (2^i)
    
main :: IO ()
main = do
    [a,b] <- map read . words <$> getLine
    print (solve b `xor` solve (a-1))


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

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

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

int n,h,ans,p;
int main(){
  cin >> n;
  rep(i,n){
    cin >> h;
    if(p < h) ans += h-p;
    p = h;
  }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int ans=100000;
for(int i=0;i<s.length()-2;i++)
{
	 int t=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
	 ans=min(ans,abs(t-753));
}
printf("%d\n",ans);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            checked
            {
                string[] s;
#if false
                int N = int.Parse(Console.ReadLine());
#else
                s = Console.ReadLine().Split(' ');
                int K = int.Parse(s[0]);
                int X = int.Parse(s[1]);
#endif

                for (int i = X - K + 1; i < X + K; i++)
                {
                    Console.Write("{0} ", i);
                }
                Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 13268
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// find_by_order()  // order_of_key
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

#define int ll
int a[1234];
vi vec,vec1;
signed main(){
    std::ios::sync_with_stdio(false); cin.tie(NULL);
  	int n,k;
  	cin>>n>>k;
  	int i,j;
  	rep(i,n){
  		cin>>a[i];
  	}
  	int ans=0;
  	rep(i,n){
  		ans=0;
  		f(j,i,n){
  			ans+=a[j];
  			vec.pb(ans);
  			//cout<<ans<<endl;
  		}
  	}
  	int siz=vec.size();
  	int st=0;
  	int bit;
  	int cnt=0;
  	ans=0;
  	fd(bit,60,0){
  		vec1.clear();
  		cnt=0;
  		f(j,st,vec.size()){
  			if(vec[j]&(1LL<<bit)){
  				cnt++;
  				vec1.pb(vec[j]);
  			}
  		}
  		if(cnt>=k){
  			ans+=(1LL<<bit);
  			vec.clear();

  			rep(j,vec1.size()){
  				vec.pb(vec1[j]);
  			}
  			//cout<<bit<<"das"<<cnt<<" "<<vec.size()<<endl;
  			vec1.clear();
  			
  		}
  	}
  	cout<<ans<<endl;
    return 0;   
}


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

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

int main(){
  int N,T;cin>>N>>T;
  vector<int> x;x.push_back(T);
  for(int i=0;i<N;i++){
    int a;cin>>a;
      x.push_back(a);
  }
  sort(x.begin(),x.end());
  vector<int> v;
  for(int i=1;i<x.size();i++)v.push_back(x[i]-x[i-1]);
  int res=v[0];
  for(int i=1;i<v.size();i++)res=gcd(res,v[i]);
  cout<<res<<endl;
}

Measured memory_bytes: 1400
a, b = map(int, input().split())
anser = ""

if a > b:
    for i in range(0, a + 1):
        anser = str(b) * i
if a == b:
    for i in range(0, a + 1):
        anser = str(b) * i
if a < b:
    for i in range(0, b + 1):
        anser = str(a) * i
print(anser)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define N 105
using namespace std;
int m,I,J,A[N][N];
vector<int> ans;

void func1(int a,int b){
  int ay,ax,by,bx;
  for(int i=0;i<m;i++)
    for(int j=0;j<m;j++){
      if(a==A[i][j])ay=i,ax=j;
      if(b==A[i][j])by=i,bx=j;
    }
  A[ay][ax]=0;
  for(int i=ax+1;i<m;i++){
    if(!A[ay][i])break;
    for(int j=0;j<m;j++)
      if(!A[j][0]){
	A[j][0]=A[ay][i];
	A[ay][i]=0;
	break;
      }
  }

  for(int i=bx+1;i<m;i++)
    if(!A[by][i]){
      A[by][i]=a;
      break;
    }
}

void func2(int a,int b){
  int ay,ax,bx;
  for(int i=0;i<m;i++)
    for(int j=0;j<m;j++){
      if(a==A[i][j])ay=i,ax=j;
      if(b==A[i][j])bx=j;
    }
  if(ax>=bx)return;

  for(int i=ax;i<m&&A[ay][i];i++){
    for(int j=0;j<m;j++)
      if(!A[j][0]){
	A[j][0]=A[ay][i];
	A[ay][i]=0;
	break;
      }
  }
  func1(a,b);
}


void func3(int a){
  int ay,ax;
  for(int i=0;i<m;i++)
    for(int j=0;j<m;j++)
      if(a==A[i][j])ay=i,ax=j;

  if(!ax)return;
  
  for(int i=ax;i<m;i++){
    if(!A[ay][i])break;
    for(int j=0;j<m;j++)
      if(!A[j][0]){
	A[j][0]=A[ay][i];
	A[ay][i]=0;
	break;
      }
  }
}


bool check(int a,int b){
  int ay,by;
  for(int i=0;i<m;i++){
    for(int j=0;j<m;j++){
      if(a==A[i][j])ay=i;
      if(b==A[i][j])by=i;
    }
  }
  return ay==by;
}

int main(){

  while(1){
    cin>>m;
    if(!m)break;
    memset(A,0,sizeof(A));
    for(int i=0;i<m;i++)A[i][0]=i+1;

    while(1){
      cin>>I>>J;
      if(!I&&!J)break;
      if(I&&!J)func3(I);
      else if(!check(I,J))func1(I,J);
      else func2(I,J);
    }

    for(int i=0;i<m;i++){
      int cnt=0;
      for(int j=0;j<m;j++){
	if(!A[i][j])break;
	cnt++;
      }
      if(cnt)ans.push_back(cnt);
    }
    sort(ans.begin(),ans.end());
    for(int i=0;i<(int)ans.size();i++)cout<<ans[i]<<endl;
    cout<<"end"<<endl;
    ans.clear();
  }
  return 0;
}

Measured memory_bytes: 1264
s=input()[::-1]
words=["dreamer","eraser","dream","erase"]
add=0
while add!=len(s):
    cnt=0
    for i in words:
        length=len(i)
        word=s[add:add+length][::-1]
        if word==i:
            add +=length
            break
        else:cnt +=1
    if cnt==4:print("NO");exit()
print("YES")

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std; 
typedef long long ll; 
typedef vector<int> vi; 
const ll oo = 0x3f3f3f3f3f3f3f3fll; 
#define pb push_back

const int maxn = 5006; 

int n; 
string s; 
int f[maxn][maxn]; 

int main() {
	cin>>n; 
	cin>>s; 
	int ans = 0; 
	for (int i = n-1; i >= 0; --i) 
		for (int j = n-1; j > i; --j) { 
			f[i][j] = (s[i]==s[j]?f[i+1][j+1]+1:0); 
			ans = max(ans, min(f[i][j],j-i)); 
		}
	cout<<ans<<endl; 
}


Measured memory_bytes: 96768
#include<iostream>
#include<string>
using namespace std;
int main(){
  string O,E;
  int i;
  cin >>O >>E;
  for(i=0;i<E.size();++i){
    cout << O[i] << E[i];
  }
  if(O.size()>E.size()) cout << O[i];
  cout << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main() {

	string s;
	cin >> s;

	deque<char>st;

	rep(i, s.size()) {
		if (s[i] == 'B') {
			if (!st.empty())
				st.pop_front();
		}
		else
			st.push_front(s[i]);
	}

	while (!st.empty()) {
		cout << st.back();
		st.pop_back();
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
A = [[int(j) for j in input().split()] for i in range(3)]
N = int(input())
B = [False] * 101

for i in range(N):
    B[int(input())] = True

ans = 'No'
for i in range(3):
    if all([B[v] for v in A[i]]):
        ans = 'Yes'
        break

for j in range(3):
    if all([B[A[i][j]] for i in range(3)]):
        ans = 'Yes'
        break

if B[A[0][0]] == B[A[1][1]] == B[A[2][2]] == True:
    ans = 'Yes'

if B[A[2][0]] == B[A[1][1]] == B[A[0][2]] == True:
    ans = 'Yes'

print(ans)



Measured memory_bytes: 3064
//DP Contest
//K-Stones
  #include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define ll long long
  #define int long long
  #define double long double
  #define max(a,b) (a>b?a:b)
  #define min(a,b) (a<b?a:b)
  #define mp make_pair
  #define pb push_back
  #define inf INT_MAX
  #define f first
  #define s second
  #define all(v) v.begin(), v.end()
  #define mod INT_MAX 
 //Ques H: Grid 1
  #define WALL '#'
  const int MOD=1e9+7;
  char grid[1005][1005];

  int32_t main()
  {
  
    IOS
   
    
    

     int height, width;
     cin>>height>>width;
     
    for(int i=1;i<=height;i++)
    	for(int j=1;j<=width;j++)
    		cin>>grid[i][j];
    int no_of_paths[height+5][width+5];

    memset(no_of_paths, 0, sizeof(no_of_paths));

    for(int i = 1; i <=height; i++)
    {
        for(int j = 1; j <= width; j++)
        {
            if(grid[i][j] == WALL) continue;

            if(i == 1 && j == 1)
            {
                no_of_paths[i][j] = 1;
            }
            else
            {
            	//if(i-1>=0 && j-1>=0)
                no_of_paths[i][j] = (no_of_paths[i - 1][j]%MOD + no_of_paths[i][j - 1]%MOD)%MOD;
            }
        }
    }

   cout<<no_of_paths[height][width];
    return 0;

     
   }



Measured memory_bytes: 9088
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
using namespace std;

int main()
{
    cin.tie(0);

    int64_t h, w, n;
    cin >> h >> w >> n;

    map<pair<int64_t, int64_t>, int> mm;

    for (int i = 0; i < n; i++) {
        int64_t y, x;
        cin >> y >> x;
        y--, x--;

        for (int64_t dy = -2; dy <= 0; dy++) {
            for (int64_t dx = -2; dx <= 0; dx++) {
                if (x + dx >= 0 && x + dx + 2 < w && y + dy >= 0 && y + dy + 2 < h)
                    mm[make_pair(x + dx, y + dy)]++;
            }
        }
    }

    int64_t tbl[10] = {};
    int64_t oth = 0;
    for (auto &p : mm) {
        tbl[p.second]++;
        if (p.second > 0)
            oth++;
    }

    tbl[0] = (h-2) * (w-2) - oth;

    for (int i = 0; i < 10; i++)
        cout << tbl[i] << endl;

    return 0;
}


Measured memory_bytes: 56448
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using int64 = int64_t;

constexpr int64 MOD = 1000000007;

using S = string::iterator ;

struct yaml {
    string type;
    string value;
    map<string, yaml> data;

    yaml() {}
    yaml(string t): type(t) {}
};

string query;
string data;
int line = 0;

yaml parse_yaml (S& it, int indent) {
    int actual = 0;
    S bak = it;
    for (; it != end(data) && actual < indent; ++it, ++actual)
        if (*it != ' ') break;
    if (it == end(data) || actual < indent){
        it = bak;
        return yaml("object");
    }

    S key_begin = it;
    while (*it != ':') ++it;
    string key = string(key_begin, it);
    ++it; // ":"

    yaml prop;
    if (*it == '\n') {
        ++it; // '\n'
        int new_indent = 0;
        S bk = it;
        while (*bk == ' ') {
            ++bk; ++new_indent;
        }
        assert(new_indent > indent);
        prop = parse_yaml(it, new_indent);
    } else {
        ++it; // " "
        S s_begin = it;
        while (*it != '\n') ++it;
        prop = yaml("yvalue");
        prop.value = string(s_begin, it);
        ++it; // '\n'
    }

    yaml wanted = parse_yaml(it, indent);
    wanted.data[key] = prop;
    return wanted;
}

const string OBJECT = "object";
const string NO_SUCH_PROPERTY = "no such property";

string solve() {
    S ittt = data.begin();
    yaml current = parse_yaml(ittt, 0);

    S it = query.begin();
    while (it != end(query)) {
        ++it; // "."
        if (current.type == "yvalue") return NO_SUCH_PROPERTY;
        S p_begin = it;
        while (it != end(query) && *it != '.') {
            ++it;
        }
        string key(p_begin, it);
        if (current.data.find(key) == end(current.data)) {
            return NO_SUCH_PROPERTY;
        }
        yaml temp = current.data[key];
        current = temp;
    }
    if (current.type == "object") {
        return OBJECT;
    }
    return "string \"" + current.value + "\"";
}


int main() {
    cin >> query;
    string line; getline(cin, line);
    while (getline(cin, line)) {
        data += line + "\n";
    }
    cout << solve() << endl;
    return 0;
}

Measured memory_bytes: 3464
#include <iostream>
#include <algorithm>
#include <queue>
#include <utility>
using namespace std;

#define DEBUG(x) cerr << #x << " = " << x << endl

// cargo(y,x) schwars(y,x)
int D[7+2][7+2][7+2][7+2];

bool F[7+2][7+2];
const int INF = (int)1e9;

struct Node {
  int cY, cX, wY, wX;
  Node(int cy_, int cx_, int wy_, int wx_) : cY(cy_), cX(cx_), wY(wy_), wX(wx_) { }
};

int main() {
  while(true) {
    int W, H; cin >> W >> H;
    if(W == 0 && H == 0) break;
    for(int i = 0; i < 7+2; ++i) {
      for(int j = 0; j < 7+2; ++j) {
        if(i == 0 || i == H + 1 || j == 0 || j == W + 1) {
          F[i][j] = true;
        }
        else {
          F[i][j] = false;
        }
        for(int a = 0; a < 7 + 2; ++a) {
          for(int b = 0; b < 7 + 2; ++b) {
            D[i][j][a][b] = INF;
          }
        }
      }
    }

    int gX, gY, wX, wY, cX, cY;
    for(int i = 1; i <= H; ++i) {
      for(int j = 1; j <= W; ++j) {
        int d; cin >> d;
        if(d == 1) {
          F[i][j] = true;
        }
        if(d == 2) {
          cY = i;
          cX = j;
        }
        if(d == 3) {
          gY = i;
          gX = j;
        }
        if(d == 4) {
          wY = i;
          wX = j;
        }
      }
    }
    queue<Node> Q;
    Q.emplace(cY, cX, wY, wX);
    D[cY][cX][wY][wX] = 0;
    while(!Q.empty()) {
      Node node = Q.front(); Q.pop();
      int cy = node.cY, cx = node.cX;
      int wy = node.wY, wx = node.wX;
#if 0
      for(int i = 0; i < H + 2; ++i) {
        for(int j = 0; j < W + 2; ++j) {
          if(i == cy && j == cx) cerr << 'C';
          else if(i == wy && j == wx) cerr << 'W';
          else cerr << F[i][j];
        }
        cerr << endl;
      }
      cerr << endl;
#endif
      for(int i = 0; i < 4; ++i) {
        static int dx[] = { 1, 0, -1, 0 };
        static int dy[] = { 0, -1, 0, 1 };
        int ny = wy + dy[i];
        int nx = wx + dx[i];
        if(ny == cy && nx == cx && F[cy + dy[i]][cx + dx[i]] == false
            && D[cy + dy[i]][cx + dx[i]][cy][cx] > D[cy][cx][wy][wx] + 1) {
          D[cy + dy[i]][cx + dx[i]][cy][cx] = D[cy][cx][wy][wx] + 1;
          Q.emplace(cy + dy[i], cx + dx[i], cy, cx);
        }
        if((ny != cy || nx != cx) && F[ny][nx] == false
            && D[cy][cx][ny][nx] > D[cy][cx][wy][wx]) {
          D[cy][cx][ny][nx] = D[cy][cx][wy][wx];
          Q.emplace(cy, cx, ny, nx);
        }
      }
    }
    int ans = INF;
    for(int i = 1; i <= H; ++i) {
      for(int j = 1; j <= W; ++j) {
        ans = min(ans, D[gY][gX][i][j]);
      }
    }
    if(ans == INF) {
      cout << -1 << endl;
    }
    else {
      cout << ans << endl;
    }
  }
}

Measured memory_bytes: 1244
#include<stdio.h>

int main()
{
    unsigned long long len,i,count[26],k,l,a[26];
    for(i=0;i<26;i++)count[i]=0;
    char s[1000000];
    scanf("%s",s);
    len=strlen(s);
    for(i=0;i<len;i++){
        count[s[i]-97]++;
    }
    for(i=0;i<26;i++){
        k=1;if(count[i]==0){k=5;break;}
    }
    if(k==1){printf("None\n");return 0;}
    for(i=0;i<26;i++){
        if(count[i]==0){printf("%c\n",i+97);return 0;}
    }

}


Measured memory_bytes: 1836