akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
int main(){
    int n;
    while(cin>>n){
        ll ans=0;
        bool l=1;
        for(int i=0; i<n; ++i){
            scanf("%d",a+i);
            if(a[i]%2==0 && (a[i]%3 && a[i]%5)){
            	l=0;
            }
        }
        if(l){
        	cout<<"APPROVED"<<endl;
        }
        else{
        	cout<<"DENIED"<<endl;
        }
    }
  return 0;
}




Measured memory_bytes: 256
#include <iostream>

using namespace std;

main(){
  int data1[55];
  int data2[100];

  for(int i=0;i<55;i++){
    data1[i]=i*i*i;
  }
  for(int i=0;i<100;i++){
    data2[i]=i*(i+1)*(i+2)/6;
  }

  while(1){
    int n;
    cin >> n;
    if(n==0) break;

    int max=-1;
    int tmp;
    for(int i=0;i<55;i++){
      if(data1[i]>n) break;
      for(int j=0;j<100;j++){
	tmp=data1[i]+data2[j];
	if(tmp>n) break;
	if(max<tmp) max=tmp;
      }
    }
    cout << max << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )
#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

const int INF = INT_MAX / 2;

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

	for ( string str; cin >> str, str != "#"; )
	{
		const int N = str.size();

		vector<VVI> dp( N + 1, VVI( 2, VI( 3, INF ) ) );
		fill( ALL( dp[0][0] ), 0 );
		fill( ALL( dp[0][1] ), 0 );

		REP( i, 0, N )
		{
			REP( j, 0, 2 )
			{
				REP( k, 0, 3 )
				{
					const int nextx = ( str[i] - '0' - 1 ) % 3;
					if ( j == 0 && nextx < k || j == 1 && k < nextx )
					{
						dp[ i + 1 ][j][ nextx ] = min( dp[ i + 1 ][j][ nextx ], dp[i][j][k] + 1 );
					}
					else
					{
						dp[ i + 1 ][ ( j + 1 ) % 2 ][ nextx ] = min( dp[ i + 1 ][ ( j + 1 ) % 2 ][ nextx ], dp[i][j][k] );
					}
				}
			}
		}

		const int res1 = *min_element( ALL( dp.back()[0] ) );
		const int res2 = *min_element( ALL( dp.back()[1] ) );
		cout << min( res1, res2 ) << endl;
	}

	return 0;
}

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

using namespace std;

constexpr int MAX = 334;
constexpr int INF = (1 << 29);

int memo[MAX][MAX];
vector<int> w;

int rec(int L, int R)
{
    int &res = memo[L][R];
    if (res != -1) return res;
    if (L >= R) return (res = 0);
    
    res = -INF;
    
    if (abs(w[L] - w[R]) <= 1) {
        int r = rec(L + 1, R - 1);
        if (r == (R - 1) - (L + 1) + 1) {
            res = max(res, r + 2);
        }
    }
    
    for (int i = L; i <= R; i++) {
        res = max(res, rec(L, i) + rec(i+1, R));
    }   
    return res;
}

int main()
{
    int N;
    while (cin >> N, N) {
        w.resize(N);
        for (int i = 0; i < N; i++) {
            cin >> w[i];
        }
        
        memset(memo, -1, sizeof(memo));
        cout << rec(0, N - 1) << endl;
    }
    return 0;
}

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

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

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

void gen_sosuu(int sosuu[]){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}

char a,b;

int main(){
  scanf("%c %c",&a,&b);
  if(a=='H'){
    printf("%c\n",b);
  }else{
    if(b=='H'){
      printf("D\n");
    }else{
      printf("H\n");
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n;i++)
#define ll long long
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c;cin>>a>>b>>c;
  if(a+b+c>21)
    cout<<"bust";
  else
    cout<<"win";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
 
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 
int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
 
long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}

long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }



int collatz(int n){
    int a=n;
    if(a%2 == 0)a/=2;
    else a = a*3+1;
    return a;
}

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

    vector<long long>h(N);
    rep(i,N)cin >> h[i];
    sort(h.begin(),h.end());

    long long ans = h.back();

    for(int i =0; i+(K-1) <N; i++){
        ans = min(ans,h[i+(K-1)]-h[i]);
    }

    cout << ans << endl;




}



Measured memory_bytes: 4052
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;

void main(){
	auto N=readln.chomp.to!int;
	auto K=readln.chomp.to!int;
	auto X=readln.chomp.to!int;
	auto Y=readln.chomp.to!int;
	if(N>K){
	writeln(X*K+(N-K)*Y);
}
    else writeln(N*X);
}

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

int n;

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> n;
    vector<ll> a(n);
    bool odd = false;
    ll sum = 0;
    for (auto& i : a) {
        cin >> i;
        if (i % 2) odd = true;
    }
    odd ? cout << "first" : cout << "second";
}

    



Measured memory_bytes: 1024
s = input()
t = input()
 
check2 = False
ans = []
for i in range(len(s)-len(t)+1):
    check = s[i: i+len(t)]
    flag = True
    for j in range(len(t)):
        if check[j] != '?' and check[j] != t[j]:
            flag = False
    if flag:
        a = s[0:i] + t + s[i+len(t):len(s)]
        a = a.replace('?','a')
        ans.append(a)
 
if ans == []:
    print('UNRESTORABLE')
else:
    print(sorted(ans)[0])

Measured memory_bytes: 3064
S = input()
T= input()
ans=0
if T in S:
  ans=0
  
