akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            char[] inputString = Console.ReadLine().ToArray();
            bool[,] equalCharMatrix = new bool[n, n];
            bool[,] checkedCharMatrix = new bool[n, n];

            int tmpMax = 0;
            for (int i = 0; i < n; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    if (inputString[i] == inputString[j])
                    {
                        for (int k = 1; k < n; k++)
                        {
                            if (i + k == j || j + k == n)
                            {
                                tmpMax = Math.Max(tmpMax, k);
                                break;
                            }
                            if (checkedCharMatrix[i + k,j + k]) { break; }
                            checkedCharMatrix[i + k, j + k] = true;

                            if (inputString[i + k] != inputString[j + k])
                            {
                                tmpMax = Math.Max(tmpMax, k);
                                break;
                            }
                        }
                    }
                }
            }

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

    }
}

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

#define INF (1e9)
#define INF_LL (1e17)

using LL = long long;
using ULL = unsigned long long;

using namespace std;

#define mod 1000000007

#define MAX_N 505

int N;
char Field[MAX_N][MAX_N];

void input()
{
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> Field[i];
  }
}

LL solve()
{
  bool checkFlag = false;
  for (int i = 0; i < N && !checkFlag; i++) {
    for (int j = 0; j < N && !checkFlag; j++) {
      if(Field[i][j] == '#'){
        checkFlag = true;
      }
    }
  }

  if(!checkFlag){
    return -1;
  }

  bool H[MAX_N];
  memset(H, 0, sizeof(H));

  for (int x = 0; x < N; x++) {
    for (int y = 0; y < N; y++) {
      if(Field[y][x] == '#'){
        H[x] = true;
        break;
      }
    }
  }
/*
  for (int y = 0; y < N; y++) {
    for (int ny = 0; ny < N; ny++) {
      if(y == ny){
        continue;
      }
      if(H[ny]){
        W[y] = true;
      }
    }
    cerr << W[y] << endl;
  }
*/
  int ret = 114514;
  for (int y = 0; y < N; y++) {
    int tmp = N;
    bool flag = false;
    for (int x = 0; x < N; x++) {
      if(Field[y][x] == '.'){
        tmp++;
        if(!H[y])
          flag = true;
      }
    }
    tmp += flag;
    //cerr << y << " " << tmp << endl;
    ret = min(tmp, ret);
  }

  for (int x = 0; x < N; x++) {
    int cnt = 0;
    for (int y = 0; y < N; y++) {
      if(Field[y][x] == '#'){
        cnt++;
      }
    }
    if(cnt == N){
      ret--;
    }
  }

  return ret;
}

int main()
{
  input();

  cout << solve() << endl;

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <map>
#include <string>
int main(){
  int n,cnt,a=0;
  std::string s;
  std::cin>>n>>s;
  std::map<char,int>m,t;
  for(char c:s)++m[c];
  for(int i=1;i!=n-1;++i){
    t.clear();
    cnt=0;
    for(int j=i;j!=n;++j)++t[s[j]];
    for(auto&& x:t)(m[x.first]-x.second?++cnt:0);
    a = (cnt>a?cnt:a);
  }
  std::cout<<a<<"\n";
}
  
  

Measured memory_bytes: 256
import math

a, b, h, m = map(int, input().split())

rad1 = (2 * math.pi) * ((h * 60 + m) / 720)
rad2 = (2 * math.pi) * (m / 60)
x = abs(rad2 - rad1)
ans = math.sqrt(a * a + b * b - 2 * a * b * math.cos(x))
print(ans)

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

if n <=111:
    print('111')
elif n<=222:
    print('222')
elif n<=333:
    print('333')
elif n<=444:
    print('444')
elif n<=555:
    print('555')
elif n<=666:
    print('666')
elif n<=777:
    print('777')
elif n<=888:
    print('888')
elif n<=999:
    print('999')

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        //int b = stdIn.nextInt();
        //int num[] = new int[3];
        //String s = stdIn.next();
        //char c[] = s.toCharArray();
        //boolean flag = true;
        
        System.out.println(a * b - a - b + 1);
        
        //System.out.println();
        //System.out.print();
    }
}


