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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... Args> void rd(Args&... args) {((cin >> args), ...);}
template<typename... Args> void write(Args... args) { ((cout << args << " "), ...); cout<<endl;}

vector<int> a,ans;
const int N=2e5+5;
vector<int> G[N];
vector<int> lis;
void dfs(int u,int fa){
    int flag;
    int pos=lower_bound(all(lis),a[u])-lis.begin();
    if(pos==lis.size()) lis.push_back(a[u]),flag=-1;
    else flag=lis[pos],lis[pos]=a[u];
    ans[u]=lis.size();
    for(auto it:G[u]){
        if(it==fa) continue;
        dfs(it,u);
    }
    if(flag==-1) lis.pop_back();
    else lis[pos]=flag;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    a=ans=vector<int>(n+1);
    for1(i,n) cin>>a[i];
    forn(i,n-1){
        int x,y;
        cin>>x>>y;
        G[x].push_back(y);
        G[y].push_back(x);
    }
    dfs(1,-1);
    for1(i,n) cout<<ans[i]<<endl;
    return 0;
}



Measured memory_bytes: 27164
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	cin>>k>>n;
	vl v(n);
	rep(i,n)cin>>v[i];
	rep(i,n)k-=v[i];
	puta(max(-1,k));
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
#define PLL pair<ll,ll>
#define F first
#define S second
#define MP make_pair
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define N 100001

int main()
{
    fastio;
   
   ll x;
   cin >> x;
   
   if(x==1)
   cout << 0 <<" "<<-1;
   else if(x==2)
   cout << 1<< " "<<-1;
   else
   {
       ll flag=0,i;
       for(i=2;i<=200;i++)
       {
           if(x%i==0)
           {
               ll num=200;
               
               while(num>=0)
               {
                   ll a=num;
                   
                   ll b=a-i;
                   
                  // cout << a << " "<< b<<'\n';
                   ll n1=a*a*a*a*a,n2=b*b*b*b*b;
                   //cout<<n1 << " "<<n2<<'\n';
                   if((n1-n2) == x)
                   {
                       flag=1;
                       cout << a<<" "<<b<<'\n';
                       break;
                   }
                   num--;
               }
           }
           if(flag)
           break;
       }
       
       
       if(flag==0)
       {
           for(i=200;i>=0;i--)
           {
               
                   ll a=i;
                   
                   ll b=a-1;
                   
                  // cout << a << " "<< b<<'\n';
                   ll n1=a*a*a*a*a,n2=b*b*b*b*b;
                   //cout<<n1 << " "<<n2<<'\n';
                   if((n1-n2) == x)
                   {
                       flag=1;
                       cout << a<<" "<<b<<'\n';
                       break;
                   }
                
               
           }
       }
       
   }
   
}

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

int main(){
  int n,l;
  cin >> n >> l;
  vector<string> s(n);

  for (int i = 0; i < n; i++)
  {
    cin >> s[i];
  }
  sort(s.begin(),s.end());

  for (int i = 0; i < n; i++)
  {
    cout << s[i];
  }
  cout << endl;
    
}

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

int main()
{
  	int n,sum;
  	double m,a;
  
 	cin >> n;
  	
  	while(n != 0){
      vector<double> s(n);
      sum = a = 0;
      
      for(int i = 0;i < n;i++){
      	cin >> s.at(i);
        sum += s.at(i);
      }
      m = sum / (double)n;
      
      for(int i = 0;i < n;i++){
      	a += pow((s.at(i) - m),2.0);
      }
      a = sqrt(a / n);
      
      cout << fixed << setprecision(8) << a << endl;
      
      cin >> n;    
    }
  
}


Measured memory_bytes: 3288
import java.util.Scanner;

public class Main {
	public static Scanner sc;
	
	public static void main(String args[]){
		int x=0,y=0;
		//System.out.println("Please input x:");
		sc = new Scanner(System.in);
		x=sc.nextInt();
		y=x*x*x;
		System.out.println(y);
	}
}


Measured memory_bytes: 26248
#include <iostream>
#include <vector>
#include <numeric>
#include <cmath>
#include <algorithm>
#include <string>
#define myfor(i,N) for(i=0;i<N;i++)
#define myforFL(i,f,l) for(i=f;i<l;i++)

