akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
signed main()
{
    int d, t, s;
    cin >> d >> t >> s;
    yorn(d <= s * t)
    return 0;
}

Measured memory_bytes: 3576
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    //int k=gi();
        String s=gs();
        

	    //System.out.print(nr*2*Math.PI);
	    if (s.equals("ABC")) {
	    	System.out.print("ARC");
	    }else {
	    	System.out.print("ABC");
	    }


	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35312
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

typedef pair<long long,int> P;

int main(){
	int N;
	long long T[1000];
	long long A[1000];

	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%lld %lld",&T[i],&A[i]);
	}

	long long t = T[0];
	long long a = A[0];
	for(int i=1;i<N;i++){
		long long k1 = t / T[i];
		long long k2 = a / A[i];
		if(t%T[i]!=0) k1++;
		if(a%A[i]!=0) k2++;
		long long k = max(k1,k2);
		t = k*T[i];
		a = k*A[i];
	}

	printf("%lld\n",t+a);

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		long N;
		long A;
		long B;
		long X;
		long mod;
		Scanner sc = new Scanner(System.in);
		N = sc.nextLong();
		A = sc.nextLong();
		B = sc.nextLong();
		X = N / (A + B);
		mod = N % (A + B);
		System.out.println(X * A + Math.min(mod, A));
		sc.close();
	}

}

Measured memory_bytes: 22100
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int map[101][101], h, w;
	char c[201];
	scanf("%d %d", &h, &w);
	for (int i = 0; i < h; i++)
	{
		scanf("%s",c);
		for (int j = 0; j < w; j++)
		{
			if (c[j] == 'c')
				map[i][j] = 0;
			else
				map[i][j] = -1;
		}
	}
	
	for (int i = 0; i < h; i++)
	{
		for (int j = 1; j < w; j++)
		{
			if (map[i][j] < 0)
			{
				if (map[i][j - 1] >= 0)
					map[i][j] = map[i][j - 1] + 1;
			}
		}
	}
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			if (j != 0)
				printf(" ");
			printf("%d", map[i][j]);
		}
		printf("\n");
	}
	return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
    int N, M;   cin >> N >> M;
    vector<ll> a(M);    vector<int> b(M);
    vector<vector<int> > c(M);
    for (int i = 0; i < M; i++) {
        cin >> a[i] >> b[i];
        c[i].resize(b[i]);
        for (int j = 0; j < b[i]; j++)
            cin >> c[i][j];
    }
    vector<vector<ll> > dp(1<<N, vector<ll>(M, 1e15));
    for (int i = 1; i < M; i++) 
        dp[0][i] = 0;
    for (int s = 0; s < (1<<N); s++) {
        int t = s;
        for (int i = 0; i < b[0]; i++) {
            if (((s>>(c[0][i]-1)) & 1) == 1)
                t = t ^ (1<<(c[0][i]-1));
        }
        if (t == 0)
            dp[s][0] = a[0];
    }

    for (int s = 1; s < (1<<N); s++) {
        for (int i = 0; i < M-1; i++) {
            int t = s;
            for (int k = 0; k < b[i+1]; k++) {
                if (((s>>(c[i+1][k]-1))&1) == 1)
                    t = t ^ (1<<(c[i+1][k]-1));
            }
            dp[s][i+1] = min(dp[s][i], dp[t][i] + a[i+1]);
        }
    }

    if (dp[(1<<N)-1][M-1] != 1e15)
        cout << dp[(1<<N) - 1][M-1] << endl;
    else 
        cout << -1 << endl;
    return 0;
}

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

int64_t lucas(int64_t n) {
  if(n == 0)
    return 2;
  else if(n==1)
    return 1;
  else
    return lucas(n-1)+lucas(n-2);
}

int main() {
  int64_t n;
  cin >> n;
  if(n==0){
    cout << 2 << endl;
    return 0;
  }else if(n==1){
    cout << 1 << endl;
    return 0;
  }
  int i = 2;
  int64_t num;
  int64_t back2=2, back1=1;
  while(1) {
    num = back2 + back1;
    if (i==n)
      break;
    i++;
    back2 = back1;
    back1 = num;
  }
    
  cout << num << endl;
}

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

