akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,1,-1,-1};
const int INF = 1<<30;
const double EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> Pii;
typedef pair<int,vi > P;
typedef unsigned long long ll;
char stage[1024][1024];
class data{
public:
	int y;
	int x;
	int cnt;
	data(){}
	data(int _y,int _x,int _cnt){
		y = _y;
		x = _x;
		cnt = _cnt;
	}
};
int memo[1024][1024];
int main(){
	int H,W;
	cin >> H >> W;
	queue < data > Q; 
	rep(i,H){
		cin >> stage[i];
		rep(j,W){
			if(stage[i][j] == '.'){
				Q.push(data(i,j,0));
			}
		}
	}
	int ans = 0;
	while(!Q.empty()){
		data d = Q.front();Q.pop();
		rep(i,8){
			int ny = d.y + dy[i];
			int nx = d.x + dx[i];
			if(ny < 0 || ny > H-1 || nx < 0 || nx > W-1)continue;
			memo[ny][nx]++;
			if(memo[ny][nx]==stage[ny][nx]-'0'){
				Q.push(data(ny,nx,d.cnt+1));
				ans = max(ans,d.cnt+1);
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

typedef long long ll;
const ll MOD=1000000007;

int main(){
	ll n,m;
	cin>>n>>m;
	
	if(abs(n-m)<=1){
		ll ret=1;
		for(int i=1;i<=n;i++){
			ret*=i; ret%=MOD;
		}
		for(int i=1;i<=m;i++){
			ret*=i; ret%=MOD;
		}
		if(n==m){
			ret*=2; ret%=MOD;
		}
		cout<<ret<<endl;
	}
	else puts("0");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000000000000LL
#define MOD 1000000007
#define writeln(n) cout<<n<<endl;
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

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

int main()
{
    int n; cin >> n;
    map<int, int> mp;
    int kind = 0,maxx=0;
    FOR(i, 0, n) {
        int p; cin >> p;
        if (p >= 3200) {
            maxx++;
            continue;
        }
        else if (mp[p / 400] == 0) {
            mp[p / 400]++;
            kind++;
        }
    }
    printf("%d %d", max(1,kind), kind + maxx);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*----------------------------Template-Begins----------------------------*/
typedef vector<int> VI;
typedef long long int ll;
typedef pair<int,int> PII;
typedef double db;
#define fastIO() ios_base::sync_with_stdio(0);cin.tie(nullptr)
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define DOTEST(t) int t;cin>>t; while(t--)
#define TEST cout<<"-------Executed--------\n";
#define all(x) x.begin(),x.end()
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
ll binexp(ll a,ll b){ll ans=1;while(b>0){if(b&1)ans = ans*a;a = a*a;b /=2;}return ans;}
ll modexp(ll a,ll b,ll m){ll ans=1;while(b>0){if(b&1){ans = ans*a%m;}a = a*a%m; b/=2;}return ans%m;}
/*---------------------------Template-Ends------------------------------ */
ll countbits(ll n){
    int c = 0;
    while(n){
        c++;
        n = n>>1;
    }
    return  c;
}
/*--------------------------------Main-----------------------------------*/
int main(){
    fastIO();
  int n;
  cin>>n;
  map<string,int> m;
  rep(i,0,n){
  string s;cin>>s;
    m[s]++;
  }
  cout<<"AC x "<<m["AC"]<<"\n";
  cout<<"WA x "<<m["WA"]<<"\n";
  cout<<"TLE x "<<m["TLE"]<<"\n";
  cout<<"RE x "<<m["RE"]<<"\n";
}
/*-----------------------------------------------------------------------*/


Measured memory_bytes: 3676
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
#x,y,a,b,c=[10**5 for _ in range(5)]
#p=[1 for i in range(a)]
#q=[1 for i in range(a)]
#r=[1 for i in range(a)]
p.sort()
p.reverse()
q.sort()
q.reverse()
total=p[:x]+q[:y]+r
total.sort()
total.reverse()
print(sum(total[:x+y]))

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

using namespace std;

void Main() {
    int N, K;
    cin >> N >> K;

    int ans = K;
    for (int i = 1; i < N; ++i) {
        ans *= K - 1;
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3640
#include <stdlib.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mini(vec) return *std::min_element(vec.begin(), vec.end());
#define maxi(vec) return *std::max_element(vec.begin(), vec.end());

int main() {
    int a;
    cin >>a;
    if(a%2==1)
        cout<<a*2<<endl;
    else
    {
        cout<<a<<endl;
    }
    
}



Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cstdlib>
#include <utility>
#include <cmath>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

#define ll long long

#ifndef ONLINE_JUDGE
#define debug(format, ...) fprintf(stderr, \
    "%s:%d: " format "\n", __func__, __LINE__,##__VA_ARGS__)
#else
#define debug(format, ...)
#define NDEBUG
#endif


#define DEFMOD(mod, type) typedef ModInt<mod, int> type;     \
                          type operator "" _m(unsigned long long x) {   \
                              type res = x; return res; \
                          }

template<int mod, class itype> struct ModInt {
    int val;
    ModInt() {
        val = 0;
    }
    ModInt(int a) {
        val = a % mod;
    }
};

/* MODIFY AS NEEDED */

DEFMOD(998244353, mi)

template<int mod, class itype> ModInt<mod, itype> fpow(ModInt<mod, itype> base, int exponent)
{
    ModInt<mod, itype> ans = 1_m;
    ModInt<mod, itype> cur = base;
    while (exponent) {
        if (exponent & 1) ans = ans * cur;
        cur = cur * cur; exponent >>= 1;
    }
    return ans;
}

template<int mod, class itype> ModInt<mod, itype> operator+(ModInt<mod, itype> a, ModInt<mod, itype> b)
{
    ModInt<mod, itype> ans;
    ll val = (ll)(a.val) + (ll)(b.val);
    if (val >= mod) val -= mod;
    ans.val = val; return ans;
}

template<int mod, class itype> ModInt<mod, itype> operator-(ModInt<mod, itype> a, ModInt<mod, itype> b)
{
    ModInt<mod, itype> ans;
    ans.val = a.val - b.val;
    if (ans.val < 0) ans.val += mod;
    return ans;
}

template<int mod, class itype> ModInt<mod, itype> operator*(ModInt<mod, itype> a, ModInt<mod, itype> b)
{
    ModInt<mod, itype> ans;
    ans.val = ((ll)(a.val) * (ll)(b.val)) % (ll)mod;
    return ans;
}

// PRIME MOD ONLY!
template<int mod, class itype> ModInt<mod, itype> operator/(ModInt<mod, itype> a, ModInt<mod, itype> b)
{
#ifndef ONLINE_JUDGE
    if (b.val == 0) {
        fprintf(stderr, "Division by zero :(\n"); abort();
    }
#endif
    return a * fpow(b, mod - 2);
}

mi fact[2000005];
mi ifact[2000005];

int n, k;

mi C(int a, int b)
{
    return fact[a] * ifact[b] * ifact[a-b];
}

mi spath(int a, int b)
{
    return C(a+b, a);
}

mi path(int x, int y, int z)
{
    if (x < 0 || y < 0) return 0;
    if (z < 0) return spath(x, y);
    if (z >= x || z >= y) return 0;
    return spath(x, y) - spath(z, x + y - z);
}

int main()
{
    fact[0] = 1;
    for (int i = 1; i <= 2000000; i++) fact[i] = (mi)i * fact[i-1];
    ifact[2000000] = 1_m / fact[2000000];
    for (int i = 1999999; i >= 0; i--) ifact[i] = ifact[i+1] * (mi)(i+1);
    scanf("%d%d", &n, &k);
    mi ans = 0;
    for (int r = 0; r <= k; r++) {
        int b = k - r;
        if (r < b) continue;
        if (r == b) {
            ans = ans + path(r, b - 1, n - 2);
        } else {
            int need_cnt = n - r + b;
            if (need_cnt <= 0) {
                ans = ans + spath(r, b);
            } else {
                ans = ans + path(r, b, need_cnt - 1);
            }
        }
    }
    printf("%d", ans.val);
    return 0;
}


Measured memory_bytes: 18868
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,o=0;
    cin>>a>>b>>c;
    for(;;){
        for(int i=0;i<7;i++){
            if(c<=0)break;
            c=c-a;
            o++;
        }
        if(c<=0)break;
        c=c-b;
    }
    cout<<o<<endl;
}



Measured memory_bytes: 3092
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han Elmuzaffer Daima
//Bismillahirrahmanirrahim

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define ort (bas+son)/2

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 100005; 
const lo mod = 1000000007; 

int n,m,cev,b,a[li],k;
string s,ss,sss;
vector<int> v;

inline int solve(){
	cin>>s>>ss>>sss;
	cout<<(char)(s[0]-32)<<(char)(ss[0]-32)<<(char)(sss[0]-32);
	return 0;
}

int main(void){
	solve();
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
Int INF = 1e18;
double EPS = 0.00000001;
//Int mod = 1e6+3;

int main() {
    Int l, r;
    cin >> l >> r;
    if (r - l >= 2019) {
        dump(0);
    }
    else {
        Int res = INF;
        for (Int i = l; i < r; i++) {
            for (Int j = l + 1; j <= r; j++) {
                res = min(res, i * j % 2019);
            }
        }
        dump(res);
    }
    return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
import heapq
A=[-i for i in A]
heapq.heapify(A)
x=heapq.heappop(A)
ans=0
ans+=-x
l=0
if N==2:
    print(ans)
else:
    while True:
        x=heapq.heappop(A)
        ans+=-x
        l+=1
        if l==N-2:
            break
        ans+=-x
        l+=1
        if l==N-2:
            break
    print(ans)

Measured memory_bytes: 102344
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    print((I()-2)*180)
if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
using ll=long long;
using namespace std;
ll a[220000];
int main(){
  ll n,sum1=0,sum2=0,tmp=0;
  cin>>n;
  rep(i,0,n)cin>>a[i];
  rep(i,0,n)sum1+=a[i];
  ll ans=1e15;
  rep(i,0,n-1){
    sum1-=a[i],sum2+=a[i];
    ans=min(ans,abs(sum1-sum2));
    }
  cout<<ans;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  if (a[a.size()-1] == b[0] && b[b.size()-1] == c[0]) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


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

int a;
int b;

int main(){
  cin >> a >> b;
  if(a <= 0 && b >= 0){
    cout << "Zero";
  }
  else if(a < 0 && b < 0){
    if((b - a + 1) % 2 == 0){
      cout << "Positive";
    }
    else {
      cout << "Negative";
    }
  }
  else if(a > 0 && b > 0){
    cout << "Positive";
  }
}

Measured memory_bytes: 3604
#include <stdio.h>


int main(){
	
	int i,count=0;
	char a[11];
	
	
	scanf("%s",&a);
	
	if(a[0]=='A') {
		count=count+1;
		a[0]='a';
	}
	for(i=2;i<=strlen(a)-2;i++){
		if(a[i]=='C') {
			count=count+1;
			a[i]='c';
			break;
		}
	}
	
	for(i=0;i<strlen(a);i++){
		if((a[i] >= 'A') && (a[i]<='Z')) count=0;
	}
	
	if(count==2)printf("AC\n");
	else printf("WA\n");
	
	return 0;
}


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

public class Main {
    public static void main(String[] args) {
        FastReader fs = new FastReader();

        int maxElevation = Integer.MAX_VALUE;
        HashMap<Integer,Node> atcoder = new HashMap<>();
        int obs = fs.nextInt();
        int hills = fs.nextInt();
        for (int i = 1; i <=obs; i++) {
            int elev = fs.nextInt();
            atcoder.put(i,new Node(elev));
            maxElevation = Math.max(maxElevation,elev);
        }
        for (int i = 1; i <=hills; i++) {
            int a = fs.nextInt();
            int b=fs.nextInt();
            //for a
            int aNeiEle = atcoder.get(b).hillElevation;
            Node aNode = atcoder.get(a);
            aNode.addNeighbor(aNeiEle);

            //for b
            int bNeiEle = atcoder.get(a).hillElevation;
            Node bNode = atcoder.get(b);
            bNode.addNeighbor(bNeiEle);
        }
        int counter =0;
        for(int ob:atcoder.keySet()){
            Node obNode = atcoder.get(ob);
            if(obNode.minNeiborElevation==Integer.MIN_VALUE || obNode.hillElevation >obNode.minNeiborElevation ){
                counter++;
            }
        }
        System.out.println(counter);
    }
    static class Node{
        int hillElevation;
        int minNeiborElevation = Integer.MIN_VALUE;
        Node(int hillElevation){
            this.hillElevation =hillElevation;
        }
        public void addNeighbor(int neigborEle){
            this.minNeiborElevation = Math.max(this.minNeiborElevation,neigborEle);
        }
    }

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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


Measured memory_bytes: 60544
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>
#include <assert.h>
#include <cstring>
#include <set>
using namespace std;

typedef long long ll;

int main()
{
    int x;
    cin >> x;
    if(x >= 30)cout << "Yes\n";
    else
    {
        cout << "No\n";
    }
    
}

Measured memory_bytes: 3552
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef queue<P> Q;

#define _CRT_SECURE_NO_WARNINGS

int N = 0;

int main() {
	int a, b;
	scanf("%d%d", &a, &b);
	int ans = 0;
	for (int i = b - a; i >= 1; i--) {
		ans += i;
	}
	printf("%d\n", ans-b);
	return 0;
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
char s[200200], t[200200];
int c;
int main(){
    scanf("%s %s",s,t);
    for(int i=0;s[i];i++) if(s[i] != t[i]) c++;
    printf("%d",c);
}

Measured memory_bytes: 4212
import java.util.*;
import java.awt.geom.*;

public class Main{	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int p = sc.nextInt();
			int n = sc.nextInt();
			if((p|n) == 0) break;
			double sqrtP = Math.sqrt(p);
			
			double nearMax = Integer.MAX_VALUE;
			int maxA = -1, maxB = -1;
			double nearMin = 0.0;
			int minA = -1, minB = -1;
			for(int i = 1; i <= n; i++){
				
				double temp = i * sqrtP;
				double temp2 = Math.ceil(temp);
				double temp1 = Math.floor(temp);
				double temp1i = temp1 / i;  // small
				double temp2i = temp2 / i;  //big
				
				if((int)temp1 <= n  && temp1i > nearMin){
					nearMin = temp1i;
					minA = (int) temp1;
					minB = i;
				}
				
				if((int) temp2 <= n && temp2i < nearMax){
					nearMax = temp2i;
					maxA = (int) temp2;
					maxB = i;
				}
			}
			System.out.println(maxA + "/" + maxB + " " + minA +"/"+minB);
		}
	}
	
	public static void main(String[] args) {
		new Main().doit();
	}
}

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

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



int main(){
  ll x,y;
  cin >> x >> y;

  for(ll i = 0; i <= x; i++){
    if(i*2+(x-i)*4==y){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
} 



Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int main(){
    int a;
    cin >> a ;

    if(a % 10 == 3){
        cout <<"bon\n";
    }else if(a % 10 ==0||a % 10 ==1||a % 10 ==6||a % 10 ==8){
        cout << "pon\n";
    }else{
        cout << "hon\n";
    }
    

}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
 
long long int INF = 2e18;
const ll fact_table = 1200008;
double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←

#define endl "\n"
#ifdef ENJAPMA
    #undef endl
#endif
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
 
const ll mod = 998244353ll;
// const ll mod = 1000000007ll;
  
ll mypow(ll number1,ll number2, ll mod){
    if(number2 == 0){
        return 1ll;
    }else{
        ll number3 = mypow(number1,number2 / 2, mod);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5]; 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/

bool multicase = false;

ll n,m,num,a,b,c,d,e,h,q;
ll w, k;

void solve(){
    cin >> a >> b;
    if(b >= a){
        p("unsafe");
    }else{
        p("safe");
    }
    return;
}


int main(){
    // init();
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if(multicase){
        cin >> q;
    }else{
        q = 1; 
    }
    while(q--){
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    
    // solve();
    return 0;
}
















Measured memory_bytes: 3656
#include <iostream>
#include <cstring>
using namespace std;
int main (){
	int len;
	char str[1002];
	cin.getline(str,1000);
	len=strlen(str);
		for(int i=0;i<len;i++){
			if(str[i]>'C'){
				str[i]=str[i]-3;
			}
			else{
				str[i]=str[i]+23;
			}
		cout<<str[i];
		}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 1120
#include<bits/stdc++.h>
using namespace std;
int main()
{
	
	long long n,m,x,y;
	cin>>n>>m;
	long long a[n+1]={0};
	for(long long i=0;i<m;i++)
	{
		cin>>x>>y;
		a[x-1]++;
		a[y]--;
	}
	long long c=0;
	//cout<<a[0]<<" ";
	for(long long i=1;i<n;i++)
	{
		a[i]=a[i]+a[i-1];
		if(a[i]==m)
		{
			c++;
		}
		//cout<<a[i]<<" ";
	}
	if(a[0]==m)
	{
		c++;
	}
	cout<<c;
	return 0;
}

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

inline char dif(char sp) {
  if (sp == 'S') {
    return 'W';
  } else {
    return 'S';
  }
}

inline char next(char prevsp, char prevsay, char nowsp, char nowsay) {
  char res;
  if (nowsp == 'S') {
    if (nowsay == 'o') {
      res = prevsp;
    } else {
      res = dif(prevsp);
    }
  } else {
    if (nowsay == 'o') {
      res = dif(prevsp);
    } else {
      res = prevsp;
    }
  }
  return res;
}

string process(char ze, char one, string say, int n) {
  string ani(n + 2, '0');
  ani[0] = ze;
  ani[1] = one;
  for (int i = 2; i <= n + 1; i++) {
    ani[i] = next(ani[i - 2], say[i - 2], ani[i - 1], say[i - 1]);
  }
  return ani;
}

bool check(string &result, int n) {
  bool res;
  if (result[0] == result[n] && result[1] == result[n + 1]) {
    res = true;
  } else {
    res = false;
  }
  result.pop_back();
  result.pop_back();
  return res;
}
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  s.push_back(s[0]);
  string result;
  char sp[2] = {'S', 'W'};
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++) {
      result = process(sp[i], sp[j], s, n);
      if (check(result, n)) {
        cout << result << endl;
        return 0;
      }
    }
  cout << -1 << endl;
}


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

using namespace std;

int main(){
  string s;
  getline(cin, s);

  for(int i = 0; i < s.size(); i++){
    if('a' <= s[i] && s[i] <= 'z'){
      s[i] = s[i] - 'a' + 'A';
    }
    else if('A' <= s[i] && s[i] <= 'Z'){
      s[i] = s[i] - 'A' + 'a';
    }
    else{
      continue;
    }
  }

  cout << s << endl;

  return 0;
}



Measured memory_bytes: 3092
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int check = 0;
		for(int i = 0; i <= 50000; i++) {
			if((int)(i * 1.08) == N) {
				
				System.out.println(i);
				break;
			}else {
				check = i;
			}
		}
		if(check == 50000)
		{
			System.out.println(":(");
		}
	}
}


Measured memory_bytes: 21844
// Problem : 
// 			E - Double Factorial
// 			Editorial
// 		
// Contest : AtCoder - AtCoder Beginner Contest 148
// URL : https://atcoder.jp/contests/abc148/tasks/abc148_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

/* DEBUGGING */
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif

/* MACROS */ 
typedef long long int ll;
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

typedef map<int,int> mii;

#define  ff          first
#define  ss          second
#define  pb          push_back
#define  IOS         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  lb          lower_bound
#define  ub          upper_bound
#define  all(x)      (x).begin(), (x).end()
#define  ps(x,y)     fixed<<setprecision(y)<<x
#define  setbit(x)   __builtin_popcountll(x)
#define  rep(i,a,b)  for(int i=a ; i<b ; ++i)
#define  repr(i,a,b) for(int i=a ; i>=b ; --i)

/* CONSTANTS */ 
#define PI 3.141592653589793
const ll MOD = 1e9 + 7;
const ll INF = 1000000000;
const ll MAX_N = 2e5 + 2;

// #define cerr if(false)cerr
/* CODE STARTS HERE */

void solve(){
    ll n; cin >> n;
    
    if(n&1) cout << "0";
    else{
        ll ans = 0 , mul = 10;
        while(1){
            if(mul > n) break;
            ans += (n/mul);
            mul *= 5;
        }
        cout << ans;
    }
}

int main(){
    IOS;
    solve();
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
long long dp[55][2];
int main(){//0偶数 1奇数 
	int n,p,i,j;
	scanf("%d%d",&n,&p);
	dp[0][0]=1;
	long long ans=dp[0][p];
	for (i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		bool flag=x&1;
		for (j=0;j<i;j++)
			dp[i][1]+=dp[j][!flag],dp[i][0]+=dp[j][flag];
		ans+=dp[i][p];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d;
  cin>>a>>b>>c;
  d=a+b+c;
  if(max(a,max(b,c))*2==d){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
/**akshaykumar99**/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
template<typename T> using id_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> ;
template<typename T> using id_setp = tree<pair<T,T>,null_type,less<pair<T,T>>,rb_tree_tag,tree_order_statistics_node_update> ;

#define f(i,x,n) for(i=x;i<n;i++)
#define fr(i,x,n) for(i=x;i>=n;i--)
#define pu push_back           
#define pp pop_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SP(x) fixed<<setprecision(x)
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const long long MOD=1e9+7;
const long double PI = acos(-1);
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N=1e5+1;
 
typedef long long ll;
typedef long double ld;
 
int main()
{
   IOS();
   ll n,m,i,j;
   cin>>n>>m;
   vector<pair<ll,ll>> v(n+1);
   f(i,0,n+1)
   {
      v[i].F=0;v[i].S=0;
   }
   ll c[n+1]={0};
   f(i,0,m)
   {
      string s;
      ll x;
      cin>>x>>s;
      if(v[x].S==0 && s=="WA")
      {
         v[x].F++;
      }
      else if(s=="AC")
      {
         v[x].S=1;
         c[x]=1;
      }
   }
   ll p=0,ca=0;
   f(i,1,n+1)
   {
      if(c[i])
         ca++;
      if(v[i].S==1)
         p+=v[i].F;
   }
   cout<<ca<<' '<<p<<'\n';

   return 0;
}

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

int calc_kaizyou(int N)
{
  int ans = 1;
  for (int i = 1; i <= N; i++) ans *=i;
  return ans;
}

int main ()
{
  char A;
  cin >> A;
  cout << (char)(A+1)<< endl;
  
  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict


def read():
    N = int(input().strip())
    S = input().strip()
    return N, S


def solve(N, S):
    low = 0
    high = (N >> 1) + 1
    while high - low > 1:
        mid = (high + low) >> 1
        is_match = False
        m = N-mid+1
        d = defaultdict(list)
        for i in range(0, m):
            d[S[i:i+mid]].append(i)
        for v in d.values():
            if v[-1] - v[0] >= mid:
                is_match = True
                break
        if is_match:
            low = mid
        else:
            high = mid
    return low


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Measured memory_bytes: 10160
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}

int func(vector<int> a, vector< vector<int> > x){
  int ret = 0;
  for(int i=0; i<4; i++){
    for(int j=0; j<a[i]; j++){
      ret += x[i][j];
    }
  }
  return ret;
}

int main() {
  int n, w;
  cin >> n >> w;
  vector<int> c(n);
  vector<int> v(n);
  vector< vector<int> > d(4);
  int tmp = -1;
  for(int i=0; i<n; i++){
    cin >> c[i] >> v[i];
    if(tmp == -1) tmp = c[i];
    d[c[i]-tmp].push_back(v[i]);
  }
  for(int i=0; i<4; i++){
    sort(d[i].begin(), d[i].end(), greater<int>());
  }
  if(tmp > w){
    cout << 0 << endl;
    return 0;
  }
  int ans = 0;
  for(int i=0; i<=d[0].size(); i++){
    for(int j=0; j<=d[1].size(); j++){
      if(i*tmp+j*(tmp+1) > w) break;
      for(int k=0; k<=d[2].size(); k++){
        if(i*tmp+j*(tmp+1)+k*(tmp+2) > w) break;
        for(int l=0; l<=d[3].size(); l++){
          if(i*tmp+j*(tmp+1)+k*(tmp+2)+l*(tmp+3) > w) break;
          // cerr << i << " " << j << " " << k << " " << l << endl;
          ans = max(ans, func(vector<int>({i,j,k,l}), d));
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include <stdio.h>
#include <bitset>
#include<math.h>
#include<list>
#include<map>
using namespace std;
typedef long long ll;
#define PI 3.14159265358979323846  


int main() {
	int n, m, ans=0;
	cin >> n >> m;
	ans += (n * (n - 1)) / 2;
	ans += (m*(m - 1)) / 2;
	cout << ans << endl;
}

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

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX];

// テーブルを作る前処理
/*
void COMinit() {
    fac[0] = fac[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
    }
}
*/

ll pow_kai(ll a,ll n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a%MOD;
    }
    a = a*a%MOD;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll tmp=1;
    for(ll i=n;i>=n-k+1;i--) tmp = (tmp*i)%MOD;

    return (tmp * pow_kai(fac[k],MOD-2)) % MOD;
}



int main()
{
    ll A,B,K,bit=0;
    cin >> K >> A >> B;

    for(int i=A;i<=B;i++){
        if(i%K==0){
            bit=1;
            break;
        }
    }

    if(bit==0){
        cout << "NG" << endl;
    }else{
        cout << "OK" << endl;
    }

 
    return 0;

}

Measured memory_bytes: 3600
#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    int l, n;
    string s;
    cin >> l >> n >> s;
    ll suc = 0;
    for(int i = 1; i < l; i++)  suc += (s[i-1]==s[i]&&s[i]=='o');
    ll ret = l;
    while(n--){
        ret += 3*suc;
        suc *= 2;
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 3212
def call(n):
    i = 1

    while True:
        x = i
        if x % 3 != 0:
            while True:
                if x % 10 == 3:
                    print(" %d" % i, end='')
                    break
                x //= 10
                if x == 0:
                    break
        else:
            print(" %d" % i, end='')
        i += 1
        if i > n:
            break
    print()


call(int(input()))



Measured memory_bytes: 5872
cards = {
        'S': [0 for _ in range(13)],
        'H': [0 for _ in range(13)],
        'C': [0 for _ in range(13)],
        'D': [0 for _ in range(13)],
}
n = int(input())
for _ in range(n):
    (s, r) = input().split()
    cards[s][int(r) - 1] = 1
 
for s in ('S', 'H', 'C', 'D'):
    for r in range(13):
        if cards[s][r] == 0:
            print(s, r + 1)

Measured memory_bytes: 6720
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));
  $a = explode(" ", trim(fgets(STDIN)));

  $r4 = 0;
  $r2 = 0;
  $r1 = 0;
  for($i=0;$i<$n;$i++){
    if($a[$i] % 4 == 0){
      $r4++;
    }else if($a[$i] % 2 == 0){
      $r2++;
    }else{
      $r1++;
    }
  }

  if($r1 == 0){
    echo "Yes";
    exit;
  }
  if($r2 == 0){
    if($r4+1 >= $r1){
      echo "Yes";
    }else{
      echo "No";
    }      
    exit;
  }
  if($r4 >= $r1){
    echo "Yes";
  }else{
    echo "No";
  }


Measured memory_bytes: 24080
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n; 
  cin >>n;
  int i=1;
  int x=i;
  while(i<=n){
    x=i;
    if(x%3==0){
      cout<<" "<<i;
    }else{
      while(x){
        if(x%10==3){
          cout<<" "<<i;
          break;
        }
        x/=10;
      }
    }
    i++;
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 3100
'use strict'
const main = arg => {
	const input = arg.trim().split("\n");
	let N = input[0].split(' ')[0]
	function fact(n) {
		var result = 1;
		for (var i = 1; i <= n; i++) {
			result = result * i % 1000000007;
		}
		return result;
	}
	console.log(fact(N) % 1000000007)
}   
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

const int N = 2005;
const int mod = 1e9 + 7;

int n, k, a[N];
int bigger[N], bigger_all[N];

void add(int &x, int y) {
    x += y; while(x >= mod) x -= mod;
}

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

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

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j < i; ++j) {
            bigger[i] += a[j] > a[i];
        }
        for (int j = 1; j <= n; ++j) {
            bigger_all[i] += a[j] > a[i];
        }
    }

    int res = 0;
    int x = (1LL * (k - 1) * k / 2) % mod;
    for (int i = 1; i <= n; ++i) {
        add(res, 1LL * bigger[i] * k % mod);
        add(res, 1LL * x * bigger_all[i] % mod); 
    }

    cout << res << endl;
}

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

void solve() {
    int n;
    cin >> n;
    unordered_map<int, int> mp;
    while(n--) {
        int x;
        cin >> x;
        int i = x - 1;
        while(i < x + 2) {
            mp[i]++;
            i++;
        }
    }
    int ans = 0;
    for (auto p : mp) {
        ans = max(ans, p.second);
    }
    cout << ans;

}


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


Measured memory_bytes: 6912
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <random>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<(e); ++x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int nax = 2e5;
int n, k;

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n >> k;
	// n = 2e5, k = 1e5;
	vector<int> a(n);
	rep(i,0,n) {
		cin >> a[i];
	}
	rep(q,0,k) {
		vi cnt(n + 1);
		rep(j,0,n) {
			int st = max(0, j - a[j]);
			int en = min(n, j+a[j]+1);
			++cnt[st];
			--cnt[en];
		}
		int curr = 0;
		int wsk = 0;
		vi b(n);
		rep(j,0,n) {
			curr += cnt[j];
			b[j] = curr;
		}
		a = b;
		bool alln = true;
		rep(i, 0, n) {
			if (a[i] != n) {
				alln = false;
			}
		}
		if (alln) {
			break;
		}
	}
	rep(i,0,n) cout << a[i] << ' ';
	cout << "\n";
}

Measured memory_bytes: 5644
#include<iostream>
using namespace std;
int main()
{
  long long n,a,b,c,res;
  cin >> n;
  a=n/3;
  b=n/5;
  c=n/15;
  res=n*(n+1)/2-a*(a+1)*3/2-b*(b+1)*5/2+c*(c+1)*15/2;
  cout << res << endl;
  return 0;
}

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

int main() {
  long long a,v,b,w,t;
  cin >> a >> v >> b >> w >> t;
  if (a < b){
    if(v * t + a >= w * t + b){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }else{
    if(-v * t + a <= -w * t + b){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
const int N=100010;
typedef long long ll;
int main()
{
  int cnt1=0,cnt2=0;
  string s1="",s2="",s;
  cin>>s;
  int n=s.size();
  for(int i=0;i<n;i++)
  {
    if(i&1) s1+='0',s2+='1';
    else s1+='1',s2+='0';
  }
  for(int i=0;i<n;i++)
  {
    if(s[i]!=s1[i]) cnt1++;
    if(s[i]!=s2[i]) cnt2++;
  }
  cout<<min(cnt1,cnt2)<<endl;
  return 0;
}


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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    int N, K; cin >> N >> K;
    int R, S, P; cin >> R >> S >> P;
    int ans = 0;
    int prev = -1; // 0 -> グー 1 -> チョキ 2 -> パー
    string T; cin >> T;
    for(int i = 0; i < K; i++){
        prev = -1;
        for(int j = i; j < N; j+=K){
            switch(T[j]){
                case 'r':
                    //パーを出したい
                    if(prev == 2) prev = -1;
                    else{
                        ans += P;
                        prev = 2;
                    }
                    break;
                case 's':
                    //グーを出したい
                    if(prev == 0) prev = -1;
                    else{
                        ans += R;
                        prev = 0;
                    }
                    break;
                case 'p':
                    //チョキを出したい
                    if(prev == 1) prev = -1;
                    else{
                        ans += S;
                        prev = 1;
                    }
                    break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
N,T = map(int, input().split())
c = [0]*N
t = [0]*N
cost = 1001
for i in range(N):
    c[i], t[i] = map(int,input().split())
    if t[i]<=T:
        cost  = min(cost,c[i])
if cost == 1001:
    print("TLE")
else:
    print(cost)

Measured memory_bytes: 3316
#include <cassert>
#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>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#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>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i,a,b;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>a>>b;
  ll ans = 0;
  repl(i,1,n+1){
    ll tmp , cnt = 0;
    tmp = i;
    while(tmp){
      cnt += tmp - tmp / 10 * 10;
      tmp /= 10;
    }
    if(a <= cnt && b >= cnt ){
      ans += i;
    }
  }
  cout<<ans<<endl;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq

class unionfind():
    def __init__(self,n):
        self.par = list(range(n))
        self.size = [1]*n
        self.rank = [0]*n

    def root(self,x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def same(self,x,y):
        return self.root(x) == self.root(y)

    def unite(self,x,y):
        x = self.root(x)
        y = self.root(y)
        if x==y:return
        else:
            if self.rank[x] < self.rank[y]:
                 x,y = y,x
            if self.rank[x] == self.rank[y]:
                self.rank[x]+=1
            self.par[y] = x
            self.size[x] +=self.size[y]
    def get_size(self,x):
        x = self.root(x)
        return self.size[x]
n,m = ma()
P = lma()
uf = unionfind(n+1)
for i in range(m):
    x,y = ma()
    uf.unite(x,y)
ans = 0
for i in range(n):
    if uf.same(i+1,P[i]):
        ans+=1
print(ans)


Measured memory_bytes: 20728
H, W = map(int, input().split())
A = []
for i in range(H):
    A.extend(list(input()))
A.sort()
a = [0, 0, 0]
if H % 2 != 0 and W % 2 != 0:
    a[0] = 1
    a[1] = int(H / 2) + int(W / 2)
    a[2] = int((H * W - a[0] - a[1] * 2) / 4)
elif H % 2 != 0:
    a[0] = 0
    a[1] = int(W / 2)
    a[2] = int((H * W - a[0] - a[1] * 2) / 4)
elif W % 2 != 0:
    a[0] = 0
    a[1] = int(H / 2)
    a[2] = int((H * W - a[0] - a[1] * 2) / 4)
else:
    a[0] = 0
    a[1] = 0
    a[2] = int(H * W / 4)
c = 1
cnt = [0, 0, 0]
for i in range(1, H * W):
    if A[i] == A[i - 1]:
        c += 1
    else:
        if c == 1:
            cnt[0] += 1
        elif c == 2:
            cnt[1] += 1
        elif c == 3:
            cnt[0] += 1
            cnt[1] += 1
        elif c == 4:
            cnt[2] += 1
        elif c > 4:
            cnt[2] += int(c / 4)
            c %= 4
            if c == 3:
                cnt[0] += 1
                cnt[1] += 1
            if c == 2:
                cnt[1] += 1
            if c == 1:
                cnt[0] += 1
        c = 1
        
if c == 1:
    cnt[0] += 1
elif c == 2:
    cnt[1] += 1
elif c == 3:
    cnt[0] += 1
    cnt[1] += 1
elif c == 4:
    cnt[2] += 1
elif c > 4:
    cnt[2] += int(c / 4)
    c %= 4
    if c == 3:
        cnt[0] += 1
        cnt[1] += 1
    if c == 2:
        cnt[1] += 1
    if c == 1:
        cnt[0] += 1

ans = 1
#print(a, cnt, ans)
if a[2] > cnt[2]:
    ans = -1
cnt[2] -= a[2]
cnt[1] += cnt[2] * 2
#print(a, cnt, ans)
if a[1] > cnt[1]:
    ans = -1
cnt[1] -= a[1]
cnt[0] += cnt[1] * 2
#print(a, cnt, ans, 2)
if cnt[0] != a[0]:
    ans = -1
if ans == 1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    string A, B, C;
    cin >> A >> B >> C;
    
    string next;
    next.push_back( A[ 0 ] );
    
    int a{}, b{}, c{};
    while( true )
    {
        if( next == "a" )
        {
            if( A.empty() )
            {
                cout << "A" << endl;
                break;
            }
            next = *A.begin();
            A.erase( A.begin() );
            a++;
        }
        if( next == "b" )
        {
            if( B.empty() )
            {
                cout << "B" << endl;
                break;
            }
            next = *B.begin();
            B.erase( B.begin() );
            b++;
        }
        if( next == "c" )
        {
            if( C.empty() )
            {
                cout << "C" << endl;
                break;
            }
            next = *C.begin();
            C.erase( C.begin() );
            c++;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cctype>
using namespace std;
int main(){
    char str;
    while(1){
        if(str == '\n') break;
        scanf("%c",&str);
        if(isalpha(str)){
            if(islower(str)) printf("%c", toupper(str));
            else printf("%c",tolower(str));
        }
        else printf("%c",str);
    }
    return 0;
    
}



Measured memory_bytes: 3112