using namespace std;

int main(void){
	int A,B,C,D;
	cin >> A >> B >> C >> D;
	if((C+B-1)/B <= (A+D-1)/D)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3624
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}


int main() {
	IOS;
	int a, b, c;
	cin >> a >> b;
	c = a + b;
	cout << (a % 3 == 0 || b % 3 == 0 || c % 3 == 0 ? "Possible" : "Impossible") << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <list>
#include <iomanip>
#include <queue>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;

int main() {

    ll N;

    cin >> N;

    vector<ll> b(N);

    rep(i, N) {
        cin >> b[i];
    }
    
    vector<ll> a;
    ll tmp = 0;


    while (b.size() != 0) {
        for (ll i = b.size() - 1; i >= 0; i--) {
            if (b[i] == i + 1) {
                a.insert(a.begin(), b[i]);
                b.erase(b.begin() + i);
                break;
            }
        }
        if (a.size() == tmp) {
            break;
        }
        tmp = a.size();
    }

    if (b.size() > 0) {
        cout << -1;
    }
    else {
        rep(i, N) {
            cout << a[i] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3612
def great_ocean_view(n, hli):

    ans = 0
    hlimax = hli[0]

    for i in hli:
        if hlimax <= i:
            ans += 1
            hlimax = i

    return ans

def main():
    n = int(input())
    hli = list(map(int, input().split()))
    print(great_ocean_view(n, hli))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    int ans = 0;
    int sum = 0;
    rep(i,sz(S)){
        if(S[i] == 'I') sum++;
        else sum--;
        ans = max(ans,sum);
    }
    pr(ans);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        char c = scan.next().charAt(0);

        if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
            System.out.println("vowel");
        } else {
            System.out.println("consonant");
        }
    }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    int N, A, B, C, D;
    string S;
    cin >> N >> A >> B >> C >> D >> S;
    bool check = true;

    for (ll i = A; i < C-1; i++) {
        if(S[i-1] == '#' && S[i] == '#'){
            check = false;
        }
    }
    for (ll i = B; i < D-1; i++) {
        if(S[i-1] == '#' && S[i] == '#'){
            check = false;
        }
    }
    if(check == false){
        No();
        return 0;
    }
    if(D < C){
        check = false;
        for (ll i = B; i <= D; i++) {
            if(S[i-2] == '.' && S[i-1] == '.' && S[i] == '.'){
                check = true;
            }
        }
    }
    if(check == false){
        No();
        return 0;
    }
    if(check == true){
        Yes();
        return 0;
    }
    

}

Measured memory_bytes: 3704
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

K = int(input())
ans = 0
for a in range(1, K+1):
    ans += a
    for b in range(1, a):
        g = gcd(a, b)
        ans +=  g * 6
        for c in range(1, b):
            ans += gcd(g, c) * 6
print(ans)


Measured memory_bytes: 9172
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');
        int ab = int.Parse(input[0] + input[1]);
        bool flag = false;
        for (int i = 1; i < ab / 2; i++)
        {
            if(i * i == ab)
            {
                flag = true;
                break;
            }

        }
        Console.WriteLine(flag ? "Yes" : "No");
    }
}

Measured memory_bytes: 13140
w, h, n = map(int, input().split())
x = []
y = []
a = []
l = [0, 0]
r = [w, h]
for i in range(n):
    s, t, u = map(int, input().split())
    x.append(s)
    y.append(t)
    a.append(u)
#白い部分の左下と右上の二点の座標を求める
for j in range(n):
    if a[j] == 1: #左側を黒にする
        if x[j] >= r[0]:
            S = 0
            break
        elif x[j] >= l[0]:
            l[0] = x[j]
    if a[j] == 2: #右側を黒にする
        if x[j] <= l[0]:
            S = 0
            break
        elif x[j]  <= r[0]:
            r[0] = x[j]
    if a[j] == 3: #下側を黒にする
        if y[j] >= r[1]:
            S = 0
            break
        elif y[j] >= l[1]:
            l[1] = y[j]
    if a[j] == 4: #上側を黒にする
        if y[j] <= l[1]:
            S = 0
            break
        elif y[j] <= r[1]:
            r[1] = y[j]
    S = (r[0] - l[0]) * (r[1] - l[1])