int main() {
	// your code goes here
	ll n;
	cin >> n;
	string s;
	cin >> s;
	ll r_so_far[n], g_so_far[n], b_so_far[n];
	memset(r_so_far, 0, sizeof(r_so_far));
	memset(g_so_far, 0, sizeof(g_so_far));
	memset(b_so_far, 0, sizeof(b_so_far));
	ll r = 0, g = 0, b = 0;
	for(int i = 0; i < n; i++){
	    if(s[i] == 'R'){
	        r++;
	        r_so_far[i] = r;
	    }
	    else if(s[i] == 'G'){
	        g++;
	        g_so_far[i] = g;
	    }
	    else if(s[i] == 'B'){
	        b++;
	        b_so_far[i] = b;
	    }
	}
	ll ans = 0;
	for(int i = 0; i < n; i++){
	    for(int j = i + 1; j < n; j++){
	        if(s[i] == s[j]){
	            continue;
	        }
	        if(s[i] == 'R' && s[j] == 'G'){
	            ans += (b_so_far[n - 1] - b_so_far[j]);
	            int diff = j - i;
	            if(j + diff < n && s[j + diff] == 'B'){
	                ans -= 1;
	            }
	        }
	        else if(s[i] == 'R' && s[j] == 'B'){
	            ans += (g_so_far[n - 1] - g_so_far[j]);
	            int diff = j - i;
	            if(j + diff < n && s[j + diff] == 'G'){
	                ans -= 1;
	            }
	        }
	        else if(s[i] == 'G' && s[j] == 'R'){
	            ans += (b_so_far[n - 1] - b_so_far[j]);
	            int diff = j - i;
	            if(j + diff < n && s[j + diff] == 'B'){
	                ans -= 1;
	            }
	        }
	        else if(s[i] == 'G' && s[j] == 'B'){
	            ans += (r_so_far[n - 1] - r_so_far[j]);
	            int diff = j - i;
	            if(j + diff < n && s[j + diff] == 'R'){
	                ans -= 1;
	            }
	        }
	        else if(s[i] == 'B' && s[j] == 'G'){
	            ans += (r_so_far[n - 1] - r_so_far[j]);
	            int diff = j - i;
	            if(j + diff < n && s[j + diff] == 'R'){
	                ans -= 1;
	            }
	        }
	        else if(s[i] == 'B' && s[j] == 'R'){
	            ans += (g_so_far[n - 1] - g_so_far[j]);
	            int diff = j - i;
	            if(j + diff < n && s[j + diff] == 'G'){
	                ans -= 1;
	            }
	        }
	    }
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3704
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	nums := []int{a * c, a * d, b * c, b * d}
	sort.Ints(nums)
	fmt.Println(nums[3])
}


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

bool vis[100010];
int p[100010];

int main()
{
  ios::sync_with_stdio(false);
  int n,m,cnt=0,ans=0;
  cin>>n>>m;
  for(int i=1;i<=m;i++){
    int x;string s;
    cin>>x>>s;
    if(vis[x]) continue;
    if(s=="AC"){
      vis[x]=1;
	  cnt++;
      ans+=p[x];
    }
    else{
      p[x]++;
    }
  }
  cout<<cnt<<" "<<ans<<endl;
  return 0;
}

Measured memory_bytes: 768
import java.util.*;

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

        int n = sc.nextInt();
        String c = sc.next();

        /*
        c = "";
        Random random = new Random();
        for(int i = 0; i < n; i++){
            c += random.nextBoolean() ? "R" :"W";
        }
        
         */

        //StringBuilder sb = new StringBuilder(c);
        //System.out.println(sb);
        int l = 0;
        int r = n - 1;
        long count = 0;
        while(l < r){
            char lc = c.charAt(l);
            char rc = c.charAt(r);
            //System.out.println(""+lc + rc);
            if(lc == 'W'){
                if(rc == 'R'){
                    count++;
                    //sb.replace(l, l + 1, "R");
                    //sb.replace(r, r + 1, "W");
                    l++;
                    r--;
                }else{
                    r--;
                }
            }else{
                if(rc == 'R'){
                    l++;
                }else{
                    l++;
                    r--;
                }
            }
        }

        System.out.println(count);
        //System.out.println(sb);

    }
}


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

#define ll long long
using namespace std;

map<int, int> mp;

int main() {

    int n;
    string ss;
    cin>>ss;

    if(ss[0]=='S') cout<<"Cloudy"<<endl;
    else if(ss[0]=='C') cout<<"Rainy"<<endl;
    else cout<<"Sunny"<<endl;
    return 0;
}

Measured memory_bytes: 256
if __FILE__==$0
	r_i=lambda{|str|str.strip.to_i}
        rl_i=lambda{|str,dl|str.strip.split(dl).map(&:to_i)}
	n=r_i[gets]
	num=rl_i[gets," "].sort.reverse
	oe=0
	s=0
	for i in 0..num.length-1
		if oe==1 && n>0
			s+=num[i]
			n-=1
		end
		oe= oe==0 ? 1 : 0
	end
	p s
end

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

typedef pair<int,int> Node; // v,com
typedef pair<int,Node> P;  // dp[Node],Node
typedef P Edge;           // int,Node

struct pair_hash {
    template <class T1, class T2>
    std::size_t operator () (const std::pair<T1,T2> &p) const {
        auto h1 = std::hash<T1>{}(p.first);
        auto h2 = std::hash<T2>{}(p.second);
        return (h1<<16)^h2;
    }
};

priority_queue<P,vector<P>,greater<P>> qu;
unordered_map<Node,vector<Edge>,pair_hash> g;
unordered_map<Node,int,pair_hash> dp;

int N,M;

void dijkstra(Node start){
    qu.push({dp[start]=0,start});
    while(qu.size()){
        P pr=qu.top(); qu.pop();
        Node v = pr.second;
        if(v==make_pair(N-1,-1))return;
        if(dp[v] < pr.first)continue;

        for(Edge e:g[v]){
            Node to = e.second;
            int cost = e.first;
            if(dp.count(to)==0 || dp[to] > dp[v]+cost){
                dp[to] = dp[v]+cost;
                qu.push({dp[to],to});
            }
        }
    }
}


