akhauriyash/Code-Regression huggingface dataset:
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<double>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> B(N - 1);
    rep(i, N - 1) cin >> B[i];
    ll total = B[0];
    rep(i, N-2) total += min(B[i], B[i+1]);
    total += B.back();
    cout << total;
    return 0;
}

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

int main(){

    int N, D, X;
    cin >> N >> D >> X;
    int a[N-1];
    for (int i = 0; i < N; i++){
        cin >> a[i];
    }

    int result = 0;

    for (int i =0; i < N; i++) {
        result += ((D - 1) / a[i] + 1);
    }

    result += X;

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
D = [int(d) for d in input().split()]
D0 = D[0]
D1 = sorted(D[1:])

def calc(D1):
    r = 1
    m = {0:1}
    for d in D1:
        if d-1 in m:
            r = r * m[d-1] % 998244353
            if d in m:
                m[d] = m[d] + 1
            else:
                m[d] = 1
        else:
            return(0)
    return(r)

if D0 != 0:
    print(0)
else:
    print(calc(D1) % 998244353)


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

int main(){
  int n;  cin >> n;
  int _a = 0, b_ = 0, b_a = 0;
  int ans = 0;
  for(int i=0; i<n; i++){
    string s;  cin >> s;
    for(int j=1; j<s.size(); j++)
      if(s[j-1]=='A' && s[j]=='B')  ans++;
    if(s[0]=='B' && s[s.size()-1]=='A')  b_a++;
    else if(s[0]=='B')  b_++;
    else if(s[s.size()-1]=='A')  _a++;
  }

  ans += min(_a, b_);
  if(b_ || _a)  ans += b_a;
  else  ans += max(0, b_a-1);

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
int main(void){
    unsigned long long int **a;
    unsigned long long int **b;
    unsigned long long int **c;
    int n,m,l,i,j,k;
    scanf("%d",&n);
    scanf("%d",&m);
    scanf("%d",&l);
    a = (unsigned long long int **)malloc(n * sizeof(unsigned long long int *));
    b = (unsigned long long int **)malloc(m * sizeof(unsigned long long int *));
    c = (unsigned long long int **)malloc(n * sizeof(unsigned long long int *));
    for(i=0;i<n;i++){
        a[i] = (unsigned long long int *)malloc(m * sizeof(unsigned long long int));
        c[i] = (unsigned long long int *)malloc(sizeof(unsigned long long int) * l);
    }
    for(i=0;i<m;i++){
        b[i] = (unsigned long long int *)malloc(sizeof(unsigned long long int) * l);
    }
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&a[i][j]);
        }
    }
    for(i=0;i<m;i++){
        for(j=0;j<l;j++){
            scanf("%d",&b[i][j]);
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<l;j++){
            c[i][j] = 0;
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<l;j++){
                for(k =0;k<m;k++){
                 c[i][j] += (a[i][k] * b[k][j]);
                }
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<l;j++){
            if(j < l -1) printf("%llu ",c[i][j]);
            else printf("%llu\n",c[i][j]);
        }
    }

    free(a);
    free(b);
    free(c);
    return 0;
}

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

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

  if(n > m / 2) {
    cout << m/2 << endl;
  } else {
    cout << (n + (m - 2 * n) / 4) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

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

    int n,m; cin >> n >> m;

    if(abs(n-m) > 1){
        cout << 0 << endl;
        return 0;
    }

    int nkumi = 1,mkumi = 1;

    for(int i = n;i > 0;i --){
        nkumi *= i;
        nkumi %= 1000000007;
    }
    for(int i = m;i > 0;i --){
        mkumi *= i;
        mkumi %= 1000000007;
    }

    
    int ans = nkumi * mkumi;
    ans %= 1000000007;

    if(n == m){
        ans *= 2;
        ans %= 1000000007;
    }

    cout << ans << endl;
}

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