S=list(S)
T=list(T)


S_pattern=[]
pre=0
lat=len(T)
while True:
  S_pattern.append(list(S[pre:lat]))
  pre+=1
  lat+=1
  if lat==len(S)+1:
    break

scores=[]
for i in S_pattern:
  score=0
  for k in range(len(i)):
    if T[k] != i[k]:
      i[k] = T[k]
      score+=1
  scores.append(score)
  
print(min(scores))
   
      

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

int main()
{
	int n;
	string s;
	cin >> n;
	cin >> s;
	int totl = 0, totr = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == '(') totl++;
		else
		{
			if (totl > 0) totl--;
			else totr++;
		}
	}
	for (int i = 0; i < totl; i++) s = s + ')';
	for (int i = 0; i < totr; i++) s = '(' + s;
	cout << s << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

ll lcm(ll a,ll b)
{
    return (a*b)/(__gcd(a,b));
}

int main()
{
    ll a,b,c,d,div_c,div_d;

    cin>>a>>b>>c>>d;

    div_c=b/c-(a-1)/c;
    div_d=b/d-(a-1)/d;

    ll cnt=div_c+div_d-(b/lcm(c,d))+(a-1)/lcm(c,d);

    cout << abs(b-a+1-cnt)<<endl;

    return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().trim.toInt
  
  val preorders = StdIn.readLine().split(' ').map(_.toInt)
  val inorders = StdIn.readLine().split(' ').map(_.toInt)
  val postorders = Array.fill[Int](n)(0)
  
  var position = 0
  var positionResult = 0

  def reconstruction(left: Int, right: Int): Unit = {
    if(left < right){
      val current = preorders(position)
      position += 1
      val middleIdx = inorders.indexOf(current)
      reconstruction(left, middleIdx)
      reconstruction(middleIdx + 1, right)
      postorders(positionResult) = current
      positionResult += 1
      
    } else ()
  }
  
  reconstruction(0, n)
  
  println(postorders.mkString(" "))
  
}



Measured memory_bytes: 44160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int,int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
/*--------------------------------------------*/

int main(){
    //cout << fixed << setprecision(10)
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;

    int N = sz(s);

    string a;

    rep(i,N){
        if(s[i] == '0' || s[i] == '1'){
            a.PB(s[i]);
        }else{
            if(!a.empty())a.erase(--a.end());
        }
    }

    cout << a << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>
#include<numeric>

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
const ll INF = 1e18+1;



int main() {
    int Q; cin >> Q;
    vector<int> l(Q), r(Q), S(1e5+1,0);
    for (int i = 0; i < Q; i++) cin >> l[i] >> r[i];

    vector<bool> isprime(1e5+1,true);
    isprime[0] = isprime[1] = false;
    for (int n = 2; n <= 1e5; n++) {
        if (isprime[n]) {
            for (int k = 2*n; k <= 1e5; k += n) {
                isprime[k] = false;
            }
        }
    }
    vector<bool> isvalid(1e5+1,false);
    for (int n = 3; n <= 1e5; n += 2) {
        if (isprime[n] && isprime[(n+1)/2]) isvalid[n] = true;
    }

    for (int i = 3; i <= 1e5; i++) {
        S[i] = S[i-1] + isvalid[i];
    }

    for (int i = 0; i < Q; i++) {
        cout << S[r[i]] - S[l[i]-1] << endl;
    }


}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	
	char x, y;
	cin >> x >> y;
	string ans;
	if(x == y) ans = "=";
	else if(x > y) ans = ">";
	else ans = "<";
	cout << ans << endl;
	return 0;
}

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

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

int main(){
    int n;
    int ans=0;
    cin>>n;
    int p[n];

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

    qsort(p, n, sizeof(int), compare_int);

    cout<<p[n/2]-p[n/2-1]<<endl;


}


Measured memory_bytes: 1020
MOD = 1000000007


def mod_inv(mod, a):
    old_t, t = 0, 1
    old_r, r = mod, a

    while r != 0:
        quotient = old_r // r

        old_r, r = r, old_r - quotient * r
        old_t, t = t, old_t - quotient * t

    return old_t % mod


def combine(n, k, mod):
    if k > n // 2:
        k = n - k
    u = 1
    for i in range(n - k + 1, n + 1):
        u = u * i % mod

    v = 1
    for i in range(1, k + 1):
        v = v * i % mod

    return u * mod_inv(mod, v) % MOD


def main():
    X, Y = map(int, input().split())
    m1 = X + Y
    if m1 % 3 == 0:
        m = m1 // 3
        if X < m or Y < m:
            print(0)
        else:
            print(combine(m, X - m, MOD))
    else:
        print(0)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62524