int main(void){
    cin>>N>>M;
    rep(i,M){
        int p,q,c;
        scanf("%d %d %d",&p,&q,&c);
        p--,q--;
        if(g.count({p,c})==0){
            g[{p,c}].push_back({0,{p,-1}});
            g[{p,-1}].push_back({1,{p,c}});
        }
        if(g.count({q,c})==0){
            g[{q,c}].push_back({0,{q,-1}});
            g[{q,-1}].push_back({1,{q,c}});
        }
        g[{p,c}].push_back({0,{q,c}});
        g[{q,c}].push_back({0,{p,c}});
    }
    dijkstra({0,-1});
    cout<<(dp.count({N-1,-1}) ? dp[{N-1,-1}] : -1)<<endl;
    return 0;
}


Measured memory_bytes: 82292
MOD = 10**9+7
N ,a, b = map(int, input().split())
nCr = 1
A=1
B=1
oa = 1
for r in range(b):
    nCr_1 = nCr * ((N - r) * pow(r + 1,MOD-2,MOD))%MOD
    nCr_1 %= MOD
    nCr = nCr_1
    if r==a-1:
      A = nCr_1
    if r==b-1:
      B = nCr_1
ans = pow(2,N,MOD)-1-A-B
print(ans%MOD)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <string>
#include <bitset>
#include <fstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;

#define INF 1000000007ll
#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define Min(a,b) (((a) < (b))?(a):(b))
#define Max(a,b) (((a) > (b))?(a):(b))
#define Abs(a) (((a) > 0)?(a):(-1)*(a))
#define cil(a,b) ( ((a)%(b) == 0)?((a)/(b)):((a)/(b)+1) )
#define SIZE 0

int main() {
   ll n, p, o = 0, e = 0, ans = 0, pw = 1;
   cin >> n >> p;
   for (int i = 0 ; i < n ; ++i) {
      int j;
      cin >> j;
      if (j % 2) {
         ++o;
      }
      else {
         ++e;
         pw = (pw << 1);
      }
   }
   ll ch = ((p == 0)? 1ll: o), st = p;
   for (ll i = st ; i <= o ; i += 2) {
      ans += ch;
      ch *= (o - i) * (o - i - 1);
      ch /= (i + 1);
      ch /= (i + 2);
   }
   ans *= pw;
   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	tmp, _ := reader.ReadString('\n')
	tmp = strings.Trim(tmp, "\n")

	// case 1
	if !check(tmp) {
		fmt.Println("No")
		return
	}

	// case 2
	pos := (len(tmp) - 1) / 2
	tmp2 := tmp[0:pos]
	if !check(tmp2) {
		fmt.Println("No")
		return
	}

	// case 3
	pos = (len(tmp)+3)/2 - 1
	tmp3 := tmp[pos:len(tmp)]
	if !check(tmp3) {
		fmt.Println("No")
		return
	}

	fmt.Println("Yes")
	return
}

func check(sen string) bool {
	length := len(sen)

	flag := true

	mid := length / 2

	for i := 0; i < mid; i++ {
		if sen[i] != sen[length-i-1] {
			flag = false
			break
		}
	}

	return flag
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#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 vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int 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);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}
template<typename T,typename U>
ll FindErase(T &v,U tar){
  ll cnt = 0;
  for(auto it = v.begin(); it != v.end();){
    if(*it == tar){
      it = v.erase(it);
      ++cnt;
    }
    else{
      ++it;
    }
  }
  return cnt;
}

template<typename T>
bool SuffixErase(T &v,size_t suf){
  if(suf > v.size()) return false;
  for(auto it = v.begin(); it != v.end();){
    if(distance(v.begin(),it) == suf){
      v.erase(it);
      return true;
    }
    else{
      ++it;
    }
  }
  return false;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  char c;
  while(cin >> s >> c && c != 'X'){
    if(c != 'D'){
      rep(i,s.size()){
        if(s[i] == '_'){
          s[i+1] = toupper(s[i+1]);
        }
      }
      if(c == 'U'){
        s[0] = toupper(s[0]);
      }
      else{
        s[0] = tolower(s[0]);
      }
      FindErase(s,'_');
    }
    else{
      string ans ;
      rep(i,s.size()){
        if(isupper(s[i]) && i != 0){
          ans +=  "_";
        }
        ans += tolower(s[i]);
      }
      s = ans;
    }
    cout << s << endl;
  }
  return 0;
}

Measured memory_bytes: 3228
#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>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// 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 <atomic>
#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>
#endif
using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
ll INFL = 1LL << 50;//10^18 = 2^60
int INF = 1 << 30;//10^9
ll MOD  = 1000000007;
vector<int> dy = {0,0,1,-1};
vector<int> dx = {1,-1,0,0};
//vector<int> dy = {1, 1, 1, 0, -1, -1, -1, 0};
//vector<int> dx = {1, 0, -1, -1, -1, 0, 1, 1};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll mypow(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}


ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){
  return x / gcd(x, y) * y % MOD;
}
vector<ll> sum(1000002);


ll N;
ll d[310][310];






int main(){
  cin >> N;
  rep(i, N)rep(j, N) cin >> d[i][j];
  rep(k, N)rep(i, N)rep(j, N){
    if(d[i][j] > d[i][k] + d[k][j]){
      cout << -1 << endl;
      return 0;
    }
  }

  rep(k, N)rep(i, N)rep(j, N){
    if(i == k || j == k) continue;
    if(d[i][j] == d[i][k] + d[k][j]){
      d[i][j] = INF;
    }
  }

  ll ans = 0;
  rep(i, N)rep(j, N){
    if(d[i][j] != INF) ans += d[i][j];
  }
  ans /= 2;
  printf("%lld\n", ans);
}