Measured memory_bytes: 21716
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	vector<vector<int> > occs(n, vector<int> (26));
	string s;
	for (int i = 0; i < n; ++i) {
		cin >> s;
		for (int j = 0; j < (int) s.size(); ++j) {
			++occs[i][s[j] - 'a'];
		}
	}

	string ans = "";
	for (int i = 0; i < 26; ++i) {
		int curr_min = 1e5;
		for (int j = 0; j < n; ++j) {
			curr_min = min(curr_min, occs[j][i]);
		}

		for (int j = 0; j < curr_min; ++j) {
			ans.push_back(i + 'a');
		}
	}

	sort(ans.begin(), ans.end());
	cout << ans << "\n";

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
using P = pair<int, int>;
constexpr array<int, 4> dx = {1, 0, -1, 0};
constexpr array<int, 4> dy = {0, 1, 0, -1};
constexpr int INF = 1234567890;
constexpr int MOD = 1000000000 + 7;
// constexpr int MOD = 998244353;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int fact(int n) { return n > 1 ? n * fact(n - 1) % MOD : 1; }
int modinv(int a)
{
    int b = MOD, u = 1, v = 0;
    while (b)
    {
        int t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= MOD;
    if (u < 0)
        u += MOD;
    return u;
}
constexpr int modpow(int a, int n)
{
    int rtn = 1;
    while (n > 0)
    {
        if (n & 1)
            rtn = rtn * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return rtn;
}

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

    int a,b,c;
    cin>>a>>b>>c;
    cout << (a + b + c >= 22 ? "bust" : "win") << endl;
}


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

#define MOD 1000000007
#define ll long long int
#define vll vector<ll>

int main() {

    ll N;
    cin >> N;

    string S;
    cin >> S;

    vll B(200005);
    B[0] = 1;
    for (ll i = 1; i < 2*N; i++) {
        if (S[i] == S[i-1]) {
            B[i] = 1 - B[i-1];
        }
        else B[i] = B[i-1];
    }

    ll sum = 0;
    for (ll i = 0; i < 2*N; i++) {
        sum += B[i];
    }

    if (sum != N || S[0] == 'W' || S[2*N-1] == 'W') {
        cout << 0 << endl;
        return 0;
    }

    ll count = 0;
    ll ans = 1;
    for (ll i = 0; i < 2*N; i++) {
        if (B[i] == 0) {
            ans *= count;
            ans %= MOD;
            count--;
        }
        else count++;
    }

    for (ll i = 1; i <= N; i++) {
        ans *= i;
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2180
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    ll temp = a-b;
    if(temp>=c)
    {
        cout<<0<<endl;
    }
    else
        cout<<c-temp<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long long S; cin >> S;
    long long n = 1e9;
    long long a, b, c, d;
    a = (S - 1) / n + 1;
    d = n;
    b = n - ((S - 1) % n + 1);
    c = 1;
    cout << "0 0 " << a << ' ' << b << ' ' << c << ' ' << d;
    return 0;
}


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

int main() {
 int A[3]; rep(i,3) cin>>A[i];
 int K; cin>>K;
 while(A[1]<=A[0]){ K--; A[1]*=2; }
 while(A[2]<=A[1]){ K--; A[2]*=2; }
 if(K<0) cout<<"No";
 else cout<<"Yes";
 cout<<endl;
}



Measured memory_bytes: 3628
#include "bits/stdc++.h"
#define ll unsigned long long
#define inf 1000000007 //10^9+7
#define sort(vec) sort(vec.begin(),vec.end());
#define rever(vec) reverse(vec.begin(),vec.end());
#define unsort(vec) sort(vec); rever(vec);
#define gcd __gcd
using namespace std;

int main() {
  string s;
  cin>>s;
  ll a=s.at(0)-'0';
  ll b=s.at(1)-'0';
  ll c=s.at(2)-'0';
  ll d=s.at(3)-'0';
  ll cnt=a;
  cout<<a;
  for(ll i=0;i<2;i++) {
    for(ll j=0;j<2;j++) {
      for(ll k=0;k<2;k++) {
        if(i) {
          cnt+=b;
        }
        else {
          cnt-=b;
        }
        if(j) {
          cnt+=c;
        }
        else {
          cnt-=c;
        }
        if(k) {
          cnt+=d;
        }
        else {
          cnt-=d;
        }
        if(cnt==7) {
          if(i) {
            cout<<"+"<<b;
          }
          else {
            cout<<"-"<<b;
          }
          if(j) {
            cout<<"+"<<c;
          }
          else {
            cout<<"-"<<c;
          }
          if(k) {
            cout<<"+"<<d;
          }
          else {
            cout<<"-"<<d;
          }
          goto end;
        }
        else {
          cnt=a;
        }
      }
    }
  }
  end:
  cout<<"=7"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int mindiff(vector<int> &a){
    sort(a.begin(), a.end());
    int ans = 100;
    int N = a.size();
    for(int i=0; i<N; ++i){
        int timeDif = min(abs(a[(i+1)%N]-a[i]), 24-abs(a[(i+1)%N]-a[i]));
        chmin(ans, timeDif);
    }
    return ans;
}

int main(){
    int N; cin >> N;
    vector<int> d(N+1, 0);
    map<int, int> mp;
    for(int i=0; i<N; ++i){
        cin >> d[i+1];
        ++mp[d[i+1]];
    }
    ++mp[0];

    if(mp[0] >= 2 || mp[12] >= 2){
        cout << 0 << endl;
        return 0;
    }

    for(int i=1; i<=11; ++i) if(mp[i] >= 3){
        cout << 0 << endl;
        return 0;
    }

    int res = 0;
    bool flg12 = false;
    if(mp[12] == 1) flg12 = true;
    vector<int> ans;
    for(int bit=0; bit<1<<11; ++bit){
        ans.resize(1, 0);
        if(flg12) ans.push_back(12);
        
        for(int i=0; i<11; ++i){
            if(mp[i+1] == 0) continue;
            else if(mp[i+1] == 1 && (bit&1<<i) != 0) ans.push_back(i+1);
            else if(mp[i+1] == 1 && (bit&1<<i) == 0) ans.push_back(24-i-1);
            else if(mp[i+1] == 2) { ans.push_back(i+1); ans.push_back(24-i-1); } 
        }

        chmax(res, mindiff(ans));
    }

    cout << res << endl;
    
}

Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define ch() getchar()
#define pc(x) putchar(x)
template<typename T>inline void read(T&x){
	int f;char c;
	for(f=1,c=ch();c<'0'||c>'9';c=ch())if(c=='-')f=-f;
	for(x=0;c<='9'&&c>='0';c=ch())x=x*10+(c&15);x*=f;
}
template<typename T>inline void write(T x){
	static char q[64];int cnt=0;
	if(!x)pc('0');if(x<0)pc('-'),x=-x;
	while(x)q[cnt++]=x%10+'0',x/=10;
	while(cnt--)pc(q[cnt]);
}
int main(){
	int k;read(k);
	while(k--)pc('A'),pc('C'),pc('L');
	pc('\n');
	return 0;
}


Measured memory_bytes: 3592
import java.io.*;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
	static ArrayList<Integer> list = new ArrayList<Integer>();
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		makePrimeList();
		while(true) {
			int a = stdIn.nextInt();
			if(a == 0) break;
			int c2 = 0;
			int c5 = 0;
			for(int i = a; i >= 1; i--) {
				int[] ret = f(i);
				c2 += ret[0];
				c5 += ret[2];
			}
			int count = Math.min(c2, c5);
			
			System.out.println(count);
		}
	}
	public static void makePrimeList() {
		boolean[] isntPrime = new boolean[20001];
		isntPrime[0] = isntPrime[1] = true;
		list.add(2);
		for(int i = 3; i < 20001; i+= 2) {
			if(!isntPrime[i]) {
				list.add(i);
				for(int j = i + i; j < 20001; j+= i) {
					isntPrime[j] = true;
				}
			}
		}
	}
	public static int[] f(int a) {
		int[] ret = new int[list.size()];
		while(a > 1) {
			for(int i = 0; i < list.size(); i++) {
				if(a % list.get(i) == 0) {
					a /= list.get(i);
					ret[i]++;
				}
				
			}
			
		}
		return ret;
	}
	
	
}

Measured memory_bytes: 151044
# C - Lower
N = int(input())
H = list(map(int, input().split()))
max = 0
count_i = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        count_i += 1
    else:
        if max > count_i:
            count_i = 0
        else:
            max = count_i
            count_i = 0

    if max > count_i:
        pass
    else:
        max = count_i
print(max)

Measured memory_bytes: 14252
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

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

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

N, K = list(map(int, sys.stdin.buffer.readline().split()))
X = list(map(int, sys.stdin.buffer.readline().split()))

li = 0
ri = K - 1
ans = INF
while ri < N:
    l = X[li]
    r = X[ri]
    if r <= 0:
        a = abs(l)
        ans = min(a, ans)
    elif l >= 0:
        a = abs(r)
        ans = min(a, ans)
    else:
        a = max(abs(l), abs(r)) + min(abs(l), abs(r)) * 2
        ans = min(a, ans)
    li += 1
    ri += 1
print(ans)


Measured memory_bytes: 22520
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    string s;
    cin >> s;
    string tmp_s;
    for ( int i = s.length() -1 ; i >= 0; --i ) {
        tmp_s = s[i] + tmp_s;
        if ( tmp_s.length() < 5 ) continue;
        if ( tmp_s.substr(tmp_s.length()-5, 5) == "dream" || tmp_s.substr(tmp_s.length()-5, 5) == "erase" ) {
            tmp_s = tmp_s.substr(0, tmp_s.length()-5);
        }
        if ( tmp_s.length() < 6 ) continue;
        else if ( tmp_s.substr(tmp_s.length()-6, 6) == "eraser" ) {
            tmp_s = tmp_s.substr(0, tmp_s.length() - 6);
        }
        if ( tmp_s.length() < 7 ) continue;
        else if ( tmp_s.substr(tmp_s.length()-7, 7) == "dreamer" ) {
            tmp_s = tmp_s.substr(0, tmp_s.length() - 7);
        }
    }
    if ( tmp_s == "" ) cout << "YES" << endl;
    else               cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 512
<?php

$line = trim(fgets(STDIN));
$line = explode(' ', $line);

if ($line[0] > $line[1]) {
  print("a > b\n");
} elseif ($line[0] < $line[1]) {
  print("a < b\n");
} else {
  print("a == b\n");                                                                                                                                                                                                                          
}

Measured memory_bytes: 15348
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
using ll = long long;
using P = pair<int, int>;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; ++i){
    cin >> a[i];
  }

  ll tmp_sum = 0;
  ll cnt = 0;
  int r = 0;
  for(int l = 0; l < n; ++l){
    while(r < n && (tmp_sum + a[r]) == (tmp_sum ^ a[r])){
      tmp_sum += a[r];
      ++r;
    }

    cnt += r - l;

    if(l == r)++r;
    else tmp_sum -= a[l];
  }

  cout << cnt << endl;

  return 0;
}


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