print(S) 

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

using P = std::pair<int, int>;

int main() {
    int N;
    std::cin >> N;

    std::vector<P> ps; // plus
    std::vector<P> ms; // minus
    std::string S;
    for (int i = 0; i < N; ++i) {
        std::cin >> S;
        int pos = 0, min = 0;
        for (size_t i = 0; i < S.size(); ++i) {
            const char c = S[i];
            if (c == '(') {
                ++pos;
            } else {
                --pos;
                min = std::min(min, pos);
            }
        }

        if (pos >= 0) {
            ps.push_back({min, pos});
        } else {
            ms.push_back({min, pos});
        }
    }

    std::sort(ps.begin(), ps.end());
    std::reverse(ps.begin(), ps.end());

    std::sort(ms.begin(), ms.end(), [](const auto& l, const auto& r) {
        return (l.second - l.first) > (r.second - r.first);
    }); 

    int pos = 0;
    for (const auto& p : ps) {
        if ((pos + p.first) < 0) {
            std::cout << "No" << std::endl;
            return 0;
        }

        pos += p.second;
    }
    
    for (const auto& p : ms) {
        if ((pos + p.first) < 0) {
            std::cout << "No" << std::endl;
            return 0;
        }

        pos += p.second;
    }

    if (pos == 0) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 11204
#include <cstdio>
#include <cstring>
const int MAXN = 1e6 + 10;

struct Edge{
  int v, next;
}edge[MAXN << 1];
int head[MAXN], tail, n;
int a[MAXN];
void insert(int u, int v) {
  edge[++tail] = (Edge) {v, head[u]}; head[u] = tail;
}
namespace solver_std {
  int ans[MAXN];
  void dfs1(int u, int fa) {
    for (int i = head[u]; i; i = edge[i].next) {
      int v = edge[i].v;
      if (v == fa) continue;
      dfs1(v, u);
      if (!ans[v] && a[v] < a[u]) ans[u] = 1;
    }
  }
  void dfs2(int u, int fa) {
    for (int i = head[u]; i; i = edge[i].next) {
      int v = edge[i].v;
      if (v == fa) continue;
      if (!ans[u] && a[v] > a[u]) ans[v] = 1;
      dfs2(v, u);
    }
  }
  void main() {
    dfs1(1, 0);
    dfs2(1, 0);
    for (int i = 1; i <= n; i++) {
      if (ans[i]) printf("%d ", i);
    }
  }
}
namespace solver1 {
  bool dfs(int u) {
    if (a[u] == 0) return 0;
    a[u]--;
    bool win = 0;
    for (int i = head[u]; i; i = edge[i].next) {
      int v = edge[i].v;
      if (!dfs(v)) {
        win = 1; break;
      }
    }
    a[u]++;
    return win;
  }
  void main() {
    for (int i = 1; i <= n; i++) {
      if (dfs(i)) printf("%d ", i);
    }
  }
}
int main() {
#ifndef LOCAL
  //freopen("C.in", "r", stdin);
  //freopen("C.out", "w", stdout);
#endif

  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    insert(u, v);
    insert(v, u);
  }
  solver_std::main();
}


Measured memory_bytes: 6400
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main(){
    while (1){    
        int a,b;
        string op;
        cin >> a >> op >> b;
        if(op == "?")break;
        if(op == "+"){
            printf("%d\n",a+b);
        }
        else if (op == "-")
        {
            printf("%d\n",a-b);
        }
        else if (op == "*")
        {
            cout << a*b << endl;
        }
        else if (op == "/")
        {
            cout << a/b << endl;
        }  
    }  
}


Measured memory_bytes: 3300
#include<stdio.h>
#include<stdlib.h>


#define MAX 100000

int X[MAX],x;


int par(int s,int t){
  int i,j,u,y;
  y = X[t];
  i = s-1;
  for(j = s;j<t;j++){
    if(X[j]<=y){
      i++;
      u = X[i];
      X[i] = X[j];
      X[j] = u;
    }
  }
  u = X[i+1];
  X[i+1] = X[t];
  X[t] = u;
  return i+1;
}