int main() {
    int n, t;
    cin >> n >> t;
    int r = 10000;
    for (int i = 0; i < n; i++) {
        int q, w;
        cin >> q >> w;
        if (w <= t && q < r) {
            r = q;
        }
    }
    if ( r == 10000 ) {
        cout << "TLE";
    }  else {
        cout << r;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(v) for(int k=head[v];k;k=e[k].ne)
#define v e[k].t
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=1e6+5,M=1e7+5,INF=1e9,mod=1e9+7;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
il void gen(){freopen("data.in","w",stdout);}
int fa[N],dep[N],X,Y,res,n;
vector<int>er[N],eb[N];
void dfsb(int x){
	re(i,0,eb[x].size())if(eb[x][i]!=fa[x]){
		fa[eb[x][i]]=x,dep[eb[x][i]]=dep[x]+1;
		dfsb(eb[x][i]);
	}
}
int ok(int x,int y){
	if(dep[x]<dep[y])swap(x,y);
	for(int i=1;i<=2&&x!=y;i++)
		if(dep[x]<dep[y])y=fa[y];else x=fa[x];
	return x==y;
}
void dfsr(int x,int f,int dis){
	gmax(res,dep[x]);
	if(dep[x]<=dis)return;
	re(i,0,er[x].size())if(er[x][i]!=f){
		if(!ok(x,er[x][i])){puts("-1");exit(0);}
		dfsr(er[x][i],x,dis+1);
	}
}
int main(){
	read(n,X,Y);
	re(i,1,n){int x,y;read(x,y);er[x].pb(y);er[y].pb(x);}
	re(i,1,n){int x,y;read(x,y);eb[x].pb(y);eb[y].pb(x);}
	dfsb(Y);
	dfsr(X,0,0);
	cout<<res*2;
}

Measured memory_bytes: 75904
fun main(args : Array<String>) {
    val (a, b, h, m) = readLine()!!.split(" ").map { it.toDouble() }

    val hd = ((360/12) * h) + ((360/12) * (m/60))
    val md = (360/60) * m

    //println("hd: $hd md: $md")

    val hr = Math.toRadians(hd)
    val mr = Math.toRadians(md)

    val hx = Math.sin(hr) * a
    val hy = Math.cos(hr) * a

    val mx = Math.sin(mr) * b
    val my = Math.cos(mr) * b

    //println("h(x, y) = ($hx, $hy)")
    //println("m(x, y) = ($mx, $my)")

    println(Math.sqrt(((mx - hx) * (mx - hx)) + ((my - hy) * (my - hy))))
}

Measured memory_bytes: 36548
s = input()
s_len = len(s)
t = input()
t_len = len(t)
dp = [[0] * (t_len + 1) for _ in range(s_len + 1)]

for i in range(s_len):
    for j in range(t_len):
        if s[i] == t[j]:
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1)
        else:
            dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j])

string = ""
cnt = dp[s_len][t_len]

while t_len > 0 and s_len > 0:
    if dp[s_len][t_len] == dp[s_len - 1][t_len]:
        s_len -= 1
    elif dp[s_len][t_len] == dp[s_len][t_len - 1]:
        t_len -= 1
    else:
        string += s[s_len - 1]
        s_len -= 1
        t_len -= 1


print(string[::-1])


Measured memory_bytes: 112348
import itertools
import math

n = int(input())
points = [list(map(int, input().split())) for _ in range(n)]
numbers = list(range(1, n + 1))
diff = 0
count = 0
for pattern in itertools.permutations(numbers):
    count += 1
    for j in range(n - 1):
        points_index = pattern[j] - 1
        next_index = pattern[j + 1] - 1
        diff += math.sqrt((points[points_index][0] - points[next_index][0]) ** 2 + (points[points_index][1] - points[next_index][1]) ** 2)

print(diff / count)


Measured memory_bytes: 9192
n, k = map(int, input().split())
s = input()

index_lst = []
num_lst = []
before = '-1'
for K, i in enumerate(s):
    if i != before:
        before = i
        index_lst.append(K)
        num_lst.append(int(i))
N = len(index_lst)
index_lst += [n] * (2*k+10)
#print('index_lst: ', index_lst)
#print('num_lst: ', num_lst)

S = 0
for i in range(N):
    if num_lst[i] == 0:
        S = max(S, index_lst[i+2*k] - index_lst[i])
    else:
        S = max(S, index_lst[i+2*k+1] - index_lst[i])
print(S)

Measured memory_bytes: 8784
#include<iostream>
#include<algorithm>	
#include<vector>
using namespace std;
int main (){
  int h,w;
  while(cin >> h >> w,h){
    int min=h*h+w*w;
    vector<pair<int,int> > ans(1000);
    int k=0,judge=1,l=0;
    while(judge){ 
      for(int i=1;i<=150;i++){
        for(int j=i+1;j<=150;j++){
          if((min+l==i*i+j*j)&&(!((i==h)&&(j==w)))){
            if(!(l==0&&i<h)){
              ans[k].first=i;
              ans[k].second=j;
              k++;
              judge=0;
            }
          }
        }
      }
    l++;
    }
    sort(ans.begin(),ans.end());
    for(int i=0;i<1000;i++){
      if(ans[i].first!=0){
        cout << ans[i].first << " " << ans[i].second << endl;
        break;	
      }
    }
  }
}

Measured memory_bytes: 3076
//#pragma GCC optimize ("O3")
///#include<bits/stdc++.h>
#include<iostream>
#include<string>

using namespace std;



/// Info.
///****************************************************************************************************************************************///
/// Coder               : BAHAA El_DEEN OSAMA SAYED.
/// Problem name        : J - UOIAUAI
/// Method              : IM
/// Date                : 23/2/2020
///****************************************************************************************************************************************///


#define rep0(i,x)         for(int i=0; i<=x ;++i)
#define all(v)           ((v.begin()),((v.end())
#define mm(v,d)          memset(v,d,sizeof(v))
#define lp(i,v)          for(int i=0;i<sizeof(v);++i)
#define lpi(i,j,n)       for(int i=(j);i>=(int)n;++i)
#define lpd(i,j,n)       for(int i=(j);i>=(int)n;--i)
#define MP               make_pair
#define SZ(v)            ((int) ( (v).size() ) )
#define ull              unsigned long long
#define ll               long long
#define pi               3.1415926536
#define oo               1e9
#define OO               1e18
#define Fx(n)            fixed<<setprecision(n)
#define FasterIO           std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define RE0              return 0
#define RE1              return 1
#define mp(a,b)          make_pair(a,b)
#define X                first
#define Y                second
#define pii              pair(int a, int b)
#define rep1(i,x)        for(int i=1;i<x;++i)
#define rep2(i,x)        for(int i=2;i<x;++i)
#define RE               return
//#define LD               long double
#define all(v) ((v).begin()),((v).end())


