akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<random>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	if(n==1) {
		cout<<"Hello World"<<endl;
	} else {
		int a,b;
		cin>>a>>b;
		cout<<a+b<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn

object Main extends App {
  var loop = true
  while (loop) {
    var s = StdIn.readLine().toString
    if (s == "-") loop = false
    else {
      val m = StdIn.readInt()
      for (i <- 1 to m) {
        val (l, r) = s.splitAt(StdIn.readInt())
        s = r + l
      }
      println(s)
    }
  }
}

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

template<int64_t MOD = 998244353,int64_t priroot = 3>
struct number_theoretic_transform{
  using i64 = int64_t;

  number_theoretic_transform() = default;

  constexpr i64 get_mod(){return MOD;}

  std::tuple<i64,i64,i64> ext_gcd(i64 a,i64 b){
    if(b==0)return {a,1,0};
    auto[d,y,x]=ext_gcd(b,a%b);
    y-=a/b*x;return {d,x,y};
  }
  constexpr inline i64 mod(i64 a){
    a%=MOD;return(a<0?a+MOD:a);
  }
  i64 mod_inv(i64 a){
    auto[d,x,y]=ext_gcd(a,MOD);return(d!=1?-1:mod(x));
  }
  i64 mod_pow(i64 n,i64 p){
    i64 ans{1};
    while(p){
      if(p&1)ans*=n;
      n*=n;p>>=1;
      ans%=MOD;n%=MOD;
    }
    return ans;
  }
  
  void ntt(std::vector<i64>& a,bool const inv = false){
    int n = std::size(a);
    if(n==1)return;
    std::vector<i64> b(n);
    i64 r = inv?(MOD-1-(MOD-1)/n):(MOD-1)/n;
    i64 s = mod_pow(priroot,r);
    std::vector<i64> kp(n/2+1,1);
    for(int i=0;i<n/2;++i)kp[i+1]=kp[i]*s%MOD;
    for(int i=1,l=n/2;i<n;i<<=1,l>>=1){
      for(int j=0,r=0;j<l;++j,r+=i){
        for(int k=0,s=kp[i*j];k<i;++k){
          i64 p = a[k+r], q = a[k+r+n/2];
          b[k+2*r] = (p+q)%MOD;
          b[k+2*r+i] = mod(p-q)*s%MOD;
        }
      }
      a.swap(b);
    }
    if(inv){
      s = mod_inv(n);
      for(int i=0;i<n;++i)(a[i]*=s)%=MOD;
    }
  }
  void inv_ntt(std::vector<i64>& a){
    ntt(a,true);
  }
  template<class T = i64>
  std::vector<i64> convolution(std::vector<T> const& a,std::vector<T> const& b){
    int n = std::size(a), m = std::size(b);
    int sz = n+m-1;
    int t = 1;
    while(t<sz)t<<=1;
    std::vector<i64> aa(t),bb(t);
    for(int i=0;i<n;++i)aa[i] = static_cast<i64>(a[i]);
    for(int j=0;j<m;++j)bb[j] = static_cast<i64>(b[j]);
    ntt(aa);ntt(bb);
    for(int i=0;i<t;++i)(aa[i]*=bb[i])%=MOD;
    inv_ntt(aa);
    aa.resize(sz);
    return aa;
  }
};

number_theoretic_transform<> ntt;

int main(){

  using namespace std;
  using i64 = int64_t;

  int n,m;
  cin>>n>>m;
  vector<i64> a(n),b(m);
  for(auto& ai:a)cin>>ai;
  for(auto& bi:b)cin>>bi;

  auto c = ntt.convolution(a,b);
  for(auto itr=begin(c);itr!=end(c);++itr){
    cout<<(*itr)<<"\n "[itr+1!=end(c)];
  }

}

Measured memory_bytes: 40156
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
void dout(double d){printf("%.12f\n",d);}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 2e5;
struct UnionFind{
  vector<int> p;
  void init(int n){
    p = vector<int>(n, -1);
  }
  int find(int a){
    return p[a] < 0 ? a : p[a] = find(p[a]);
  }
  void merge(int a, int b){
    p[a] = b;
  }
} uf;

int n, m;
V<pair<ll, pii>> e;
V<int> E[N];
V<ll> history, x;
bool y[N];
void dfs(int a){
  y[a] = true;
  for(int b:E[a]) dfs(b);
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  uf.init(N);
  FOR(i, 0, n){
    ll X;
    cin >> X;
    x.pb(X);
  }
  FOR(i, 0, m){
    int a, b, y;
    cin >> a >> b >> y;
    a--; b--;
    e.pb(mp(y, mp(a, b)));
  }
  sort(all(e));
  FOR(i, 0, m){
    pii p = e[i].se;
    int pa = uf.find(p.fi);
    int pb = uf.find(p.se);
    if(pa != pb){
      uf.merge(pa, i+n);
      uf.merge(pb, i+n);
      ll s = x[pa] + x[pb];
      x.pb(s);
      E[i+n].pb(pa);
      E[i+n].pb(pb);
    }else{
      uf.merge(pa, i+n);
      x.pb(x[pa]);
      E[i+n].pb(pa);
    }
  }
  int ans = 0;
  FORR(i, m-1, 0){
    if(y[i+n]) continue;
    if(x[i+n] < e[i].fi){
      ans++;
    }else{
      dfs(i+n);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 15340
process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function (chunk) {
    let line = chunk.toString().split(' ').map(s => parseInt(s))
    let W = line[0];
    let H = line[1];
    let x = line[2];
    let y = line[3];
    let r = line[4];
    if (x - r < 0 || 
        x + r > W ||
        y - r < 0 ||
        y + r > H) {
        console.log("No");
    } else {
        console.log("Yes");
    }
});


Measured memory_bytes: 19360
#include <iostream>
#include <stdlib.h>
#include <string>

using namespace std;

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

	char p[100][11];
	cin >> p[0];
	for (int i = 1; i < n; i++) {
		cin >> p[i];
		if (p[i - 1][strlen(p[i - 1])-1] != p[i][0]) {
			cout << "No\n";
			return 0;
		}
		for (int j = i - 1; j >= 0; j--) {
			if (strcmp(p[i], p[j]) == 0) {
				cout << "No\n";
				return 0;
			}
		}
	}

	cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <math.h>
#include <cstring>
#include <algorithm>
using namespace std;
#define EPS (1e-10)
struct point
{
	double x, y;
	point(double a = 0, double b = 0):x(a),y(b){}
};
typedef point Point;
Point operator +(Point a, Point b){
	return Point(a.x + b.x, a.y + b.y);
}
Point operator -(Point a, Point b){
	return Point(a.x - b.x, a.y - b.y);
}
Point operator *(Point a, double k){
	return Point(a.x * k, a.y * k);
}
double norm(Point a){
	return a.x * a.x + a.y * a.y;
}
double abs(Point a){
	return sqrt(norm(a));
}
double dot(Point a, Point b){
	return a.x * b.x + a.y * b.y;
}
double cross(Point a, Point b){
	return a.x * b.y - a.y * b.x;
}
const int COUNTER_CLOCKWISE = 1;
const int CLOCKWISE = -1;
const int ONLINE_BACK = 2;
const int ONLINE_FRONT = -2;
const int ON_SEGEMENT = 0;
int ccw(Point p0, Point p1, Point p2){
	Point a = p1 - p0;
	Point b = p2 - p0;
	if(cross(a,b) > EPS) return COUNTER_CLOCKWISE;
	if(cross(a,b) < -EPS) return CLOCKWISE;
	if(dot(a,b) < -EPS) return ONLINE_BACK;
	if(norm(a) < norm(b)) return ONLINE_FRONT;
	return ON_SEGEMENT;
}
int main(){
	int n;
	Point a, b;
	scanf("%lf %lf %lf %lf",&a.x, &a.y, &b.x, &b.y);
	scanf("%d",&n);
	while(n--){
		Point c;
		scanf("%lf %lf",&c.x, &c.y);
		int cnt = ccw(a, b, c);
		if(cnt == 1) printf("COUNTER_CLOCKWISE\n");
		else if(cnt == -1) printf("CLOCKWISE\n");
		else if(cnt == 2) printf("ONLINE_BACK\n");
		else if(cnt == -2) printf("ONLINE_FRONT\n");
		else printf("ON_SEGMENT\n");
	}
	return 0;
}


Measured memory_bytes: 3236
#include<stdio.h>
#include<math.h>
int sosuu(int);
int main(){
  int A[10000],N,i,j,k,z,count=0;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for(j=0;j<N;j++){
    if(sosuu(A[j])==1)
      count++;
  } 
  printf("%d\n",count);
  return 0;
}
int sosuu(int x){
  int i;
  if(x<=1)
    return 0;
  if(x==2)
    return 1;
  else if(x%2==0)
    return 0;
  i=3;
  while(i<=sqrt(x)){
      if(x%i==0)
	return 0;
      i=i+2;
    }
  return 1;
}
  



Measured memory_bytes: 2040
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	ll ans = 0;
	for (ll i = 0; i < s.length(); i++) {
		if (s[i] != t[i]) {
			ans++;
		}
	}
	cout << ans << endl;
}


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  str s; cin >> s;
  for(ll i = 0;i < s.size();i++)
  {
    if(s[i] == ',') s[i] = ' ';
    cout<<s[i];
  }
  fin("")
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


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

int main() {
  string s;
  cin>>s;
  int count=0;
  int ans;
  for(int i=0;i<s.size();i++){
    count+=s.at(i)-'0';
  }
  ans=count%9;
  if(ans==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3692
def main():
    N = int(input())
    A = [0]
    B = [0]
    C = [0]
    for i in range(N):
        a, b, c = (int(i) for i in input().split())
        A.append(a)
        B.append(b)
        C.append(c)
    dp = [[0 for _ in range(N+1)] for _ in range(3)]
    dp[0][1] = A[1]
    dp[1][1] = B[1]
    dp[2][1] = C[1]

    for i in range(1, N):
        dp[2][i+1] = max(dp[0][i] + C[i+1], dp[1][i] + C[i+1])
        dp[1][i+1] = max(dp[0][i] + B[i+1], dp[2][i] + B[i+1])
        dp[0][i+1] = max(dp[1][i] + A[i+1], dp[2][i] + A[i+1])

    print(max(dp[0][-1], dp[1][-1], dp[2][-1]))


if __name__ == '__main__':
    main()


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

int main() {
  int r, g, b, n, s = 0;
  cin >> r >> g >> b >> n;
  rep(i, n/r+1){
    rep(j, (n-i*r)/g+1){
      int d = n-i*r-j*g;
      if(d >= 0 && d % b == 0) ++s;
    }
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using System.Threading.Tasks;

class Sobaya
{
    static void Main(){
      new Sobaya().calc();
      return;
    }
      
    Scanner cin;
    
    void calc(){
        cin = new Scanner();
        int a = cin.nextInt();
        int b = cin.nextInt();
        float x = (1.1f+a+b)/2.0f;
        Console.WriteLine((int)x);

    }
}




class Scanner
{
    string[] s;
    int i;
 
    char[] cs = new char[] { ' ' };
 
    public Scanner()
    {
        s = new string[0];
        i = 0;
    }
 
    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }
 
    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }
 
    public long nextLong()
    {
        return long.Parse(next());
    }
 
    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }
 
    public double nextDouble()
    {
        return double.Parse(next());
    }
 
 
    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std ; 
typedef long long int ll;
#define forn(i,e) for(ll i=0; i<e; i++)
#define fors(i , s ,e) for(ll i = s ; i < e ; i++)
#define endl "\n"
#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PB push_back 
#define MP make_pair
#define F first
#define S second


int main()
{


ll n , m , k ; cin >> n >> m >> k ; 
ll a[n] ; ll b[m] ; 
forn(i,n) cin >> a[i] ; 
forn(i,m) cin >> b[i] ;
 
ll i = 0 ; 
ll pre_a = 0 ; 
 
while((pre_a+ a[i]) <= k)
{

	pre_a += a[i] ; 
	if(i+1 <n)
	i++ ; 
	else 
	{
		i++; break ; 
	}
	
} 


ll maks = 0 ; 
ll ans = i; 

ll j = 0 ; 
while(i>(-1)) 
{
	
	
	
	while(pre_a + b[j] <= k)
	{
		pre_a += b[j] ;
		j++; 
		ans++ ;
		if(j == m) {break ;}  
		
	}
	if(j==m) 
		{	
			maks = max(maks ,ans) ; 
			i = -1 ;
		}
	else
	{
	maks = max(maks, ans) ; 
	ans-- ; 
	pre_a = pre_a - a[i-1] ; 
	i--;
	}
//	cout << maks << endl ;
}
cout << maks << endl ;


}
  



Measured memory_bytes: 6704
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a)
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;

inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=500005;
//i_am_noob
char c;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> c;
    if(c>='a') print1("a");
    else print1("A");
	return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define rep2(i,x,y) for (int i = x; i < (y); ++i)
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
int INF = 100100101;
int main()
{
  ios::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  for(int i = 3; i <= n; i++){
    if(i % 10 == 3) cout << " " << i;
    else if(i % 3 == 0) cout << " " << i;
    else if( i / 10 == 3){
      cout << " " << i;
    }
    else{
      string s = to_string(i);
      if(s.find('3') != string::npos) cout << " " << i;
    }
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 3256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<=(end);i++)
#define REP(i, n) FOR(i,1,n)
#define IFOR(i, begin, end) for(int i=(end);i>=(begin);i--)
#define IREP(i, n) IFOR(i,1,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
 
#define ll long long
using namespace std;
 
int main()
{
    // 入力
    ll N;
    cin>>N;
    if(N%2==0) cout<<N<<endl;
  	else cout<<2*N<<endl; 
    return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


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

    cout << fixed << setprecision(7) << pow(L/3.0, 3) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
 
class ModInt{
private:
  long long val;
  static const int default_mod = 1e9 + 7;
  static int mod;
  static vector<ModInt> facts;
public:
  ModInt(long long val)
  {
    if(mod == 0){
      mod = default_mod;
    }
    this->val = ((val % mod) + mod) % mod;
  }
  ModInt()
    : ModInt(0)
  {
  }
  static void setMod(int mod){
    if(ModInt::mod != 0){
      throw "The modulo is already set.";
    }
    ModInt::mod = mod;
  }

  const ModInt operator* (const ModInt& another) const{
    return ModInt(val * another.val);
  }
  ModInt operator+ (const ModInt& another){
    return ModInt(val + another.val);
  }
  ModInt operator- (const ModInt & another){
    return ModInt(val - another.val + mod);
  }
  ModInt operator/(const ModInt& rhs){
    return (*this) * rhs.inv();
  }
  ModInt& operator*=(const ModInt& rhs){
    (*this) = (*this) * rhs;
    return *this;
  }
  ModInt& operator+=(const ModInt& rhs){
    (*this) = (*this) + rhs;
    return *this;
  }
  ModInt& operator-=(const ModInt& rhs){
    (*this) = (*this) - rhs;
    return *this;
  }
  ModInt& operator/=(const ModInt& rhs){
    (*this) = (*this) / rhs;
    return *this;
  }
  ModInt pow(long long exponent) const{
    exponent %= mod - 1;
    if(exponent == 0){
      return ModInt(1);
    }else{
      if(exponent % 2){
        return ((*this) * (*this)).pow(exponent / 2) * (*this);
      }else{
        return ((*this) * (*this)).pow(exponent / 2);
      }
    }
  }
  ModInt inv() const{
    return this->pow(mod - 2);
  }
  static ModInt fact(long long n){
    if(n >= mod){
      return 0;
    }
    if(facts.size() < static_cast<size_t>(n + 1)){
      if(facts.size() == 0){
        facts.push_back(1);
      }
      for(int i = facts.size(); i <= n; i++){
        facts.push_back(facts[i - 1] * i);
      }
    }
    return facts[n];
  }
  static ModInt comb(long long n, long long r){
    if(r > n){
      return 0;
    }
    return ModInt::fact(n) * ModInt::fact(r).inv() * ModInt::fact(n - r).inv();
  }
 
  friend ostream& operator<< (ostream& os, const ModInt& modint){
    os << modint.val;
    return os;
  }
  friend istream& operator>>(istream& is, ModInt& modint){
    long long val;
    is >> val;
    modint.val = val % modint.mod;
    return is;
  }
  friend ModInt operator*(const long long lhs, const ModInt& rhs){
    return ModInt(lhs) * rhs;
  }
};
int ModInt::mod = 0;
vector<ModInt> ModInt::facts;

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

  string s;
  cin >> s;

  vector<vector<ModInt>> dp(N, vector<ModInt>(N));
  for(int j = 0; j < N; j++){
    dp[0][j] = 1;
  }

  for(int i = 1; i < N; i++){
    vector<ModInt> dp_sum(N - (i - 1) + 1);
    for(int j = 1; j <= N - (i - 1); j++){
      dp_sum[j] = dp_sum[j - 1] + dp[i - 1][j - 1];
    }
    for(int j = 0; j < N - i; j++){
      if(s[i - 1] == '<'){
        dp[i][j] = dp_sum[j + 1];
      }else{
        dp[i][j] = dp_sum[N - (i - 1)] - dp_sum[j + 1];
      }
    }
  }

  cout << dp[N - 1][0] << endl;
}


Measured memory_bytes: 70656
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int min = n + 1;
    int ans = 0;
    REP(i, 0, n) {
        int a;
        cin >> a;
        ans += (min >= a);
        chmin(min, a);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
typedef long long ll;

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

  vector < pair<int, int> > BA(N), CD(N);

  for (int i = 0; i < N; i++){
    int A, B; cin >> A >> B;
    BA[i].first = B;
    BA[i].second = A;
  }
  sort(BA.begin(), BA.end());

  for (int i = 0; i < N; i++){
    int C, D; cin >> C >> D;
    CD[i].first = C;
    CD[i].second = D;
  }
  sort(CD.begin(), CD.end());

  vector <bool> checked(N);
  int ans = 0;
  for (int i = 0; i < N; i++){
    int C = CD[i].first, D = CD[i].second;

    for (int j = N - 1; j >= 0; j--){
      if (checked[j] == false){
        int B = BA[j].first, A = BA[j].second;
        if(A < C && B < D){
          ans++;
          checked[j] = true;
          break;
        }
      }
    }
  }
  cout << ans << endl;
  
  

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}
 
ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,a,b;
    cin >> n >> a >> b;
    ll res = n/(a+b)*a+min(a,n%(a+b));
    ct(res);

}

Measured memory_bytes: 256
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int fact(int a){
  int ret=1;
  for(int i=2;i<=a;i++) ret*=i;
  return ret;
}


int main(){
  int N;
  cin >> N;
  vector<vector<int>> P(2,vector<int>(N));
  vector<vector<int>> num(2,vector<int>(N));
  for(int i=0;i<2;i++){
    for(int j=0;j<N;j++){
      cin >> P.at(i).at(j);
      num.at(i).at(j)=j+1;
    }
  }

  vector<int> pos(2,0);
  
  for(int i=0;i<2;i++){
    for(int j=0;j<N;j++){
      for(int k=0;k<num.at(i).size();k++){
	if(P.at(i).at(j)==num.at(i).at(k)){
	  pos.at(i)+=k*fact(N-1-j);
	  num.at(i).erase(num.at(i).begin()+k);
	  break;
	}
      }
    }
  }

  cout << abs(pos.at(0)-pos.at(1)) << endl;

  return 0;
}


Measured memory_bytes: 256
/* blog: https://misteer.hatenablog.com/entry/ARC100-E */

#include <iostream>
#include <algorithm>
#include <vector>

using Int = long long int;
template <class T>
using Vector = std::vector<T>;

int main() {
    Int n;
    std::cin >> n;
    Int m = (1 << n);

    Vector<Int> a(m);
    for (auto& x : a) std::cin >> x;

    Vector<Vector<Int>> max(m);
    max[0] = {0};
    // kの部分bit全体で、aが大きい方から2つ(0だけ1つ)

    Int ans = 0;
    for (Int k = 1; k < m; ++k) {
        auto& idx = max[k];
        idx.push_back(k);

        // kからbitを1つだけ下ろしたlについて、max[l]をマージ
        for (Int i = 0; i < n; ++i) {
            if ((k >> i) & 1) {
                Int l = k - (1 << i);
                for (auto x : max[l]) {
                    idx.push_back(x);
                }
            }
        }

        // a[i]の大きさによってソート
        // 後でuniqueで重複を消すため、a[i]が同じ場合はiについてソート
        std::sort(idx.begin(), idx.end(), [&](Int i, Int j) {
            return (a[i] == a[j] ? i < j : a[i] > a[j]);
        });

        // 重複を消して大きい方から2つを残す
        idx.erase(std::unique(idx.begin(), idx.end()), idx.end());
        idx.resize(2);

        ans = std::max(ans, a[idx[0]] + a[idx[1]]);
        std::cout << ans << std::endl;
    }
    return 0;
}


Measured memory_bytes: 72960
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;

int main(){
  string  a,b;
  cin >> a >> b;
  sort(a.begin(),a.end());
  sort(b.begin(),b.end(),greater<char>());
  if(a<b) cout << "Yes" << endl;
  else cout << "No" << endl;

}


Measured memory_bytes: 256
//In The Name Of GOD
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int inf = 2000000000;
const int maxn = 40000;
#define ll long long
#define pb push_back
#define mp make_pair
#define IO ios_base::sync_with_stdio(false);
int main(){
  IO;
  int n;
  cin>>n;
  int p[n],A[n],B[n];
  for(int i=0;i<n;i++){
    cin>>p[i];
    p[i]-=1;
  }
  for(int i=0;i<n;i++){
    A[i]=(i+1)*maxn;
  }
  for(int i=0;i<n;i++){
    B[p[i]]=(p[i]+1)*(-maxn)+i;
  }
  int mini=0;
  for(int i=0;i<n;i++){
    mini=min(B[i],mini);
  }
  for(int i=0;i<n;i++){
    B[i]+=-mini+1;
  }
  for(int i=0;i<n;i++){
    cout<<A[i]<<' ';
  }
  cout<<endl;
  for(int i=0;i<n;i++){
    cout<<B[i]<<' ';
  }
  cout<<endl;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define maxn 100086

using namespace std;

typedef long long ll;

int n, m;
int x, y;
vector<int> v[maxn];

int dep[maxn], fa[maxn];
ll ans, siz[maxn];
vector<ll> a;

void dfs(int i){
	dep[i] = dep[fa[i]] + 1, siz[i] = dep[i] & 1 ? 1 : -1;
	for(int j = 0;j < v[i].size();j++){
		int to = v[i][j];
		if(to == fa[i]) continue;
		if(dep[to]) x = to, y = i;
		else fa[to] = i, dfs(to), siz[i] += siz[to];
	}
	ans += abs(siz[i]);
}

int main(){
	scanf("%d%d", &n, &m);
	while(m--){
		scanf("%d%d", &x, &y);
		v[x].push_back(y), v[y].push_back(x);
	}
	x = y = 0;
	dfs(1);
	if(!x) return printf("%lld", siz[1] ? -1 : ans), 0;
	if((dep[x] - dep[y]) & 1){
		if(siz[1]) return printf("-1"), 0;
		for(int i = x;i != y;i = fa[i]){
			ans -= abs(siz[i]), a.push_back(siz[i]);
		}
		a.push_back(0);
		sort(a.begin(), a.end());
		for(int i = 0;i < a.size();i++) ans += abs(a[i] - a[a.size() / 2]);
		printf("%lld", ans);
	}else{
		if(siz[1] & 1) return printf("-1"), 0;
		ll sum = siz[1] >> 1;
		for(int i = x;i;i = fa[i]) ans -= abs(siz[i]), ans += abs(siz[i] -= sum); 
		for(int i = y;i;i = fa[i]) ans -= abs(siz[i]), ans += abs(siz[i] -= sum); 
		printf("%lld", ans + abs(sum));
	}
	
}

Measured memory_bytes: 17648
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9

// 整数aが素数かどうかチェックする。
// order root of x
bool isPrime(int x) {
	if (x == 2) return true;
	else if (x < 2 || x % 2 == 0) return false;

	int i = 3;
	while (i*i <= x) {
		if (x%i == 0) return false;
		i += 2;
	}
	return true;
}

int main() {
	int N; cin >> N;
	int count = 0;
	int num = 11;
	while (count < N) {
		if (isPrime(num)) {
			cout << num << " ";
			count++;
		}
		num += 5;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#define INF 100000000
using namespace std;

int n;
int graph[100][100];

void floyd(){
    for(int k=0;k<n;k++)
      for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
          graph[i][j]=min(graph[i][j],graph[i][k]+graph[k][j]);
}


int main(){
  int k,i,j,a,b,c,d,e,x;
  while(scanf("%d %d",&n,&k),n,k){
    for(i=0;i<n;i++)
      for(j=0;j<n;j++)
        graph[i][j]=i==j?0:INF;
    for(i=0;i<k;i++){
      if (scanf("%d",&x),x){
        scanf("%d %d %d",&c,&d,&e);
        if (graph[--c][--d]>e){
          graph[c][d]=graph[d][c]=e;
          floyd();
        }
      }else{
        scanf("%d %d",&a,&b);
        if (graph[--a][--b]==INF)
          printf("-1\n");
        else
          printf("%d\n",graph[a][b]);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1076
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<string>
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define SZ(a) (int)((a).size())
using namespace std;
typedef long long ll;
typedef double db;
typedef pair <int, int> Pii;
typedef pair <ll, int> Pli;
typedef unsigned long long ull;
const double eps = 1e-8;
const ll infll = 0x7fffffffffffffff;
const int mod = (int)(1e9) + 7;
const int inf = 0x7fffffff;
const int maxn = (int)(2e5) + 7;
const int maxm = 300;
  
int n, k;
ll a[maxn];

int main() {

    // freopen("in.in", "r", stdin);
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
    sort(a + 1, a + 1 + n);
    ll res = 0;
    for (int i = 1; i <= k; i++) res += a[i];
    printf("%lld", res);

    return 0;
}

Measured memory_bytes: 3240
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

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

int main()
{
    int x;
    cin >> x;
    cout << (x == 3 || x == 5 || x == 7 ? "YES" : "NO") << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        if (k%2 == 0) {
			System.out.print(k/2 * k/2);
		} else {
			System.out.print(((k-1)/2 + 1) * (k-1)/2);
		}
    }
}

Measured memory_bytes: 35832
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

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

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

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

typedef struct kouji{
	int time,x,flag;
}kouji;

int main()
{
	int n,q;
	cin>>n>>q;
	vector<int> s(n),t(n),x(n);
	for(int i = 0; i < n; i++){
		cin>>s[i]>>t[i]>>x[i];
	}
	for(int i = 0; i < n; i++){
		s[i] -= x[i];
		t[i] -= x[i];
	}
	vector<int> d(q);
	for(int i = 0; i < q; i++){
		cin>>d[i];
	}

	vector<kouji> ko;
	for(int i = 0; i < n; i++){
		kouji k1 = {s[i],x[i],1};
		kouji k2 = {t[i],x[i],-1};
		ko.push_back(k1);
		ko.push_back(k2);
	}

	sort(all(ko),[](kouji k1,kouji k2){
		if(k1.time == k2.time)
			return k1.flag<k2.flag;
		else
			return k1.time < k2.time;
	});

	set<int> stop;
	auto itr = ko.begin();

	for(int i = 0; i < q; i++){
		while(itr != ko.end() && itr->time <= d[i]){
			if(itr->flag > 0)
				stop.insert(itr->x);
			else
				stop.erase(itr->x);
			itr++;
		}
		cout << (!stop.empty()?*stop.begin():-1) << endl;
	}


	return 0;
}


Measured memory_bytes: 18412
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

int dp[3030][3030];
string ans;

int main()
{
  string a, b; cin >> a >> b;
  
  for (int i = 1; i <= a.length(); ++i)
    for (int j = 1; j <= b.length(); ++j)
      if (a[i-1] == b[j-1])
        dp[i][j] = dp[i-1][j-1] + 1;
      else if (dp[i-1][j] < dp[i][j-1])
        dp[i][j] = dp[i][j-1];
      else dp[i][j] = dp[i-1][j];
  
  int x = a.length(), y = b.length();
  while(x)
    if (a[x-1] == b[y-1]) {
      ans += a[x-1];
      --x, --y;
    } else if (dp[x][y] == dp[x-1][y])
      --x;
    else
      --y;
  
  reverse(ans.begin(), ans.end());
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 35840
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    string s;
    cin>>s;
    int a,b;
    REP(i,s.size()){
        if(s[i]=='A'){
            a=i+1;
            break;
        }
    }
    for(int i=s.size()-1;i>0;i--){
        if(s[i]=='Z'){
            b=i+1;
            break;
        }
    }
    cout<<b-a+1;
    return 0;
}


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

bool f(const long kind, const size_t n, const vector<long>& a){
    map<long,long> c;
    for(size_t i=0; i<n-1; i++){
        if(a[i]>=a[i+1]){
            c.erase(c.lower_bound(a[i+1]), c.end());
            long j=a[i+1]-1;
            c[j]++;
            for(;;){
                if(c[j] < kind){
                    break;
                }else if(j<=0){
                    return false;
                }else{
                    c[j]=0;
                    c[j-1]++;
                    j--;
                }
            }
        }
    }
    return true;
}

bool strict_increasing(const vector<long>& a){
    size_t n = a.size();
    for(size_t i=1; i<n; i++){
        if(a[i-1]>=a[i]){
            return false;
        }
    }
    return true;
}

int main(void){
    long n;
    cin >> n;
    vector<long> a(n);
    for(long i=0; i<n; i++){
        cin >> a[i];
    }
    if(strict_increasing(a)){
        cout << 1 << endl;
        return 0;
    }
    long left=1, right=n;
    for(;;){
        const long mid = (left+right)/2;
        if(right-left<=1){
            if(f(right, n, a)){
                cout << right << endl;
            }else{
                cout << left << endl;
            }
            return 0;
        }
        const bool b = f(mid, n, a);
        //printf("[%ld, %ld] %ld %s\n", left, right, mid, b ? "true" : "false");
        if(b){
            right=mid;
        }else{
            left=mid;
        }
    }
}


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

int main() {
    // 入力
    size_t N;
    int T;
    cin >> N >> T;
    vector<int> A(N);
    for (int &Ai : A) cin >> Ai;

    // 部分最小値
    vector<int> partial_min_A(N, A.at(0UL));
    for (size_t i = 1UL; i < N; i++) {
        if (A.at(i) <= partial_min_A.at(i - 1UL)) {
            partial_min_A.at(i) = A.at(i);
        } else {
            partial_min_A.at(i) = partial_min_A.at(i - 1UL);
        }
    }

    // りんご１個あたりの最大利益
    int max_profit_per_apple = 0;
    for (size_t i = 1UL; i < N; i++) {
        int current_town_profit = A.at(i) - partial_min_A.at(i - 1UL);
        max_profit_per_apple = max(max_profit_per_apple, current_town_profit);
    }

    // りんご１個あたりの利益が最大となる組み合わせの数
    int ans = 0;
    for (size_t i = 1UL; i < N; i++) {
        int current_town_profit = A.at(i) - partial_min_A.at(i - 1UL);
        if (max_profit_per_apple == current_town_profit) ++ans;
    }

    // 出力
    cout << ans << "\n";

    return 0;
}


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

using namespace std;
int main()
{
    string s1;
    string s2;
    cin>>s1>>s2;
    int ans=0;
    for(int i=0;i<3;i++){
        if(s1[i]==s2[i])
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
#define all(a)  (a).begin(),(a).end()
#define mod 1000000007
#define inf 2147483647
#define range(x,a,b) (a)<=x&&x<=(b)
int main(){
	int n,m;
	cin>>n>>m;
	int h[n+1];
	rep(i,n)cin>>h[i+1];
	int a,b;
	int good[n+1];
	rep(i,n+1)good[i]=1;
	rep(i,m){
		cin>>a>>b;
		if(h[a]>=h[b]){
			good[b]=0;
		}
		if(h[a]<=h[b]){
			good[a]=0;
		}
	}
	int count=0;
	rep(i,n)count+=good[i+1];
	cout<<count;
	return 0;
}

Measured memory_bytes: 4396
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
    for (T &x : vec)
        is >> x;
    return is;
}

ll gcd(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    while (m != n)
    {
        if (m > n)
            m = m - n;
        else
            n = n - m;
    }
    return m;
}

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

int ctoi(const char c)
{
    if ('0' <= c && c <= '9')
        return (c - '0');
    return -1;
}

int main(){
    ll n, p;
    cin >> n >> p;
    vector<ll> sosuu;
    sosuu.push_back(2);

    if(n==1){
        cout << p << endl;
        return 0;
    }

    for (int i = 3; i <= 1000000; i += 2)
    {
        if (p % i == 0)
        {
            bool flg = true;
            for (int j = 0; j < sosuu.size(); ++j)
            {
                if (i % sosuu[j] == 0)
                    flg = false;
            }
            if (flg == true)
                sosuu.push_back(i);
        }
    }

    ll ans=1;
    //cout << sosuu.size() << endl;
    REP(i, sosuu.size()){
        //cout << sosuu[i] << endl;

        ll res_p = p;
        ll divider = pow(sosuu[i], n);
        while(res_p % divider ==0){
            res_p /= divider;
            ans *= sosuu[i];
        }    
    }

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(a) int((a).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

#define _deb(x) cout<<x;
void _print() {cerr << "]\n";} template <typename T, typename... V>void _print(T t, V... v) {_deb(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
template <class T, class U> void print_m(const map<T,U> &m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}
template<class T, class U>void debp(const pair<T, U> &pr, bool end_line=1){cout<<"{"<<pr.first<<" "<<pr.second<<"}"; cout<<(end_line ? "\n" : ", ");}
template <class T> void print_vp(const T &vp, int sep_line=0){if(vp.empty()){cout<<"Empty"<<endl; return;}if(!sep_line) cout<<"{ ";for(auto x: vp) debp(x,sep_line);if(!sep_line) cout<<"}\n";cout<<endl;}
template <typename T>void print(const T &v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<sz(v); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<endl;}
template <typename T>void print_vv(const T &vv){if(sz(vv)==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<sz(*vv.begin()); j++)cout<<setw(w)<<j<<" ";cout<<endl;int i = 0;for(auto &v: vv){cout<<i++<<" {";for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<"},\n";}cout<<endl;}

int main(){
    int X, Y;
    while(cin>>X>>Y){
        bool yes = false;
        for(int c=0; c<=300; ++c){
            for(int t=0; t<=300; ++t){
                int e1 = 2*c+ 4*t;
                int e2 = c + t;
                if(e1==Y && e2==X){
                    yes = true;
                }
            }
        }

        cout<<(yes ? "Yes\n" : "No\n");
    }
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define chmax(a,b) if(a<b)a=b
#define LL long long
const int N=2e5+5;

int n;
LL dp[N],c[N];
int a[N],b[N];
void update(int i,LL x)
{
	while(i<=n)
	{
		chmax(c[i],x);
		i+=i&(-i);
	}
}
LL getmx(int i)
{
	LL mx=0;
	while(i)
	{
		chmax(mx,c[i]);
		i-=i&(-i);
	}
	return mx;
}

int main()
{
	
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",a+i);
	for(int i=1;i<=n;i++)
		scanf("%d",b+i);
	for(int i=1;i<=n;i++)
	{
		dp[i]=b[i]+getmx(a[i]);
		update(a[i],dp[i]);
	}
	printf("%lld\n",getmx(n));
	
	return 0;
}

Measured memory_bytes: 4992
module Main where

import           Control.Monad
import           Debug.Trace
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM
import           Data.List
import qualified Data.ByteString               as BS
import qualified Data.ByteString.Char8         as BSC8
import           Data.Char
import           Data.Maybe
import           Data.Ord
import qualified Data.Array                    as A
import qualified Data.Array.Unboxed            as AU
import qualified Data.Array.IO                 as AIO



getvuil :: IO (VU.Vector Int)
getvuil = VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
readi :: BSC8.ByteString -> Int
readi = fst . fromJust . BSC8.readInt
readil :: BSC8.ByteString -> [Int]
readil = map readi . BSC8.words
geti :: IO Int
geti = readi <$> BSC8.getLine
getil :: IO [Int]
getil = readil <$> BSC8.getLine

getNis :: Int -> IO [(Int, BSC8.ByteString)]
getNis 0 = return []
getisl n = do
    [aFst, aSnd] <- BSC8.words <$> BSC8.getLine
    next         <- (getisl (n - 1))
    return ((readi aFst, aSnd) : next)

il2ss :: [Int] -> String
il2ss = unwords . map show

il2sn :: [Int] -> String
il2sn = unlines . map show

main :: IO ()
main = do
    aS  <- getLine
    aQ  <- geti
    aQD <- getQuery aQ
    let (rF, rB, rR) = foldl
            (\acc@(f, b, r) x ->
                let (q1, q2, q3) = x
                in  if q1 == 1
                        then (f, b, not r)
                        else if q2 == 1
                            then if r == False
                                then ((q3 !! 0 : f), b, r)
                                else (f, (q3 !! 0 : b), r)
                            else if r == True
                                then ((q3 !! 0 : f), b, r)
                                else (f, (q3 !! 0 : b), r)
            )
            ("", "", False)
            aQD
    putStrLn
        (if rR == False
            then rF ++ aS ++ (reverse rB)
            else rB ++ (reverse aS) ++ (reverse rF)
        )

getQuery :: Int -> IO [(Int, Int, String)]
getQuery aQ = mapM
    (\_ -> do
        x <- BSC8.words <$> BSC8.getLine
        return
            (if x !! 0 == (BSC8.pack "1")
                then (1, 0, "")
                else (2, (readi (x !! 1)), BSC8.unpack (x !! 2))
            )
    )
    [1 .. aQ]


Measured memory_bytes: 156284
#include<stdio.h>
int main(void)
{
  int k;
  int count=0;
  scanf("%d",&k);
  for(int i=1;i<=k;i++){
    for(int j=1;j<=k;j++){
      if(i%2==0&&j%2==1){
        count++;
      }
    }
  }

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

  return 0;
}


Measured memory_bytes: 128
N = gets.chomp.to_i
str = gets.split
a = Array.new(N)
for i in 0...N do
    a[i] = str[i].to_i
end

n = 1
for i in 0...N do
    if a[i] == n
        n += 1
    end
end
if n == 1
    puts -1
else
    answer = N - n + 1
    puts answer
end

Measured memory_bytes: 15364
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

const int INF = 1e9+5;

int main(){
  int d,n;
  cin >> d >> n;
  ll res = 1;
  rep(i,d) res*=100;
  ll tmp = res;
  rep(i,n-1) res+=tmp;
  if(n==100) res = (ll)101*pow(100,(double)d);
  cout << res<<endl;
}

Measured memory_bytes: 256
N = int(input())
a_list = list(map(int, input().split()))
c = 0

for i in range(N):
    if a_list[i]  % 2 != 0:
        a = 1
    else:
        if (a_list[i] % 3 != 0) and (a_list[i] % 5 != 0):
            c = 1
        else:
            a = 1


if c == 1:
    print("DENIED")
else:
    print("APPROVED")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(void){
	int n, k;

	cin >> n >> k;

	vector<int> l(n);

	for (int i = 0; i < n; i++)
		cin >> l[i];

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


	int sum = 0;

	for (int i = n-1; i > n-k-1; i--)
		sum += l[i];


	cout << sum << endl;
}

Measured memory_bytes: 256
object Main extends App{
  val firstLine = readLine.split(" ").map(_.toInt)
  val N = firstLine(0)
  def checkNextLine(acc: Array[String], remainingCount: Int): Array[String] = {
    if (remainingCount == 0 || acc.size == 0) {
      return acc
    }
    val nextLikes = readLine.split(" ").tail
    checkNextLine(acc.filter(l => nextLikes.contains(l)), remainingCount - 1)
  }
  
  println(checkNextLine(readLine.split(" ").tail, N - 1).size)
}

Measured memory_bytes: 27196
// AOJ ALDS1_10_C Longest Common Subsequence
// 2018.4.27 bal4u

#include <stdio.h>
#include <stdlib.h>

// Longest Common Subsequence
int c[1005][1005];
int LCS(char *x, int m, char *y, int n)
{
	int i, j;

	for (i = 0; i <= m; i++)  c[i][0] = 0;
	for (j = 0; j <= n; j++)  c[0][j] = 0;

	for (i = 1; i <= m; i++) for (j = 1; j <= n; j++) {
		if (x[i-1] == y[j-1]) c[i][j] = c[i-1][j-1] + 1;
		else if (c[i-1][j] >= c[i][j-1]) c[i][j] = c[i-1][j];
		else                             c[i][j] = c[i][j-1];
	}
	return c[m][n];
}

char x[1005], y[1005];

int main()
{
	int q, lx, ly;
	char *p;

	fgets(x, 10, stdin);
	q = atoi(x);
	while (q--) {
		fgets(p=x, 1005, stdin);
		while (*p > ' ') p++;
		*p = 0, lx = p-x;

		fgets(p=y, 1005, stdin);
		while (*p > ' ') p++;
		*p = 0, ly = p-y;

		printf("%d\n", LCS(x, lx, y, ly));
	}
	return 0;
}



Measured memory_bytes: 5584