int main(){
  int i,p;

  scanf("%d",&x);
  for(i = 0;i<x;i++) scanf("%d",&X[i]);

  p = par(0,x-1);

  for(i = 0;i<x;i++){
    if(i)
      printf(" ");
    if( i==p)
      printf("[");
    printf("%d",X[i]);
    if(i == p)
      printf("]");
  }
  printf("\n");
  

  return 0;
}



Measured memory_bytes: 2084
#include<stdio.h>

int main()
{
    int i,j,a[30],n,temp=0;

    scanf("%d",&n);

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

    for(i=1;i<n-1;i++)
    {
        if(a[i-1]<a[i] && a[i]<a[i+1])
            temp++;

        else if(a[i-1]>a[i] && a[i]>a[i+1])
            temp++;
    }

    printf("%d",temp);

    return 0;
}


Measured memory_bytes: 3252
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <iomanip>
#include <vector>
using namespace std;
#define ll long long
vector<int> prime(3e5 + 5);
void sieve(int x)
{
	fill(prime.begin(), prime.end(), true);
	for (int i = 2; i*i <= 3e5+4; i++)
	{
		if (prime[i])
		{
			for (int j = i*i; j <= 3e5 + 4; j += i)
				prime[j] = false;
		}
	}
}
int main()
{
	int x;
	cin >> x;
	sieve(x);
	for (int i = x; i <= 3e5 + 4; i++)
	{
		if (prime[i])
		{
			cout << i; break;
		}
	}
	system("pause>0");
	return 0;
}


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

int main(){
	int N,W;
	cin>>N>>W;

	int v[1000],w[1000];
	for(int i=0;i<N;i++)
		cin>>v[i]>>w[i];

	static int DP[101][10001];
	for(int i=0;i<=N;i++)
		DP[i][0]=0;
	for(int j=0;j<=W;j++)
		DP[0][j]=0;

	for(int i=1;i<=N;i++){
		for(int j=0;j<=W;j++){
			if(j<w[i-1])
				DP[i][j]=DP[i-1][j];
			else{
				if(DP[i-1][j]>DP[i][j-w[i-1]]+v[i-1])
					DP[i][j]=DP[i-1][j];
				else
					DP[i][j]=DP[i][j-w[i-1]]+v[i-1];
			}
		}
	}
	
	cout<<DP[N][W]<<endl;
	
	return 0;
}

	

Measured memory_bytes: 7052
#include <stdio.h>

