akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int r = sc.nextInt();
		int D = sc.nextInt();
		int x = sc.nextInt();

		for(int i = 0; i < 10; i++) {
			x = r*x - D;
			System.out.println(x);
		}
	}
}

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


Measured memory_bytes: 23124
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    // 入力
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();

    // 準備
    // A~Zを配列(c_ans)に設定
    char[] c_ans = new char[26];
    for(int i=0; i<26; ++i)
      c_ans[i] = (char)('A'+i);

    // 解く
    // c_ans[]に A~Zを0~25 に変換したものを設定し出力する方針
    char[] c = new char[s.length()];
    for(int i=0; i<s.length(); ++i) {

      // 入力sを一文字ずつ「0~25」の値に変換
      c[i] = s.charAt(i);
      int c_num = c[i] - 'A' + n;
      if(c_num > 25) c_num = c_num-26; // 26以上になったらマイナス26。26番目=0番目, 27番目=1番目...

      // 出力
      System.out.print(c_ans[c_num]);
    }
  }
}
// b問題だから弱いと思ったけど、強かった。

Measured memory_bytes: 25428
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).ok();
    let n = buf.trim().parse::<u64>().unwrap();
    let mut res = n as usize;
    for i in 1..n {
        if i*i > n { break; }
        if n%i != 0 { continue; }
        res = std::cmp::min(res, std::cmp::max(i.to_string().len(), (n/i).to_string().len()));
    }
    println!("{}", res);
}


Measured memory_bytes: 4352
N,T = map(int,input().split())
Sum = []
lis = list(map(int,input().split()))
for i in range(N-1):
  Sum.append(lis[i+1]-lis[i])
for k in range(len(Sum)):
  if Sum[k] > T:
    Sum[k] = T
print(sum(Sum)+T)

Measured memory_bytes: 26708
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c) { return b / c - (a - 1) / c; }

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
string op(string x) {
    if (x == "Sunny") {
        return ("Cloudy");
    }
    if (x == "Cloudy") {
        return ("Rainy");
    }
    if (x == "Rainy") {
        return ("Sunny");
    }
    return 0;
}