int main() {
    ll n; cin >> n;
    queue<ll> q;
    rep(i, n)  {
        ll a; cin >> a;
        q.push(a);
    }

    ll cnt = 1;
    ll ans = 0;
    while(!q.empty()){
        ll tmp = q.front();
        q.pop();
        if(tmp == cnt){
            cnt++;
        }
        else ans++;
    }

    if(cnt==1) cout << -1 << endl;
    else cout << ans << endl;

}


Measured memory_bytes: 1920
#include <iostream>

using namespace std;

int co[100000];
int sum_u, sum_d;
long long ch_u, ch_d;
int n;
//uは奇数で負dは奇数で正
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> n;
	for (int i = 0; i < n; i++) { cin >> co[i]; }

	if (co[0] > 0) {
		sum_u = -1;
		ch_u = co[0] + 1;
		sum_d = co[0];
		ch_d = 0;
	}
	else if (co[0] < 0) {
		sum_u = co[0];
		ch_u = 0;
		sum_d = 1;
		ch_d = 1-co[0];
	}
	else {
		sum_u = -1;
		ch_u = 1;
		sum_d = 1;
		ch_d = 1;
	}

	for (int i = 1; i < n; i++) {
		
		sum_d += co[i];
		sum_u += co[i];
		if (i % 2 == 0 && sum_u >= 0) {
			ch_u += sum_u + 1;
			sum_u = -1;
		}
		else if (i % 2 == 1 && sum_u <= 0) {
			ch_u += 1-sum_u;
			sum_u = 1;
		}

		if (i % 2 == 0 && sum_d <= 0) {
			ch_d += 1 - sum_d;
			sum_d = 1;
		}
		else if (i % 2 == 1 && sum_d >= 0) {
			ch_d += sum_d + 1;
			sum_d = -1;
		}
	}

	if (ch_d >= ch_u)	cout << ch_u << "\n";
	else
	{
		cout << ch_d << "\n";
	}

	return 0;
}