int main()
{
    int N,X,T;
    int ans,temp;

    scanf("%d %d %d\n",&N,&X,&T);

    temp=N/X;

    if(N%X!=0){
        temp++;
    }

    ans=temp*T;

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

    return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
string s;
int main()
{
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5]){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
   // cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;
using ll = long long;

#define INF 1000000007
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((int)(x).size())
#define MSG(a) cout << #a << " " << a << endl;

int main()
{
    int arr[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int n;
    cin >> n;
    n--;
    cout << arr[n] << endl;
    return 0;
}


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

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
int a,b;
cin >> a >> b;
int t = a + b;
if(t >= 24) t -= 24;
cout << t << endl;  
}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Data.Maybe
import Control.Monad

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words

getIntList = readIntList <$> BS.getLine

calc table order xs index count = do
  let destination = xs VU.! index - 1
  visited <- VUM.read table index
  VUM.write order count (index + 1)
  if visited /= - 1 then
    return (count, visited)
  else do 
    VUM.write table index count
    calc table order xs destination (count + 1)

main = do
  [n, k] <- getIntList
  as <- getIntList
  let as' = VU.fromList as
  table <- VUM.replicate n (-1) :: IO (VUM.IOVector Int)
  order <- VUM.replicate n (-1) :: IO (VUM.IOVector Int)
  (repeated, first) <- calc table order as' 0 0
  if k <= first then do
    result <- VUM.read order k
    print result
  else do
    let cycle = repeated - first
    let remain = (k - first) `mod` cycle
    result <- VUM.read order (first + remain)
    print result


Measured memory_bytes: 14744
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
using namespace std;
long long ans[10];
map <int,map <int,int> > w;
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int main() {
    int H,W,n;
    cin>>H>>W>>n;
    ans[0]=1LL*(H-2)*(W-2);
    for(int i=1;i<=n;i++) {
	int x=gi(),y=gi();
	for(int a=x-1;a<x+2;a++)
	    for(int b=y-1;b<y+2;b++)
		if(a>1&&a<H&&b>1&&b<W) {
		    int &c=w[a][b];
		    --ans[c],++ans[++c];
		}
    }
    for(int i=0;i<10;i++) cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 70528
#include <iostream>
#include <cmath>
#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(){
  int A,B;
  cin>>A>>B;
  int x=1;
  int ans=0;
  while(x<B){
    ans++;
    x+=A-1;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
using namespace std;

#define ll         long long
#define PI         acos(-1.0)
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)

int main(){
    int N;
    cin >> N;
    vector<double> A(N);
    FOR(i, 0, N) cin >> A[i];
    sort(A.begin(), A.end());
    ll ans = 1;
    FOR(i, 0, N-1){
        if(A[i+1] <= A[i] * 2){
            ans++;
        }
        else ans = 1;
        A[i+1] += A[i];
        //sort(A.begin(), A.end());
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
	int a,b;
	char c, p;
	do{
		scanf("%d ",&a);
		scanf("%c",&c);
		scanf(" %d",&b);
		switch(c){
		case '-':
			printf("%d\n",a-b);
			break;
		case '+':
			printf("%d\n",a+b);
			break;
		case '*':
			printf("%d\n",a*b);
			break;
		case '/':
			printf("%d\n",a/b);
			break;
		case '%':
			printf("%d\n",a%b);
			break;
		default:
			break;
		}
	}while(c!='?');
	return 0;
}

Measured memory_bytes: 600
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

constexpr usize operator"" _z(unsigned long long x) noexcept {
  return static_cast<usize>(x);
}

class rep {
  const usize f, l;

public:
  class itr {
    friend rep;
    usize i;
    constexpr itr(const usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr rep(const usize first, const usize last) noexcept
      : f(first), l(last) {}
  constexpr itr begin() const noexcept { return itr(f); }
  constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
  const usize f, l;

public:
  class itr {
    friend revrep;
    usize i;
    constexpr itr(usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
  constexpr itr begin() const noexcept { return itr(l); }
  constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
  return a < b ? b - a : a - b;
}

} // namespace n91

#include <algorithm>
#include <array>
#include <iostream>
#include <string>
#include <utility>

namespace n91 {

void main_() {
  usize n;
  std::cin >> n;
  std::vector<u32> d(n);
  for (auto &e : d) {
    std::cin >> e;
  }
  std::sort(d.begin(), d.end());
  std::cout << d[n / 2_z] - d[n / 2_z - 1_z] << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define forit(it, st) for(auto it : st)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
void solve(){
	int n;
	string s;
	cin >> n >> s;
	rep(i, sz(s)){
		cout << char(((s[i] - 'A') + n) % 26 + 'A');

	}
}	

 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;
}


Measured memory_bytes: 256
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.util.*;
public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}

	public Main() {
		while(in.hasNext())new AOJ0081().doIt();
	}

	class AOJ0081{
		//p0-p1の直線があるときに直線p2から直線らしたときp0-p1上の垂直な点を求める。
		private Point2D projection(Line2D l,Point2D p2){
			double kyori = l.getP1().distance(l.getP2());
			double angle = angle(l.getP1(),l.getP2(), p2);
			double t = l.getP1().distance(p2) * Math.cos(angle);
			Point2D result = new Point2D.Double(l.getP1().getX()+(l.getP2().getX()-l.getP1().getX())*t/kyori,
					l.getP1().getY()+(l.getP2().getY()-l.getP1().getY())*t/kyori);
			return result;
		}
		private double angle(Point2D p0, Point2D p1, Point2D p2){
			return Math.atan2(p2.getY()-p0.getY(),p2.getX()-p0.getX())-
					Math.atan2(p1.getY()-p0.getY(),p1.getX()-p0.getX());
		}
		
		
		void doIt(){
			String input[] = in.next().split(",");
			double a[] = new double[input.length];
			for(int i=0;i<a.length;i++)a[i] = Double.parseDouble(input[i]);
			Line2D l = new Line2D.Double(a[0], a[1], a[2], a[3]);
			Point2D p = new Point2D.Double(a[4],a[5]);
			Point2D result = projection(l, p);
			 double dx = result.getX()-p.getX();
             double dy = result.getY()-p.getY();
             double tx = dx+result.getX();
             double ty = dy+result.getY();
             System.out.printf("%.9f %.9f\n",tx,ty);
		}
	}

}

Measured memory_bytes: 17200
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using pi = pair<int,int>;

const int INF = 19191919;
int dp[1001][1005];

int main()
{
    int n;
    cin >>n;
    vector<pi> p(n);
    rep(i,n) cin >>p[i].se >>p[i].fi;

    sort(all(p));

    fill(dp[0],dp[1001],INF);
    dp[0][0] = 0;
    rep(i,n)
    {
        int a = p[i].se, b = p[i].fi;

        rep(j,n+1)
        {
            dp[i+1][j] = min(dp[i+1][j],dp[i][j]);

            int t = dp[i][j]+a;
            if(t<=b) dp[i+1][j+1] = min(dp[i+1][j+1],t);
        }
    }

    int ans = 0;
    rep(i,n+1)if(dp[n][i]<INF) ans = i;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7044
n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

con = a.dup
[k, 41].min.times do |i|
  imos = Array.new(n, 0)
  n.times do |j|
    imos[[0, j - con[j]].max] += 1
    if j + con[j] + 1 < n
      imos[j + con[j] + 1] -= 1
    end
  end

  1.upto(n-1) do |j|
    imos[j] += imos[j - 1]
  end

  con = imos
end

puts con.join(' ')


Measured memory_bytes: 81312
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)



int main() {
	ll K;
  	cin>>K;
  	int count=1;
    ll a=7;
    ll ans=0;
  	bool flag=false;
  	rep(i,1000001){
      	 ans+=a;
      	 if(ans%K==0){
           	flag=true;
          	break; 
         }
      	 else{
          	 a=(a*10)%K;
         }
      	 count++;
    }
  	if(!flag){
     	count=-1; 
    }
  
  	cout<<count<<endl;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int n = sc.nextInt();
            if(n==0){
                break;
            }
            int [] S;
            S = new int[n];
            int Max=0;
            int Min=1024;
            int Sum=0;
            for(int i=0;i<n;i++){
                S[i] = sc.nextInt();
                if(Max<=S[i]){
                    Max = S[i];
                }
                if(Min >= S[i]){
                    Min = S[i];
                }
                Sum += S[i];

            }
            Sum = Sum - (Max + Min);
            int ave=0;
            ave = Sum / (n-2);
            System.out.println(ave);

        }
        

        sc.close();
    }
}


Measured memory_bytes: 28948
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String[] temp   = scanner.nextLine().split(" ");
		int n = Integer.parseInt(temp[0]);
		int k = Integer.parseInt(temp[1]);
		String[] temp2  = scanner.nextLine().split(" ");
		Long[] mlist     = new Long[n];

		for(int i = 0; i < n; i++) {

			mlist[i] = Long.parseLong(temp2[i]);

		}

		Arrays.sort(mlist,Collections.reverseOrder());
		long sum = 0;

		for(int i = 0; i < n; i++) {

			if(i >= k) {

				sum += mlist[i];

			}


		}

		System.out.println(sum);

	}

}

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

int main() {
  vector<int> a(3);
  for (int &i : a)
    cin >> i;
  sort(a.begin(), a.end());
  if (a[0] == 5 && a[1] == 5 && a[2] == 7)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}

Measured memory_bytes: 764
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static double[] getLine(double x1, double y1, double x2, double y2){
		double[] ans = new double[3];
		double mid_x = (x1 + x2) / 2;
		double mid_y = (y1 + y2) / 2;
		ans[0] = y1 - y2;
		ans[1] = x1 - x2;
		ans[2] = - mid_y * (y1 - y2) - mid_x * (x1 - x2);
		return ans;
	}

	public static void main(String[] args){
		List<Double> listX = new ArrayList<Double>();
		List<Double> listY = new ArrayList<Double>();
		List<Double> listR = new ArrayList<Double>();
		int n = scan.nextInt();
		double[] pt = new double[6];
		for(int i = 0; i < n; i++){
			for(int j = 0; j < pt.length; j++){
				pt[j] = scan.nextDouble();
			}
			double[] l1 = getLine(pt[0], pt[1], pt[2], pt[3]);
			double[] l2 = getLine(pt[0], pt[1], pt[4], pt[5]);

			double x = (l1[0] * l2[2] - l1[2] * l2[0]) /
						(l1[1] * l2[0] - l1[0] * l2[1]);
			double y;
			if(l1[0] != 0){
				y = (l1[1] * x + l1[2]) / - l1[0];
			} else{
				y = (l2[1] * x + l2[2]) / - l2[0];
			}
			double r = Math.sqrt(Math.pow(x - pt[0], 2) +
					Math.pow(y - pt[1], 2));
			listX.add(x);
			listY.add(y);
			listR.add(r);
		}

		Iterator<Double> itX = listX.iterator();
		Iterator<Double> itY = listY.iterator();
		Iterator<Double> itR = listR.iterator();
		while(itX.hasNext()){
			double x = itX.next();
			double y = itY.next();
			double r = itR.next();
			System.out.printf("%.3f %.3f %.3f\n", x, y, r);
		}
	}
}