Measured memory_bytes: 8960
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;

const int CN = 2e5+5;

char ch[CN];
int n;

bool exm(int cl,int cr,int pl,int pr){
    if((pr-pl+1) != (cr-cl+1)) return true;
    for(int i=0;i<(pr-pl+1);i++)
        if(ch[cl+i] != ch[pl+i]) return true;
    return false;
}

int f[CN];
int dfs(int st,int pl,int pr){
    if(st > n) return 0;
    if(f[st]) return f[st];
    if(exm(st,st,pl,pr)) f[st] = max(f[st], dfs(st+1,st,st)+1);
    if(exm(st,st+1,pl,pr) && st+1<=n) f[st] = max(f[st], dfs(st+2,st,st+1)+1);
    return f[st];
}

int main()
{
    //freopen("agc037 A.in","r",stdin);
	
	cin>>ch;
    n = strlen(ch)-1;

    dfs(0,1,0);

    printf("%d",f[0]);

    return 0;
}

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

int main(){
	std::string org_str,str;
	while(std::getline(std::cin,org_str)){
		for(int i=0;i<26;i++){
			str=org_str;
			for(int j=0;j<str.size();j++){
				if(str[j]!=' '&&str[j]!='.'){
					int a=static_cast<int>(str[j]);
					a-=i;
					while(a<(int)'a')a+=26;
					while(a>(int)'z')a-=26;
					str[j]=static_cast<char>(a);
				}
			}
			if(str.find("the")!=-1||str.find("this")!=-1||str.find("that")!=-1)break;
		}
		std::cout<<str<<std::endl;
	}
	return 0;
}

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

#define F first 
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 1010;

int n, m;
int a[N], p[N];

int find(int x)
{
	if (x != p[x]) p[x] = find(p[x]);
	return p[x];
}

int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i ++ )
	{
		scanf("%d", &a[i]);
		p[i] = i;
	}
	
	for (int i = 0; i < m; i ++ )
	{
		int x, y;
		scanf("%d%d", &x, &y);
		
		int pa = find(x), pb = find(y);
		p[pa] = pb;
	}
	
	int res = 0;
	for (int i = 1; i <= n; i ++ )
	{
		int pa = find(a[i]), pb = find(i);
		if (pa == pb) res ++ ;
	}
	printf("%d\n", res);
    return 0;
}

Measured memory_bytes: 4532
while True :
    H,W = map(int,input().split())
    if H == W == 0 : break
    setA = ""
    setB = ""
    for i in range(W) :
        if i % 2 == 0 :
            setA += "#"
            setB += "."
        else :
            setA += "."
            setB += "#"
    for i in range(H) :
        if i % 2 == 0 :
            print(setA)
        else :
            print(setB)
    print()


Measured memory_bytes: 5612
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			scanner.Scan()
			arr[i], _ = strconv.Atoi(scanner.Text())
		}
		cnt := 0
		for i := n-1; i  > 0; i-- {
			for j := 0; j < i; j++ {
				if arr[j] > arr[j+1] {
					// log.Println(arr)
					cnt++
					arr[j], arr[j+1] = arr[j+1], arr[j]
				}
			}
		}
		// log.Println(arr)
		fmt.Println(cnt)
	}
}



Measured memory_bytes: 1084
/*
 * Author : Sadi
 * Tue 14/07/2020
 * 13:48:44.78
 */
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <climits>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

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

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int n;
    cin >> n;
    vector<pair<int, int>> v(n + 1);
    for(int i = 1; i <= n; ++i) {
        int a;
        cin >> a;
        v[i] = make_pair(a, i);
    }
    sort(all(v));
    for(int i = 1; i <= n; ++i) {
        cout << v[i].se << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3988
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<cstdio>
#include<iomanip>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int INF = 1e9 + 7;
ll memo[3001][3001][2];
int a[3000];
//f(a,b,c)で左端がa,右端がbの時のX-Yを返す。c=0の時太郎の番1の時次郎の番
ll f(int l, int r, int state) {
	if (l > r)return 0;
	if (memo[l][r][state] !=0)return memo[l][r][state];
	ll ret = 0;
	if (state == 0) {
		ret = max(f(l + 1, r, 1) + a[l], f(l, r - 1, 1) + a[r]);
	}
	else {
		ret = min(f(l + 1, r, 0) - a[l], f(l, r - 1, 0) - a[r]);
	}
	return  memo[l][r][state] = ret;
}
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	cout << f(0, n - 1, 0) << endl;
	return 0;
}

Measured memory_bytes: 139776
#include<iostream>
#include<algorithm>
#include<queue>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>

using namespace std;
const int maxn = 1e5 + 7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
typedef long long ll;

