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

using namespace std;

#ifndef ONLINE_JUDGE
  #define pr_vars(...) do { cerr << "DEBUG: line "<< __LINE__ << ": " << __PRETTY_FUNCTION__ << ":  "; \
                            pr_var(split(#__VA_ARGS__, ',').begin(), __VA_ARGS__); } while(0)
#else
  __attribute__ ((constructor)) static void fast_cin() { ios_base::sync_with_stdio(false); cin.tie(0); }
  #define pr_vars(...) do { } while(0)
#endif /* ONLINE_JUDGE */

using ll = int64_t;
using ull = uint64_t;
using mp = pair<ll, ll>;
using mt = tuple<ll, ll, ll>;    // unpack: tie(ll, ll, ll) = mt;

template<typename T, typename R>
istream &operator>> (istream &fin, pair<T, R> &p) { fin >> p.first >> p.second; return fin; }

template<typename T, typename R>
ostream &operator<< (ostream &fout, const pair<T, R> &p)
{ fout << "{" << p.first << ", " << p.second << "} "; return fout; }

template<typename T> ostream &operator<< (ostream &fout, const vector<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fout << vec[i] << ' '; return fout; }

template<typename T> ostream &operator<< (ostream &fout, const deque<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fout << vec[i] << ' '; return fout; }

template<typename T> ostream &operator<< (ostream &fout, const list<T> &vec)
{ for (auto i: vec) fout << i << ' '; return fout; }

template<typename T> istream &operator>> (istream &fin, vector<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fin >> vec[i]; return fin; }

vector<string> split(const string &s, char c) { vector<string> v; ull st = 0, fn = 0, lvl = 0;
for ( ; fn < s.size(); fn++ ) { if (s[fn] == c && lvl == 0) { v.push_back(s.substr(st, fn - st)); st = fn + 1; }
if (s[fn] == '(') { lvl++; } if (s[fn] == ')') { lvl--; } } v.push_back(s.substr(st, fn - st)); return v; }

void pr_var(vector<string>::iterator it) { (void) it; cerr << endl; }
template<typename T, typename... Args> void pr_var(vector<string>::iterator it, T a, Args... args)
{ cerr << *it << "=" << a << "  "; pr_var(++it, args...); }

ll div_ceil(ll n, ll d) { ll res = n / d; if (res >= 0) res += n % d ? 1 : 0; return res; }
ll gcd(ll a, ll b) { a = llabs(a); b = llabs(b); while (a && b) a > b ? a %= b : b %= a; return a + b; }
ll lcm(ll a, ll b) { ll c = gcd(a, b); return c == 0 ? 0 : llabs(a / c * b); }

#define setp(a) fixed << setprecision(a)
const double PI = acos(-1.0);
constexpr double EPS = 1e-6;
constexpr ll INF = numeric_limits<ll>::max();
constexpr ll MOD = 1e9 + 7;

#define FOR(i, n) for (ll i = 0; i < (n); i++)
int main()
{
    ll a, b; cin >> a >> b;
    ll k = a + b;
    if (k % 2 == 1) cout << "IMPOSSIBLE" << endl;
    else cout << k / 2 << endl;
    return 0;
}


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

int main(){

	int A,B,C;
	cin >> A >> B >> C;
	if(A == B && B == C && C == A){cout << "Yes" << endl;}
	else{cout << "No" << endl;}


	return 0;

}

Measured memory_bytes: 256
/***
 ** " Any fool can write code that a computer can understand. Good programmers write code that humans can understand "
 **     -- Martin Fowler
***/

/**
  *  Author: dhruv_gheewala
  *  Problem: ac@abc174@a
  *  Date:   02.08.2020
  *  Time:   17:31:04
**/

#if __has_include("debug.h")
    #include "debug.h"
#else
    #include<bits/stdc++.h>
    using namespace std;
    
    #define fundri 108
    #define debug(...) 1729
#endif

#define int int64_t
typedef pair<int, int> pii;
typedef vector<int> vi;

const bool testcases = false;
#define ff first
#define ss second
#define endl '\n'
#define all(s) s.begin(), s.end()

// if vector isn't soted then it will remove consecutive same elements
#define make_unique(vec) vec.erase(unique(all(vec)), vec.end())
#define test int TC = 1;if(testcases)cin >> TC;for(int tc = 1 ; tc <= TC ; tc++)solve(), fundri
#define sort_by(cont,expr) sort(all(cont),[&](const auto &lhs,const auto &rhs){return expr;})

int seed; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l = 0, int r = INT_MAX) {return uniform_int_distribution<int>(l, r)(rng);}

inline bool in_range(int a, int l, int r) {return (a >= l && a <= r);}
template<typename H, typename ...T>void inp(H &head) {cin >> head;}
template<typename H, typename ...T>void inp(H &head, T &...tail) {cin >> head;inp(tail...);}
template<typename T>bool isPrime(T n) {for(T i = 2; i * i <= n; i++)if(n % i == 0)return false; return n >= 2;}
template<typename T>inline istream &operator >>(istream &in, vector<T> &a) {for(T &x : a)in >> x; return in;}
template<typename T, typename U>inline istream &operator >>(istream &in, pair<T, U> &a) {in >> a.ff >> a.ss; return in;}

void solve();
void fast_io();

int32_t main(int32_t argc, char **argv)
{
    fast_io();
    test;
    return 0;
}

void solve()
{
    int x;
    cin >> x;
    cout << (x >= 30 ? "Yes" : "No") << endl;
}

void fast_io()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

#ifdef DHRUV_GHEEWALA
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define N 100005
using namespace std;
int node,edge,visit[N],dp[N],ans;
vector<int> graph[N];
void dfs(int now){
	visit[now]=1;
	for(int i=0;i<graph[now].size();i++){
		if(visit[graph[now][i]]==0){
			dfs(graph[now][i]);
		}
		dp[now]=max(dp[now],dp[graph[now][i]]+1);
	}
	ans=max(ans,dp[now]);
}
int main(){
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	cin>>node>>edge;
	int temp1,temp2;
	for(int i=0;i<edge;i++){
		cin>>temp1>>temp2;
		temp1--;
		temp2--;
		graph[temp1].push_back(temp2);
	}
	for(int i=0;i<node;i++){
		if(visit[i]==0){
			dfs(i);
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 8576
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
  string s; cin >> s; int c=1; bool y = true;
  for(int x:s) {
    if (c%2 && x=='L') {y=false; break;}
    if (c%2==0 && x=='R') {y=false; break;}
    c++;
  }
  cout << (y?"Yes":"No") << endl;
}

Measured memory_bytes: 256
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, A, B):
    if A + B - 1 > N or A * B < N:
        print(-1)
        return
    P = []
    r = A * B - N
    for b in range(B):
        for a in range(A):
            if b >= 1 and a >= 1 and r > 0:
                if r >= A - 1:
                    r -= A - 1
                    break
                r -= 1
                continue
            P.append((B - b) * A + a + 1)
    s = sorted([(p, i) for i, p in enumerate(P)], key=lambda x: x[0])
    s = sorted([(i, j) for j, (p, i) in enumerate(s)], key=lambda x: x[0])
    s = [j + 1 for i, j in s]
    print(*s)

if __name__ == '__main__':
    input = sys.stdin.readline
    N, A, B = map(int, input().split())
    main(N, A, B)


Measured memory_bytes: 157752
#include <iostream>
#include <vector>

typedef long long ll;
using namespace std;

void bfs(ll v, vector<vector<int>> &Graph, vector<int> &seen, ll &res) {
  bool ok = true;
  for (ll i = 0; i < seen.size(); i++) {
    if (seen[i] == 0 && i != v) {
      ok = false;
      break;
    }
  }

  // cout << "visited: " << v << endl;
  // cout << "ok:" << ok << endl;

  if (ok) {
    res++;
    return;
  }

  seen[v] = 1;
  for (ll i = 0; i < Graph.size(); i++) {
    if (Graph[v][i] == 1 && seen[i] == 0) {
      bfs(i, Graph, seen, res);
    }
  }
  seen[v] = 0;
}

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

  vector<vector<int>> Graph(N, vector<int>(N, 0));

  for (ll i = 0; i < M; i++) {
    ll a, b;
    cin >> a >> b;
    Graph[a-1][b-1] = 1;
    Graph[b-1][a-1] = 1;
  }

  vector<int> seen(N, 0);

  ll res = 0;
  bfs(0, Graph, seen, res);

  cout << res << endl;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
mod = 10**9+7
v = [0]*(k+1)
ans = 0
for i in range(k,0,-1):
    if v[i] == 0:
        v[i] =  (pow(k//i,n,mod)-sum(v[i::i])) % mod
        ans += (v[i]*i) % mod
        ans %= mod
print(ans)

Measured memory_bytes: 12004
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>

#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	string s;
	int w;
	cin >> s >> w;

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



	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10;
int dp[MAX];
int a[MAX];
int n;
const int inf = 0x3f3f3f3f;


int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; ++i) {
		scanf("%d", a+i);
	}
	dp[n-1] = 0;
	for(int i = n-2; i >= 0; --i){
		dp[i] = abs(a[i] - a[i+1]) + dp[i+1];
		if(i+2 < n) dp[i] = min(dp[i], abs(a[i] - a[i+2]) + dp[i+2]);
	}
	printf("%d\n", dp[0]);

	return 0;
}

Measured memory_bytes: 1024
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[2000012]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<2000012;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/

int inv[1000008]={0};int invf[1000007]={0};
void findinverse(){
	inv[0]=1;
	inv[1] = 1;
	for(int i = 2; i <=1e6+2; ++i)
		inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;
	invf[0]=1;invf[1]=1;
	for(int i=2;i<=1e6+2;i++){
		invf[i]=invf[i-1]*inv[i]%mod;
	}
}
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> orderedMultiset;
int solve()
{
	int n,k;
	cin>>n>>k;
	int p[n+1];
	forci(1,n+1)
		cin>>p[i];
	int c[n+1];
	forci(1,n+1)
		cin>>c[i];
	int ans=-1e18;
	for(int i=1;i<=n;i++){
		int curr=p[i];
		int sum=0;
		vi g;
		sum+=c[i];
		while(curr!=i){
			g.pb(c[curr]);
			sum+=c[curr];
			curr=p[curr];
		}
		g.pb(c[i]);
		int cnt=0;
//		cout<<sum<<endl;
		for(int j=0;j<g.size();j++){
			if(j+1>k)
				break;
			cnt+=g[j];
			int t=cnt;
			int m=g.size();
			if(sum>0)
				t+=((k-(j+1))/m)*sum;
			ans=max(ans,t);
		}
	}
	cout<<ans<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}



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

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  rep(i,h) cin >> s[i];
  int ans = 0;
  rep(is,1<<h)rep(js,1<<w) {
    int cnt = 0;
    rep(i,h)rep(j,w) {
      if (is&(1<<i)) continue;
      if (js&(1<<j)) continue;
      if (s[i][j] == '#') cnt++;
    }
    if (cnt == k) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int isprime(int x);

int main() {
  int N;
  cin>>N;
  int j=0;
  for(int i=0;i<N;i++){
      int x;
      cin>>x;
      j+=isprime(x);     
      }
      cout<<j<<endl;
      return 0;
 }

int isprime(int x){
    if(x==2){
        return 1;
    }
    else if(x%2==0||x<2){
        return 0;
    }
    int g=sqrt(x);
    int k=3;
    while(k<=g){
        if(x%k==0){
            return 0;
        }
        k+=2;
    }
    return 1;
}

 


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){

    // 文字数が偶数か奇数, 両端が同じか異なるかでどちらが勝つか決まる
    // パリティに注目
    // 最終的には
    // ababa
    // abab
    // の2パターン
    string s;
    cin >> s;
    if (s[0] == s.back()) {
        if (s.size() % 2) cout << "Second" << '\n';
        else cout << "First" << '\n';
    }
    else {
        if (s.size() % 2) cout << "First" << '\n';
        else cout << "Second" << '\n';
    }
}


Measured memory_bytes: 3744
#include <cstdio>
#include <map>
#include <algorithm>
using namespace std;
const int N=200005;
int n;
int a[N];
int cur,ans;
map <int,int> p;
bool cmp(int x,int y)
{
	return x>y;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		p[a[i]]++;
	}
	sort(a+1,a+n+1,cmp);
	cur=1<<30;
	for (int i=1;i<=n;i++)
	{
		while (cur>2*a[i])
			cur/=2;
		while (p[a[i]]&&((cur-a[i]==a[i]&&p[cur-a[i]]>=2)||(cur-a[i]!=a[i]&&p[cur-a[i]]>=1)))
		{
			ans++;
			p[a[i]]--;
			p[cur-a[i]]--;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 19712
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x,y) for(ll i=x;i<=y;i++)
#define imin INT_MIN
#define imax INT_MAX
int mod =1e9+7;

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

	int n;
	cin>>n;
	vector<ll> v(n);
	int cnt=0;
	
	for(int i=0; i<n; i++) cin>>v[i];
	for(int i=0; i<n-2; i++){
		for(int j=i+1; j<n-1; j++){
			for(int k=j+1; k<n; k++){
				if(v[i] != v[j]){
					if(v[i] != v[k] && v[j] != v[k]){
						ll a[3];
						a[0]=v[i];
						a[1]=v[j];
						a[2]=v[k];
						sort(a,a+3);
						if(a[0]+a[1] > a[2]){
							cnt++;
						}
					}
			}
		}
	}
	}
	cout<<cnt<<"\n";
	
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define eps 1e-6
#define ll long long
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
//#define int long long
#define MEM(x,y) memset(x,y,sizeof(x))
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define fi first
#define se second
#define endl "\n"
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll Max(ll a,ll b){return a>=b?a:b;}
ll Min(ll a,ll b){return a<=b?a:b;}
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res,t;res=1;t=a%c;while(b){if(b&1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
using namespace std;
//head file
int main()
{
    int n,k;
    cin>>n>>k;
    int a[n+5];
    MEM(a,0);
    while(k--)
    {
        int num;
        cin>>num;
        rep(i,0,num)
        {
            int nu;
            cin>>nu;
            a[nu]++;
        }
    }
    int cnt=0;
    rep(i,1,n+1)
    {
        if(a[i]==0)
            cnt++;
    }
    cout<<cnt<<endl;
}


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

int main() {
	int a[5];
	int r=10;
	cin >> a[0] >> a[1] >> a[2] >> a [3] >> a[4];
	for (int i=0; i<5; i++){
		if ((r>a[i]%10)&&(a[i]%10!=0)){
			r=a[i]%10;	
		}
	}

	int ans;
	ans=((a[0]+9)/10+
	    (a[1]+9)/10+
	    (a[2]+9)/10+
	    (a[3]+9)/10+
	    (a[4]+9)/10)*10-10+r;
	cout << ans << endl;
	return 0;
}

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

class Dice
{
  private:
    int top, front, right, left, back, bottom, temp;

  public:
    void set(int *nums)
    {
        this->top = nums[0];
        this->front = nums[1];
        this->right = nums[2];
        this->left = nums[3];
        this->back = nums[4];
        this->bottom = nums[5];
    }
    int getTop() { return this->top; }
    int getFront() { return this->front; }
    int getRight() { return this->right; }
    int getLeft() { return this->left; }
    int getBack() { return this->back; }
    int getBottom() { return this->bottom; }
    void east()
    {
        this->temp = this->top;
        this->top = this->left;
        this->left = this->bottom;
        this->bottom = this->right;
        this->right = this->temp;
    }
    void west()
    {
        this->temp = this->top;
        this->top = this->right;
        this->right = this->bottom;
        this->bottom = this->left;
        this->left = this->temp;
    }
    void north()
    {
        this->temp = this->top;
        this->top = this->front;
        this->front = this->bottom;
        this->bottom = this->back;
        this->back = this->temp;
    }
    void south()
    {
        this->temp = this->top;
        this->top = this->back;
        this->back = this->bottom;
        this->bottom = this->front;
        this->front = this->temp;
    }
};

int main(int argc, char *argv[])
{
    Dice dice;
    int nums[6];
    for (int i = 0; i < 6; i++)
        cin >> nums[i];
    dice.set(nums);

    int q_num, top, front;
    cin >> q_num;
    while (0 < q_num--)
    {
        cin >> top >> front;
        if (dice.getTop() == top && dice.getFront() == front)
        {
            cout << dice.getRight() << endl;
            continue;
        }
        else
        {
            if (dice.getRight() != front && dice.getLeft() != front)
            {
                while (dice.getFront() != front)
                {
                    dice.south();
                }
            }
            else
            {
                if (dice.getRight() == front)
                {
                    dice.west();
                    dice.south();
                }
                else
                {
                    dice.east();
                    dice.south();
                }
            }

            if (dice.getTop() != top)
            {
                while (dice.getTop() != top)
                {
                    dice.east();
                }
            }

            cout << dice.getRight() << endl;
            continue;
        }
    }

    return 0;
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int A, B;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> A >> B;
	int ans = A * B;
	cout << ans << endl;

}







Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#define MAX 5000000
#define INFTY (1<<30)

int n, H[MAX];

void maxHeapify(int i) {
    int l, r, largest;
    l = 2 * i;
    r = 2 * i + 1;
    
    if ( l <= n && H[l] > H[i]) largest = l;
    else largest = i;
    if ( r <= n && H[r] > H[largest]) largest = r;
    
    if (largest != i) {
        std::swap(H[i], H[largest]);
        maxHeapify(largest);
    }
}

int heapExtraMax() {
    if (n < 1) return -1;
    int max = H[1];
    H[1] = H[n--];
    maxHeapify(1);
    return max;
}

void heapIncreaseKey(int key, int i) {
    if ( H[i] > key ) return;
    H[i] = key;
    while ( i > 1 && H[int(i/2.0)] < H[i] ) {
        std::swap(H[int(i/2.0)], H[i]);
        i = int(i/2.0);
    }
}

void insert(int key) {
    n++;
    H[n] = -INFTY;
    heapIncreaseKey(key, n);
}


int main() {
    int key;
    char moji[10];
    n = 0;
    
    while (1) {
        scanf("%s", moji);
        if (moji[0] == 'e' && moji[1] == 'n') break;
        
        if (moji[0] == 'i') {
            scanf("%d", &key);
            insert(key);
        } else {
            printf("%d\n", heapExtraMax());
        }
    }
    
    return 0;
}



Measured memory_bytes: 7104
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

bool check(vector<int> &d, ll md, int n){
	for(int i = 0; i < n-1; i++){
		for(int j = n-i-2; j <= n+i-1; j += 2*i+1){
			if(d[j]<md && d[j+1]<md) return false;
			if(d[j]>=md && d[j+1]>=md) return true;
		}
	}
	return d[0]>=md;
}

int main(){
	int n;
	cin>>n;
	vector<int> d(2*n-1);
	rep(i, 2*n-1) cin>>d[i];
	ll lb = 2, ub = 2*n-1;
	while(ub-lb>1){
		ll md = (ub+lb)/2;
		if(check(d, md, n)){ // res in [md, ub) when true
			lb = md;
		} else {
			ub = md;
		}
	}
	cout<<lb<<endl;
	return 0;
}


Measured memory_bytes: 1152
/* 
chirag11032000
Chirag Thakur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void test_case();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void test_case() {
	int a, b, k;
	cin >> a >> b >> k;
	vector < int > done;
	for (int i = 1; i <= 100; ++i) {
		if ((a % i == 0) && (b % i == 0)) {
			done.eb(i);
		}
	}
	reverse(all(done));
	cout << done[k - 1] << "\n";
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long int H, W, N, a[10001] = {}, ans[101][101] = {}, b, c, d, e, current;
bool flag = false;

int main() {
	cin >> H >> W;
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> a[i];
	}
	b = W;
	c = H;
	d = 1;
	e = 2;
	current = 1;
	while (1) {
		flag = false;
		for (int i = d; i <= b; i++) {
			ans[e-1][i] = current;
			a[current]--;
			if (a[current] == 0)current++;
			flag = true;
		}
		b--;
		if (!flag) {
			break;
		}
		flag = false;
		for (int i = e; i <= c; i++) {
			ans[i][b+1] = current;
			a[current]--;
			if (a[current] == 0)current++;
			flag = true;
		}
		c--;
		if (!flag) {
			break;
		}
		flag = false;
		for (int i = b; i >= d; i--) {
			ans[c+1][i] = current;
			a[current]--;
			if (a[current] == 0)current++;
			flag = true;
		}
		d++;
		if (!flag) {
			break;
		}
		flag = false;
		for (int i = c; i >= e; i--) {
			ans[i][d-1] = current;
			a[current]--;
			if (a[current] == 0)current++;
			flag = true;
		}
		e++;
		if (!flag) {
			break;
		}
		flag = false;
	}
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W-1; j++) {
			cout << ans[i][j]<<" ";
		}
		cout << ans[i][W] << endl;
	}
	return 0;
}

Measured memory_bytes: 384
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<cstring>
#include<vector>
#include<stack>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<iomanip>
#include<functional>
#include<unordered_map>
#define io ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define inf 0x3f3f3f3f
#define ll long long
#define ull unsigned long long
#define P pair<int,int>
#define lc rt*2
#define rc rt*2+1
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
const double PI = 3.1415926536;

using namespace std;

string s;

int main()
{
	io;
	cin >> s;
	s = ' ' + s;
	int n = s.size() - 1;
	for(int i = 1, j = n ;i <= n;++i, --j)
		if (s[i] != s[j]) {
			cout << "No";
			return 0;
		}
	for(int i=1,j=(n-1)/2;j>=1;++i,--j)
		if (s[i] != s[j]) {
			cout << "No";
			return 0;
		}
	for(int i=(n+3)/2,j=n;i<=n;++i,--j)
		if (s[i] != s[j]) {
			cout << "No";
			return 0;
		}
	cout << "Yes";
	return 0;
}


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

int main () {
  int N;
  string A, B;
  cin >> N >> A >> B;
  
  for (int i = 0; i < N; i++){
    if (i == N-1) cout  << A.at(i) << B.at(i) << endl;
    else cout << A.at(i) << B.at(i);
  }
}

Measured memory_bytes: 256
// A.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>

using namespace std;
int main()
{
    int n;

    cin >> n;


    if (n % 2 == 0) {
        cout << n << endl;
    }
    else {
        cout << n * 2 << endl;
    }

    return 0;
}



Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>

using namespace std;

string C(string s){
  return s.substr(1)+s[0];
}

string J(string s){
  return s[s.length()-1]+s.substr(0,s.length()-1);
}

string E(string s){
  if(s.length()%2 == 0){
    //even
    int half = s.length()/2;
    return s.substr(half)+s.substr(0,half);
  }else{
    //odd
    int half = s.length()/2;
    return s.substr(half+1)+s[half]+s.substr(0,half);
  }
}

string A(string s){
  reverse(s.begin(),s.end());
  return s;
}

string M(string s){
  for(int i = 0; i < s.length(); i++)
    if('0' <= s[i] && s[i] < '9') s[i]++;
    else if(s[i] == '9') s[i] = '0';
  return s;
}

string P(string s){
  for(int i = 0; i < s.length(); i++)
    if('0' < s[i] && s[i] <= '9') s[i]--;
    else if(s[i] == '0') s[i] = '9';
  return s;
}
int main(){

  int n;
  cin >> n;
  while(n--){
    string s,m;
    cin >> s >> m;
    for(int i = s.length()-1; i >= 0; i--){
      if(s[i] == 'J') m = J(m);
      if(s[i] == 'C') m = C(m);
      if(s[i] == 'E') m = E(m);
      if(s[i] == 'A') m = A(m);
      if(s[i] == 'P') m = P(m);
      if(s[i] == 'M') m = M(m);
      //   cout << "m " << m << endl;
    }
    cout << m << endl;
  }
  return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

/*
Cnt how many ways to sum x
  Use how many ways to sum x - k

*/

const int maxN = 3e3 + 1; int n, s;
const lli mod = 998244353;
int a[maxN];

lli memo[maxN][maxN][2];
lli solve(int i = 0, int cs = 0, int t = 0)
{
  if (cs > s) return 0;
  if (i == n || t == 2) return cs == s;
  lli &ans = memo[i][cs][t];
  if (ans != -1) return ans;

  ans = 0;
  if (t == 0)
    ans = (ans + solve(i + 1) + solve(i, 0, 1)) % mod;
  else if (t == 1)
    ans = (ans + solve(i + 1, cs + a[i], 1) + solve(i + 1, cs, 1)
               + solve(i + 1, cs, 2)) % mod;
  return ans;
}

int main()
{
  while (scanf("%d %d", &n, &s) != EOF)
  {
    for (int i = 0; i < n; i++)
      scanf("%d", &a[i]);

    memset(memo, -1, sizeof(memo));
    lli ans = solve();
    printf("%lld\n", ans);
  }
  return 0;
}

Measured memory_bytes: 141056
def f(n) : 
    while n >= 10:  
        n /= 10 
    return int(n)
n = int(input())
l = list(list(0 for i in range(10)) for j in range(10))
for i in range(1, n+1):
	last = i%10
	if last:
		l[f(i)][last] += 1
ans = 0
for i in range(10):
	for j in range(10):
		ans += l[i][j] * l[j][i]
print(ans)

Measured memory_bytes: 3064
maxa=10**10*(-1)
def euclid(a, b):
  if b == 0:
    return a
  else:
    return euclid(b, a%b)
N=int(input())
L=list(map(int,input().split()))
A=[0]*N
B=[0]*N
a=L[0]
A[0]=a
b=L[-1]
B[0]=b
for i in range(N-1):
  A[i+1]=euclid(A[i],L[i+1])
  B[i+1]=euclid(B[i],L[-(i+2)])
A.pop(-1)
B.pop(-1)
maxa=max(B[-1],A[-1])
for i in range(N-2):
  maxa=max(maxa,euclid(A[i],B[N-3-i]))
print(maxa)

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

int main(){
    ll h,w;
    cin >> h >> w;

    if(h == 1 || w == 1){
        cout << 1 << endl;
    }
    else {
        cout << (h*w+1)/2 << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main() {
  char a[123], b[123];
  scanf("%s %s", a, b);
  int n = strlen(a);
  for (int i = 0; i < n; i++) {
    if (a[i] == b[0]) {
      bool ok = true;
      for (int j = i, k = 0; k < n; j++, k++, j %= n) {
        ok &= (a[j] == b[k]);
      }
      if (ok) {
        puts("Yes");
        return 0;
      }
    }
  }
  puts("No");
  return 0;
}

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

using namespace std;

#define pb push_back

const int maxi = 1e6+10;
long long a, b, v, w, t;


int main()
{
   cin>>a>>v;
   cin>>b>>w;
   cin>>t;

   long long dist = abs(a - b);

   if (w >= v) return !printf("NO\n");

   if (t * (v- w) >=dist) return !printf("YES\n");

   printf("NO\n");
}
//Moj mali posao za Bari
//cekam da se vrati, donijece mi stvari
//a kad se vrati, pune se ormari
//svima da se hvalim, korzo da zapalim


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

public class Main {

	public static final int FRONT = 0;
	public static final int RIGHT = 1;
	public static final int LEFT = 2;
	public static final int BACK = 3;

	public static final int[][] right = {
		{0,3,5,2,4,0},
		{4,0,1,6,0,3},
		{2,6,0,0,1,5},
		{5,1,0,0,6,2},
		{3,0,6,1,0,4},
		{0,4,2,5,3,0}
	};
	public static int[][] numTable = new int[211][211];
	public static int[][] upTable = new int[211][211];
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		doIt();
	}
	public static void doIt(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n == 0) break;
			for(int[] b : numTable) Arrays.fill(b, 0);
			for(int[] b : upTable) Arrays.fill(b, 0);
			for(int i = 0; i < n; i++){
				int up = sc.nextInt();
				int front = sc.nextInt();
				isRoll(105,105,up,front,numTable[105][105]);
			}
			print();
		}
	}
	
	public static void print(){
		int[] dice = new int[6];
		for(int[] a : upTable) for(int b : a) if(b > 0) dice[b - 1]++;
		for(int i = 0; i < 5; i++) System.out.print(dice[i] + " ");
		System.out.println(dice[5]);
	}

	public static void isRoll(int x, int y, int up, int front, int high){
		int[] dir = new int[4];
		dir[FRONT] = front;
		dir[BACK] = 7 - front;
		dir[RIGHT] = right[up - 1][front - 1];
		dir[LEFT] = 7 - dir[RIGHT];
		boolean bRoll = false;
		if(high > 0){
			for(int i = 6; i >= 4; i--){
				for(int j = 0; j < 4; j++){
					if(dir[j] == i){
						int xx = x,yy = y;
						int newFront = front, newUp = up; 
						switch(j){
						case FRONT:
							yy--;
							newFront = up;
							newUp = 7 - front;
							break;
						case BACK:
							yy++;
							newFront = 7 - up;
							newUp = front;
							break;
						case RIGHT:
							xx++;
							newFront = front;
							newUp = dir[LEFT];
							break;
						case LEFT:
							xx--;
							newFront = front;
							newUp = dir[RIGHT];
							break;
						}
						if(numTable[xx][yy] < high){
							isRoll(xx,yy,newUp,newFront, numTable[xx][yy]);
							bRoll = true;
							break;
						}
					}
				}
				if(bRoll) break;
			}
		}
		
		if(bRoll == false){
			numTable[x][y]++;
			upTable[x][y] = up;
		}
	}
}

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

odd = [v for i, v in enumerate(a[1:]) if i % 2 == 1]
even = [v for i, v in enumerate(a[1:]) if i % 2 == 0]

ans = []
if n % 2 == 0:
    ans = even[::-1] + [a[0]] + odd
else:
    ans = odd[::-1] + [a[0]] + even

print(" ".join(map(str, ans)))

Measured memory_bytes: 121664
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
inline bool isprime(ll num)
{if(num==2||num==3)return true;
if(num%6!=1&&num%6!=5)return false;
for(int i=5;1ll*i*i<=num;i+=6){if(num%i==0||num%(i+2)==0)return false;}
return true;}
const int mod = 1e9+7;
inline ll mul(ll a,ll b,ll c){return (a*b-(ll)((ld)a*b/c)*c+c)%c;}
inline ll exgcd(ll a,ll b,ll &x,ll &y){if(!b){x=1;y=0;return a;}ll g = exgcd(b,a%b,y,x);y-=a/b*x;return g;}
inline ll quick_pow(ll a,ll b,ll mod){ll res=1;while(b){if(b&1)res=mul(res,a,mod);a=mul(a,a,mod);b>>=1;}return res;}
inline ll quick_pow(ll a,ll b){ll res=1;while(b){if(b&1)res=mul(res,a,mod);a=mul(a,a,mod);b>>=1;}return res;}
inline ll inv(ll x){return quick_pow(x,mod-2);}
inline ll inv(ll x,ll mod){return quick_pow(x,mod-2,mod);}
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	printf("%d %d %d\n",c,a,b);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://arc066.contest.atcoder.jp/tasks/arc066_a?lang=en>
問題文============================================================
 1~N までの番号がついた、N 人の人がいます。
 彼らは昨日、ある順番で左右一列に並んでいましたが、今日になってその並び方が分からなくなってしまいました。
 しかし、彼らは全員、「自分の左に並んでいた人数と自分の右に並んでいた人数の差の絶対値」を覚えています。
 彼らの報告によると、人 i の、「自分の左に並んでいた人数と自分の右に並んでいた人数の差の絶対値」は Ai です。
 
 彼らの報告を元に、元の並び方が何通りあり得るかを求めてください。
 ただし、答えは非常に大きくなることがあるので、10^9+7 で割った余りを出力してください。
 また、彼らの報告が間違っており、ありうる並び方がないこともありえます。 その際は 0 を出力してください。
=================================================================

解説=============================================================

================================================================
*/
const ll MOD = 1e9+7;
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> A(N);
    vector<int> cnt(N,0);
    for(auto& in:A){
        cin >> in;
        cnt[in]++;
    }
    ll ans = 1;
    if(N%2 == 0){
        if(cnt[0]){
            cout << 0 << endl;
            return 0;
        }else{
            for(int i = 1; i < N;i++){
                if(i%2 == 0){
                    if(cnt[i]){
                        cout << 0 << endl;
                        return 0;
                    }
                }else{
                    if(cnt[i] == 2){
                        (ans *= 2)%=MOD;
                    }else{
                        cout << 0 << endl;
                        return 0;
                    }
                }
            }
        }
    }else{
        if(cnt[0] != 1){
            cout << 0 << endl;
            return 0;
        }
        for(int i = 1; i < N;i++){
            if(i%2 == 0){
                if(cnt[i] == 2){
                    (ans *= 2)%=MOD;
                }else{
                    cout << 0 << endl;
                    return 0;
                }
            }else{
                if(cnt[i]){
                    cout << 0 << endl;
                    return 0;
                }
            }
        }
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
int n;
ll m,a[N],b[N];
int main()
{
    scanf("%d%lld",&n,&m);
    for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
    sort(a+1,a+1+n);
    ll p=1,s=1;
    bool f=false;
    for(int i=1;i<=n;i++)
    {
        b[i]=a[i]/2;
        p=p/__gcd(p,(ll)b[i])*b[i];
        s=s/__gcd(s,(ll)a[i])*a[i];
        if(s>m)
        {
            f=true;
        }
        if(p>m)
        {
            printf("0\n");return 0;
        }
    }

    for(int i=1;i<=n;i++)
    {
        assert(s/b[i]%2==0);
        if(p/b[i]%2==0)
            {printf("0\n");return 0;}
    }
    if(f)
    {
        cout<<1<<endl;return 0;
    }
    assert(s/p==2);
    ll ans=(m-p)/s+1;
    printf("%lld\n",ans);
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iterator>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <string>
#include <vector>
#include <limits>
#include <queue>
#include <cmath>
#include <map>
#include <set>

using namespace std;

using ll = long long;

const ll INF = numeric_limits<ll>::max();

// [from, to)
ll get_sum(const vector<ll>& pref, int from, int to)
{
    ll left = 0;
    if(from - 1 >= 0)
        left = pref[from - 1];

    ll right = pref[to - 1];
    return right - left;
}

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

    vector<ll> v(n);

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

    vector<ll> pref(n);
    pref[0] = v[0];

    for(int i = 1; i < n; ++i)
        pref[i] = pref[i - 1] + v[i];

    vector<vector<ll> > dp(n, vector<ll>(n + 1, INF));

    for(int i = 0; i < n; ++i)
        dp[i][i + 1] = 0;

    for(int len = 2; len <= n; ++len) {
        for(int left = 0; left + len <= n; ++left) {
            int right = left + len;

            for(int k = left + 1; k < right; ++k) {
                ll cur = dp[left][k] + dp[k][right] +
                         get_sum(pref, left, k) + get_sum(pref, k, right);

                dp[left][right] = min(cur, dp[left][right]);
            }
        }
    }


    cout << dp[0][n] << endl;

    return 0;
}


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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

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

    vector<ll> A(N);
    REP(i, N) cin >> A[i];
    A.push_back(-1);

    set<int> se;
    REP(i, N) if(A[i] == 0) se.insert(i);

    ll ans = 0;
    if(A[0] != 0){
        ans = -1;
    } else {
        for(int i = N - 1; i >= 0; i--){
            if(A[i] + 1 == A[i + 1] || (A[i] == 0 && A[i + 1] == 0)) continue;
            if(A[i + 1] - A[i] > 1) {
                ans = -1;
                break;
            }
            ans += A[i];
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 12004
#include<cstdio>
#include<iostream>
#define MAX 500010
int mem[MAX]={0};
int gcd(int p,int q){
	if(p%q ==0 ) return q;
	return gcd(q,p%q);
}
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	int sum=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			for(int k=1;k<=n;k++){
				sum+=gcd(gcd(i,j),k);
			}
		}
	}
	printf("%d",sum);
	return 0;
} 

Measured memory_bytes: 3780
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s=="Sunny"){
    cout << "Cloudy" << endl;
  }
  if(s=="Cloudy"){
    cout << "Rainy" << endl;
  }
  if(s=="Rainy"){
    cout << "Sunny" << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main(){
    int n,a,b;
    char s[100010];
    scanf("%d %d %d",&n,&a,&b);
    scanf("%s",s);
    a+=b;
    for(int i=0;i<n;i++){
        if(s[i]=='a'&&a){
            printf("Yes\n");
            a--;
        }
        else if(s[i]=='b'&&a&&b){
            printf("Yes\n");
            a--;
            b--;
        }
        else{
            printf("No\n");
        }
    }
}

Measured memory_bytes: 640
import java.util._

object Main {
  def main(args: Array[String]) = {
    val scanner = new Scanner(System.in)
    val string = scanner.nextLine
    if (string(2) != string(3) || string(4) != string(5)) {
      println("No")
    } else {
      println("Yes")
    }
  }
}


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

ll gcd(ll a,ll b,ll c){
    ll i=0;
    ll n = 0;
    n = min({a,b,c});
    rep(i,n){
        if(a%(n-i)==0&&b%(n-i)==0&&c%(n-i)==0){
            return n-i;
        }
    }
    return 1;
}
int main(){
  ll n,i,j,k;
  cin>>n;
  ll s1=0;
  rep(i,n)rep(j,n)rep(k,n){
      if(i==j&&j==k)s1+=i+1;
      if(i>j&&j>k)s1+=6*gcd(i+1,j+1,k+1);
      if(i>j&&j==k)s1+=3*gcd(i+1,j+1,k+1);
      if(i==j&&j>k)s1+=3*gcd(i+1,j+1,k+1);
  }
  cout << s1;
 
  return 0;
}

Measured memory_bytes: 3620
#coding:utf-8

n = int(input())
T = [list(map(int, input().split())) for i in range(n)]
A = []
def parentSearch():
    numList = []
    for t in T:
        if t[1] != 0:
            for num in t[2:]:
                numList.append(num)
    numList.sort()
    for i in range(n-1):
        if numList[i] != i:
            return i


def rootedTrees(node, parent, depth):
    t = T[node]
    if t[1] != 0:
        if parent == -1:
            kind = "root"
        else:
            kind = "internal node"
        A.append([t[0], parent, depth, kind, t[2:]])
        parent = node
        for i in t[2:]:
            rootedTrees(i, parent, depth+1)
    else:
        if parent == -1:
            kind = "root"
        else:
            kind = "leaf"
        A.append([t[0], parent, depth, kind, []])


def Merge(A, left, mid, right):
    L = A[left:mid]
    R = A[mid:right]
    L.append([510000])
    R.append([510000])
    i,j = 0,0
    for k in range(left,right):
        if L[i][0] <= R[j][0]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1

def MergeSort(A, left, right):
    if left+1 < right:
        mid = (left + right)//2
        MergeSort(A, left, mid)
        MergeSort(A, mid, right)
        Merge(A, left, mid, right)

MergeSort(T, 0, n)
node = parentSearch()
if node == None:
    node = 0
depth = 0
parent = -1
rootedTrees(node, parent, depth)
MergeSort(A, 0, n)

for t in A:
    print("node {}: parent = {}, depth = {}, {}, {}".format(t[0],t[1],t[2],t[3],t[4]))


Measured memory_bytes: 43528
#include<stdio.h>

int main(){
    int n,m,a[100],b[100][100],p[100]={0};
    int i,j,cnt;

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

    for(i=0;i<m;i++){
        for(j=0,cnt=0;j<n;j++){
            if(b[i][j]==a[i]){
                p[j]++;
            }else{
                cnt++;
            }
        }
        p[a[i]-1]+=cnt;
    }

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

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

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    int count  = 0;
    while(1)
    {
        if(a == b && b == c) break;
        if(a < b-2 || a < c-2)
        {
            a+=2;
            count++;
        }
        else if(b < a-2 || b < c-2)
        {
            b+=2;
            count++;
        }
        else if(c < a-2 || c < b-2)
        {
            c+=2;
            count++;
        }
        else if(a < b-1 || a < c-1)
        {
            a+=2;
            count++;
        }
        else if(b < a-1 || b < c-1)
        {
            b+=2;
            count++;
        }
        else if(c < a-1 || c < b-1)
        {
            c+=2;
            count++;
        }
        else if(a == b)
        {
            a++;
            b++;
            count++;
        }
        else if(b == c)
        {
            c++;
            b++;
            count++;
        }
        else if(a == c)
        {
            c++;
            a++;
            count++;
        }
        //cout << a << " " << b << " " << c << " " << endl;
    }
    cout << count;
    return 0;
}

Measured memory_bytes: 256
(let ((q (read))
      (h (read))
      (s (read))
      (d (read))
      (n (read))
      (p 0))
  (setf s (min (* 4 q) (* 2 h) s))
  (when (= (mod n 2) 1)
    (setf n (- n 1))
    (setf p 1))
  (if (< (+ (* d (/ n 2)) (* p s)) (* (+ p n) s))
    (setf a (+ (* d (/ n 2)) (* p s)))
    (setf a (* (+ p n) s)))
  (format t "~A~%" a))

Measured memory_bytes: 16616
package main

import (
	"bufio"
	"fmt"
	"strconv"
	"strings"
	"os"
)

func readLine(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func readInt(sc *bufio.Scanner) (res int) {
	res, _ =strconv.Atoi(readLine(sc))
	return
}

func readInts(sc *bufio.Scanner, n int) []int {
	ns := strings.Split(readLine(sc), " ")
	res := make([]int, n)

	for i, n := range ns {
		res[i], _ = strconv.Atoi(n)
	}
	return res
}

func readMatrix(sc *bufio.Scanner, rows, cols int) [][]int {
	res := make([][]int, rows)
	for i := 0; i < rows; i ++ {
		res[i] = readInts(sc, cols)
	}
	return res
}

func main() {
	const d = 1000000007

	sc := bufio.NewScanner(os.Stdin)

	n := readInt(sc)

	r := 1
	for i := 1; i <= n; i ++ {
		r = r * i % d
	}

	fmt.Println(r)
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

long long int dp[99][21]={0};
int main(void){
	int n,tmp;
	cin >> n;
	cin >> tmp;
	dp[0][tmp]=1;
	for(int i=1;i<n-1;i++){
		cin >> tmp;
		for(int j=0;j<=20;j++){
			if(dp[i-1][j]){
				if(j+tmp<=20)
					dp[i][j+tmp]+=dp[i-1][j];
				if(j-tmp>=0)
					dp[i][j-tmp]+=dp[i-1][j];
			}
		}
	}
	cin >> tmp;
	cout << dp[n-2][tmp] << endl;
	return 0;		
}

Measured memory_bytes: 1172