const  int  N   = (int) 1e5+100;
const  int  M   = (int) 1e4+4;
const  int  INF = (int) 0x3f3f3f3f;
///const double ESP = 1e-7;
///const ll MOD=1e8+9;

char s;

int main()
{
FasterIO;

cin>>s;
if(s=='a'||s=='e'||s=='o'||s=='u'||s=='i')
{
    cout << "vowel";
}
else
{
    cout << "consonant";
}



 RE0;}


Measured memory_bytes: 256
#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

char buf[20]; int w;
void mypr(int n)
{
	w = 0;
	if (!n) { buf[w++] = '0'; return; }
	while (n) buf[w++] = n%10 + '0', n/=10;
}

#define MAX_N 10000
int f[MAX_N+2];

int main()
{
	int N, i, j, c;

	N = in();
	for (i = 0; i < N; i++) f[in()]++;
	for (i = 0; ; i++) if (c = f[i]) break;
	mypr(i); j = w; while (j--) pc(buf[j]);
	while (--c) { pc(' '); j = w; while (j--) pc(buf[j]); }
	while (++i <= MAX_N) if (c = f[i]) {
		mypr(i); 
		while (c--) { pc(' '); j = w; while (j--) pc(buf[j]); }
	}
	pc('\n');
	return 0;
}



Measured memory_bytes: 2148
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    int a; cin >> a;
    cout << a*a*a+a*a+a << endl;
}

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

aPlus=0
bPlus=0

for i in range(n):
    if a[i]>b[i]:
        aPlus+=(a[i]-b[i])
    elif a[i]<b[i]:
        if (b[i]-a[i])%2==0:
            bPlus+=(b[i]-a[i])//2
        else:
            aPlus+=1
            bPlus+=(b[i]+1-a[i])//2

if aPlus<=bPlus:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 40944
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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;}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    ll k, a, b; cin >> k >> a >> b;
    ll ans = 0;
    if(b - a < 2){
        cout << 1 + k << endl;
        return 0;
    }else{
        ans = a;
        k -= (a-1);
        ll c = k / 2;
        ans += c * (b-a);
        k -= c * 2;
        if(k == 1){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

int main() {
    int r, c;
    cin >> r >> c;

    int S[101][101];
    rep(i,r) {
        rep(j,c) cin >> S[i][j];
    }

    rep(k,c + 1) S[k][c] = 0;
    rep(l,r + 1) S[r][l] = 0;

    rep(i,r) {
        rep(j,c) {
            S[i][c] += S[i][j];
            S[r][j] += S[i][j];
            S[r][c] += S[i][j];
        }
    }    
    rep(i,r + 1) {
        rep(j,c + 1) {
            if (j) cout << " ";
            cout << S[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3084
#include<iostream>
#include<array>

using namespace std;

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

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

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



}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

int n, sw;
int w[105];
long long v[105];
long long a[100003][105];

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

	for (int i = 1; i <= n; i++)
	{
		scanf("%d%d", &w[i], &v[i]);
	}
	
	for (int i = 1; i <= sw; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			long long res = 0;

			if (i >= w[j])
				res = a[i - w[j]][j - 1] + v[j];

			a[i][j] = max(res, a[i][j - 1]);
		}
	}

	cout << a[sw][n] << endl;

	return 0;
}

Measured memory_bytes: 82304
n,m = map(int,input().split())
g = sorted([list(map(int,input().split())) for _ in range(m)])
def BellmanFord(edges,num_v,source):
  #グラフの初期化
  inf=float("inf")
  dist=[inf for i in range(num_v)]
  dist[source-1]=0
  
  #辺の緩和
  for i in range(num_v):
    for edge in edges:
      if edge[0] != inf and dist[edge[1]-1] > dist[edge[0]-1] - edge[2]:
        dist[edge[1]-1] = dist[edge[0]-1] - edge[2]
        if i==num_v-1 and edge[0] == num_v-1: return -1
  
  return dist
if BellmanFord(g,n,1) == -1:
  print("inf")
else:
  print(-BellmanFord(g,n,1)[-1])

Measured memory_bytes: 45416
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;

int main(){
  int x;
  cin>>x;
  if(x<1200)cout<<"ABC"<<endl;
  else cout<<"ARC"<<endl;
  
}


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

icnt = 0
for i in range(0, len(a)):
	imin = i
	for j in range(i + 1, len(a)):
		if a[j] < a[imin]:
			imin = j
	if imin != i:
		a[i], a[imin] = a[imin], a[i]
		icnt = icnt + 1

print(' '.join([str(n) for n in a]))
print(icnt)



Measured memory_bytes: 5608
N, K = gets.split.map(&:to_i)
d = Array.new
array = Array.new
input_array = Array.new

K.times do
    d.push(gets.to_i)
    input_array = gets.split.map(&:to_i)
    input_array.each do |x|
        array.push(x)
    end
end

puts N - array.uniq.count


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

using namespace std;
using ll = long long;

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


int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int n, m; cin >> n >> m;

    priority_queue<int> que;

    int total_vote = 0;

    REP(i, n) {
        int a; cin >> a;
        que.push(a);
        total_vote += a;
    }

    REP(i, m - 1) {
        que.pop();
    }

    int x = que.top();

    if ((double)total_vote / (4 * m) <= x) {
        cout << "Yes" << endl;
    } else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		String x = input.nextLine();
		boolean lucky = false;
		for (int i = 0; i < x.length(); i++) {
			if (x.charAt(i)=='7') {
				lucky = true;
				break;
			}
		}
		System.out.println(lucky?"Yes":"No");
	}
}


Measured memory_bytes: 26944
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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 int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN3(n,a,b);
  OUT((n-a+1)*(n-b+1));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	bool f = 0;

	for(int i = 0; i < n; i++) {
		int t, x, y, u = 0, p = 0, q = 0;
		cin >> t >> x >> y;
		u = t - u;
		p = x - p;
		q = y - q;
		if((u < p + q)||((u + p + q) % 2 == 1)) {
			f = 1;
		}
	}

	if(f) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
	}

	return 0;
}


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