string s;
int main(){
	cin >> s;
	if(s[2] == s[3] && s[4] == s[5]) puts("Yes");
	else puts("No");
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc127/tasks/abc127_d

#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 INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

int main()
{
  ll N, M, a, b, c, cnt = 0, total = 0;
  map<ll, ll> A;

  cin >> N >> M;
  REP(i, N)
  {
    cin >> a;
    if (A.find(a) != A.end())
      A[a]++;
    else
      A[a] = 1;
  }
  REP(i, M)
  {
    cin >> b >> c;
    if (A.find(c) != A.end())
      A[c] += b;
    else
      A[c] = b;
  }

  for (auto itr = A.rbegin(); itr != A.rend(); ++itr)
  {
    if (N < cnt)
      break;
    else
      total += itr->first * min(itr->second, N - cnt);
    cnt += itr->second;
  }

  cout << total << '\n';

  return 0;
}


Measured memory_bytes: 12800
H,W=map(int,input().split())
C=[list(map(int,input().split())) for _ in range(10)]
A=[list(map(int,input().split())) for _ in range(H)]

#各数字を1に変えるための最小の魔力を求める
#ワーシャルフロイド法
dp=[[1000*10 for _ in range(10)] for __ in range(10)]
for i in range(10):
    for j in range(10):
        dp[i][j]=C[i][j]
for i in range(10): #直前の数字
    for j in range(10): #最初の数字
        for k in range(10): #変化後の数字
            dp[j][k]=min(dp[j][k],dp[j][i]+dp[i][k])
min_mp=[0]*10
for i in range(10):
    min_mp[i]=dp[i][1]

ans=0
for i in range(H):
    for j in range(W):
        a = A[i][j]
        if a!=-1:
            ans+=min_mp[a]
print(ans)

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

int main(void){
  int n,q=0;char a;cin>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    if(a=='Y'){q++;}
  }
  if(q==0){cout<<"Three";}
  else{cout<<"Four";}
  return 0;
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
ans = "Yes"
if len(H) == 1:
    print(ans)
else:
    for i in range(N-1):
        if H[-i-2] - H[-i-1] >= 2:
           ans = "No"
        elif H[-i-2] - H[-i-1] == 1:
            H[-i-2] = H[-i-2] - 1
    print(ans)

Measured memory_bytes: 15020
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <map>

using namespace std;



int main(){

    int n, r;
    cin >> n >> r;

    int ans = 0;
    if(n<10){
        ans = 100*(10-n) + r;
    } else{
        ans = r;
    }

    cout << ans << endl;




    return 0;
}

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

int main() {

    ll n; cin >> n;
    ll ans = 0;
    if (n % 2 != 0) {}
    else {
        n /= 2;
        ll q = 5;
        while (q <= n) {
            ans += n / q;
            q *= 5;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int a,b,c;
int n,ans=0;
int main(){
	cin>>n;
	a=-1,b=-1,c=-1;
	cin>>a>>b;
	for (int i=0;i<n;i++){
		cin>>c;
		if ((a<b && b<c) || (a>b && b>c)) ans++;
		a=b,b=c;
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
      
const int MAXN =1e5+10;
      
char s[MAXN][10+10];
long long int march[5+5];
int main()
{
	int N =0;
	scanf("%d",&N);
	long long int ans =0;
	for(int i=0;i<N;i++)
	{
		scanf("%s",&s[i]);
	}
	for(int i=0;i<N;i++)
	{
		if(s[i][0]=='M')    march[0]++;
		if(s[i][0]=='A')    march[1]++;
		if(s[i][0]=='R')    march[2]++;
		if(s[i][0]=='C')    march[3]++;
		if(s[i][0]=='H')    march[4]++;
	}
	ans=march[0]*march[1]*march[2]+march[0]*march[1]*march[3]+march[0]*march[1]*march[4]+march[0]*march[2]*march[3]+march[0]*march[2]*march[4]+march[0]*march[3]*march[4]+march[1]*march[2]*march[3]+march[1]*march[2]*march[4]+march[1]*march[3]*march[4]+march[2]*march[3]*march[4];
printf("%lld",ans);
	return 0;
	}

Measured memory_bytes: 2176
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long,long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long,long>>;

int main() {
    ll A,B,C,D;
    cin >> A >> B >> C >> D;
    cout << max(A*B,C*D) << endl;
}

Measured memory_bytes: 3568
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<stack>
#include<map>
#include<algorithm>
using namespace std;

int loop(int,int[],int,int);

int main(){
   int n,s;
   int ans;
   int flag[10];
   int kaijyo;
   
   for(;;){
      cin>>n>>s;
      if(n==0&&s==0) break;
      
      memset(flag,0,sizeof(flag));
      ans=0;
      kaijyo=1;
      for(int i=n;i>0;i--) kaijyo*=i;
      
      ans = loop(ans,flag,n,s);
      
      cout<<ans/kaijyo<<endl;
   }
   return 0;
}

int loop(int ans,int flag[],int n, int s){

   if(n==0){
      if(s==0) ans++;
      return ans;
   }
   
   int i;
   for(i=0;i<10;i++){
      if(s-i>=0&&flag[i]!=1){
         flag[i]=1;
         ans = loop(ans,flag,n-1,s-i);
         flag[i]=0;
      }
   }
   return ans;
}

Measured memory_bytes: 868
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=2e5+5;
struct C{
	int k,l,r;
	bool operator <(const C &b)const{return abs(l-r)>abs(b.l-b.r);}
}a[N];
set<int>S,S1;
void work(){
	int n,n1=0;scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d%d%d",&a[i].k,&a[i].l,&a[i].r),n1+=(a[i].l>a[i].r);
	S.clear(),S1.clear();
	for(int i=1;i<=n1;i++)S.insert(i);
	for(int i=n1+1;i<=n;i++)S1.insert(i);
	sort(a,a+n);LL ans=0;
	for(int i=0;i<n;i++){
		if(a[i].l>a[i].r){
			auto x=S.lower_bound(a[i].k+1);
			if(x!=S.begin()){
				x--;S.erase(x);
				ans+=a[i].l;
			}
			else ans+=a[i].r;
		}
		else{
			auto x=S1.upper_bound(a[i].k);
			if(x!=S1.end()){
				S1.erase(x);ans+=a[i].r;
			}
			else ans+=a[i].l;
		}
	}
	printf("%lld\n",ans);
}
int main(){
	int t;scanf("%d",&t);
	while(t--)work();
	return 0;
}

Measured memory_bytes: 15496
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pii pair<ll,ll> 
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);

int main() 
{
    FAST;
    ll n,w;
    cin>>n>>w;
    ll d[n+7][w+7];
    memset(d,0,sizeof(d));
    ll i,j;
    vector<pii> v;
    v.push_back(make_pair(0,0));
    for(i=1;i<=n;i++)
    {
        ll x,y;
        cin>>x>>y;
        pii p=make_pair(x,y);
        v.push_back(p);
    }
    sort(v.begin(),v.end());
    for(i=0;i<=w;i++)
    {
        for(j=1;j<=n;j++)
        {
            if(i>=v[j].first)
            {
               d[j][i]=max(d[j-1][i],d[j-1][i-v[j].first]+v[j].second);
            }
            else
            {
                d[j][i]=d[j-1][i];
            }
        }
    }
    cout<<d[n][w];
}

Measured memory_bytes: 83840
#include <iostream>
#include <set>
#include <string>

using namespace std;

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	string str;
	cin >> str;
	int max = 0;
	for(int i = 1; i < str.size() - 1; i++){
			set<char> left;
			set<char> right;
			for(int j = 0; j < i; j++){
					left.insert(str[j]);
			}
			for(int j = i; j < str.size(); j++){
					right.insert(str[j]);
			}
			int count = 0;
			for(auto itr = left.begin(); itr != left.end(); ++itr){
					if(right.find(*itr) != right.end()){
							count++;
					}
			}
			if(max < count)max = count;

	}
	cout << max << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

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

scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
if(c>=a&&c<=b){
			printf("Yes\n");
			}
else{
	printf("No\n");
	}


	return 0;
	
}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		int n = in.nextInt();
		int sum = -n;
		for(int i=0; i<n; i++) {
			sum += in.nextInt();
		}
		
		
		System.out.println(sum);
		in.close();
	}
}

Measured memory_bytes: 25704
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
string f(long long n){
    if(n < 26) return string(1, 'a'+n);
    return f(n/26-1) + f(n%26);
}
int main(void){
    long long n;
    cin >> n;
    cout << f(n-1) << endl;
}


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

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

  vector<int> P(N);
  for (int i = 0; i < N; i++) {
    cin >> P.at(i);
  }

  int Q1 = 0, Q2 = 0, Q3 = 0;
  for (int i = 0; i < N; i++) {
    if (P.at(i) <= A) Q1++;
    else if (P.at(i) >= (A + 1) && P.at(i) <= B) Q2++;
    else if (P.at(i) >= B + 1) Q3++;
  }

  cout << min(min(Q1, Q2), Q3) << endl;
}


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

using namespace std;
 
#define len(x) (int)((x).size())
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
 
#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else 
    #define dbg(x)
#endif 
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);                                       
    freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(10);
    solve();    
}