Measured memory_bytes: 28596
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

X = int(input())  

for i in range(X,10**6):
  if is_prime(i):
    print(i)
    exit()

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,N) for(ll i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

map<ll, ll> prime_facter(ll n){
    map<ll, ll> res;
    for (ll i = 2; i*i <= n; i++){
        while (n%i == 0){
            ++res[i];
            n /= i;
        }
    }
    if (n != 1)res[n] = 1;
    return res;
}

ll n,p;

int main(){
    cin >> n >> p;
    map<ll,ll> pf = prime_facter(p);
    ll ans = 1;
    for(auto it = pf.begin();it != pf.end();it++){
        // cout << it->first << " " << it->second << endl;
        if(it->second >= n){
            for(int i = 0;i < (it->second/n);i++)ans *= it->first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int n = sc.nextInt();
        int one = 0;
        int two = 0;
        int three = 0;

        double[][][] dp = new double[n+2][n+2][n+2];

        for (int i=0; i<n; i++) {
            int t = sc.nextInt();
            if (t == 1) one++;
            if (t == 2) two++;
            if (t == 3) three++;
        }

        for (int i=0; i<=n; i++) {
            for (int j=0; j<=n; j++) {
                for (int k=0; k<=n; k++) {
                    if (i == 0 && j == 0 && k == 0) continue;
                    if (i + j + k > n) continue;
                    double sum = i + j + k, p = n / sum;
                    if (0 < k) dp[k][j][i] += dp[k-1][j][i] * k / sum;
                    if (0 < j) dp[k][j][i] += dp[k+1][j-1][i] * j / sum;
                    if (0 < i) dp[k][j][i] += dp[k][j+1][i-1] * i / sum;
                    dp[k][j][i] += p;
//                    dp[i][j][k] += n;
//                    dp[i][j][k] /= (double) (i + j + k);
                }
            }
        }

//        for (int i=0; i<=n; i++) {
//            for (int j=0; j<n; j++) {
//                for (int k=0; k<n; k++) {
//                    if (i == 0 && j == 0 && k == 0) continue;
//                    double sum = i + j + k, p = n / sum;
//                    if (0 < i) dp[i][j][k] += dp[i-1][j+1][k] * i / sum;
//                    if (0 < j) dp[i][j][k] += dp[i][j-1][k+1] * j / sum;
//                    if (0 < k) dp[i][j][k] += dp[i][j][k-1] * k / sum;
//                    dp[i][j][k] += p;
//                }
//            }
//        }




//        System.out.println(res);

//        System.out.println(dp[three][two][one]);
        System.out.println(dp[one][two][three]);



    }

}



Measured memory_bytes: 306772
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iterator>
#include <math.h>
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#include <algorithm>
#include <cmath>
using namespace std;
pair<ll,ll> norm(ll a,ll b)
{
  if(a<0)
  {
    a*=-1;
    b*=-1;
  }
  else if ((a==0)&&(b<0))
  {
    b*=-1;
  }
  ll d=__gcd(abs(a),abs(b));
  a=(ll)(a/d);
  b=(ll)(b/d);
  pair <ll,ll> p=mp(a,b);
  return p;
}
bool decreasing(pair<ll,ll> a,pair<ll,ll> b) 
{ 
       if(a.first>b.first)
       return true;
       else if(a.first==b.first)
       {
        if(a.second<b.second)
        return false;
        else
        return true;
       } 
       else
       return false;
} 
ll expo(ll x,ll y) 
{ 
    ll res = 1;  
    while(y>0) 
    {  
        if(y&1) 
        res=(res*x)%1000000007;  
        y=y>>1;
        x=(x*x)%1000000007; 
    } 
    return res; 
}
int main()
{
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // int T,p;
    // cin>>T;
    // for(p=1;p<=T;p++)
    // { 
      ll N;
      cin>>N;
      ll A[N][2];
      ll a,b,c,i,j,k;
      for(i=0;i<N;i++)
      {
        cin>>A[i][0]>>A[i][1];
      }
      bool x=false;
      for(i=0;i<=N-3;i++)
      {
        if((A[i][0]==A[i][1])&&(A[i+1][0]==A[i+1][1])&&(A[i+2][0]==A[i+2][1]))
        {
          x=true;
          break;
        }
      }
      if(x)
      cout<<"Yes";
      else
      cout<<"No";
    return 0;
}

Measured memory_bytes: 3628
x,n=map(int,input().split())
if n==0:
  print(x)
  exit()
p=list(map(int,input().split()))
for i in range(102):
  if not x-i in p:
    print(x-i)
    exit()
  if not x+i in p:
    print(x+i)
    exit()

Measured memory_bytes: 9184
#include <stdio.h>
int main(void){
    // Your code here!
    int m,f,r,sum;
    while(1){
        scanf("%d %d %d\n",&m,&f,&r);
        if(m==-1 && f==-1 && r==-1){
        break;
        }
        sum=m+f;
        if(m==-1 || f==-1 || sum<30){
            printf("F\n");
        }
        else if(sum>=80){
            printf("A\n");
        }
        else if(sum>=65 && sum<80){
            printf("B\n");
        }
        else if(sum>=50 && sum<65){
            printf("C\n");
        }
        else if(sum>=30 && sum<50 && r >=50){
            printf("C\n");
        }
        else if(sum >=30 && sum<50 && r<50){
            printf("D\n");
        }
    }
    return 0;
}




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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N = I()
H = IL()

now = H[0]-1

for i in range(1,N):
  if H[i]>now:
    now = H[i]-1
  elif H[i] == now:
    continue
  else:
    NE()
Y()

Measured memory_bytes: 59504
// https://atcoder.jp/contests/abc132/tasks/abc132_c

#include <stdio.h>
#include <stdlib.h>
#define forn(i,L,R) for (int i = L; i < R; i++)
#define wez(n) int (n); scanf("%d",&(n))
#define getInt(a) scanf("%d", &a)

int cmpfunc (const void * a, const void * b) {
   return ( *(int*)a - *(int*)b );
}

int main(){
    wez(n);
    int arr[100000];
    forn(i, 0, n)
        getInt(arr[i]);
    qsort(arr, n, sizeof(int), cmpfunc);
    printf("%d\n", arr[n/2] - arr[n/2 - 1]);
}

Measured memory_bytes: 892
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	int a,b,out=0;
	cin>>a>>b;
	if(b>a) swap(a,b);
	rep(i,a) out=out*10+b;
	cout<<out<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<functional>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};




signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,m;
    cin>>n>>m;
    bool c[200010]={},d[200010]={};
    rep(i,m){
        ll a,b;
        cin>>a>>b;
        if(a==1) c[b]=1;
        if(b==n) d[a]=1;
    }
    rep2(i,2,n+1){
        if(c[i]&&d[i]){
            cout<<"POSSIBLE"<<endl;
            return 0;
        }
    }
    cout<<"IMPOSSIBLE"<<endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int count = 0;
		for(int i = 0; i < n; i++){
			if(i+1 != Integer.parseInt(sc.next()))count++;
		}
		if(count == 0 || count == 2){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 22868