int main(){
    string s; cin>>s;
    int ans=0;
    int n=s.size();
    for(int i=0; i<n; i++){
        if(s[i]=='o') ans ++;
    }
    cout <<(ans+15-n>=8?"YES":"NO") << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		if(a * b % 2 == 1) {
			System.out.println("Odd");
		} else {
			System.out.println("Even");
		}
	}
}

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

using namespace std;

int main(void){
  int size,vnum,adjnum,adj;
  cin>>size;
  vector<vector<int>> adjmat(size,vector<int>(size));
  for(int i=0;i<size;i++){
    cin>>vnum>>adjnum;
    for(int j=0;j<adjnum;j++){
      cin>>adj;
      adjmat.at(vnum-1).at(adj-1)=1;
    }
  }

  for(int i=0;i<size;i++){
    for(int j=0;j<size-1;j++) cout<<adjmat.at(i).at(j)<<" ";
    cout<<adjmat.at(i).at(size-1)<<endl;
  }

  return 0;
}



Measured memory_bytes: 3132
n,m,k=map(int,input().split())
ans=0
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 998244353 #出力の制限
N = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


  
kk=n-k
#print(kk)
color=m*(m-1)**(kk-1)%mod
#print(color)
while kk<=n:
  now=color
  color=color*(m-1)%mod
  now=now*(cmb((n-1),(n-kk),mod))%mod
  kk+=1
  ans+=now
  ans=ans%mod
  #print(kk)
  #print(now)
  #print("color",color,"com",com)
print(ans)
  

Measured memory_bytes: 34424
import math

n, m = map(int, input().split())


ans_n = 0
if n <= 1:
    ans_n = 0
else:
    ans_n = math.factorial(n)//(math.factorial(n-2)*math.factorial(2))

ans_m = 0
if m <= 1:
    ans_m = 0
else:
    ans_m = math.factorial(m)//(math.factorial(m-2)*math.factorial(2))
print(ans_n+ans_m)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,N) for (ll i=0;i<N;i++)
#define REP(i,N) for (ll i=1;i<=N;i++)
 
ll N,M,A,B,C;
string S,T,U;
double n,m,a,b,c;
 