Measured memory_bytes: 640
input = gets.chomp.split("\s")
h, w = input[0].to_i, input[1].to_i

until (h == 0) && (w == 0)
	for i in 1..h
	output = ['#'] * w
	puts output.join
	end
puts ""
input = gets.chomp.split("\s")
h, w = input[0].to_i, input[1].to_i
end

Measured memory_bytes: 6472
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end(),greater<int>())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000000000000003 //1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

  ll K;
  cin>>K;

  cout<< 50<<"\n";

  rep(i,50){
    cout<< 49 + (K/50)*51 + ((K%50)>i)*51 - K<<" ";
  }
  cout<<"\n";
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(0);
  Main();
}
//-----------------------------------


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

#define WALL '#'
#define EMPTY '.'

enum{NORTH, EAST, SOUTH, WEST};
char ItoC[4] = {'N', 'E', 'S', 'W'};
map<char,int> CtoI;

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

struct Robot{
  int y,x,dir;

  Robot(int i=0, int j=0, int d=0){y=i; x=j; dir=d;}

  void move(){
    y += dy[dir];
    x += dx[dir];
  }
  void turn(){
    dir = (dir+1)%4;
  }

  bool operator< (Robot r) const{return y!=r.y?y<r.y:(x!=r.x?x<r.x:dir<r.dir);}
};