const int INF = 1e18, MAXN = 2e5 + 10, MOD = 998244353;

void solve() {
	int n; cin >> n;
	deque<int> q;
	for (int i = 0; i < n; ++i) {
		int num; cin >> num;
		if (i % 2 == 0) {
			q.push_back(num);
		}
		else {
			q.push_front(num);
		}
	}

	if (n % 2 == 0) {
		for (auto it : q) {
			cout << it << " ";
		}
	}
	else {
		reverse(all(q));
		for (auto it : q) {
			cout << it << " ";
		}
	}
}

Measured memory_bytes: 3840
#include<stdio.h>
int main(void)
{
		int a,b,x;
		char op;
		scanf("%d %c %d",&a,&op,&b);
		while(op!='?'){
			if(op=='+'){
				x=a+b;
				printf("%d\n",x);
			}
			else if(op=='-'){
				x=a-b;
				printf("%d\n",x);
			}
			else if(op=='*'){
				x=a*b;
				printf("%d\n",x);
			}
			else{
				x=a/b;
				printf("%d\n",x);
			}
			scanf("%d %c %d",&a,&op,&b);
		}
		return 0;
}

Measured memory_bytes: 1028
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:-x, A))

heapq.heapify(A)

for _ in range(M):
  a = -heapq.heappop(A)
  heapq.heappush(A, -(a//2))

print(-sum(A))

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

const ll MOD = 1000000007;

int main()
{
    int h, w;
    cin >> h >> w;
    char c[1002][1002];
    fill(c[0], c[0] + w + 1, '#');
    for(int i = 1; i <= h; i++){
        c[i][0] = '#';
        for(int j = 1; j <= w; j++){
            cin >> c[i][j];
        }
    }
    ll dp[1002][1002];
    for(int i = 0; i <= h; i++){
        for(int j = 0; j <= w; j++){
            if(i == 1 && j == 1) dp[i][j] = 1;
            else if(c[i][j] == '#') dp[i][j] = 0;
            else dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
        }
    }
    cout << dp[h][w] << endl;
}

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

ll solve() {
    ll X;
    cin >> X;
    while ( true ) {
        bool ng = false;
        for ( ll k = 2; k * k <= X; k++ ) {
            if ( X % k == 0 ) {
                ng = true;
                break;
            }
        }
        if ( !ng ) {
            return X;
        }
        X++;
    }
    return -1;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) long long((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
typedef pair<ll, ll> P;
typedef map<string, ll> M;
typedef unordered_map<ll, ll> HM;
typedef set<ll> S;
typedef multiset<ll> MS;
typedef queue<ll> Q;
ll mod = 1e9 + 7;
map<ll, ll> f;
void fact(ll m)
{
    for (ll i = 2; i * i <= m; i++)
    {
        if (m % i == 0)
        {
            while (m % i == 0)
            {
                f[i]++;
                m /= i;
            }
        }
    }
    if (m != 1)
    {
        f[m]++;
        m = 1;
    }
}

int main(){
    ll n; cin>>n;
    for(ll i=1; i<=n; i++)
        fact(i);
    ll ans = 1;
    for(auto p : f){
        ans *= p.second + 1;
        ans %= mod;
    }
    OUT(ans);
}

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

typedef long long lint;
typedef long double louble;

#define so(a) ((int)((a).size()))

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

const char lf = '\n';

namespace ae86
{
	const int bufl = 1 << 15;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0;int b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 1000007 , mo = 1000000007;

template<typename T1,typename T2> inline T1 ad(T1 &a,T2 b){return a=a+b>=mo?a+b-mo:a+b;}
template<typename T1,typename T2> inline T1 dl(T1 &a,T2 b){return a=a>=b?a-b:a-b+mo;}
template<typename T1,typename T2> inline T1 add(T1 a,T2 b){return a+b>=mo?a+b-mo:a+b;}
template<typename T1,typename T2> inline T1 del(T1 a,T2 b){return a>=b?a-b:a-b+mo;}

int n;
lint f[_]={0};

int main()
{
	ios::sync_with_stdio(0),cout.tie(nullptr);

	n=ty();
	f[n]=n,f[n-1]=1ll*n*n%mo;
	for(int i=n-2,sf=0;i>=1;i--)ad(sf,f[i+3]),f[i]=add(f[i+1],((n-1ll)*(n-1ll)%mo+sf+i+1)%mo);
	cout<<f[1]<<lf;
	
	return 0;
}


Measured memory_bytes: 8064
n=int(input())
now=[1,2,3,4,5,6,7,8,9]
if n<10:
  print(now[n-1])
  exit()
cnt=9
while True:
  next=[]
  for s in now:
    s=str(s)
    if s[-1]!="0":
      cnt+=1
      if cnt<n:
        next.append(s+str(int(s[-1])-1))
      else:
        print(s+str(int(s[-1])-1))
        exit()
    cnt+=1
    if cnt<n:
      next.append(s+s[-1])
    else:
      print(s+s[-1])
      exit()
    if s[-1]!="9":
      cnt+=1
      if cnt<n:
        next.append(s+str(int(s[-1])+1))
      else:
        print(s+str(int(s[-1])+1))
        exit()
  now=next


Measured memory_bytes: 8596
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_C
  * ????????¢?????¢?????¨??¨?????????
  * ?????? a cm ?????? b cm ???????????¢?????¢?????¨??¨?????????????±???????????????°?????????????????????????????????
  */
object Main {
  def main(args: Array[String]): Unit = {
    val seqPair = io.StdIn.readLine().split(" +").map(_.toInt).toSeq
    val (a, b) = seqPair match { case Seq(x, y) => (x, y) }
    val area = a * b
    val length = 2 * a + 2 * b
    println(s"$area $length")
  }
}

Measured memory_bytes: 43884
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pi;
const int MAXN=100005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

bool match(char x, char y){
	return (x=='?'||y=='?'||x==y);
}

int ab[MAXN], bc[MAXN], ac[MAXN];
main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string a,b,c; cin>>a>>b>>c;
	
	//int ans=1e9;
	int A=a.length(), B=b.length(), C=c.length();
	FOR(i,0,A-1) FOR(j,0,B-1) if(!match(a[i],b[j])) ab[i-j+50000]=1;
	FOR(i,0,A-1) FOR(j,0,C-1) if(!match(a[i],c[j])) ac[i-j+50000]=1;
	FOR(i,0,B-1) FOR(j,0,C-1) if(!match(b[i],c[j])) bc[i-j+50000]=1;
	
	int ans = 1e9;
	FOR(i,-4000,4000) FOR(j,-4000,4000) {
		int x=ab[50000+i]+ac[50000+j]+bc[-i+j+50000];
		if(x==0){
			int L = min({0,i,j});
			int R = max({A,B+i,C+j});
			ans = min(ans, R - L);
		}
	}
	cout<<ans;
}


Measured memory_bytes: 384
#A=0
#for i in range(100):
#    A=A^i
#    print(i,bin(A))

#for i in range(100):
#	print(bin(i).zfill(10),i)

#BITごとに考える

A,B=map(int,input().split())

def bit_i(x,i):#xまでにbit i番目が立っているものは何個？

    y=(x+1)//(1<<i)*(1<<(i-1))
    x=x-(x+1)//(1<<i)*(1<<i)+1-(1<<(i-1))
    #print(y,x)
    return y +max(x,0)

ANS=[]

for i in range(1,50):
    ANS.append((bit_i(B,i)-bit_i(A-1,i))%2)

print(int("".join(map(str,ANS[::-1])),2))



Measured memory_bytes: 3060
n, k = gets.split(" ").map { |v|
	v.to_i
}

items  = []
vals = []
n.times do 
	a, b = gets.split(" ").map { |v|
		v.to_i
	}
	items << a
	vals << b
end

ans= 0
30.downto(0) do |i|
	po = 1 << i
	if po & k != 0 then
		k0 = (k - po) | (po - 1)
		
		sum = 0
		for  m in 0 .. n do
			if items[m] | k0 == k0 then
				sum += vals[m]
			end
		end
	ans = [ans, sum].max
	end
end

k0 = k
sum = 0
for  m in 0 .. n do
	if items[m] | k0 == k0 then
		sum += vals[m]
	end
end
ans = [ans, sum].max

puts ans


Measured memory_bytes: 3532
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int R, G, B, N; cin >> R >> G >> B >> N;
  
  int ans = 0;
  rep(r, N+1) rep(g, N+1) {
    if(N-r*R-g*G >= 0 && (N-r*R-g*G)%B == 0) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define WRAP(y,x,h,w) (0<=y && y<h && 0<=x && x<w)

typedef long long ll;
typedef unsigned long long ull;
typedef string str;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {
	int n;
	cin >> n;
	map<int, int> mpii;
	int ans = 0;
	REP(i, n) {
		int a;
		cin >> a;
		if (mpii.find(a) == mpii.end()) {
			mpii[a] = 1;
		}
		else {
			mpii[a]++;
		}
		
	}
	for (auto x : mpii) {
		if (x.first < x.second)
			ans += x.second - x.first;
		else if (x.first > x.second) {
			ans += x.second;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <tuple>

using namespace std;

int main()
{
    int n, k, x, y;
    cin >> n >> k >> x >> y;

    if(n-k >= 0) cout << x*k + y*(n-k) << endl;
    else cout << x*n << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define MOD 1000000007 
#define INF 1000000000000000000
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main()
{
	ll n;
	cin >> n;
	cout << (n * (n - 1)) / 2;
}


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

int main() {

    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);

    int N;
    cin >> N;

    if(N % 2)
        cout << N / 2 << "\n";
    else
        cout << N / 2 - 1 << "\n";

    return 0;
}



Measured memory_bytes: 256
// AtCoder Beginner Contest 122 - Problem A: Double Helix (https://atcoder.jp/contests/abc122/tasks/abc122_a)
#include <bits/stdc++.h>

using namespace std;

map<char, char> ms {
    { 'A', 'T' },
    { 'T', 'A' },
    { 'C', 'G' },
    { 'G', 'C' },
};

int main()
{
    ios::sync_with_stdio(false);

    char c;
    cin >> c;

    cout << ms[c] << '\n';

    return 0;
}


Measured memory_bytes: 256
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split()))
import math;floor,ceil=lambda x:int(math.floor(x)),lambda x:int(math.ceil(x))
from functools import reduce;gcd=lambda*x:reduce(math.gcd,x);lcm=lambda*x:reduce(lambda x,y:(x*y)//gcd(x,y),x,1)
from collections import deque
Yes=lambda b:print("Yes"if b else"No");YES=lambda b:print("YES"if b else"NO")
is_even=lambda x:True if x%2==0 else False

def is_palindrome(s):
  n=len(s);b=True
  for i in range(int(0.5*n)):
    if s[i]!=s[n-i-1]:b=False
  return b

def main():
  x=aint()
  n,i=100,0
  while n<x:
    n=floor(1.01*n)
    i+=1
  print(i)

if __name__ == '__main__':
    main()

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1'000'000'000'000'007ll;
const llong mod = 1e9+7;

int main() {
	llong N;
	vector<llong> A;

	cin >> N;
	A.resize(N);
	for (int i = 0; i < N; ++i)
		cin >> A[i];

	ldbl ans = 0;
	for (int i = 0; i < N; ++i) {
		ans += 1.0/A[i];
	}
	ans = 1.0/ans;

	cout << fixed << setprecision(20) << ans << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
class aizu{
    public static int Main(){
    	int[] n = new int[1000];
    	int m;
    	string str;
    	str = Console.ReadLine();
    	m = int.Parse(str);
    	n[0] = m/3600;
    	n[1] = (m%3600)/60;
    	n[2] = (m%3600)%60;
        Console.WriteLine("{0}:{1}:{2}",n[0],n[1],n[2]);
        return 0;
    }
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n, ans = 0;
  string s;
  cin >> n >> s;
  ll r = 0, g = 0, b = 0;
  rep(i, n) {
    if (s[i] == 'R') {
      r++;
    } else if (s[i] == 'G') {
      g++;
    } else {
      b++;
    }
  }

  if (r == 0 || b == 0 || g == 0) {
    cout << 0 << endl;
    return 0;
  }

  ans = r * g * b;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int k = 2 * j - i;
      if (k >= n || s[k] == s[i] || s[k] == s[j] || s[i] == s[j]) continue;
      ans--;
    }
  }

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


Measured memory_bytes: 3612