int main() {
	cin>>S;
  if (S[2]==S[3]&&S[4]==S[5]) cout<<"Yes";
  else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

//#include "Union_Find.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>

using namespace std;
#define REP(i,a,n) for(int i = a; i < n; ++i)
#define REPM(i,n,a) for(int i = n - 1; i >= a; --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

class SplitStream {
	typedef basic_ostream<char, char_traits<char> > BaseOst;
	std::ostream& ost_m;
	bool line_is_empty_m;
public:
	SplitStream(std::ostream& ost);
	template <typename T>
	SplitStream& operator<<(T right);
	SplitStream& operator<<(BaseOst& (*right)(BaseOst&));
};
SplitStream::SplitStream(std::ostream& ost) : ost_m(ost), line_is_empty_m(true) {}
template <typename T>
SplitStream& SplitStream::operator<<(T right) {
	if (!line_is_empty_m) ost_m << ' ';
	line_is_empty_m = false;
	ost_m << right;
	return *this;
}
/* std::endl のみ */
SplitStream& SplitStream::operator<<(BaseOst& (*right)(BaseOst&)) {
	ost_m << '\n';
	ost_m.flush();
	line_is_empty_m = true;
	return *this;
}
SplitStream Scout(cout);

template <typename T, int Begin, int End>
class OffsetArray {
	T arr_m[End - Begin];
public:
	OffsetArray();

	T& operator[](int index);
	T operator[](int index) const;
};
template<typename T, int Begin, int End>
OffsetArray<T, Begin, End>::OffsetArray() : arr_m() {}
template<typename T, int Begin, int End>
T& OffsetArray<T, Begin, End>::operator[](int index) {
	return arr_m[index - Begin];
}
template<typename T, int Begin, int End>
T OffsetArray<T, Begin, End>::operator[](int index) const {
	return arr_m[index - Begin];
}

template<typename T, int N>
void Fill(T(&arr)[N], T val) {
	for (int i = 0; i < N; ++i) {
		Fill(arr[i], val);
	}
}
template<typename T, int M, int N>
void Fill2D(T(&arr)[M][N], T val) {
	for (int i = 0; i < M; ++i) {
		Fill(arr[i], val);
	}
}

#if 1
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;
#endif
int N;
LL A[100000], B[100000];
int main() {
	cin >> N;
	REP(i, 0, N) {
		cin >> A[i] >> B[i];
	}
	LL plus = 0;
	REPM(i, N, 0) {
		LL AA = A[i] + plus;
		plus += B[i] - (AA % B[i] == 0 ? B[i] : AA % B[i]);
	}
	cout << plus << endl;
	return 0;
}



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

int n;
string s;

bool cek(string s, int n){
	if(n%2) return false;
	
	if(s.substr(0, n/2)==s.substr(n/2, n/2)) return true;
	return false;
}

int main(){
	cin>>s;
	n=s.size();
	s.erase(n-1, 1);
	n--;
	
	while(!cek(s, n)){
		s.erase(n-1, 1);
		n--;
	}
	
	cout<<n<<endl;
}


Measured memory_bytes: 3636
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}





int main(){
    long long A; long double B;
    std::cin >> A >> B;
    long long b(100*B + 0.5);
    std::cout << (A * b) / 100 << std::endl;
    return 0;
}


Measured memory_bytes: 3712
def main():
    while True:
        N, M, S = map(int, input().split())
        if max(N, M, S) == 0:
            break
        ans = solve(N, M, S)
        print(ans)


def solve(N, M, S):
    MOD = 10 ** 5
    p = N * N
    q = M - p
    T = S - (p * (p + 1)) // 2

    dp = [[0 for i in range(T + 1)] for j in range(p + 1)]
    dp[0][0] = 1
    for i in range(1, p + 1):
        for j in range(T + 1):
            dp[i][j] = dp[i - 1][j]
            if j - i >= 0:
                dp[i][j] += dp[i][j - i]
            if j - i - q >= 0:
                dp[i][j] -= dp[i - 1][j - i - q]

            dp[i][j] %= MOD

    ans = dp[p][T]
    # for r in dp:
    #     print(", ".join(map(str, r)))
    return ans


main()



