akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

long long n;

int main() {
  cin >> n;
  
  long long ans = n;
  for(long long i = 1; i * i <= n; i++){
    if(n % i) continue;
    long long k = n / i;
    ans = min(ans, i + k - 2);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////
int main() {
	int N;
	vector<int>a(100100,0);
	cin >> N;
	int X = 0;
	for (int i = 0; i < N; ++i) {
		int x;
		cin >> x;
		X = max(X, x);
		a[x]++;
		a[x + 1]++;
		a[x + 2]++;
	}
	int ans = 0;
	for (int i = 0; i <=X+5; ++i) {
		ans = max(ans, a[i]);
	}
	cout << ans << endl;
    return 0;
}

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

#define ll unsigned long long
ll n;
ll sum(ll n)
{
    ll ans = 0;
    while(n)
    {
        ans += (n % 10);
        n /= 10;
    }
    return ans+n;
}
int main()
{
    scanf("%lld",&n);
    if(n == 0)
        printf("Yes");
    else
    {
        ll ans = sum(n);
        if(!(n%ans))
            cout << "Yes";
        else
            cout << "No";
    }
    return 0;
}



Measured memory_bytes: 3760
#include <stdio.h>

int selectionSort(int A[], int N) {
	int i, j, t, minj, sw = 0;

	for (i = 0; i < N - 1; i++) {
		minj = i;
		for (j = i; j < N; j++) {
			if (A[j] < A[minj]) {
				minj = j;
			}
		}
		t = A[minj]; A[minj] = A[i]; A[i] = t;
		if (i != minj) {
			sw++;
		}
	}
	return sw;
}

int main() {
	int A[100];
	int N, i, sw;

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

	sw = selectionSort(A, N);

	for (i = 0; i < N; i++) {
		if (i > 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
	printf("%d\n", sw);

	return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<long, long>
#define ff first
#define ss second
#define pb push_back


main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int T; cin >> T;
    vector<int> a(4, 0);
    while(T--){
        string s; cin >> s;
        if(s == "AC") a[0]++;
        else if(s == "WA") a[1]++;
        else if(s == "TLE") a[2]++;
        else if(s == "RE") a[3]++;
    }
    cout << "AC x " << a[0] << "\n";
    cout << "WA x " << a[1] << "\n";
    cout << "TLE x " << a[2] << "\n";
    cout << "RE x " << a[3] << "\n";
}


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


signed main(){
    int N;
    int A[114514];
    int B[114514];
    int Ans1=0,Ans2=0;
    cin >> N;
    REP(i,N){cin >> A[i];B[i]=A[i];}
    REP(i,N){
        if(i%2==0){
            if(i!=0){A[i]+=A[i-1];}
            if(A[i]<=0){
                Ans1+=1-A[i];
                A[i]=1;
            }
        }else{
            A[i]+=A[i-1];
            if(A[i]>=0){
                Ans1+=1+A[i];
                A[i]=-1;
            }
        }
    }
    REP(i,N){A[i]=B[i];}
    REP(i,N){
        if(i%2==0){
            if(i!=0){A[i]+=A[i-1];}
            if(A[i]>=0){
                Ans2+=1+A[i];
                A[i]=-1;
            }
        }else{
            A[i]+=A[i-1];
            
            if(A[i]<=0){
                Ans2+=1-A[i];
                A[i]=1;
            }
        }
    }
    cout << min(Ans1,Ans2) << endl;
	return 0;
}


Measured memory_bytes: 1792
n, m = map(int, input().split())
l = sorted(list(map(int, input().split())), reverse=True)

if n>=m or m == 1:
    S =0
else:
    d = sorted([l[i] - l[i+1]  for i in range(m-1)], reverse=True)
    S = max(l) - min(l)
    for i in range(n-1):
        S -= d[i]

print(S)


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

#define el '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define DEBUG cerr << "DEBUG >>> " 
#define ms(a,b) memset(a, b, sizeof(a))

typedef long long ll;

const int nax = 1e5+5;
const int mod = 1e9+7;
int dp[nax];
bool cant[nax];

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

  int n, m;
  cin >> n >> m;
  for(int i = 0; i < m; i++){
    int x;
    cin >> x;
    cant[x] = 1;
  }
  dp[0] = 1;
  for(int i = 1; i <= n; i++){
    if(!cant[i]) dp[i] += (dp[i-1]+dp[i-2])%mod;
    else dp[i] = 0;
  }
  cout << dp[n] << el;

  return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

//grid-BFS
string c[25];
int h, w, d[10010][10010];

int bfs(int sx, int sy, int gx, int gy) {
  queue<PII> que;
  REP(i, h) REP(j, w) d[i][j] = INF;
  que.push(PII{sx, sy});
  d[sy][sx] = 0;

  while(que.size()) {
    PII p = que.front(); que.pop();
    if(p.first == gx && p.second == gy) break;
    REP(i, 4) {
      int nx = p.first + dx[i], ny = p.second + dy[i];
      if(IN(0, w, nx) && IN(0, h, ny) && c[ny][nx] != 'x' && d[ny][nx] == INF) {
        que.push(PII{nx, ny});
        d[ny][nx] = d[p.second][p.first] + 1;
      }
    }
  }

  return d[gy][gx];
}

int ax[15], ay[15], dp[1<<10][15], cost[15][15];
signed main(void)
{
  while(true) {
    cin >> w >> h;
    if(!w) break;
    int idx = 0, sx, sy;
    REP(i, h) cin >> c[i];
    REP(i, h) REP(j, w) {
      if(c[i][j] == 'o') sx = j, sy = i;
      if(c[i][j] == '*') ax[idx] = j, ay[idx++] = i;
    }

    // REP(i, idx) cout << ax[i] << "," << ay[i] << " "; cout << endl;

    REP(i, idx) FOR(j, i+1, idx) {
      // (ax[i], ay[i]) ?????? (ax[j], ay[j]) ????????????
      cost[i][j] = cost[j][i] = bfs(ax[i], ay[i], ax[j], ay[j]);
    }

    REP(i, 1LL<<idx) REP(j, idx) dp[i][j] = INF;

    REP(i, idx) {
      dp[1<<i][i] = bfs(sx, sy, ax[i], ay[i]);
      // cout << i << " " << dp[1<<i][i] << endl;
    }

    REP(i, 1LL<<idx) REP(j, idx) {
      // ?¨?????????????i??§???????????????j
      if(dp[i][j] == INF) continue;
      // cout << i << " " << j << endl;
      // k?????????
      REP(k, idx) {
        if(i&(1<<k)) continue;
        // j??????k????????????????????¢???+
        chmin(dp[i | 1<<k][k], dp[i][j] + cost[j][k]);
      }
    }

    int ret = INF;
    REP(i, idx) chmin(ret, dp[(1LL<<idx)-1][i]);
    if(ret >= INF) cout << -1 << endl;
    else cout << ret << endl;
  }

  return 0;
}

Measured memory_bytes: 3320
n = int(input())
R = [0]*n
for i in range(n):
    R[i] = int(input())
    
minv = R[0]
maxv = R[1] - R[0]
for i in range(1,n):
    maxv = max(maxv, R[i] - minv)
    minv = min(minv, R[i])
print(maxv)


Measured memory_bytes: 13376
//  ROAD TO GREEN
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <queue>
#include <set>

#define ll long long
#define uint unsigned int
#define ull unsigned ll


using namespace std;
const ll MAXN = 2e9+2;
const ll SIZE = 1e6+2;

int main(){
	ll a,b;
	cin >> a >> b;
	ll gcd = __gcd(a,b);
	ll i = 2;
	ll cnt = 1;
	while(gcd > 1){
		if(gcd%i == 0){
			cnt++;
			while(gcd%i == 0){
				gcd /= i;
			}
		}
		i++;
		if(i*i > gcd)
		break;
	}
	if(gcd > 1) cnt++;
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
// C
(function Main(input){
	var input = input.split('\n'),
		_ = input[0].split(' '),
		N = Number(_[0]),
		M = Number(_[1]),
		arr = new Array(N),
		flag = true;

	input.splice(0,1);

	for(var i=0; i<M; i++){
		var _ = input[i].split(' '),
			s = _[0],
			c = _[1];

		if(arr[s-1] && arr[s-1] != c){ flag = false; break; }
		arr[s-1] = c;
	}

	if(N >= 2 && arr[0] === '0'){ flag = false; }
	if(N >= 2 && !arr[0]){ arr[0] = 1; }

	if(flag){
		for(var i=0; i<N; i++){
			if(!arr[i]){
				arr[i] = 0;
			}
		}
		console.log(arr.join(''));

	}else{
		console.log(-1);
	}
})(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h> 
using namespace std; 
 int reverse(int n){
	int rat=0;
	while(n!=0){
		int m=n%10;
		n/=10;
		rat*=10;
		rat+=m;
	}
	return rat;
}
string ispaland(int num){
if (num==reverse(num))
return "Yes";
else 
return "No";
}
 
int main() 
{ 
int s;
cin>>s;

cout<<ispaland(s);
 
     
      
} 

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

ans = [0] * n
i = 0
while i < n:
    if i % 2 == 0:
        ans[i//2] = a[-(i+1)]
    else:
        ans[-(i//2+1)] = a[-(i+1)]
    i += 1
print(" ".join(map(str,ans)))

Measured memory_bytes: 29940
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<stdio.h>
#include<iostream>
#include<numeric>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int s;
	s = max(a, b);
	s = max(s, c);
	cout << a + b + c - s << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
int main(){ 
  int a,b,c;
  cin>>a>>b;
  c=2019;
  for(int i=a;i<min(b,a+2019);i++){
    for(int j=i+1;j<min(b+1,a+2019+1);j++){
      c=min(c,i%2019*(j%2019)%2019);
      }
    }
  cout<<c<<endl;
  }

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  int N;
  cin >> N;
  while(N--){
    int c,a,n;
    cin >> c >> a >> n;
    int ans = 0;

    int tmp = min(c,min(a,n));
    ans += tmp;
    c -= tmp; a -= tmp; n -= tmp;
    tmp = min(c/2,a);
    ans += tmp;
    c -= 2*tmp; a -= tmp; 
    ans += c/3;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
def gcd(a, b):
    """ 最大公約数。aはbより大きいこと """
    if b == 0:
        return a
    else:
        return gcd(b, a%b)


def solve():
    N = int(input())
    A = [int(x) for x in input().split(" ")]

    A.sort(reverse=True)
    ans = A[0]
    for i in range(1, N):
        ans = gcd(ans, A[i])

    print(ans)


if __name__ == "__main__":
    solve()

Measured memory_bytes: 14252
#include<cstdio>
#include<iostream>
using namespace std;
long long a,ans=1e12;
int main(){
	scanf("%lld",&a);
	for(long long i=1;i*i<=a;i++){
		if(a%i==0){
			ans=min(ans,i+a/i-2); 
		}
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 256
n=int(input())
csf=[list(map(int,input().split())) for _ in range(n-1)]
ans=[float("inf") for _ in range(n)]
ans[n-1]=0
for i in range(n-1):
  cnt=csf[i][1]+csf[i][0]
  for j in range(i+1,n-1):
    if csf[j][2]<cnt:
      if cnt%csf[j][2]==0:
        cnt+=csf[j][0]
      else:
        cnt+=csf[j][0]+csf[j][2]-cnt%csf[j][2]
    else:
      cnt+=cnt-csf[j][2]
  ans[i]=cnt
ans=ans[::-1]
ans.append(float("inf"))
for i in range(n):
  if ans[i]>ans[i+1]:
    ans[i+1]=ans[i]
ans.pop(-1)
for i in ans[::-1]:
  print(i)

Measured memory_bytes: 3188
import java.io.*;
//??????????????????????????\?????????????????????
public class Main {

    public static void main(String[] args) {
        
        try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String str = br.readLine();
            int N = Integer.parseInt(str);
            int Ans = N*N*N;
            System.out.println(Ans);
        }
        catch(IOException e) {
            System.out.println("??\????????¨??????");    
        }
        catch(NumberFormatException e) {
            System.out.println("?????¨?????????"); 
        }
    }
    
}

Measured memory_bytes: 24324
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>


using namespace std;


int main(int argc, const char *argv[])
{
    std::string str;
    cin>>str;
    std::vector<int> vec(4,0);

    for(int i = 0; i < 4 ; i ++)
    {
        vec[i] = int(str[i]);
    }

    sort(vec.begin(),vec.end());

    if(vec[0]==vec[1])
    {
        if(vec[2]==vec[3])
        {
            if(vec[1] != vec[2])
            {
                cout<<"Yes";
                return 0;
            }
        }
    }

    cout<<"No";

    
    return 0;
}

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

int n;
double ans,x;

int main()
{
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		cin >> x;
		ans+=1.0/x;
	}
	cout << fixed << setprecision(5) << 1.0/ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main {
    static Scanner scanner = new Scanner();

    public static void main(String[]$) throws IOException {
        int k = scanner.nextInt();
        int x = scanner.nextInt();
        for (int i = x - k + 1; i < x + k; i++) {
            System.out.println(i);
        }
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 32768);
        StringTokenizer tokenizer;

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

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

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

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

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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028L;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int P, Q, R;
signed main() {
    cin >> P >> Q >> R;
    cout << min({P + Q, Q + R, R + P});
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

ll count(ll a, ll b) {
  ll c=0;
  while(a%b==0) {
    c++;
    a/=b;
  }
  return c;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  ll n,p;
  cin>>n>>p;
  ll ans=1;
  if(p==1) {
    cout << 1 << endl;
    return 0;
  }
  for(ll k=2; k*k<=p; k++) {
    if(p%k==0) {
      if(count(p,k)>=n) ans=max(ans,k);
      if(n==1) ans=max(ans,p/k);
    }
  }
  if(1==n) ans=max(ans,p);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline

def main():
    r,c,k=map(int,input().split())

    item=[[0]*c for i in range(r)]
    for i in range(k):
        R,C,v=map(int,input().split())
        item[R-1][C-1]=v

    dp0=[[-10**10]*c  for i in range(r)]
    dp1 = [[-10 ** 10] * c for i in range(r)]
    dp2 = [[-10 ** 10] * c for i in range(r)]
    dp3 = [[-10 ** 10] * c for i in range(r)]

    if item[0][0]==0:
        dp0[0][0]=0
    else:
        dp0[0][0]=0
        dp1[0][0]=item[0][0]

    for i in range(r):
        for j in range(c):
            if j!=c-1:
                v=item[i][j+1]
                if v==0:
                    dp0[i][j+1]=max(dp0[i][j],dp0[i][j+1])
                    dp1[i][j + 1] = max(dp1[i][j], dp1[i][j + 1])
                    dp2[i][j + 1] = max(dp2[i][j], dp2[i][j + 1])
                    dp3[i][j + 1] = max(dp3[i][j], dp3[i][j + 1])
                else:
                    dp0[i][j+1]=max(dp0[i][j],dp0[i][j+1])
                    dp1[i][j+1]=max(dp0[i][j]+v,dp1[i][j],dp1[i][j+1])
                    dp2[i][j + 1] = max(dp1[i][j] + v, dp2[i][j], dp2[i][j + 1])
                    dp3[i][j + 1] = max(dp2[i][j] + v, dp3[i][j], dp3[i][j + 1])
            if i!=r-1:
                v=item[i+1][j]
                if v==0:
                    dp0[i+1][j]=max(dp0[i][j],dp1[i][j],dp2[i][j],dp3[i][j],dp0[i+1][j])
                else:
                    dp0[i+1][j]=max(dp0[i][j],dp1[i][j],dp2[i][j],dp3[i][j],dp0[i+1][j])
                    dp1[i + 1][j] = max(dp0[i][j]+v, dp1[i][j]+v, dp2[i][j]+v, dp3[i][j]+v, dp1[i + 1][j])

    ans=max(dp0[r-1][c-1],dp1[r-1][c-1],dp2[r-1][c-1],dp3[r-1][c-1])
    print(ans)

if __name__=='__main__':
    main()

Measured memory_bytes: 426528
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <string.h>

using namespace std;
#define ll long long int

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

	ll n,a,temp;
	cin>>n>>a;
	ll arr[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>arr[i];
	}
	temp=-1;
	for (int i = 0; i < n-1; ++i)
	{
		if(arr[i]+arr[i+1]>=a){
			temp=i+1;
			break;
		}
	}
	if(temp>0){
		cout<<"Possible"<<endl;
		for (int i = 1; i < temp; ++i)
		{
			cout<<i<<endl;
		}
		for (int i = n-1; i > temp; --i)
		{
			cout<<i<<endl;
		}
		cout<<temp<<endl;
	}
	else{
		cout<<"Impossible"<<endl;
	}
	return 0;
}


Measured memory_bytes: 1664
//Author : Sukarna Paul

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1)
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll int64_t
#define MAX 300005
#define INF 0x3f3f3f3f
template <class T> inline T bigmod(T p,T e,T M){ll ret = 1LL;for(; e > 0LL; e >>= 1LL){if(e & 1LL) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}   // M is prime}

using namespace std;
using namespace __gnu_pbds;

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update>pref_trie;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;



int arr[200005];
vector<int>vec ;
int main(){
    IOS
    //freopen("output.txt","w",stdout);
    int n;
    cin>>n;

    ll k;
    cin>>k;


    for(int i = 1;i<=n;i++)cin>>arr[i];


    vec.pb(1);
    map<int,int>mark;
    mark[1]=vec.size();
    int cur = 1;
    for(int i=0;i<n;i++){
        cur=arr[cur];
        if(mark[cur]>0){
            //cout<<mark[cur]<<"\n";
            vector<int>ans;
            for(int j=mark[cur]-1;j<vec.size();j++){
                ans.pb(vec[j]);
            }
            ll sz = ans.size();
            ll v=vec.size();
            k-=(v-sz);
            if(k<=0){
                k+=(v-sz);
                //cout<<"hell";
                cout<<vec[k]<<"\n";
                return 0;
            }
            //cout<<k<<" "<<sz<<"\n";
            k%=sz;
            cout<<ans[k]<<"\n";
            return 0;
        }
        vec.pb(cur);
        mark[cur]=vec.size();

    }

}


Measured memory_bytes: 15004
from collections import Counter


def prime_factorize(n):
    p = 2
    fct = []
    # 素数pはp**2がnを超えないもの（ただしnはある素数で割り切れるだけ割り切れたもの）
    # これはある素数p(i)でnを割れる時、他の素数p(i以外)はn//p(i) を割り切れるものになるため

    # 例えば、nが54なら
    # p が2のとき 54 // 2 で27
    # 27はもう2で割り切れないので2は1個
    # この時点でnは27に更新されている
    # 次にp が3の時、何度もpで割る（3度）
    while n >= p ** 2:
        while n % p == 0:
            n //= p
            fct.append(p)
        p += 1
    if n > 1:
        fct.append(n)
    return fct


N = int(input())
MOD = 1000000007
numbers = []
for i in range(1, N+1):
    numbers += prime_factorize(i)

count_numbers = Counter(numbers)
ans = 1
for n in count_numbers.values():
    ans *= ((n+1) % MOD)

print(ans % MOD)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define DBG(x) cout<<"# # #     "<<x<<'\n';
#define fri(i,s,n) for(long long i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 1e18
#define five 100005;
#define six 1000005;
#define prllclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//___________________________________________________________________________________________________________________________________________________________
vct lun;
void f(int i,ll num,int k){
       lun.pb(num);
       if(i==k){
              return;
       }
       ll xx = num%10;
       f(i+1,num*10+xx,k);
       if(xx!=0){
              f(i+1,num*10+(xx-1),k);
       }
       if(xx != 9){
              f(i+1,num*10+(xx+1),k);
       }
}
int main()
{
       speed;
       fri(i,1,10){
              f(0,i,10);
       }
       //cout<<lun.size()<<endl;
       sort(all(lun));
       int k;
       cin>>k;
       cout<<lun[k-1]<<endl;
}


Measured memory_bytes: 10604
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define F first
#define S second
const int N=1000005;
#define M 1000000007
#define double long double
#define BINF 1000000000000000001
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN  1000005
using namespace std;



#undef int
int main(){
#define int long long int
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);


    int m,d;
    cin >> m >> d;
    int ans = 0;
    for(int i = 1; i <= m; i++){
        for(int j = 10; j <= d; j++){
            if((j % 10) * (j / 10) == i and j % 10 >= 2 and j / 10 >= 2)
                ans++;
        }
    }
    cout << ans;
    
    
return 0;    
}



Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <set>
const long long ji=1000000007;
using namespace std;
int main() {
	int n;
	cin>>n;
	long long a=10,b=9,c=8;
	for(int i=1;i<n;i++) {
		a=(a*10)%ji;
		b=(b*9)%ji;
		c=(c*8)%ji;
	} 
	cout<<((a-(2*b)%ji+c)%ji+ji)%ji;
	return 0; 
}


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

int main(){
  int N,K;
  cin >> N >> K;
  vector<int64_t> H(N);
  for(int i=0;i<N;i++){
    cin >> H.at(i);
  }
  // sort(H.begin(),H.end());
  // reverse(H.begin(),H.end());
  sort(H.begin(),H.end(),greater<int64_t>());
  int64_t ans=0;
  for(int i=K;i<N;i++){
    ans+=H.at(i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define oset tree < int ,  null_type ,  less ,  rb_tree_tag ,  tree_order_statistics_node_update >
#define endl '\n'
#define int long long int
#define db long double
#define str string
#define mod 1000000007
#define ff first
#define ss second
#define PQi priority_queue<int>
#define Vi vector<int>
#define Si set<int>
#define Li list<int>
#define mk make_pair
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define For(i,s,n) for(int i=s;i<n;i++)
#define mat2D(T,r,c) vector<vector<int> > T(r,vector<int>(c))
#define vec2D vector<vector<int> >
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define getVal(x) {int val;cin>>val;x.pb(val);}
#define debug(x) {for(auto i :x) cout << i << " ";cout << endl;}

void solve() {
	int n;
	cin >> n;
	vector<int> a(n);
	For(i, 0, n)
	cin >> a[i];
	sort(all(a));
	unordered_map<int, int>mp;
	For(i, 0, n){
		mp[a[i] + 1]++;
		mp[a[i]]++;
		mp[a[i] - 1]++;
	}
	int maxx = 0;
	for (auto x : mp)
		maxx = max(x.ss, maxx);
	cout << maxx;
}

int32_t main() {
	fastIO;
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
# endif
	solve();
	return 0;
}


Measured memory_bytes: 7804
s=int(input())
a=list(map(int,input().split()))
b=[]
if s%2!=0:
  for i in range(s-1,-1,-2):
    b.append(a[i])
  for i in range(1,s,2):
    b.append(a[i])
else:
  for i in range(s-1,0,-2):
    b.append(a[i])
  for i in range(0,s,2):
    b.append(a[i])
print(" ".join(map(str,b)))

Measured memory_bytes: 29604
#include <iostream>
#include<cmath>
using namespace std;
int s[10];
int p[10];
int main(){
    int n,m;
    cin >> n>>m;
    for(int i=0;i<m;i++){
        int k ;
        cin >> k;
        for(int j=0;j<k;j++){
            int s_i;
            cin >> s_i;
            s[i] += pow(2,s_i-1);
        }
        //cout << s[i] << endl;
    }
    for(int i=0;i<m;i++){
        cin >> p[i];
    }
    int ans = 0;
    for(int i=0;i<pow(2,n);i++){
        int flag = 0;
        for(int k=0;k<m;k++){
            int sum = 0;
            for(int j=0;j<n;j++){
                if((i&s[k])&(1<<j)){
                    sum ++;
                }
            }
            if(sum%2 == p[k]){
                flag ++;
            }  
        }
        if(flag == m){
            ans ++;
        }
    }
    cout <<ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#define INF 0x3f3f3f3f
#define MOD 1000000007
using namespace std;

vector<int> node[9];
int N,M;
int a,b;
int pass=0;
bool done[9]={};
void tansaku(int num);
int main(){
	scanf("%d%d",&N,&M);
	for(int i=0;i<M;i++){
		scanf("%d%d",&a,&b);
		node[a].push_back(b);
		node[b].push_back(a);
	}
	tansaku(1);
	printf("%d\n",pass);
	return 0;
}

void tansaku(int num){
	bool flag=0;
	done[num]=1;
	for(int i=0;i<node[num].size();i++){
		if(!done[node[num][i]]){
			tansaku(node[num][i]);
		}
	}
	for(int i=1;i<=N;i++){
		if(done[i]==0) flag=1;
	}
	if(flag==0) pass++;
	done[num]=0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

const int MAX_N = 305;

int arr [MAX_N][MAX_N];
int del [MAX_N][MAX_N];

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

  ll ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> arr[i][j];
      ans += arr[i][j];
    }
  }

  for (int u = 0; u < n; u++) {
    for (int v = 0; v < n; v++) {
      for (int w = 0; w < n; w++) {
        if (arr[u][v] + arr[v][w] < arr[u][w]) {
          cout << -1 << endl;
          return 0; 
        } else if (arr[u][v] + arr[v][w] == arr[u][w]) {
          if (u != v && v != w && !del[u][w]) {
            del[u][w] = 1;
            ans -= arr[u][w];
          }
        }
      }
    }
  }

  ans /= 2;
  cout << ans << '\n';
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

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

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int n, t, a[3010], b[3010];

    P p[3010];

    memset(p, 0, sizeof(p));

    cin >> n >> t;
    REP(i, n)
    cin >> p[i + 1].first >> p[i + 1].second;

    sort(p + 1, p + n + 1);

    int dp[3010][6010];
    int ep[3010][6010];
    memset(dp, 0, sizeof(dp));
    memset(ep, 0, sizeof(ep));

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <= 6000; j++)
        {
            if (j + p[i + 1].first > 6001)
                break;

            dp[i + 1][j + p[i + 1].first] = max(dp[i + 1][j + p[i + 1].first], dp[i][j] + p[i + 1].second);
            ep[i + 1][j + p[i + 1].first] = dp[i + 1][j + p[i + 1].first];
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
        }
    }

    int res = 0;
    for (int i = 1; i <= n; i++)
    {
        res = max(res, ep[i][t + p[i].first - 1]);
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 141568
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define clear(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


int w, h;
int sx, sy, gx, gy;
bool f[32][32];	
int res;
bool out(int x, int y)
{
	return x < 0 || x >= w || y < 0 || y >= h;
}
void dfs(int x, int y, int depth)
{
	if (depth >= res)
		return;

	for (int i = 0; i < 4; ++i)
	{
		int nx = x + dx[i], ny = y + dy[i];
		if (out(x, y) || f[ny][nx])
			continue;

		for ( ; !out(nx, ny); nx += dx[i], ny += dy[i])
		{
			if (nx == gx && ny == gy)
			{
				res = depth;
				break;;
			}
			else if (f[ny][nx])
			{
				f[ny][nx] = false;
				dfs(nx - dx[i], ny - dy[i], depth + 1);
				f[ny][nx] = true;
				break;
			}
		}
	}
}
int main()
{
	while (cin >> w >> h, w)
	{
		clear(f, 0);
		for (int y = 0; y < h; ++y)
		{
			for (int x = 0; x < w; ++x)
			{
				int t;
				cin >> t;
				if (t == 1)
					f[y][x] = true;
				else if (t == 2)
					sx = x, sy = y;
				else if (t == 3)
					gx = x, gy = y;
			}
		}

		res = 11;
		dfs(sx, sy, 1);
		if (res == 11)
			res = -1;
		cout << res << endl;
	}
}

Measured memory_bytes: 0
/*
    Just Another Source code by - shahincsejnu
*/
#include                        <bits/stdc++.h>
#define   ulli                  unsigned long long int
#define   lli                   long long int
#define   MOD                   1000000007
#define   PI                    acos(-1.0)
#define   UNIQUE(V)             (V).erase(unique(ALL(V), (V).end()) //vector/string etc must need to be sorted
#define   timesave              ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define   ALL(V)                (V).begin(), (V).end()
#define   MEM(a, val)           memset(a, val, sizeof(a))
#define   SORT(v)               sort(v.begin(),v.end())
#define   REV(v)                reverse(v.begin(),v.end())
using     namespace             std;


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

    int k, n;
    cin >> n >> k;

    int arr[20] = {0};
    for(int i = 1; i <= k; i++){
        int val;
        cin >> val;
        arr[val] = 1;
    }

    for(int i = n; ; i++){
        int nn = i;
        int flag = 0;

        while(nn){
            int d = nn%10;
            nn /= 10;
            if(arr[d]) {flag = 1; break;}
        }

        if(!flag) {n = i; break;}
    }

    cout << n << "\n";

    return 0;
}

Measured memory_bytes: 256
N, M =map(int,input().split())
LR = [list(map(int,input().split())) for i in range(M)]
ansMIN = 1
ansMAX = N
for i in range(M):
    ansMIN = max(ansMIN,LR[i][0])
    ansMAX = min(ansMAX,LR[i][1])
print(max(0,ansMAX-ansMIN+1))

Measured memory_bytes: 27336
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll n;cin>>n;
    vector<pll>a(n);
    rep(i,n){
        ll x,l;cin>>x>>l;
        a[i]=mp(x+l,x-l);
    }
    sort(all(a));
    ll ans=1;
    ll last=a[0].first;
    REP(i,1,n){
        if(last<=a[i].second){
            ans++;
            last=a[i].first;
        }
    }
    cout<<ans<<endl;
}

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

template<typename First, typename Second, typename Third>
struct triple {
   First first;
   Second second;
   Third third;
};
using namespace std;
bool is(long long y){
    string s=to_string(y);
    for(int i=0,j=s.size()-1;i<j;i++,j--){
        if(s[i]!=s[j])
           return false;
    }
    return true;
}
void solve(){
    long long x,y;
    cin>>x>>y;
    long long c=0;
    for(long long i=x;i<=y;i++){
        if(is(i))
           c++;
    }
    cout<<c;
}
int main(){
//   #ifndef ONLINE_JUDGE
//      freopen("in.txt", "r", stdin);
//      freopen("out.txt", "w", stdout);
//   #endif  
    std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    // int x;
    // cin>>x;
    // while(x--)
    solve();
  return 0;
}


Measured memory_bytes: 256
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

A = [LI() for _ in range(3)]
N = I()
b = LIR(N,1)

c = [[False]*3 for _ in range(3)]

for i in range(N):
    for j in range(3):
        for k in range(3):
            if A[j][k] == b[i]:
                c[j][k] = True
for i in range(3):
    if c[i][0] == c[i][1] == c[i][2] == True:
        print('Yes')
        exit()
for i in range(3):
    if c[0][i] == c[1][i] == c[2][i] == True:
        print('Yes')
        exit()
if c[0][0] == c[1][1] == c[2][2] == True:
    print('Yes')
    exit()
if c[0][2] == c[1][1] == c[2][0] == True:
    print('Yes')
    exit()

print('No')

Measured memory_bytes: 38384
import sys
from math import sqrt
from collections import Counter, defaultdict

input = sys.stdin.readline


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    x = I()

    print(x // 500 * 1000 + x % 500 // 5 * 5)
    pass


if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef pair<int, int> pii;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

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; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


class B {
	int n;
public:
	B()
	{
		cin >> n;
	}
	void solve()
	{
		char tmp;
		REP(i, n)
		{
			cin >> tmp;
			if (tmp == 'Y')
			{
				cout << "Four" << endl;
				return;
			}
		}

		cout << "Three" << endl;

	}
};


int main()
{
	B solution;
	solution.solve();

	return 0;
}

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

#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define pb push_back
#define fi first
#define se second

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}
ll LCM(ll x, ll y){
	return x/GCD(x, y)*y;
}

int main() {
	char c; cin >> c;
	if((c-'A')>=0 && (c-'A')<=25){
		cout << 'A' << endl;
	}else{
		cout << 'a' << endl;
	}
	return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
vector<ll> get(ll n){
  vector<ll> res;
  ll now=n;
  ll i=2;
  for(;(i-1)*(i-1)<=n;i++){
    ll lb=0,rb=n+1;
    while(rb-lb>1){
      ll mid=(lb+rb)/2;
      if(mid<=n/i) lb=mid;
      else rb=mid;
    }
    res.push_back(now-lb);
    now=lb;
  }
  for(int j=now;j>=1;j--) res.push_back(1);

  vector<ll> r2;
  r2.push_back(0);
  for(int i=res.size()-1;i>=0;i--) r2.push_back(res[i]%mod);
  return r2;
}
ll dp[105][70005]={0};
int main(){
  ll s,k;
  cin>>s>>k;
  vector<ll> vec=get(s);
  ll n=vec.size()-1;
  dp[0][1]=1;

  for(int i=0;i<k;i++){
    ll kans=0;
    for(int j=1;j<=n;j++) {
      kans+=dp[i][j];
      kans%=mod;
    }
    for(int j=1;j<=n;j++){
      dp[i+1][j]=kans;
      dp[i+1][j]%=mod;
      dp[i+1][j]*=vec[j];
      dp[i+1][j]%=mod;
      kans-=(dp[i][n-j+1])%mod;
      kans+=mod;
      kans%=mod;
    }
  }
  ll ans=0;
  for(int i=1;i<=n;i++) {
    ans+=dp[k][i];
    ans%=mod;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 55560
import java.util.*;
 
class Main {
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                        long N = sc.nextInt();
                        long minv = 100000001L, maxv = -1000000000L, sumv = 0;
                        for (int i = 0; i < N; i++) {
                                long x = sc.nextInt();
                                minv = Math.min(x, minv);
                                maxv = Math.max(x, maxv);
                                sumv += x;
                        }
                        System.out.println(minv + " " + maxv + " " + sumv);
                }
        }
}


Measured memory_bytes: 42328
#include<stdio.h>
int main()
{
    int a,b,c,A,B;
    scanf("%d%d%d",&a,&b,&c);
    A=a-b;
    if(A<0)
        A=-A;
    B=a-c;
    if(B<0)
        B=-B;
    if(A>B)
        printf("B\n");
    else
        printf("A\n");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
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; }
#define rep(i, n) for (int i = 0; i < (int)n; i++)
typedef long long ll;
const ll MOD = 1e9+7;
const int inf = 1000000;
const int minf = -1000000;
const ll lnf = 1e9;
const ll mlnf = -1e9;

void debug_vector(vector<int>& v){
    int n = v.size();
    for (int i = 0; i < n; i++){
        cout << v[i] << " ";
    }
    cout << endl;
}

void solve(int N, int X);
int main(void){
    // 入力
    vector<pair<int, int>> ent;
    int cnt = 0;
    while (1){
        int n, x;
        cin >> n >> x;
        if (n == 0 && x == 0) break;
        pair<int, int> p;
        p.first = n;
        p.second = x;
        ent.push_back(p);
        cnt++;
    }
    for (int i = 0; i < cnt; i++){
        solve(ent[i].first, ent[i].second);
    }
    return 0;
}

void solve(int N, int X){
    int ans = 0;
        for (int i = 1; i <= N; i++){
        for (int j = i+1; j <= N; j++){
            for (int k = j+1; k <= N; k++){
                if (i + j + k == X) ans++;
            }
        }
    }
    printf("%d\n", ans);
}




Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
#include<vector>
#include<queue>
#define ll long long
#define inf INT_MAX
ll int d[101][200000];
/*ll int solve(ll int a[][2],ll int n,ll int w,ll int i)
{
	
	if(w>=0&&i>=n)
	  return 0;
	if(a[i][0]>w)
	{
		return solve(a,n,w,i+1);
	}
	else
	{
		return max(a[i][1]+solve(a,n,w-a[i][0],i+1),solve(a,n,w,i+1));
	}
}*/
int main()
{
	memset(d,0,sizeof(d));
	ll int n,w;
	cin>>n>>w;
	
	ll int a[n+1][2];
	//a[0][0]=0;
	//a[0][1]=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i][0]>>a[i][1];
	}
    for(int i=1;i<=n;i++)
    {
    	for(int j=1;j<=w;j++)
    	{
    		if(a[i-1][0]>j)
    		    d[i][j] = d[i-1][j];
    		else
    		    d[i][j] = max(a[i-1][1]+d[i-1][j-a[i-1][0]],d[i-1][j]);
    		
		}
	}
/*	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=w;j++)
		{
			cout<<d[i][j]<<" ";
		}
		cout<<endl;
	}*/
	cout<<d[n][w]<<endl;
 
	
}


Measured memory_bytes: 158080
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <limits>
#include <iterator>
#include <cmath>
#include <numeric>
#include <stack>
#include <queue>
#include <cassert>
#include <forward_list>
#include <chrono>
#include <deque>
#include <list>
#include <random>
#include <cstdio>
#include <sstream>

using namespace std;

//最大公約数
template<class T>
inline T GCD(T m, T n)
{
	T temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
template<class T>
inline T LCM(T m, T n)
{
	return m * n / GCD(m, n);
}

int main()
{
	int n, a, b; cin >> n >> a >> b;

	cout << min(a * n, b) << endl;
	return 0;
}

Measured memory_bytes: 888
from collections import deque
N = int(input())
Y = {}
for _ in range(N):
    c,d = map(int,input().split())
    Y[c] = d  
X = []
for _ in range(N):
    a,b = map(int,input().split())
    X.append([a,b])

X.sort()
dq = deque(X)
cnt =0
while dq:
    x,y = dq.popleft()
    sorted_Y = sorted(Y.items(),reverse=True, key = lambda x:x[1])
    for key,val in sorted_Y:
        if key <x and val<y:
            cnt += 1
            del Y[key]
            break
    
print(cnt)


Measured memory_bytes: 74724
N = int(input())
H = list(map(int, input().split()))
step=0
max_step=0
for i in range(N):
    if i+1<=N-1:
        if H[i+1]<=H[i]:
            step +=1
        else:
            if step>max_step:
                max_step=step
            step=0
    elif i+1>N-1:
        if step>max_step:
            max_step=step
        print(max_step)


Measured memory_bytes: 14252
#include <iostream>

using namespace std;

int main() {


	bool flag = true;

	string s1, s2;
	getline(cin, s1);
	getline(cin, s2);


	if (s2.size() <= s1.size()) {
		flag = false;
	} else {
		for (int i = 0; i < s1.size(); i++) {
			if (s1.at(i) != s2.at(i))
				flag = false;
		}
	}

	if (flag)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;








	return 0;
}

Measured memory_bytes: 3032
#include<stdio.h>
int main(void){
  int n,a[200000],i,count=0,b=1;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%d", &a[i]);
  }
  for(i=0;i<n;i++){
    if(a[i]==b){
      count++;
      b++;
    }
  }
  if(count==0){printf("-1");}
  else{printf("%d", n-count);}
}

Measured memory_bytes: 896
N,M = map(int,input().split())
AC = 0
WA = 0
L = [0 for i in range(N)]
for i in range(M):
    pi,Si = input().split()
    pi = int(pi)-1
    if L[pi] == 0 and Si == 'AC':
        AC += 1
        L[pi] = -1
    elif L[pi] != -1 and Si == 'WA':
        L[pi] += 1
    elif L[pi] > 0 and Si == 'AC':
        AC += 1
        WA += L[pi]
        L[pi] = -1
    else:
        pass

print(AC,WA)

Measured memory_bytes: 51232