/**
*    created: 06.07.2020 18:15:19
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
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;}
const long double pi = acos(-1.0);
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int a, b; cin >> a >> b;
    if (a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0) {
        cout << "Possible" << endl;
    }
    else cout << "Impossible" << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int n;
  vector<int> a(1000,0);
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=n-1;i>=0;i--){
    cout<<a[i]<<" \n"[i==0];
  }
  return(0);
}
 


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long INF = 1e15;
using namespace std;
typedef long long ll;

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool is_prime(ll x) {
  for (ll i = 2; i * i <= x; i++) {
    if (x % i == 0) return false;
  }
  return true;
}

int main() {
  ll a, b;
  cin >> a >> b;
  ll mn = sqrt(min(a, b));
  auto d = divisor(min(a, b));
  ll mx = max(a, b);
  ll ans = 0;
  for (auto x : d) {
    if (mx % x == 0 && is_prime(x)) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
# define ll long long
# define ld long double
# define pb push_back
#define F first
#define S second
#define vi vector <int>
#define vl vector <ll>
 
// #define loop(i,n) for(int i=0;i<n;i++)
// #define loops(i,s,n) for(int i=s;i<=n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
 
  
    // for(int i=0;i<n;i++){  
        
    //     int x,y;
    //     cin>>x>>y;
        
    //     v.pb({x,y});         //make pair in vector
    // }
 
using namespace std;
 
#define P 1000000007
priority_queue<int, vector<int>, greater<int> > Q;
 
const int INF= 1e9+9;
int main()
{ ll a,b,c,k;
	cin>>a>>b>>c>>k;

	if(k<=a)
		{ cout<<k<<"\n"; }
	else
	{ ll ans=0;
		ans+=a;
		k=k-a;
		if(k>0)
			{ k=k-b;}
		if(k>0)
			{ ans=ans-k;  }

       // if(ans>=0)
       // {cout<<ans<<"\n";}
       // else
       // 	{cout<<0<<"\n";}

		cout<<ans<<"\n";
	}
 
 
	
} 

Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>

using namespace std;

long long mod = 1e9+7;
vector<long long> fact;
vector<long long> factinv;

void initfact(long long n) {
  fact.push_back(1);
  for (long long i = 1; i < n+1; i++) {
    fact.push_back((fact.back()*i)%mod);
  }
}

long long sqr(long long n) {
  return n*n%mod;
}

long long bipow(long long c, long long n) {
  if (n == 0) {
    return 1;
  } else if(n == 1) {
    return c;
  } else if(n%2 == 0) {
    return sqr(bipow(c, n/2))%mod;
  } else {
    return (c*sqr(bipow(c, (n-1)/2)))%mod;
  }
}

void initfactinv() {
  factinv.push_back(bipow(fact.back(), mod-2));
  for (long long i = fact.size()-1; i > 0; i--) {
    factinv.push_back((factinv.back()*(i))%mod);
  }
  reverse(factinv.begin(), factinv.end());
}

long long C(long long n, long long m) {
  if (n < m) {
    return 0;
  }
  return (((fact[n]*factinv[m])%mod)*factinv[n-m])%mod;
}

int main() {
  long long n, m, k;

  std::cin >> n >> m >> k;

  initfact(n*m-2);
  initfactinv();

  long long ans = 0;

  for (int i = 1; i < n; i++) {
    ans += ((((((n-i) * m) % mod) * m) % mod) * i) % mod;
    ans %= mod;
  }

  for (int i = 1; i < m; i++) {
    ans += ((((((m-i) * n) % mod) * n) % mod) * i) % mod;
    ans %= mod;
  }

  ans *= C(n*m-2, k-2);
  ans %= mod;

  std::cout << ans << std::endl;

  return 0;
}



Measured memory_bytes: 4848
#include<iostream>
using namespace std;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(true){
    	c-=b;
    	if(c<=0){
    		cout<<"Yes";
    		return 0;
		}
		a-=d;
		if(a<=0){
			cout<<"No";
		    return 0; 
		}
	}
}

Measured memory_bytes: 3572
x,n = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
#print(p)
memo1 = [0]*100
memo2 = [0]*100
a,b = 1000,1000
if n == 0:
    print(x)
    exit()
for i in range(100):
    memo1[i] = abs(i-x)
    memo2[i] = abs(i+x)
    if memo1[i] not in p:
        a = memo1[i]
        i1 = i
        break
    elif memo2[i] not in p:
        b = memo2[i]
        i2 = i
        break
if a<=b:
    print(a)
else:
    print(b)

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

int main() {
  int a, b;
  cin >> a >> b;
  string s(b,'0'+a);
  string t(a,'0'+b);
  cout << min(s,t) << endl;
  return 0;
}


Measured memory_bytes: 256
S=input()
rS=S[::-1]

le=len(S)
cent=int((le+1)/2)

S1=S[0:cent-1]
S2=S[cent:]
rS1=S1[::-1]
rS2=S2[::-1]

if S==rS and S1==rS1 and S2==rS2:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 9028
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	while (1) {
		auto x = readln.chomp.split.map!(to!int);
		if (x[0] == 0) break;
		int res;
		foreach	(i; 1..x[2]) {
			foreach (j; i..x[2]) {
				auto pl = i * (100+x[0]) / 100 + j * (100+x[0]) / 100;
				if (pl == x[2]) {
					auto npl = i * (100+x[1]) / 100 + j * (100+x[1]) / 100;
					res = max(res, npl);
				}
			}
		}
		res.writeln;	
	}
}

Measured memory_bytes: 1052
ls = list(input().split())


class Stack:
    def __init__(self):
        self.stack = []

    def push(self, item):
        self.stack.append(item)

    def pop(self):
        if len(self.stack) == 0:
            return None
        return self.stack.pop()


stack = Stack()
for s in ls:
    if s in ['+', '-', '*']:
        v2 = stack.pop()
        v1 = stack.pop()
        stack.push(str(eval(v1+s+v2)))
    else:
        stack.push(s)
print(stack.stack[0])



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

int main(){
	int N, K;
	cin >> N >> K;
	int h[N];
	for(int i=0;i<N;i++){
		cin >> h[i];
	}
	sort(h, h+N);
	int MIN = 1000000000;
	for(int i=0;i+K-1<N;i++){
		MIN = min(MIN, h[i+K-1] - h[i]);
	}
	cout << MIN << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int [] h = new int[n];
        for (int i = 0 ; i < n ; i++) {
            h[i] = sc.nextInt();
        }
        int c = 0;
        int max = 0;
        for (int l = 0 ; l < n ; l++) {
            while (l < n - 1 && h[l] >=  h[l + 1]) {
                c++;
                l++;
            }
            max = Math.max(max, c);
            c = 0;
        }
        System.out.println(max);
    }

}

Measured memory_bytes: 50528
#include<bits/stdc++.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
using namespace std;

int main(){
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;

  cout << s1.substr(0,1) + s2.substr(1,1) + s3.substr(2,1) << endl;

  return 0;
}



Measured memory_bytes: 256
import numpy as np

N = int(input())
A = list(map(int, input().split()))
exist = [0] * (10**6 + 1)
for a in A:
    exist[a] += 1

if np.gcd.reduce(A) != 1:
    print('not coprime')
elif np.all([sum(exist[i::i]) <= 1 for i in range(2, 10**6+1)]):
    print('pairwise coprime')
else:
    print('setwise coprime')

Measured memory_bytes: 150048
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>

using namespace std;

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

long int inv[200001];

// a^n mod を計算する
long int modpow(long int a, long int n, long int mod) {
    long int res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = (a * a) % mod;
        n >>= 1;
    }
    return res;
}

long int modcomb(long int a, long int b, long int mod){
    long int res = 1;
    for(long int i = a; i > a - b; i--){
        res *= i % mod;
        res %= mod;
    }
    res %= mod;

    
    for(long int i = 1; i <= b; i++){
        if (inv[i] == 0) {
            inv[i] = modpow(i, mod - 2, mod);
        }
        res *= inv[i] % mod;
        res %= mod;
    }
    res %= mod;
    // cout << res << endl;
    return res;
}



int main(){
    long int n, k;
    cin >> n >> k;
    long int ans;
    long int mod = 1000000007;
    fill(inv, inv + n + 1, 0);
    if (k >= n - 1) {
        ans = modcomb(2 * n - 1, n - 1, mod);
    }else{
        ans = 1;
        long int com = modcomb(n, k, mod) * modcomb(n - 1, k, mod);
        com %= mod;
        ans += com;
        // cout << ans << endl;
        // cout << com << endl;
        for(long int i = k; i > 1; i--){
            com *= (((modpow(n - i + 1, mod - 2, mod) * modpow(n - i, mod - 2, mod)) % mod) * ((i * i) % mod)) % mod;
            // cout << ((modpow(n - i + 1, mod - 2, mod) * modpow(n - i, mod - 2, mod)) % mod) * ((i * i) % mod) << endl;
            com %= mod; 
            
            ans += com;
            ans %= mod;
            // cout << ans << endl;
        }
        
    }

    
    // cout << (modcomb(2 * k + 1, k, mod) - 1) << endl;
    // cout << modcomb(n, k, mod) << endl;
    cout << ans << endl;
    
    

    
}

Measured memory_bytes: 1792
#include <cstdio>

int main()
{
    int a,b,c;
    int n[20] = { 0 };
    scanf("%d %d %d", &a, &b, &c);
    n[a]++;
    n[b]++;
    n[c]++;
    if (n[5] == 2 && n[7] == 1) {
        printf("YES\n");
    }
    else {
        printf("NO\n");
    }
} 

Measured memory_bytes: 128
from fractions import gcd
def lcm(a,b):
    return a*b//gcd(a,b)
def main():
    a,b,c,d=map(int,input().split())
    a-=1
    e=a-a//c-a//d+a//lcm(c,d)
    f=b-b//c-b//d+b//lcm(c,d)
    print(f-e)
if __name__=="__main__":
    main()

Measured memory_bytes: 5048
N = int(input())
S = list(str(input()))

a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
a = list(a)
answer = []
for i in range(len(S)):
  num = a.index(S[i])
  num_next = (num+N)%26
  answer.append(a[num_next])
answer = ''.join(answer)
print(str(answer))

Measured memory_bytes: 3188
import java.text.DecimalFormat;
import java.util.*;
import java.io.*;
public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
	int[] list = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
	int A = list[0];
	int B =list[1];
	int H = list[2];
	int M = list[3];
	double deg_min = M * (Math.PI/30.0);
       	double deg_hrs = (H + (M/60.0))*(Math.PI/6.00);	
	double angle = Math.abs(deg_min-deg_hrs);
	double result = Math.sqrt(A*A + B*B -  2*A*B*Math.cos(angle));
	DecimalFormat dec = new DecimalFormat("#0.000000000");
	System.out.println(dec.format(result));
	}
}


Measured memory_bytes: 35944
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;
void insert(int a[],int n){
	for(int i=1;i<=n;i++){
		if(i>1)cout<<" ";
		cout<<a[i];
	}
	cout<<endl;
}
int main(){
	int n;
	int a[100]={0};
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	insert(a,n);
	for(int j=2;j<=n;j++){
		int v=a[j];
		int i=j-1;
		while(i>0&a[i]>v){
			a[i+1]=a[i];
			i--;
		}
		a[i+1]=v;
		insert(a,n);
	}

	return 0;
}

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

int main()
{
    int a, b;
    string s;
    cin >> a >> b >> s;

    bool ok = true;
    rep (i, a + b + 1)
        if (i == a)
        {
            if (s[i] == '-')
                continue;
            ok = false;
        }
        else if ((int)(s[i] - '0') < 0 || (int)(s[i] - '0') > 9)
            ok = false;

    cout << (ok == true ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3576
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <utility>

#define INF 1000000000000000

using namespace std;

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

int e, v, r;
struct edge{ lli to, cost; };
vector<edge> G[100000];
lli d[100000];

void dijkstra(int s){
	priority_queue< P, vector<P>, greater<P> > que;
	fill(d, d+v, INF);
	d[s] = 0;
	que.push(P(0, s));
	while(!que.empty()){
		P p = que.top(); que.pop();
		if(d[p.second] < p.first) continue;
		for(int i = 0;i < G[p.second].size();i++){
			edge ed = G[p.second][i];
			if(d[ed.to] > d[p.second] + ed.cost){
				d[ed.to] = d[p.second] + ed.cost;
				que.push(P(d[ed.to], ed.to));
			}
		}
	}
}

int main(void){
	cin >> v >> e >> r;
	for(int i = 0;i < e;i++){
		int s, t, d;
		cin >> s >> t >> d;
		edge e;
		e.to = t; e.cost = d;
		G[s].push_back(e);
	}
	dijkstra(r);
	for(int i = 0;i < v;i++){
		if(d[i] != INF)
			cout << d[i] << endl;
		else
			cout << "INF" << endl;
	}
	return 0;
}

Measured memory_bytes: 16672
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;

class RAQ{
	public:
	int n;
	vector<ll> dat, dat2;
	RAQ(){}
	RAQ(int size){
		n = 1;
		while(n < size) n *= 2;
		dat.resize(2 * n - 1, 0);
		dat2.resize(2 * n - 1, 0);
	}
	void add(int l, int r, ll x){
		rangeAdd(l, r + 1, x, 0, 0, n);
	}
	void rangeAdd(int a, int b, ll x, int k, int l, int r){
		if(a <= l && r <= b){
			dat[k] += x;
		}else if(l < b && a < r){
			dat2[k] += (min(b, r) - max(a, l)) * x;
			rangeAdd(a, b, x, 2 * k + 1, l, (l + r) / 2);
			rangeAdd(a, b, x, 2 * k + 2, (l + r) / 2, r);
		}
	}
	ll getSum(int s, int t){
		return query(s, t + 1, 0, 0, n);
	}
	ll query(int a, int b, int k, int l, int r){
		if(r <= a || b <= l) return 0;
		if(a <= l && r <= b) return dat[k] * (r - l) + dat2[k];
		else{
			ll ret = (min(b, r) - max(a, l)) * dat[k];
			ll vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
			ll vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
			return ret + vl + vr;
		}
	}
};

int main(){
	int n, q;
	cin >> n >> q;
	RAQ raqa(n);
	for(int i = 0; i < q; i++){
		int com;
		cin >> com;
		if(com == 0){
			int x, y; ll a;
			cin >> x >> y >> a;
			x--; y--;
			raqa.add(x, y, a);
		}else if(com == 1){
			int x;
			cin >> x;
			x--;
			cout << raqa.getSum(x, x) << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 7020
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Q = sc.nextInt();
		String S = sc.next();

		int dp[] = new int[N];
		int cnt = 0;
		for (int i = 1; i < N; i++) {
			if (S.charAt(i - 1) == 'A' && S.charAt(i) == 'C') {
				cnt++;
			}
			dp[i] = cnt;
		}
		for (int i = 0; i < Q; i++) {
			int l = sc.nextInt() - 1;
			int r = sc.nextInt() - 1;
			System.out.println(dp[r] - dp[l]);
		}
	}
}


Measured memory_bytes: 65928
// 特殊な剰余と原始根
// (924844033, 5)
// (998244353, 3)
// (1012924417, 5)
// (167772161, 3)
// (469762049, 3)
// (1224736769, 3)
#include <bits/stdc++.h>
using namespace std;

const int MOD = 998244353;
const int root = 3;

unsigned int add(const unsigned int x, const unsigned int y) { return (x + y < MOD) ? x + y : x + y - MOD; }

unsigned int sub(const unsigned int x, const unsigned int y) { return (x >= y) ? (x - y) : (MOD - y + x); }

unsigned int mul(const unsigned int x, const unsigned int y) { return (unsigned long long)x * y % MOD; }

unsigned int mod_pow(unsigned int x, unsigned int n) {
	unsigned int res = 1;
	while(n > 0) {
		if(n & 1) {
			res = mul(res, x);
		}
		x = mul(x, x);
		n >>= 1;
	}
	return res;
}

unsigned int inverse(const unsigned int x) { return mod_pow(x, MOD - 2); }

void ntt(vector<int>& a, const bool rev = false) {
	unsigned int i, j, k, l, p, q, r, s;
	const unsigned int size = a.size();
	if(size == 1) return;
	vector<int> b(size);
	r = rev ? (MOD - 1 - (MOD - 1) / size) : (MOD - 1) / size;
	s = mod_pow(root, r);
	vector<unsigned int> kp(size / 2 + 1, 1);
	for(i = 0; i < size / 2; ++i) kp[i + 1] = mul(kp[i], s);
	for(i = 1, l = size / 2; i < size; i <<= 1, l >>= 1) {
		for(j = 0, r = 0; j < l; ++j, r += i) {
			for(k = 0, s = kp[i * j]; k < i; ++k) {
				p = a[k + r], q = a[k + r + size / 2];
				b[k + 2 * r] = add(p, q);
				b[k + 2 * r + i] = mul(sub(p, q), s);
			}
		}
		swap(a, b);
	}
	if(rev) {
		s = inverse(size);
		for(i = 0; i < size; i++) {
			a[i] = mul(a[i], s);
		}
	}
}

vector<int> convolute(const vector<int>& a, const vector<int>& b) {
	const int size = (int)a.size() + (int)b.size() - 1;
	int t = 1;
	while(t < size) {
		t <<= 1;
	}
	vector<int> A(t, 0), B(t, 0);
	for(int i = 0; i < (int)a.size(); i++) {
		A[i] = a[i];
	}
	for(int i = 0; i < (int)b.size(); i++) {
		B[i] = b[i];
	}
	ntt(A), ntt(B);
	for(int i = 0; i < t; i++) {
		A[i] = mul(A[i], B[i]);
	}
	ntt(A, true);
	A.resize(size);
	return A;
}

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

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

	vector<int> a(n), b(m);

	rep(i, n) cin >> a[i];
	rep(i, m) { cin >> b[i]; }
	auto c = convolute(a, b);
	rep(i, n + m - 1) { cout << c[i] << " "; }
}

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

int main() {

	int a, b, c;

	cin >> a >> b >> c;

	if ((c > a && c < b) || (c < a && c > b)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
	
}

Measured memory_bytes: 256
import sys
def LS2():
    return list(sys.stdin.readline().rstrip())  #空白なし

s = LS2()

if s[0] == s[-1]:
    print('First' if len(s) % 2 == 0 else 'Second')
else:
    print('Second' if len(s) % 2 == 0 else 'First')

Measured memory_bytes: 66824
# include<iostream>

using namespace std;
int main(){
	int a = 0;
	int b = 0;
	while (1)
	{
		cin >> a >> b;
		if (a == 0 && b == 0){
			break;
		}
		for (int i = 0; i < a; i++){
			for (int it = 0; it < b / 2; it++){
				if (i % 2 == 0){
					cout << "#.";
				}
				else{
					cout << ".#";
				}
			}
			if (i % 2 == 0 && b % 2 == 1){
				cout << "#";
			}
			else if (i % 2 == 1 && b % 2 == 1){
				cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
}

Measured memory_bytes: 3100
#include <iostream>
using namespace std;
static const int maxs=100;
static const int infty=(1<<21);
static const int white=0;
static const int gray=1;
static const int black=2;

int n,m[maxs][maxs];

void dicstra(){
  int minv;
  int d[maxs],color[maxs];
  for(int i=0;i<n;i++){
    d[i]=infty;
    color[i]=white;
  }
  d[0]=0;
  color[0]=gray;
  while(1){
    minv=infty;
    int u=-1;
    for(int i=0;i<n;i++){
      if(minv>d[i]&&color[i]!=black){
	u=i;
	minv=d[i];
      }
    }
    if(u==-1)break;
    color[u]=black;
    for(int v=0;v<n;v++){
      if(color[v]!=black&&m[u][v]!=infty){
	if(d[v]>d[u]+m[u][v]){
	  d[v]=d[u]+m[u][v];
	  color[v]=gray;
	}
      }
    }
  }
  for(int i=0;i<n;i++){
    cout<<i<<" "<<(d[i]==infty?-1:d[i])<<endl;
  }
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      m[i][j]=infty;
    }
  }
  int k,c,u,v;
  for(int i=0;i<n;i++){
    cin>>u>>k;
    for(int j=0;j<k;j++){
      cin>>v>>c;
      m[u][v]=c;
    }
  }
  dicstra();
  return 0;
}

Measured memory_bytes: 3092
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            sum += a[i];
        }

        Arrays.sort(a);
        for (int i = 0; i < n; i++) {
            if (sum % 10 != 0) {
                break;
            }
            if (a[i] % 10 != 0) {
                sum -= a[i];
            }
        }
        System.out.println(sum % 10 == 0 ? 0 : sum);
    }
}


Measured memory_bytes: 23764
def main():
  number_cnt = int(input())
  max_1 = 0
  max_2 = 0
  max_1_index = 0
  for i in range(number_cnt):
    tmp = int(input())
    if tmp > max_1:
      max_2 = max_1
      max_1 = tmp
      max_1_index = i
    elif tmp > max_2:
      max_2 = tmp
  for i in range(number_cnt):
    if i == max_1_index:
      print(max_2)
    else:
      print(max_1)
    
main()

Measured memory_bytes: 4668
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int[] ingredients = new int[N];
        for (int i = 0; i < N; i++) ingredients[i] = in.nextInt();
        Arrays.sort(ingredients);

        float res = (float) (ingredients[0] + ingredients[1]) / 2;
        for (int i = 2; i < N; i++) res = (res + ingredients[i]) / 2;
        System.out.println(res);
    }
}


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

int main() {
  int n,m;
  cin>>n>>m;
  vector<int>vec(n);
  
  rep(i,m){
    int a,b;
    cin>>a>>b;
    vec.at(a-1)+=1;
    vec.at(b-1)+=1;  
  }
  rep(i,n){
    cout<<vec.at(i)<<endl;  
  }
}



Measured memory_bytes: 256
N = int(input())

lst = list(map(int, input().split()))

count = 0 #水をやる回数
def water(i, j): #lst[i:j]に水をやるとする
    count = 0
    #print ('A')
    #print ('lst', lst[i:j])
    #print ('i, j=', i, j)
    if i == j or lst[i:j] == [0]:
        #print ('X')
        return 0
    elif min(lst[i:j]) == 0: #lst[i:j]内の最小値が0の時
        a = lst[i:j].index(0)
        #print ('a=', a)
        #print ('B', count)
        count = water(i,i + a) + water(i + a+1, j)
        return count
    else: #lst[i:j]の最小値が0でない時
        for x in range(i,j):
            lst[x] = lst[x] - 1
        #print ('C', count)
        count += 1 + water(i, j)
        return count

print(water(0, N))



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

int main()
{
	long long N,d[100],i,j,n,m,r,s;
	while(cin>>N)
	{
		for(i=0;i<N;i++)
		{
			cin>>d[i];
		}
		for(i=0,m=0;i<N;i++)
		{
			for(j=1,n=0;j<N;j++)
			{
				if(i>=j){
					continue;
				}
				r=d[i]*d[j];
				n=n+r;
			}
			m=m+n;
		}
		cout<<m<<endl;
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

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

using namespace std;

vector<int> a, b, c, d;

int check(const vector<int> &cur) {
    int point = 0;

    REP(i, a.size()) {
        if ( (cur[b[i]] - cur[a[i]]) == c[i] )
            point += d[i];
    }

    return point;
}

int dfs(vector<int> &cur, int pos, int M) {
    if (pos == cur.size()) {
        /*
        REP(i, cur.size()) {
            cout << cur[i] << " ";
        }
        cout << endl;
        */

        return check(cur);
    }

    int point = 0;

    int start;
    if (pos == 0) {
        start = 1;
    } else {
        start = cur[pos - 1];
    }

    for (int i = start; i <= M; ++i) {
        cur[pos] = i;
        point = max(point, dfs(cur, pos + 1, M));
    }
    cur[pos] = start;

    return point;
}