int main(){
  CtoI['N'] = 0;
  CtoI['E'] = 1;
  CtoI['S'] = 2;
  CtoI['W'] = 3;
  long long int H, W, L;
  while(cin>>H>>W>>L, H|W|L){
    vector< vector<char> > c(H+2, vector<char>(W+2, WALL));
    Robot me;
    long long int step = 0;
    map<Robot,int> visited;
    for(int i=1; i<=H; i++){
      for(int j=1; j<=W; j++){
        cin>>c[i][j];
        if(c[i][j]!=WALL && c[i][j]!=EMPTY){
          me = Robot(i, j, CtoI[c[i][j]]);
          c[i][j] = EMPTY;
        }
      }
    }

    while(L>step){
      while(c[me.y+dy[me.dir]][me.x+dx[me.dir]]==WALL){me.turn();}
      me.move();
      step++;
      if(visited.count(me)){
        long long int dif = step-visited[me];
        step = L - (L-step)%dif;
      }else{
        visited[me] = step;
      }
    }

    cout<<me.y<<" "<<me.x<<" "<<ItoC[me.dir]<<endl;
  }
}

Measured memory_bytes: 1556
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
#define mi 600851475143

int main()
{FAST
ll k;
cin>>k;
string s;
cin>>s;

	  if(k>=s.length())
	  cout<<s<<"\n";
	  else
	 {rep(i,0,k)
	  cout<<s[i];	 
	  cout<<"..."<<"\n";
	   } 
	  
	
	
	
}


Measured memory_bytes: 3656
#include <iostream>
using namespace std;
typedef long long ll;
ll n, a[110000], b[110000], res;
int main(void){
    // Your code here!
    cin >> n;
    for (ll i = 0; i < n; i++) cin >> a[i] >> b[i];
    for (ll i = n - 1; i >= 0; i--) {
        a[i] += res;
        res += (a[i] % b[i] ? b[i] - a[i] % b[i] : 0);
    }
    cout << res << endl;
}


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

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

  bool ok = false;
  for (int i = 0; i <= n; i+=4)
  {
    for (int j = 0; i+j <= n; j+=7)
    {
      if(i+j==n) ok = true;
    }
  }

  if(ok) puts("Yes");
  else puts("No");
}

Measured memory_bytes: 256
from sys import stdin

n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

alphas = [chr(x) for x in range(65, 65 + 26)]

new = str()

for i in range(len(s)):
    aI = alphas.index(s[i])
    if aI + n >= 26:
        b = aI + n - 26
        new += alphas[b]
    else:
        new += alphas[aI + n]

print(new)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1e+9
#define MOD 1000000007
using namespace std;