Measured memory_bytes: 8948
#include<stdio.h>
int main()
{	
	int N,i,k;
	int C[500],S[500],F[500],T[500];
	scanf("%d",&N);
	for(i=1;i<N;i++)
	scanf("%d%d%d",&C[i],&S[i],&F[i]);
	for(i=1;i<N;i++)
	{
		T[i]=0;
		for(k=i;k<N;k++)
		{	
			if(T[i]>=S[k]) 
				{
					if((T[i]-S[k])%F[k]==0) 
					T[i]=T[i]+C[k];
					else
					T[i]=T[i]+C[k]+F[k]-(T[i]-S[k])%F[k];
				}
			else
			T[i]=S[k]+C[k];
		}
		printf("%d\n",T[i]);
	}
	printf("0\n");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;

int fie[1550][1550];
int cycs[40];

int main(void){
	int n=1407;
	int k=38;
	printf("%d %d\n",n,k);
	int now=1;
	for(int i=0;i<k;i++){
		fie[i][0]=n;
		for(int j=1;j<k;j++){
			if(j==1)cycs[i]=now;
			fie[i][j]=now++;
		}
	}
	int p=k-1;
	for(int i=0;i<p;i++){
		for(int j=0;j<p;j++){
			fie[k+i*p+j][0]=p*p+i+1;
			int fu=j;
			for(int m=1;m<k;m++){
				fie[k+i*p+j][m]=cycs[m-1]+fu;
				fu=(fu+i)%p;
			}
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<k;j++){
			printf("%d%c",fie[i][j],(j+1)==k?'\n':' ');
		}
	}
	return 0;
}

Measured memory_bytes: 8192
def h(seq):
    return len(seq)!=len(set(seq))
a=int(input())
t=['0']*a
hantei=0
for i in range(a):
    t[i]=input()
for i in range(a-1):
    if t[i][-1]!=t[i+1][0]:
        hantei=1
if h(t):
    hantei=1
if hantei==0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<iostream>
#include<string>
using namespace std;
int main(void){
	string a;
		cin >> a;
	int ans=0;
	for(int i=0;i<4;i++){
		if(a[i]=='+')
			ans++;
		else
			ans--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int sum = 0;
        int [][] List = new int[10][10];
        for(int i=0;i<10;i++)for(int j=0;j<10;j++) List[i][j]=0;
        for(int i=1;i<=N;i++){
            int [] Pair = F(i);
            List[Pair[1]][Pair[0]]++;
        }
        for(int i=1;i<=N;i++){
            if(i%10!=0){
                int [] Pair = F(i);
                sum+=List[Pair[0]][Pair[1]];
            }
        }
        System.out.println(sum);

    }
    public static int[] F(int i){
        int [] List = new int [2];
        List[0]= i%10;
        List[1] = 0;
       while(i!=0){
           List[1] = i;
           i/=10;
       }
       return List;
    }
}

Measured memory_bytes: 31956
var
  a:array[0..10] of longint=(0,1,2,3,4,5,5,4,3,2,1);
  str:ansistring;
  f,ff,ans,anss:array[-100..1000005] of longint;
  i,len:longint;
function min(x,y:int64):int64;
begin
  if (x<y) then exit(x)
  else exit(y);
end;
begin
  readln(str);
  len:=length(str);
  for i:=1 to len do
   f[i]:=ord(str[i])-48;
  anss[len+1]:=10000;
   for i:=len downto 0 do
   begin
     ans[i]:=min(ans[i+1]+f[i],anss[i+1]+f[i]+1);
     anss[i]:=min(ans[i+1]+10-f[i],anss[i+1]+9-f[i]);
   end;
  writeln(min(ans[0],anss[0]));
end.


Measured memory_bytes: 14976
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using pii = std::pair<int, int>;
using namespace std;

int main() {
  ll N, Y;
  cin >> N >> Y;
  ll x = -1, y = -1;
  REP(u, 2501) {
    REP(v, 4001) {
      if (9000 * u + 4000 * v + 1000 * N == Y && N >= (u + v)) {
        x = u;
        y = v;
      }
    }
  }
  const ll z = (x == -1 && y == -1) ? -1 : (N - x - y);
  cout << x << " " << y << " " << z << endl;
  return 0;
}


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

ll ans = 0;

int main(){
    ll n;
    cin >> n;
  	if(n % 2 == 1){
      	cout << 0 << endl;
      	return 0;
    }
    ll p = 10,p5 = 5;

    while(n >= p){
        ans += n/p;
        p *= p5;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-04-05 14:59:08
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rev(x) greater<(x)>()
#define MOD 1000000007
#define INF 1000000000

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

LL modpower(LL n, LL m, LL mod) {
    if (m == 0) {
        return 1;
    } else if (m % 2 == 0) {
        LL p = modpower(n, m/2, mod);
        return p*p % mod;
    } else {
        return n*modpower(n, m-1, mod) % mod;
    }
}

LL modinv(LL n, LL mod) {
    return modpower(n, mod-2, mod);
}

LL modcombination(LL n, LL r, LL mod) {
    LL ret = 1;

    for (int i = 0; i < r; i++) {
        ret *= (n-i);
        ret %= mod;
        ret *= modinv(i+1, mod);
        ret % mod;
    }

    return ret % mod;
}

int gcd(int k, int l) {
    if (l > 0) return gcd(l, k%l);
    else return k;
}

ostringstream oss_global;
string s_global = oss_global.str();

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

    if (n <= 999) cout << "ABC" << endl;
    else cout << "ABD" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
/*
long long int tks(long long int D,long long int ans){
	int y=D;
	ans+=D*D*y;
	
	


}
*/
int main(){
	
	
	int D=0;
	
	while(cin>>D){
long long int ans=0;
int y=0;
	while(1){
		y+=D;
		if(y>=600)break;
		ans+=y*y*D;
	}
	cout<<ans<<endl;}
	return 0;
}
	

Measured memory_bytes: 1156
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define link(x) for(edge *j=h[x];j;j=j->next)
#define inc(i,l,r) for(int i=l;i<=r;i++)
#define dec(i,r,l) for(int i=r;i>=l;i--)
const int MAXN=3e5+10;
const double eps=1e-8;
const int mod=1e9+9;
#define ll long long
using namespace std;
struct edge{int t,v;edge*next;}e[MAXN<<1],*h[MAXN],*o=e;
void add(int x,int y,int vul){o->t=y;o->v=vul;o->next=h[x];h[x]=o++;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    return x*f;
}



vector<char>vec;
int n;
ll a[3];
char str[MAXN][5];
int main(){
    n=read();
    inc(i,0,2){
	a[i]=read();
    }
    inc(i,1,n)scanf("%s",str[i]+1);
    inc(i,1,n){
	int x=str[i][1]-'A';int y=str[i][2]-'A';
	if(a[x]!=a[y]){
	    if(a[x]<a[y])swap(x,y);
	    a[x]--;a[y]++;
	    vec.pb((char)('A'+y));
	}
	else if(a[x]==a[y]){
	    if(i==n){
		a[x]--;a[y]++;
		vec.pb((char)('A'+y));
	    }
	    else{
		int t1=str[i+1][1]-'A';int t2=str[i+1][2]-'A';
		int cnt=0;
		if(x==t1)cnt++;
		if(x==t2)cnt++;
		if(y==t1)cnt++;
		if(y==t2)cnt++;
		if(cnt==2){
		    a[x]++;a[y]--;
		    vec.pb((char)('A'+x));		    
		}
		else{
		    if(x==t1||x==t2){
			a[x]++;a[y]--;
			vec.pb((char)('A'+x));
		    }
		    else{
			a[x]--;a[y]++;
			vec.pb((char)('A'+y));
		    }
		}
	    }
	}
	inc(j,0,2)if(a[j]<0)return 0*printf("No\n");
    }
    printf("Yes\n");
    inc(i,1,n)printf("%c\n",vec[i-1]);
    return 0;
}


Measured memory_bytes: 4416
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 100000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define eps 0.000001
#define endl '\n'
#define mo 998244353
 
using namespace std ;
 
#define MAXN 305 

typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

lli dp[3000 + 5][3000 + 5];
lli a[3000 + 5];

lli f(lli s, lli e)
{
    if(dp[s][e] != -1) return dp[s][e];
    if(s == e) return dp[s][e] = a[s];

    return dp[s][e] = max(a[s] - f(s+1,e) , a[e] - f(s,e-1));
}


int main()
{
///////////////////////////////////////////

    memset(dp,-1,sizeof(dp));

    lli n;
    cin>>n;

    loopl(i,0,n) cin>>a[i];

    cout<<f(0,n-1)<<endl;

}

Measured memory_bytes: 70912
#include <stdio.h>
int main() {
  int fir=0, sec=0, thr=0, i;
  int p;
  for(i=0;i<10;i++) {
    scanf("%d",&p);
    if(p > fir) {
      thr = sec;
      sec = fir;
      fir = p;
    }
    else if(p > sec) {
      thr = sec;
      sec = p;
    }
    else if(p > thr) {
      thr = p;
    }
  }
  printf("%d\n%d\n%d\n",fir,sec,thr);
  return 0;
}

Measured memory_bytes: 600
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define For(i, a, b) for (i = a; i <= b; i++)

inline int read()
{
	int res = 0; bool bo = 0; char c;
	while (((c = getchar()) < '0' || c > '9') && c != '-');
	if (c == '-') bo = 1; else res = c - 48;
	while ((c = getchar()) >= '0' && c <= '9')
		res = (res << 3) + (res << 1) + (c - 48);
	return bo ? ~res + 1 : res;
}

template <class T>
inline T Min(const T &a, const T &b) {return a < b ? a : b;}

template <class T>
inline T Max(const T &a, const T &b) {return a > b ? a : b;}

const int N = 305, INF = 0x3f3f3f3f, ZZQ = 1e9 + 7;

int n, m, min1[N], min2[N], max2[N], max3[N], f[N][N][N], ans;

bool check(int i, int j, int k)
{
	return min1[i] >= j && min2[i] >= k && max2[i] < j && max3[i] < k;
}

int main()
{
	int i, j, k, l, r, x;
	n = read(); m = read();
	For (i, 1, n) min1[i] = min2[i] = INF, max2[i] = max3[i] = -INF;
	while (m--)
	{
		l = read(); r = read(); x = read();
		if (x == 1) min1[r] = Min(min1[r], l);
		else if (x == 2)
			min2[r] = Min(min2[r], l), max2[r] = Max(max2[r], l);
		else max3[r] = Max(max3[r], l);
	}
	f[1][1][0] = max2[1] == -INF && max3[1] == -INF ? 3 : 0;
	For (i, 1, n - 1) For (j, 0, i) For (k, 0, i)
	{
		if (!f[i][j][k]) continue;
		if (check(i + 1, j, k))
			f[i + 1][j][k] = (f[i + 1][j][k] + f[i][j][k]) % ZZQ;
		if (k)
		{
			if (check(i + 1, i + 1, k))
				f[i + 1][i + 1][k] = (f[i + 1][i + 1][k] + f[i][j][k]) % ZZQ;
			if (check(i + 1, i + 1, j))
				f[i + 1][i + 1][j] = (f[i + 1][i + 1][j] + f[i][j][k]) % ZZQ;
		}
		else
		{
			if (check(i + 1, i + 1, j))
				f[i + 1][i + 1][j] = (2ll * f[i][j][k]
				+ f[i + 1][i + 1][j]) % ZZQ;
		}
	}
	For (j, 0, n) For (k, 0, j - 1)
		ans = (ans + f[n][j][k]) % ZZQ;
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 108800
#include <stdio.h>

void NotoMamiko(int SakuraAyane) {
	int IsikawaKaito;
	if (SakuraAyane <= 0) return;
	IsikawaKaito = SakuraAyane % 3;
	NotoMamiko(SakuraAyane / 3 + (IsikawaKaito == 2));
	putchar("0+-"[IsikawaKaito]);
}

int main(void) {
	int HayamiSaori;
	if (scanf("%d", &HayamiSaori) != 1) return 1;
	NotoMamiko(HayamiSaori);
	putchar('\n');
	return 0;
}

Measured memory_bytes: 568
#include<iostream>
#include<algorithm>
using namespace std;
int cost[100005],n,k;

bool check(int P){
    int i=1,temp;
    for(int j=1;j<=k;j++){
        temp=0;
        while(i<=n&&temp+cost[i]<=P){
            temp+=cost[i];
            i++;
            if(i>n)return true;
        }
    }
    return false;
}

int main(){
    int i,Left=0,Right=0,Mid;
    cin>>n>>k;
    for(i=1;i<=n;i++){
        cin>>cost[i];
        Right+=cost[i];
    }
    while(Left<Right){
        Mid=(Left+Right)>>1;
        if(check(Mid)){
            Right=Mid;
        }
        else Left=Mid+1;
    }
    cout<<Right<<endl;
    return 0;
}


Measured memory_bytes: 3464
//list index out of rangeエラー表示用
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep1(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)


int main(){
  long long n, a, b;
  cin >> n >> a >> b;
  cout << n/(a+b)*a + min(a, n%(a+b));
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////


int main(){fastio
    ll q;cin>>q;
    multiset<ll>l,r;
    ll suml=0,sumr=0;
    l.insert(-inf);r.insert(inf);
    ll sumb=0;
    while(q--){
        ll p;cin>>p;
        if(p==1){
            ll a,b;cin>>a>>b;
            sumb+=b;
            auto itr1=l.end();itr1--;
            auto itr2=r.begin();
            if(a<*itr1){
                sumr+=*itr1;
                suml+=2*a-*itr1;
                r.insert(*itr1);
                l.erase(itr1);
                rep(qq,1,2)l.insert(a);
            }else if(*itr2<a){
                sumr+=2*a-*itr2;
                suml+=*itr2;
                l.insert(*itr2);
                r.erase(itr2);
                rep(qq,1,2)r.insert(a);
            }else{
                l.insert(a);suml+=a;
                r.insert(a);sumr+=a;
            }
        }else{
            auto itr=l.end();itr--;
            ll ans=(sumr-suml)/2+sumb;
            cout<<*itr<<" "<<ans<<endl;
        }
       // cout<<suml<<" "<<sumr<<endl;
        //for(auto x:l)cout<<x<<" ";cout<<endl;
        //for(auto x:r)cout<<x<<" ";cout<<endl;
    }
    
    return 0;
}
/*
10
 1 4 0
 2
1 7 0
 2
 


 */



Measured memory_bytes: 19072
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n)     for (ll i = 0; i < n; ++i)
#define rep2(i, a, b) for (ll i = (a); i < (b); ++i)
#define repin(a, n)  \
    vector<ll> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repins(a, n)     \
    vector<string> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repind(a, n)     \
    vector<double> a(n); \
    rep(i, n) { cin >> a[i]; }
#define in(a) \
    ll a;     \
    cin >> a;
#define ins(a) \
    string a;  \
    cin >> a;
#define ind(a) \
    double a;  \
    cin >> a;
template <class T>
inline void out(T a) {
    cout << a << endl;
}
inline void out(double a) { printf("%.10f\n", a); }
#define all(x)  (x).begin(), (x).end()    //昇順
#define rall(x) (x).rbegin(), (x).rend()  //降順
#define yes     out("Yes");
#define no      out("No");

int main() {
    ins(s);
    ins(t);

    ll ans = t.size();

    rep(i, s.size() - t.size() + 1) {
        ll c = t.size();
        rep(j, t.size()) {
            if (s[i + j] == t[j]) {
                c--;
            }
        }
        ans = min(ans, c);
    }
    out(ans);
}

Measured memory_bytes: 3628
r, c, R, C = [int(_) for _ in input().split()]
mod = 10**9 + 7

f = [1] * (2 * 10**6 + 10)
for i in range(1, 2 * 10**6 + 10):
    f[i] = i * f[i - 1] % mod


def comb(x, y):
    return f[x] * pow(f[y], mod - 2, mod) * pow(f[x - y], mod - 2, mod)


print((comb(C + R + 2, R + 1) - comb(c + R + 1, R + 1) - comb(C + r + 1, r) + comb(c + r, r)) % mod)


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

int main(){
    int n,L[100],i;
    cin >> n;
    for(i=0;i<n;i++)cin >> L[i];

    for(i=n-1;i>=0;i--){
        if(i != n-1)cout << " ";
        cout << L[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3016
l1,l2,l3=[],[],[]
final=[]
count=0
for i in range(24):
    p,t=map(float,input().split())
    if count<=7:l1.append([t,p])
    elif 7<count<=15:l2.append([t,p])
    elif 15<count<=23:l3.append([t,p])
    count +=1
l1=sorted(l1)
l2=sorted(l2)
l3=sorted(l3)
final +=[l1[0],l1[1],l2[0],l2[1],l3[0],l3[1]]
del l1[0],l1[0],l2[0],l2[0],l3[0],l3[0]
third=sorted(l1+l2+l3)
final +=[third[0],third[1]]
for i in range(8):print(int(final[i][1]),final[i][0])


Measured memory_bytes: 5588
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
  let (s, w) = read_touple::<usize>();
  if w >= s {
     println!("unsafe");
  } else {
    println!("safe");
  }
}


Measured memory_bytes: 2156