int main() {
    int N, M, Q;
    cin >> N >> M >> Q;

    a.resize(Q);
    b.resize(Q);
    c.resize(Q);
    d.resize(Q);

    REP(i, Q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--;
        b[i]--;
    }

    vector<int> current(N);

    cout << dfs(current, 0, M) << endl;

    return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)


int main() {
    int n, m;
    while (cin >> n && n) {
        cin >> m;
        int s[n]; int t[m];
        int sums = 0, sumt = 0;
        rep(i, n) { cin >> s[i]; sums += s[i]; }
        rep(i, m) { cin >> t[i]; sumt += t[i]; }
        int a = inf, b = inf;
        rep(i, n) rep(j, m) {
            if (sums - s[i] + t[j] == sumt - t[j] + s[i]) {
                if (s[i] + t[j] < a + b) {
                    a = s[i]; b = t[j];
                }
            }
        }
        if (a == inf) out(-1);
        else out(a << " " << b);
    }
    
}



Measured memory_bytes: 2984
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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 pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll INF = 1e18;

V vec;
ll n, k;
bool judge(ll x)
{
    ll cnt = 0;
    ll prev = x;
    while (1)
    {
        ll f = lower_bound(all(vec), prev) - vec.begin();
        if (f == n)
            break;
        cnt++;
        prev = vec[f];
    }
    return cnt <= k;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    VV dp(n + 1, V(3));
    VV vec(n, V(3));
    rep(i,n)rep(j,3)cin>>vec[i][j];
    rep(i,n){
        dp[i + 1][0] = max(dp[i][1]+vec[i][1],dp[i][2]+vec[i][2]);
        dp[i + 1][1] = max(dp[i][0] + vec[i][0], dp[i][2] + vec[i][2]);
        dp[i + 1][2] = max(dp[i][1] + vec[i][1], dp[i][0] + vec[i][0]);
    }
  //  cout<<dp[1][1]<<endl;
    cout << max({dp[n][1],dp[n][1],dp[n][2]})<<endl;
}