int main(){
	int N;
  cin >> N;
  string s;
  cin >> s;
  int r=0,b=0;
  for(int i=0; i<N; i++){
    if(s[i]=='R'){
      r++;
    }else{
      b++;
    }
    
 
  }
  
  if(r>b){
    cout<<"Yes"<<endl;
  }else{
cout<<"No"<<endl;
  }
  
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n; cin>>n;
    int dif = 0;
    for(int i=0; i<n; i++){
        int p; cin>>p;
        dif += (p != i + 1);
    }

    if(dif < 3){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

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

int main()
{
    long long n,k,i,j,flag1,flag2,flag3;
    cin>>n>>k;
    long a[n+1],b[n+1],c[n+1];
    flag1=0;
    flag2=0;
    for ( i = 1; i <= n; i++) cin>>a[i];
    b[0]=1;
    b[1]=a[1];
    for ( i = 2; i <= n; i++) b[i]=a[b[i-1]];
    if (k>n)
    {
        c[1]=1;
        for ( i = 1; i <= n; i++)
        {
            if (c[b[i]]==1)
            {
                for ( j = 0; j < i; j++)
                {
                    if (b[j]==b[i])
                    {
                        flag1=j;
                        flag2=i-j;
                        break;
                    }
                }
                break;
            }
            else c[b[i]]=1;
        }
        flag3=(k-flag1)%flag2+flag1;
        cout<<b[flag3]<<endl;
    }
    else cout<<b[k]<<endl;
}

Measured memory_bytes: 8284
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <string.h>
#include <math.h>
typedef long long ll;
#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define MIN(x, y)	(((x) < (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define REP(i,x,y)	for (int (i)=(x);(i)<(y);(i)++)
#define REP_(i,x,y)	for ((i)=(x);(i)<(y);(i)++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

using namespace std;
typedef pair<int, int> Point;
typedef vector<vector<Point>> Graph;

#define P 100
#define Q (P/2)

int N,S,A[100002];


int main() {
	
	cin >> N;
	
	REP(i,0,N) cin >> A[i+1],S+=ABS(A[i+1] - A[i]);
	S+=ABS(A[N+1] - A[N]);
	
	REP(i,1,N+1) cout << S-( ABS(A[i-1]-A[i]) + ABS(A[i]-A[i+1]) - ABS(A[i-1]-A[i+1]) ) << endl;

	return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define lowbit(x) ((x)&(-(x)))
using namespace std;

int n;

int main()
{
	cin >> n;
	if(lowbit(n) == n){
		puts("No");
		return 0;
	}
	puts("Yes");
	for(int i = 2; i < n; i += 2){
		printf("1 %d\n", i), printf("%d %d\n", i, i+1);
		printf("1 %d\n", i+n+1), printf("%d %d\n", i+n+1, i+n);
	}
	printf("3 %d\n", n+1);
	if(n&1) return 0;
	int p = lowbit(n);
	printf("%d %d\n", p+n+1, n);
	printf("%d %d\n", n^p, n+n);
	
	return 0;
}

Measured memory_bytes: 2304
let cnt = ref 0

let merge a l m r =
  let ai = Array.make (m - l + 1) max_int in
  for i = 0 to m - l - 1 do
    ai.(i) <- a.(l + i)
  done;
  let aj = Array.make (r - m + 1) max_int in
  for i = 0 to r - m - 1 do
    aj.(i) <- a.(m + i)
  done;
  let i = ref 0 in
  let j = ref 0 in
  for k = l to r - 1 do
    incr cnt;
    if ai.(!i) <= aj.(!j) then begin
      a.(k) <- ai.(!i);
      incr i;
    end else begin
      a.(k) <- aj.(!j);
      incr j;
    end
  done

let rec merge_sort a l r =
  if (l + 1) >= r then () else
  let m = (l + r) / 2 in
  merge_sort a l m;
  merge_sort a m r;
  merge a l m r

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun i -> i)) in
  merge_sort a 0 n;
  print_int a.(0);
  for i = 1 to n - 1 do
    print_string " ";
    print_int a.(i);
  done;
  print_newline ();
  print_int !cnt;
  print_newline ()

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

#define rep(i,n) for(int i = 0;i < n;++i)
#define rep2(i,n,m) for(int i = n;i < m;++i)
#define all(v) v.begin(),v.end()

using namespace std;
using ll = long long;


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


    int n,m;
    double a;
    int b,c=0,sum=0;
    cin >> n >> m;
    vector<int> vec(n);
    rep(i,n){
        cin >> vec.at(i);
        sum += vec.at(i);
    }
    a = 1.0*sum/(4*m);
    rep(i,n){
        if(vec.at(i) >= a){
            c++;
        }
    }
    if(c >= m){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#define int long long
using namespace std;

signed main() {
	int a, b;
	while (cin >> a >> b, a | b) {
		for (int c = 0; c < a; c++) {
			for (int d = 0; d < b; d++) {
				if ((c+d)&1)cout << ".";
				else cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}
}

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

int main(){
  int n,z,x; 
  cin >> n ;
  vector<int> a(n);
  vector<int> sum(n);
  z=0;
for(int i=0;i<n;i++){
  cin>>a.at(i);
}
  for(int i=0;i<n;i++){
    if(a.at(i)%2==0){if(a.at(i)%3==0 || a.at(i)%5==0){}
                     else{z+=1;}}}
     if(z>0){cout<<"DENIED"<<endl;}
  
  else{cout<<"APPROVED"<<endl;}    
          }



Measured memory_bytes: 256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (_, K) = read!(usize, usize);
    let S = rl().chars().collect::<Vec<_>>();

    let mut max_sum = 0;

    // 注目する区間の左端
    let mut l = 0;

    // 注目する区間の右端
    let mut r = 0;

    // 注目している区間に含まれる、0 が連続する部分の個数
    // 例えば 010001 なら zero_count = 2
    let mut zero_count = 0;

    while l < S.len() {
        while r < S.len() {
            // 次に c が連続する区間を最長区間に取り込む。
            let c = S[r];

            // 次が 0 からなる区間なら反転操作の回数が増える。
            if c == '0' {
                if zero_count < K {
                    zero_count += 1;
                } else {
                    // 操作回数が上限に達しているので、区間をこれ以上伸ばすことはできない。
                    break;
                }
            }

            while r < S.len() && S[r] == c {
                r += 1;
            }
        }

        max_sum = max(max_sum, r - l);

        // 注目している区間の左端にある、0 または 1 が連続している部分を捨てる。
        let c = S[l];
        if c == '0' {
            zero_count -= 1;
        }
        while l < S.len() && S[l] == c {
            l += 1;
        }
    }

    println!("{}", max_sum)
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
typedef std::pair<ll, ll>P;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const ll mod = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 8000000000000000000LL;
bool fl = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
std::string abc = "abcdefghijklmnopqrstuvwxyz";
struct edge { ll to, cost; };
struct edge1 { ll from, to, cost; };
double pai = 3.141592653589793;
std::vector<edge>v[100000];

int main() {
	ll n, m;
	std::cin >> n >> m;
	if (n == 1 && m == 1)std::cout << 1 << std::endl;
	else if (n == 1 || m == 1)std::cout << std::max(n, m) - 2 << std::endl;
	else std::cout << (n - 2)*(m - 2) << std::endl;
}

Measured memory_bytes: 2560
def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

            else:

                flg = 0
    finally:

        return array_result

arr_data = getinputdata()

s = arr_data[0][0]

kposi = s.find("K")
iposi = s.find("I")
hposi = s.find("H")
bposi = s.find("B")
rposi = s.find("R")


if len(s) >= 10:
    
    print("NO")
    
elif not((kposi == 0 or kposi == 1)  and 
#        kposi < iposi and 
#        iposi < hposi and 
#        hposi < bposi and 
#        bposi < rposi and 
        kposi == iposi-1 and 
        iposi == hposi-1 and 
        (hposi == bposi-1 or hposi == bposi-2) and 
        (bposi == rposi-1 or bposi == rposi-2) and 
        (s[-2::] == "RA" or s[-2::]=="BR" or s[-2::]=="AR")):

    print("NO")
    
elif not(s.count("K") == 1 and s.count("I") == 1 and s.count("H") == 1 and s.count("B") == 1 and s.count("R") == 1 and (s.count("A") == 0 or s.count("A") == 1 or s.count("A") == 2 or s.count("A") == 3 or s.count("A") == 4)):
    
    print("NO")
    
    
else:
    
    print("YES")



Measured memory_bytes: 3064
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ;; ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( $ t : ty ;; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ;; ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let (n, i) = get!(usize, usize);
    println!("{}", (n + 1) - i);
}


Measured memory_bytes: 8572
m, d = list(map(int, input().split()))
ans = 0
for mm in range(1, m+1):
  for dd in range(1, d+1):
    d1 = dd%10
    d2 = dd//10
    if d1>=2 and d2>=2 and d1*d2==mm:
      ans += 1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
inline long long read();
using namespace std;
int p,w,g,y;
int main()
{
	int n=read();
	for(int i=1;i<=n;i++)
	{
		char c;cin>>c;
		if(c=='P')p=1;
		else if(c=='W')w=1;
		else if(c=='G')g=1;
		else if(c=='Y')y=1;
	}
	int ans=p+w+g+y;
	if(ans==3)cout<<"Three";
	else cout<<"Four";
cout<<endl;
}
inline long long read()
{
    register long long x=0,k=1;
    char c;
    c=getchar();
    while(c<'0'||c>'9'){if(c=='-')k=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
    return x*k;
}


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

int main(int argc, char const *argv[]) {
  ll N; cin >> N;
  vector<ll> a1(N); REP(i,N) cin >> a1[i];
  vector<ll> a2(N); REP(i,N) cin >> a2[i];
  vector<ll> s1(N);
  vector<ll> s2(N);
  s1[0] = a1[0];
  FOR(i,1,N) s1[i] = s1[i-1]+a1[i];
  s2[N-1] = a2[N-1];
  DOWN(i,N-2,0) s2[i] = s2[i+1]+a2[i];
  ll ans = 0;
  REP(i,N) ans = max(ans, (s1[i]+s2[i]));
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include <algorithm> 
using namespace std;

# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define p(s) std::cout << s << endl;

int main()
{
    int x;cin >> x;
    int ret=1;
    for(int b=2;b*b<=x;b++){
        int tmp=b;
        while(tmp<=x){
            ret=max(tmp,ret);
            tmp*=b;
        }
    }
    p(ret)
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5,mod=998244353;
int n,hs[N],nex[N],t[N<<2];
ll f[N],g[N];
struct node
{
    int l,r;
    bool operator<(const node&o)const{return l<o.l;}
}a[N];
void fix(int l,int r,int k,int x,int v)
{
    if(l==r)
    {
        t[k]=max(t[k],v);return;
    }
    int m=l+r>>1;
    if(x<=m) fix(l,m,k<<1,x,v);
    else fix(m+1,r,k<<1|1,x,v);
    t[k]=max(t[k<<1],t[k<<1|1]);
}
int query(int l,int r,int k,int x,int y)
{
    if(r<x||l>y) return 0;
    if(l>=x&&r<=y) return t[k];
    int m=l+r>>1;
    return max(query(l,m,k<<1,x,y),query(m+1,r,k<<1|1,x,y));
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int x,y;scanf("%d%d",&x,&y);
        y=x+y-1;
        a[i]={x,y};
        hs[i]=x;
    }
    sort(a+1,a+1+n);
    sort(hs+1,hs+1+n);
    nex[n]=n+1;
    fix(1,n,1,n,nex[n]);
    for(int i=n-1;i>=1;i--)
    {
        int l=lower_bound(hs+1,hs+1+n,a[i].l)-hs,r=upper_bound(hs+1,hs+1+n,a[i].r)-hs-1;
        nex[i]=max(r+1,query(1,n,1,l,r));
        fix(1,n,1,i,nex[i]);
    }
    f[1]=1;
    for(int i=1;i<=n;i++)
    {
        f[i+1]=(f[i+1]+f[i])%mod;
        g[i+1]=(g[i+1]+g[i]+f[i])%mod;
        f[nex[i]]=(f[nex[i]]+f[i])%mod;
        g[nex[i]]=(g[nex[i]]+g[i])%mod;
    }
    printf("%lld\n",f[n+1]);
}


Measured memory_bytes: 9600
(* O(b log b) *)
Scanf.scanf "%d %d" @@ fun a b ->
  let ans = ref 0 in
  for n = a to b do
    let s = string_of_int n in
    if s.[0] = s.[4] && s.[1] = s.[3] then incr ans
  done;
  Printf.printf "%d\n" !ans

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

int main()
{
	int abc[3];
	cin >> abc[0] >> abc[1] >> abc[2];
	sort(abc, abc + 3);
	if ((abc[0] == abc[1] && abc[2] != abc[1]) || (abc[2] == abc[1] && abc[0] != abc[1])) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
#define int ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef RUS_HOME
    freopen("input", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}


void smain() {
    int n,k;
    cin>>n>>k;
    cout<<n-k+1;
    


}

Measured memory_bytes: 3624
a, b, c, x, y = map(int, input().split())
yasui = a*x +b*y
for i in range(2*10**5):
    cost = 2*c*i + max(x-i, 0)*a + max(y-i,0)*b
    if cost<yasui:
        yasui = cost
print(yasui)

Measured memory_bytes: 3060
N = list(input())
if N[0] == 'R' and N[1] == 'R' and N[2] == 'R':
    print(3)
elif N[0] == 'R' and N[1] == 'R' and N[2] == 'S':
    print(2)
elif N[0] == 'S' and N[1] == 'R' and N[2] == 'R':
    print(2)
elif N[0] == 'R' and N[1] == 'S' and N[2] == 'R':
    print(1)
elif N[0] == 'R' or N[1] == 'R' or N[2] == 'R':
    print(1)
else:
    print(0)


Measured memory_bytes: 61692
////////////////////////
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
namespace my {
char itoc(int i) { return i + '0'; }
int ctoi(char c) { return c - '0'; }
ll gcd(ll a, ll b) {
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
ll lcm(ll a, ll b) { return a * b / my::gcd(a, b); }
}  // namespace my
////////////////////////

int main() {
  ll n;
  cin >> n;
  vector<ll> a;

  for (int i = 0; i < n; i++) {
    ll tmp;
    cin >> tmp;
    if (tmp == 0) {
      cout << 0 << endl;
      return 0;
    }
    a.push_back(tmp);
  }

  ll ans = 1;
  for (int i = 0; i < n; i++) {
    if (a.at(i) == 0) {
      ans = 0;
      break;
    } else if ((ld)1e18 / a.at(i) < (ld)ans) {
      ans = -1;
      break;
    }
    ans *= a.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 4320