int main() {
    long long a, b, c, ra, rb, rc, g;
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if ((i + 1) % 2 == 0 && s[i] == 'R') {
            cout << "No" << endl;
            return 0;
        } else if ((i + 1) % 2 == 1 && s[i] == 'L') {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>

using namespace std;
using lli = long long int;
// #define DEBUG
#ifdef DEBUG
#define debug(var) cout << (#var) << ": " << (var) << endl;
template<class T> void dump_array_impl(const T& a) {
  bool first = true;
  for (auto&& x : a) {
    if (!first) cout << ", "; else first = false; cout << x;
  }
}
#define debug_array(a) cout<<(#a)<<": ";dump_array_impl(a);cout<<endl
#else
#define debug(var) {}
#define debug_array(a) {}
#endif
template<class T> void read_n(vector<T>& v, size_t n) {
  v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i];
}
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli h, w, d, q;
vector<pair<lli, lli>> pos;
vector<lli> sum;
int main() {
  cin >> h >> w >> d;
  pos = decltype(pos)(h*w+1);
  for (lli j=1; j<=h; ++j) {
    for (lli i=1; i<=w; ++i) {
      lli a; cin >> a;
      pos[a] = { i, j };
    }
  }
  sum = decltype(sum)(h*w+1);
  for (lli i=1; i<=d; i++) {
    sum[i] = 0;
    for (lli j=i+d, pj=i; j<=h*w; pj=j, j+=d) {
      sum[j] = sum[pj] 
	+ abs(pos[pj].first - pos[j].first)
	+ abs(pos[pj].second - pos[j].second);
    }
  }
  cin >> q;
  vector<pair<lli, lli>> qs(q);
  for (lli i=0; i<q; ++i) cin >> qs[i].first >> qs[i].second;
  for (lli i=0; i<q; ++i) {
    lli f = qs[i].first, t = qs[i].second;
    cout << (sum[t] - sum[f]) << '\n';
  }
  return 0;
}


Measured memory_bytes: 4988
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int k, n;
  cin >> k >> n;
  
  vector<int> A(n);
  for(int i=0; i<n; i++){
    cin >> A[i];
  }
  
  vector<int> d(n);
  d[0]=max(A[1]-A[0], A[2]-A[1]);
  
  for(int j=1; j<n-2; j++){
    d[j]=max(d[j-1], A[j+2]-A[j+1]);
  }
  
  d[n-2]=max(d[n-3], k-A[n-1]+A[0]);
  
  cout << k-d[n-2] << endl;
  
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define all(a) (a).begin(),(a).end()

int main() {
  int n,a;
  int count=0;
  cin >> n;
  rep(i,n){
    cin >> a;
    if(a!=(i+1))count++;
  }
  if(count==0 || count==2){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


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

int main() {
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;

    int a = x - r;//>0
    int b = W - x;//>r
    int c = y - r;//>0
    int d = H - y;//>r

    if(a>=0 && b>=r && c>=0 && d>=r) cout <<"Yes" << endl;
    else cout << "No" << endl;
}


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

int main(void){
    int S;
    int h;
    int m;
    int s;
   cin >> S;
   h=S/3600;
   cout <<h;
   cout <<":";
   m=(S%3600)/60;
   cout <<m;
   cout <<":";
   s=(S%3600)%60;
   cout <<s;
   cout <<endl;
}


Measured memory_bytes: 3108
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main() {
  string s;
  cin >> s;

  if (s[1] == 'B') {
    cout << "ARC" << endl;
  } else {
    cout << "ABC" << endl;
  }
  return 0;
}

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

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

using namespace std;

int main(){
	string s,t; cin>>s>>t;

	int a;
	sscanf((s+t).c_str(),"%d",&a);
	rep(i,1000) if(i*i==a) { cout<<"Yes"<<endl; return 0; }
	cout<<"No"<<endl;

	return 0;
}


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

int main(){
	string step;
	int i;
	cin >> step;
	size_t size_pre = step.length();
	int size = (int)(size_pre);
	for(i = 0; i < size; i++){
		if(i%2 == 0){
			if(step[i] == 'L'){
				break;
			}
		}
		else if(i%2 == 1){
			if(step[i] == 'R'){
				break;
			}
		}
	}

	if(i == size){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cctype>
using namespace std;
 
int main(void)
{
    string str;
    while( getline(cin, str) )
    {
        int i;
        int s = str.size();
        const string::size_type N = string::npos;
        while( str.find("the")==N && str.find("this")==N && str.find("that")==N )
        {
            for(i = 0; i < s; i++)
            {
                if(isalpha(str[i]))
                {
                    str[i] = (str[i]-'a'+1)%26+'a';
                }
            }
        }
        cout << str << endl;
    }
    return 0;
}

Measured memory_bytes: 1180
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int n,k,a,b;
  cin >> n >> k;

  a = n % k == 0 ? 0 : 1;

  cout << a ;



  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

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

    int a = 0;
    int b = 0;
    a = S / 100;
    b = S % 100;
    if(a == 0 && b == 0){
        cout << "NA" << endl;
    }else if(a == 0 || b == 0){
        if(a == 0){
            if(b <= 12){
                cout << "YYMM" << endl;
            }else{
                cout << "NA" << endl;
            }
        }else{
            if(a <= 12){
                cout << "MMYY" << endl;
            }else{
                cout << "NA" << endl;
            }
        }
    }else if(a <= 12 && b <= 12){
        cout << "AMBIGUOUS" << endl;
    }else if(a <= 12){
        cout << "MMYY" << endl;
    }else if(b <= 12){
        cout << "YYMM" << endl;
    }else{
        cout << "NA" << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
int gcd(int a,int b){
	return a%b?gcd(b,a%b):b;
}
int arr[100001];
int rdp[100001], ldp[100001];
int N;
int cnt;
int main(){
	scanf("%d",&N);
	for(int i=0;i<N;i++) scanf("%d",arr+i);
	rdp[0]=arr[0];
	ldp[N-1]=arr[N-1];
	for(int i=1;i<N;i++){
		rdp[i]=gcd(rdp[i-1],arr[i]);
		ldp[N-1-i]=gcd(ldp[N-i],arr[N-1-i]);
	}
	int Max=max(ldp[1],rdp[N-2]);
	for(int i=1;i<N-1;i++) Max=max(Max,gcd(rdp[i-1],ldp[i+1]));
	printf("%d",Max);
	
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using VI = vector<int>;
using VB = vector<bool>;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n, k;
  cin >> n >> k;
  vector<ll> h(n);
  rep(i, n) cin >> h[i];

  sort(all(h));


  ll cnt = 0;

  rep(i, n-k){
    cnt += h[i];
  }

  cout << cnt << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int INF=1e9;
const int MOD=1e9+7;
const double pi=acos(-1);

int main(){
  string s;
  cin >> s;
  cout<<s.substr(0,4) << " " <<s.substr(4) << endl;

}


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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define sz(v) v.size()
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define sqr(x) x*x
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ten(n) (int)1e##n
#define tenll(n) (lli)1e##n
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

///priority_queue< int, vector< int >, greater< int > > minHeap;

void mor(){cout<<"NO"; exit(0);}


int main()
{
    ///freopen("output.txt","w",stdout);
    ///freopen("input.txt","r",stdin);

    ///FastIO;
    int n,q;
    scn2(n,q);

    string s;
    cin>>s;
    s = "$"+s;

    vector<int>dp(n+3,0);

    for(int i=2; i<s.size(); i++){
        if(s[i]=='C'&& s[i-1]=='A') dp[i] = 1;
    }
    for(int i=1; i<s.size(); i++) dp[i] += dp[i-1];

    while(q--){
        int l,r;
        scn2(l,r);
        printf("%d\n",dp[r]-dp[l]);
    }


    return 0;
    ///return main();
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)


Measured memory_bytes: 1404
# -*- coding: utf-8 -*-

def check(T, i, j):
    tmp=[]
    for t in range(i,j):
        tmp.append(T[t])
    print(tmp)

N,C,K =map(int, input().split())
tmp = []
for i in range(N):
    tmp.append(int(input()))

T = sorted(tmp)

ans = i = 0
while i < N:
    start = T[i]
    num = 0
    for j in range(i+1, N):
        num += 1
        if T[j] - start > K or num == C:
            #check(T, i, j)
            i = j
            ans += 1
            break
    else:
        ans += 1
        break

print(ans)

Measured memory_bytes: 14076
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  string S,T;
  cin>>S;
  cin>>T;
  int ans=-1;
  for(int i=S.size()-T.size();i>=0;i--){
    string U=S.substr(i,T.size());
    bool flag=1;
    REP(j,T.size()){
      if(U[j]!=T[j] and U[j]!='?')flag=0;
    }
    if(flag){
      ans=i;
      break;
    }
  }
  if(ans<0){
    cout<<"UNRESTORABLE"<<endl;
    return 0;
  }
  REP(i,ans){
    if(S[i]=='?')cout<<'a';
    else cout<<S[i];
  }
  cout<<T;
  FOR(i,(ans+T.size()),S.size()){
    if(S[i]=='?')cout<<'a';
    else cout<<S[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#include<set>
#include <numeric>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define DIVCEIL(a,b) ((a+b-1)/b)
//int CHMAX

int intpow(int a, int n) {
	// a^nのint ver
	rep(i, n - 1)
		a *= a;
	return a;
}
int MODPOW(int a, int n, int mod) {
	// a^n mod
	int ans = 1;
	while (n > 0) {
		if (n & 1)
			ans = ans * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return ans;
}
int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int MODFACT(int a, int mod) {
	if (a == 0)
		return 1;
	else
		return (a * FACT(a - 1)) % mod;
}
int nPr(int n, int r) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++)
		sum *= i;
	return sum;
}
int MODnPr(int n, int r, int mod) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++) {
		sum *= i;
		sum = sum % MOD;
	}
	return sum;
}
//int nCr(int n, int r)
int nCr2(int n, int r) {
	return FACT(n) / (FACT(r) * FACT(n - r));
}
int GCD(int a, int b)
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b)
{
	return  a * b / GCD(a, b);
}
int NUMOFDIV(int n) {
	//約数の数（だっけ？）
	int ans = 0;
	REP(i, n) {
		if (n % i == 0)
			ans++;
	}
	return ans;
}
int CEIL1(int n) {
	//1桁目切り上げ
	return (n + 9) / 10 * 10;
}
int GetDigit(int n) {
	return log10(n) + 1;
}
int DIGIT(int n, int k) {
	//nのk桁目
	rep(i, k - 1)
		n /= 10;
	return n % 10;
}
int DIGITSUM(int n) {
	int sum = 0, dig;
	while (n) {
		dig = n % 10;
		sum += dig;
		n /= 10;
	}
	return sum;
}
int DIVTIME(int n, int k) {
	//nをkで何回割れるか的な
	int div = 0;
	while (n % k == 0) {
		div++;
		n /= k;
	}
	return div;
}
int binary(int n) {
	//10進数→2進数
	int ans = 0;
	for (int i = 0; n > 0; i++) {
		ans += n % 2 * intpow(10, i);
		n /= 2;
	}
	return ans;
}
int intabs(int n) {
	if (n < 0)
		return -1 * n;
	else
		return n;
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
double DISTANCE(int x1, int y1, int x2, int y2) {
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool between(int x, int min, int max) {
	if (min < x && x < max)
		return true;
	else
		return false;
}
inline bool PRIMEOR(int x) {
	if (x == 1)
		return false;
	if (x == 2)
		return true;
	if (x % 2 == 0)
		return false;
	double sqrtx = sqrt(x);
	for (int i = 3; i <= sqrtx; i += 2) {
		if (x % i == 0)
			return false;
	}
	return true;
}
bool SQRTOR(int n) {
	if (sqrt(n) == (int)sqrt(n))
		return true;
	else
		return false;
}
// 順位付け
using namespace std;
#pragma endregion

signed main() {
	int N;
	cin >> N;
	int cou = N;
	while (!SQRTOR(cou))
		cou--;
	cout << cou;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int m, k;
	cin >> m >> k;
	if (m == 1) {
		if (k == 0)
			cout << "0 0 1 1\n";
		else
			cout << "-1\n";
		return 0;
	}
	int bound = pow(2, m) - 1;
	if (k > bound)
		cout << "-1\n";
	else {
		for (int i = 0; i <= bound; ++i)
			if (i != k)
				cout << i << ' ';
		cout << k << ' ';
		for (int i = bound; i >= 0; --i)
			if (i != k)
				cout << i << ' ';
		cout << k << ' ';
		cout << '\n';
	}
	return 0;
}

Measured memory_bytes: 1792
'use strict'
function main(input) {
  const list = input.split("\n")
    .slice(1)
    .map(s => Array.from(s).sort().join(''))

  let totalCount = 0
  const map = new Map()
  for (let i = 0; i < list.length; i++) {
    if (!map.has(list[i])) {
      map.set(list[i], 1)
      continue;
    }
    totalCount += map.get(list[i])
    map.set(list[i], map.get(list[i]) + 1)
  }

  console.log(totalCount)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 55716
n,m = map(int,input().split())
lst = list(map(int,input().split()))
lst.sort()
dst = []
for i in range(1,m):
    dst.append(lst[i] - lst[i-1])
dst.sort()
if n >= m:
    print(0)
elif n==1:
    print(sum(dst))
else:
    print(sum(dst[:-n+1]))

Measured memory_bytes: 13968
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

double dp[2][3000];
ll n;
int main(){
	scanf("%lld",&n);
	dp[0][0]=1;
	rep(i,0,n){
		double p;
		scanf("%lf",&p);
		dp[(i%2)^1][0]=dp[i%2][0]*(1-p);
		rep(j,1,3000)dp[(i%2)^1][j]=dp[i%2][j-1]*p+dp[i%2][j]*(1-p);
	}
	double ans=0;
	rep(j,n/2+1,n+1)ans+=dp[n%2][j];
	printf("%.15f\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int k;
	string s;
	cin >> k >> s;
	if (s.size() <= k) {
		cout << s << endl;
	} else {
		for (int i = 0; i < k; i++) {
			cout << s.at(i);
		}
		cout << "..." << endl;
	}
}

Measured memory_bytes: 3604
#include<iostream>
using namespace std;
int main()
{
	int n,i,a[105],sum=0,x,sum1;
	long long ans=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];sum+=a[i];
	}
	sum1=sum%n;
	x=sum/n;
	if(sum1*2>n) x=x+1;
	for(i=1;i<=n;i++)
	ans+=(a[i]-x)*(a[i]-x);
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

const int N = 105;
const int V = 100005;

int n; int W;
long long dp[V];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  for(int i = 1; i < V; ++i) {
    dp[i] = 1e9 + 7;
  }
  cin >> n >> W;
  while(n--) {
    int w, v; cin >> w >> v;
    for(int i = V - 1; i >= v; --i) {
      dp[i] = min(dp[i], dp[i - v] + w);
    }
  }
  int ans = 0;
  for(int i = 0; i < V; ++i) {
    if(dp[i] <= W)
      ans = max(ans, i);
  }
  cout << ans << '\n';
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-10;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
typedef int Weight;
struct Edge
{
    int from, to; Weight cost;
    bool operator < (const Edge& e) const { return cost < e.cost; }
    bool operator >(const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;
void add_edge(Graph &g, int from, int to, int cost)
{
    g[from].push_back(Edge{ from, to, cost });
}
 
/*--------------------template--------------------*/
int n, m;
vector<pii> v;
int dp[1111][1111], mx[1111][1111];
 
void dijkstra(Graph &g, vector<Weight> &d, int s)
{
    d.assign(g.size(), INF);
    d[s] = 0;
    typedef pair<Weight, int> P;
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0, s));
    while (!que.empty())
    {
        Weight dist = que.top().first;
        int v = que.top().second;
        que.pop();
        if (d[v] < dist) continue;
        REP(i, g[v].size())
        {
            Edge e = g[v][i];
            if (d[e.to] > d[v] + e.cost)
            {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}
 
 
int main()
{
    cin >> n >> m;
    REP(i, m)
    {
        int c, d; cin >> c >> d;
        v.emplace_back(c, d);
    }
    sort(ALL(v));
    REP(i, m) mx[i][i] = v[i].second;
    REP(i, m)FOR(j, i + 1, m) mx[i][j] = max(mx[i][j - 1], v[j].second);
    Graph g(m+1);
    REP(i, m)FOR(j, i, m)
    {
        add_edge(g, i, j + 1, mx[i][j] - v[i].first);
    }
    vector<Weight> dist;
    dijkstra(g, dist, 0);
    cout << n + 1 + dist[m] * 2 << endl;
    return 0;
}

Measured memory_bytes: 7268
def biscuit(a,b,t):
    n = int(t/a) * b

    print("%d" %n)

if __name__ == '__main__':
    string = input().split()
    a = int(string[0])
    b = int(string[1])
    t = int(string[2])

    biscuit(a,b,t)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		int n = sc.nextInt();
		int x[] = new int[n];
		int y[] = new int[n];
		for(int i=0;i<n;i++){
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		int answer = 0;
		for(int i=1;i<n;i++){
			if(x[i-1]<=x[i] && y[i-1]<= y[i]){
				answer += Math.max(x[i]-x[i-1],y[i]-y[i-1]);
			} else if(x[i-1]>=x[i] && y[i-1]>=y[i]){
				answer += Math.max(x[i-1]-x[i], y[i-1]-y[i]);
			} else {
				answer += Math.abs(x[i-1]-x[i]) + Math.abs(y[i-1]-y[i]);
			}
		}
		System.out.println(answer);
	}

}

Measured memory_bytes: 32676
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, int> pii;

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define repm(i, a, b) for(int i = (a); i >= (b); i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える

int main(){
    int n;
    cin >> n;
    
    set<string> S;

    rep(i, n){
        string s;
        cin >> s;

        S.insert(s);
    }

    int cnt = S.size();

    cout << cnt << endl;
}

Measured memory_bytes: 19116
#include <iostream>
using namespace std;
int k, a, b;

void solve() {
    int largest = (b / k) * k;
    if (a <= largest) {
        cout << "OK";
    } else {
        cout << "NG";
    }
}

int main() {
    cin >> k >> a >> b;
    solve();
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	int x, y;
	cin >> x >> y;
	if (x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12) {
		if (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12) {
			cout << "Yes" << endl;
		}
		else cout << "No" << endl;
	}
	else if (x == 4 || x == 6 || x == 9 || x == 11) {
		if (y == 4 || y == 6 || y == 9 || y == 11) {
			cout << "Yes" << endl;
		}
		else cout << "No" << endl;
	}
	else if (x == 2 && y == 2)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>

using namespace std;

int main(){
  const int n = getInt();

  int ans = 1;
  int prev = -1;
  int sign = 0;

  REP(i,n){
    const int cur = getInt();

    if(prev != -1) {
      const int nextSign = prev == cur ? 0 : prev < cur ? 1 : -1;
      if(sign == 0) {
        sign = nextSign;
      } else {
        if(nextSign != 0 && sign != nextSign) {
          sign = 0;
          ans++;
        }
      }
    }

    prev = cur;
  }

  printf("%d\n", ans);

  return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		PrimeNumberGenerator pg = new PrimeNumberGenerator();

		while(true){
			String[] tmpArray = br.readLine().split(" ");

			int m = Integer.parseInt(tmpArray[0]);
			int a = Integer.parseInt(tmpArray[1]);
			int b = Integer.parseInt(tmpArray[2]);

			if(m == 0){
				break;
			}

			int maxArea = 0;
			int maxI = 0, maxJ = 0;
			//ちゃんと途中でやめないとオーバーフローが発生する
			for(int i = 2; i <= Math.sqrt(m); i++){
				if(!pg.isPrime(i)){
					continue;
				}
				for(int j = i; i*j <= m; j++){
					if(!pg.isPrime(j)){
						continue;
					}

					//分数よりも掛け算の比較の方が多分誤差が少ない
					if(a*j <= b*i && i*j > maxArea){
						maxI = i;
						maxJ = j;
						maxArea = i*j;
					}
				}
			}

			System.out.println(maxI+" "+maxJ);
		}
	}

}

class PrimeNumberGenerator {
    private boolean[] isPrime= new boolean[100001];

    public PrimeNumberGenerator() {
        Arrays.fill(isPrime, true);

        isPrime[0] = false;
        isPrime[1] = false;
        isPrime[2] = true;

        int limit = (int)Math.sqrt(isPrime.length);
        for(int i = 3; i <= limit; i+=2){
            if(isPrime[i] == false){
                continue;
            }

            for(int j = i * 2; j <= isPrime.length - 1; j += i){
                isPrime[j] = false;
            }
        }
    }

    public boolean isPrime(int index){
        if(index % 2 == 0 && index != 2){
            return false;
        }
        return isPrime[index];
    }
}



Measured memory_bytes: 27952
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(){
    ll n,ans=0;
    cin >> n;
    vector<ll>  h(n),H(n);
    for(ll i=0;i<n;i++) cin >> h[i];
    for(ll i=0;i<n;i++){
        while(h[i]!=H[i]){
            ans++;
            for(ll j=i;j<n;j++){
                if(h[j]!=H[j])  H[j]++;
                else    break;
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
while True:
    R, N = map(int, input().split())
    if not (R | N):
        break
    geta = 20
    buildings = [0] * (geta * 2)
    for _ in range(N):
        xl, xr, h = map(int, input().split())
        for i in range(xl + geta, xr + geta):
            buildings[i] = max(buildings[i], h)

    sun = [0] * (geta * 2)
    for i in range(-R + geta, R + geta):
        if i < geta:
            buildings[i] -= pow(R * R - (i - geta + 1) * (i - geta + 1), 0.5) - R
        else:
            buildings[i] -= pow(R * R - (i - geta) * (i - geta), 0.5) - R


    left, right = 0, 20
    while right - left > 1e-4:
        mid = (left + right) / 2
        flag = True
        for i in range(-R + geta, R + geta):
            if i < geta:
                flag &= buildings[i] >= mid
            else:
                y = pow(R * R - (i - geta) * (i - geta), 0.5)
                flag &= buildings[i] >= mid
        if flag:
            left = mid
        else:
            right = mid
    print("{:.20f}".format(left))

Measured memory_bytes: 7684
s = int(input())
MOD = 10**9 + 7
b3 = 1; b2 = 0; now = 0 # now == b1
for n in range(3, s+1):
    b1 = now
    now = (b1 + b3) % MOD
    b3, b2 = b2, b1
print(now)


Measured memory_bytes: 8924
#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 <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

ll fact[200010];

ll comb(int n, int r) {
    if(n < r) return 0;
    ll ret = fact[n];
    ret = mdiv(ret, fact[n-r]);
    ret = mdiv(ret, fact[r]);
    return ret;
}

signed main() {
    fact[0] = 1;
    rep(i,1,200010) fact[i] = mmul(fact[i-1], i);

    int h, w, a, b; cin >> h >> w >> a >> b;
    ll ans = 0;
    repq(i,1,w-b) {
        int va = comb(h-a+b+i-2, b+i-1);
        int vb = comb(w-b-i+1+a-2, a-1);
        ans = madd(ans, mmul(va, vb));
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  string input;
  cin >> input;

  int a[4];
  for(int i=0;i<4;++i){
    a[i] = (int)(input[i] - '0');
  }
  
  for(int x=0;x<8;x++){
    int sum = a[0];
    string s;
    s += (char)('0'+a[0]); 

    for(int i=0;i<3;i++){
      if(x&(1<<i)){
        sum += a[i+1];
        s += '+';
        s += (char)('0'+a[i+1]); 
      }
      else{
        sum -= a[i+1];
        s += '-';
        s += (char)('0'+a[i+1]);
      }
    }

    if(sum == 7){
      s += '=';
      s += (char)('0'+7);
      cout << s << endl;
      break;
    }

    //cout << sum << endl;

    //cout << s << endl;

  }

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().compute();
    }

    void compute() {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] perm = new int[w];
        for (int i = 0; i < w; i++) {
            perm[i] = i;
        }
        for (int i = 0; i < n; i++) {
            String[] swap = sc.next().split(",", 0);
            int tmp = perm[Integer.parseInt(swap[0]) - 1];
            perm[Integer.parseInt(swap[0]) - 1] = perm[Integer.parseInt(swap[1]) - 1];
            perm[Integer.parseInt(swap[1]) - 1] = tmp;
        }
        for (int i = 0; i < w; i++) {
            System.out.println(perm[i] + 1);
        }

    }
}


Measured memory_bytes: 26224
using System;
namespace atcoder {
	class MainClass {
		public static void Main(){
			int N, K;
			var input1 = Console.ReadLine().Split(' ');
			N = int.Parse(input1[0]);
			K = int.Parse(input1[1]);
			int[] A = new int[N];
			int[] C = new int[N];
			var input2 = Console.ReadLine().Split(' ');
			for (int i=0;i<N;i++){
				A[i] = int.Parse(input2[i]);
			}
			Array.Sort(A);
			int tmp = A[0];
			int c_index = 0;
			C[c_index] = 1;
			int ctmpmax = 1;
			int dif_count = 1;
			for (int i=1;i<N;i++){
				if (A[i]>tmp){
					dif_count++;
					if (ctmpmax<C[c_index]){
						ctmpmax = C[c_index];
					}
					tmp = A[i];
					C[++c_index] = 1;
				}
				else{
					C[c_index]++;
				}
			}
			int cc_index = c_index + 1;
			int[] CC=new int[cc_index];
			for (int i=0;i<cc_index;i++){
				CC[i] = C[i];
			}
			Array.Sort(CC);
			if (ctmpmax<C[c_index]){
				ctmpmax = C[c_index];
			}
			int rtn;
			if (dif_count<=K){
				rtn = 0;
			}
			else {
				rtn = 0;
				int end = dif_count - K;
				for (int j=0;j<end;j++){
					rtn += CC[j];
				}
			}
			Console.WriteLine(rtn);
        }
	}
}


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

int main()
{
	int a = 0, b = 0, c = 1, n = 0;

	cin >> a >> b >> c;

	for (int i = a; i <= b; i++) {
		if (c % i == 0)
			n++;
	}

	cout << n << endl;

    return 0;
}

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

int main() {
    int n, x = 1000000, y = 0;
    std::cin >> n;
    std::vector<int> a(n);
    std::map<int, int> cs;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        cs[a[i]]++;
        x = std::min(x, a[i]);
        y = std::max(y, a[i]);
    }

    bool ret;
    if (x == y) {
        ret = x == n - 1 || n / x > 1;
    } else if (y - x == 1) {
        ret = y > cs[x] && 2 * (n - y) >= cs[y];
    } else {
        ret = false;
    }

    std::cout << (ret ? "Yes" : "No") << std::endl;

    return 0;
}

Measured memory_bytes: 5376
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;

string debug_show(P a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

ll powMod(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % mod;
		x = x * x % mod;
		n >>= 1;
	}
	return res;
}

int popcnt(int n) {
	int ret = 0;
	while (n > 0) {
		ret += (n & 1);
		n >>= 1;
	}
	return ret;
}

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

	int N, x, y, z;
	cin >> N >> x >> y >> z;

	vvll dp(N + 1, vll(1 << (x + y + z), 0));
	vll num(N + 1, 0);
	dp[0][0] = 1;
	ll ans = 0;

	rep(i, N) {
		rep(j, 1 << (x + y + z)) {
			repl(k, 1, 11) {
				int state = ((j << k) + (1 << (k - 1))) & ((1 << (x + y + z)) - 1);
				if ((state & (1 << (x + y + z - 1))) != 0 && (state & (1 << (y + z - 1))) != 0 && (state & (1 << (z - 1))) != 0) {
					dp[i + 1][state] = 0;
				}
				else {
					dp[i + 1][state] += dp[i][j];
					dp[i + 1][state] %= MOD;
				}
			}
		}
	}

	rep(j, 1 << (x + y + z)) {
		ans += dp[N][j];
		ans %= MOD;
	}

	cout << (powMod(10,N,MOD) - ans + MOD) % MOD << endl;

	return 0;
}

Measured memory_bytes: 43392
s = input()
if s[0]!="A":
    print("WA")
    exit()

ss = ""
count = 0
for i in range(2, len(s)-1):
    if s[i] == "C":
        count += 1
    else:
        ss += s[i]
sss = s[1]+ss+s[-1]
if count==1:
    if sss.islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")
    exit()

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

#define int long long
#define double long double
#define incin(n) int (n); cin >> (n)

//main.cpp-Sample


namespace math
{
	double PI = 3.14159265359;
	int step(int n);
	int ncr(int n,int r);

	int step(int n){
		if(n<=1){
			return 1;
		}else{
			return n * step(n-1);
		}
	}
	int ncr(int n,int r){
		for(int i=1;i<r;i++){
			n *= n-i;
		}
		for(int i=1;i<r;i++){
			r *= r-1;
		}
		return n/r;
	}
}


using namespace std;
signed main (){
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> v.at(i);
	}
	int c = 0;
	for (int i = 1; i <= n-2; ++i)
	{
		if((v[i-1] > v[i] && v[i] > v[i+1]) || (v[i-1] < v[i] && v[i] < v[i+1])){
			c++;
		}
	}
	cout<<c<<endl;
	return 0;
}




Measured memory_bytes: 256
if __name__ == '__main__':

	#入力
	N, K  = map(int,input().split())
	lst = []
	for i in range(0,N):
		a, b = map(int,input().split())
		lst.append([a,b])

	lst.sort()
	indx = 0

	for i in range(0,N):
		indx += lst[i][1]
		if indx >= K:
			ans = lst[i][0]
			break

	print(ans)

Measured memory_bytes: 20104
// Starting with the name of Allah

#include <bits/stdc++.h>
#define ll long long
#define nl endl
#define flash_all ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b


using namespace std;



int main()
{
	flash_all;
	ll n,i;
	string s;
	cin>>n;
	while(n){
		n--;
		s.push_back('a'+n%26);
		n/=26;
	}
	reverse(s.begin(),s.end());
	cout<<s<<nl;
}
//Happy Coding.....

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/04/03  Problem: ABC 046 B / Link: http://abc046.contest.atcoder.jp/tasks/abc046_b  ----- */


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

	LL N, K; cin >> N >> K;

	
	LL ans = K;
	FOR(i, 1, N) {
		ans *= K - 1;
	}
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = [int(input().rstrip('\n')) for _ in range(n)]
    b = sorted(a, reverse=True)
    for i in a:
        if i == b[0]:
            print(b[1])
        else:
            print(b[0])
            
            
if __name__ == '__main__':
    main()


Measured memory_bytes: 59824
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
int main(){
    int n;
    while(cin>>n){
        ll ans=0;
        for(int i=0; i<n; ++i){
            scanf("%d",a+i);
        }
        ans=100000000;
        for(int i=0; i<=100; ++i){
        	ll tmp=0;
        	for(int j=0; j<n; ++j){
        		tmp+=(i-a[j])*(i-a[j]);
        	}
        	ans=min(ans, tmp);
        }
        cout<<ans<<endl;
    }
  return 0;
}




Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))
A.append(0)
T = []

ans = 0
for i in range(n+1):
  if A[i]==(i+1):
    T.append(1)
  else:
    T.append(0)    
for i in range(n+1):
  if T[i]:
    ans+=1
    T[i+1]=0

print(ans)

Measured memory_bytes: 14008
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();
        int num = (H-h)*(W-w);
        System.out.println(num);
        
    }
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
 
int main() {
  int n;
  cin>>n;
  string s,t;
  cin>>s>>t;
  rep(i,n){
    cout<<s[i]<<t[i];
  }
  cout<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <numeric>
#include <map>
using namespace std;


int main()
{
    long long N;
    string S;
    cin>>N>>S;
    
    long long ans=1;
    long long mod=pow(10,9)+7;
    ans*=count(S.cbegin(),S.cend(), 'a')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'b')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'c')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'd')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'e')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'f')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'g')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'h')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'i')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'j')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'k')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'l')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'm')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'n')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'o')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'p')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'q')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'r')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 's')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 't')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'u')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'v')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'w')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'x')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'y')+1;
    ans=ans%mod;
    ans*=count(S.cbegin(),S.cend(), 'z')+1;
    
    cout<<(ans-1)%mod<<endl;
    
    
    
}


Measured memory_bytes: 512