Measured memory_bytes: 11264
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    if (a * b % 2 == 1)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N=0,ans=0,sum=0;
  cin>>N;
  vector<int> H(N);
  cin>>H.at(0);
  for(int i=1;i<N;i++){
    cin>>H.at(i);
    if(H.at(i)<=H.at(i-1))
      sum++;
    else{
      ans=max(ans,sum);
      sum=0;
    }
  }
  ans=max(ans,sum);
  cout<<ans<<endl;
}


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

int main() 
{
  int N, Q, l, r;
  string S;
  cin >> N >> Q;
  cin >> S;
  vector<int> A(N);
  A.at(0) = 0;
  for (int i = 0; i < N - 1; i++) {
  A.at(i + 1) = A.at(i) + (S.substr(i, 2) == "AC");
  }
  for (int j = 0; j < Q; j++) {
    cin >> l >> r;
    cout << A.at(r - 1) - A.at(l - 1) << endl;
  }
}

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

dic = {"M":[], "R":[], "A":[], "C":[], "H":[]}

for _ in range(n):
    s = input()
    if s[0] in dic:
        dic[s[0]].append(s)


import itertools
a = [i for i in range(5)]
per = list(itertools.combinations(a, 3))

ans = 0
for a,b,c in per:
    aa = ["M", "R", "A", "C", "H"]
    ans += len(set(dic[aa[a]])) * len(set(dic[aa[b]])) * len(set(dic[aa[c]]))
print(ans)

Measured memory_bytes: 16520
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define debug int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<int, Pi> V;
typedef vector<int> VE;
const ll mod = 1e9 + 7; //10^9+7

int main(){
    int n, m, x, y;
    VE X;
    VE Y;
    cin >> n >> m >> x >> y;
    int q, p;
    REP(i, n){
        cin >> q;
        X.push_back(q);
    }
    REP(i, m){
        cin >> p;
        Y.push_back(p);
    }
    sort(X.begin(), X.end());
    sort(Y.begin(), Y.end());
    int z = X[n - 1] + 1;


    if(z <= Y[0] && z > X[n-1] && z <= y && Y[0] > x){
        print("No War");
    }else{
        print("War");
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pb push_back
#define sz(x) ((int)x.size())

const int mod = 1000*1000*1000 + 7;
int dp[3005][3005] = {{0}};

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    dp[1][1] = 1;
    for(int i = 2; i <= n; i++)
    {
        int sum = 0;
        if(s[i-2] == '<')
        {
            for(int k = 1; k <= i; k++)
            {
                dp[i][k] = sum;
                sum += dp[i-1][k];
                sum %= mod;
            }
        }
        else
        {
            for(int k = i; k >= 1; k--)
            {
                sum += dp[i-1][k];
                sum %= mod;
                dp[i][k] = sum;
            }
        }
    }
    int ans = 0;
    for(int i = 1; i <= n; i++) 
        ans += dp[n][i], ans %= mod;
    cout << ans << endl;
}

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

// 与えられた数列を逆順に出力する
int main()
{
	int iSequenceSize;	// 数列の要素数
	int* aiSequence;	// 与えられる数列
	int iCount;			// ループカウンタ

	// 入力：数列の要素数
	scanf("%d", &iSequenceSize);

	// 配列領域の確保
	aiSequence = (int*)malloc(sizeof(int) * iSequenceSize);

	// 入力：数列の全要素
	for (iCount = 0; iCount < iSequenceSize; iCount++)
	{
		scanf("%d", &aiSequence[iCount]);
	}

	// 配列を逆順に出力
	for (iCount = iSequenceSize - 1; iCount > 0; iCount--)
	{
		printf("%d ", aiSequence[iCount]);
	}
	printf("%d\n", aiSequence[0]);

	// 配列領域の解放
	free(aiSequence);
}


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

#define ll long long
#define ld long double

using namespace std;

const long long LINF = LLONG_MAX;
const int INF = INT_MAX;
const int MOD = 1000000007;

const ld PI = 3.14159265358979323;

const int N = 2e2 + 111;

string s;

int main() {
    #ifdef Vova
        freopen("input", "r", stdin);
    #else
        ios::sync_with_stdio(false);
        cin.tie(0);
    #endif
    int ans = 0, cur = 0;
    cin >> s;
    for (auto& c : s){
        if (c == 'R'){
            cur++;
            ans = max(ans, cur);
        }
        else {
            cur = 0;
        }
    }
    cout << ans;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define show(x) std::cerr << #x << "=" << x << std::endl
using namespace std;
typedef long long ll;
const double eps=1e-8;
const int maxn = 2e5+5;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
int t;
int n,m;
int a[1005];
bool vis[1005];
int main()
{
    cin>>m>>n;
    memset(vis,0,sizeof vis);
    for(int i=1;i<=n;++i) {
        cin>>a[i];
        vis[a[i]] = 1;
    }
    int cha = 0;
    while(1)
    {
        int tmp1 = m-cha, tmp2 = m+cha;
        if(!vis[tmp1]){
            printf("%d\n",tmp1);
            return 0;
        }
        if(!vis[tmp2]){
            printf("%d\n",tmp2);
            return 0;
        }
        ++cha;
    }
    return 0;
}


Measured memory_bytes: 3764
#include<stdio.h>
int main()
{
    char ch;
    scanf("%c",&ch);

    if(ch =='a' || ch =='a' || ch =='e' || ch =='E' || ch=='i' || ch =='I' || ch =='o' || ch =='O' || ch =='u' || ch=='U')
    {
        printf("vowel\n");
    }

    else
        printf("consonant\n");

    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main (void)

{

int a, b;

scanf("%d""%d",&a,&b);

if(a>b){

printf("a > b\n");

}

else if(a<b){

printf("a < b\n");

}

else{

printf("a == b\n");

}

return 0;

}

Measured memory_bytes: 580
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  string S;
  cin >> S;
  string a;
  a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  for (int i = 0; i < S.size(); i++) {
    int pos = a.find(S[i]);
    pos = (pos + N) % 26;
    cout << a[pos];
  }
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
#include <wchar.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;


/*
*/

ll n,a,b,p[110],cnt[3]={};

int main(void){
	cin>>n>>a>>b;
	rep(i,n){
		cin>>p[i];
		if(p[i]<=a)cnt[0]++;
		if(a<p[i]&&p[i]<=b)cnt[1]++;
		if(b<p[i])cnt[2]++;
	}
	cout<<min({cnt[0],cnt[1],cnt[2]})<<endl;
	return 0;
}

Measured memory_bytes: 256
import Data.Maybe
import Data.List

main :: IO ()
main = do
  input <- getContents
  putStrLn $ trim (solve (trim input))

--処理
solve :: String -> String
solve s | op == "+" = show $ a + b
        | otherwise = show $ a - b
 where
  [x, op, y] = (words s)
  [a, b]     = fmap read [x, y] :: [Int]

trimHead :: String -> String
trimHead = dropWhile (\s -> isJust (elemIndex s [' ', '\t', '\n', '\r']))

trim :: String -> String
trim = reverse . trimHead . reverse . trimHead

Measured memory_bytes: 508