akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

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

        int A = sc.nextInt();
        String cul = sc.next();
        int B = sc.nextInt();

        if(cul.equals("+")){
            System.out.println((A+B));
        }else if(cul.equals("-")){
            System.out.println((A-B));
        }
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const signed INF_=1001001001; const ll INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
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(a>b){a=b;return 1;}return 0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

bool solve() {
    int N,M;
    cin>>N>>M;
    vector<vector<pii>> g(N);
    vector<int> deg(N,0);
    REP(i,M) {
        int L,R,D;
        cin>>L>>R>>D;
        L--,R--;
        g[L].push_back({R,D});
        deg[R]++;
    }

    vector<int> tps;
    tps.reserve(N);
    stack<int> st;
    REP(i,N) if(deg[i]==0) st.push(i);
    while(!st.empty()) {
        int v=st.top(); st.pop();
        tps.push_back(v);
        FORE(e,g[v]) {
            deg[e.first]--;
            if(deg[e.first]==0) {
                st.push(e.first);
            }
        }
    }
    if(SZ(tps)<N) {
        return false;
    }

    bool ng=false;
    vector<int> dist(N,INF);
    function<void(int)> dfs=[&](int v) {
        FORE(e,g[v]) {
            if(dist[e.first]!=INF && dist[v]+e.second!=dist[e.first]) {
                ng=1;
                return;
            }
            if(dist[e.first]==INF) {
                dist[e.first]=dist[v]+e.second;
                dfs(e.first);
            }
        }
    };
    REP(i,N) {
        int v=tps[i];
        if(dist[v]==INF) {
            ng=false;
            dist[v]=0;
            dfs(v);
            if(ng) return false;
        }
    }
    return true;
}
signed main() {
    cout<<(solve()?"Yes":"No")<<endl;
    return 0;
}


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

int main()
{
  ll n,m;
  cin>>n>>m;
  vector<ll>a(n);
  ll sum=0;
  for(ll i=0;i<n;i++) cin>>a[i];
  for(ll i=0;i<n;i++) sum+=a[i];
  
  sort(a.begin(),a.end(),greater<ll>());
  bool f=true;
  for(ll i=0;i<m;i++)
  {
    if(a[i] < ceil(1.0*sum/(4*m)))
    {
      f=false;
      break;
    }
  }
  if(f)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int n;
   cin >> n;
   vector<pii> a(n);
   f(i,0,n){
      cin >> a[i].F;
      a[i].S = i+1;
   }
   sort(all(a));
   f(i,0,n){
      cout << a[i].S << ' ';
   }
   return 0;
}

Measured memory_bytes: 2432
def gcd(x, y):
    while y > 0:
        tmp = x % y
        x = y
        y = tmp
    return x

def lcm(x, y):
    if x == 0 or y == 0:
        return 0
    else:
        return x // gcd(x, y) * y

def main():
    mod = int(1e9 + 7)
    n = int(input())
    a = list(map(int, input().split()))
    l = 1
    for i in range(n):
        l = lcm(l, a[i])

    ans = 0

    print(int(sum(l // i for i in a) % mod))

if __name__ == '__main__':
    main()


Measured memory_bytes: 4084
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e16;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    string N; cin >> N;
    vvl dp(20, vl(2, -LINF)); dp[0][0] = 0;
    for (ll i = 0; i < N.size(); i++) {
        ll d = N[i] - '0';
        dp[i+1][0] = dp[i][0] + d;
        if(dp[i][1] != -LINF) dp[i+1][1] = max(dp[i][0]+d-1, dp[i][1]+9);
        else dp[i+1][1] = d-1;
    }
    cout << max(dp[N.size()][0], dp[N.size()][1]) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define N 10010
#define ll long long
int last[N*2],cur[N*2],len=1;
ll dis[N*2];
int q[N*2],p[N*2];
ll ans=0;
struct
{
	int c,w,to,next;
}a[N*20];
int n,ns,m;
void add(int x,int y,int c,int w)
{
	a[++len].to=y;
	a[len].next=last[x];
	a[len].c=c,a[len].w=w;
	last[x]=len;
}
int id = 0;
int SPFA()
{
	for(int i=0;i<=ns;i++) dis[i]=-1e16;
	q[1]=0,p[0]=++id,dis[0]=0;
	int l=0,r=1;
	while(l!=r)
	{
		l=l%(ns+10)+1;
		int k=q[l];
		p[k]=0;
		for(int i=last[k];i;i=a[i].next) 
		{
			int x=a[i].to;
			if(dis[k]+a[i].w>dis[x]&&a[i].c)
			{
				dis[x]=dis[k]+a[i].w;
				if(p[x] < id)
				{
					p[x]=id;
					r=r%(ns+10)+1;
					q[r]=x;
				}
			}
		}
	}
	return dis[ns]>0;
}
int dfs(int k,int flow)
{
	if(k==ns) return flow;
	int have=0;
	p[k]=1;
	for(int i=cur[k];i;i=a[i].next)
	{
		int x=a[i].to;
		if(!p[x]&&dis[k]+a[i].w==dis[x]&&a[i].c)
		{
			cur[k] = i;
			int t=min(flow-have,a[i].c);
			int now=dfs(x,t);
			ans+=(ll)now*a[i].w;
			have+=now,a[i].c-=now,a[i^1].c+=now;
			if(have==flow) break;
		}

	}
	p[k]=0;
	return have;
}
int main()
{
	int i,x,y,c;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d%d%d",&x,&y,&c);
		add(i,2*n+1,c,x+y);
		add(2*n+1,i,0,-x-y);
		add(i,2*n+2,c,x-y);
		add(2*n+2,i,0,y-x);
		add(i,2*n+3,c,y-x);
		add(2*n+3,i,0,x-y);
		add(i,2*n+4,c,-x-y);
		add(2*n+4,i,0,x+y);
		add(0,i,c,0);
		add(i,0,0,0);
	}
	for(i=1;i<=n;i++)
	{
		scanf("%d%d%d",&x,&y,&c);
		add(2*n+1,i+n,1e6,-x-y);
		add(i+n,2*n+1,0,x+y);
		add(2*n+2,i+n,1e6,y-x);
		add(i+n,2*n+2,0,x-y);
		add(2*n+3,i+n,1e6,x-y);
		add(i+n,2*n+3,0,y-x);
		add(2*n+4,i+n,1e6,x+y);
		add(i+n,2*n+4,0,-x-y);
		add(i+n,2*n+5,c,0);
		add(2*n+5,i+n,0,0);
	}
	ns=2*n+5;
	while(SPFA())
	{
		for(i = 0; i <= ns; i++) cur[i] = last[i];
		dfs(0,1e6);
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 2080
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int N, P[10], R[26]; string S;
int main() {
    cin >> N >> S;
    for(int i = 0; i < S.size(); i += 2) R[S[i] - 97]++;
    for(int i = 0; i < 26; i++) P[R[i]]++;
    int ret = -1;
    for(int i = 1; i < 10; i++) {
        if(P[i] != 0) ret++;
    }
    if(P[1] != 0) ret += P[1] * 2 - 1;
    for(int i = 2; i < 10; i++) {
        if(P[i] != 0) {
            ret += min(P[i] * 2 + 3, P[i] * 4 - 1);
        }
    }
    printf("%d\n", ret);
    return 0;
}

Measured memory_bytes: 3248
#include<iostream>
#include<string>

using namespace std;

int main() {
	string source;
	cin >> source;
	int count;
	cin >> count;
	for (int i = 0; i < count; i++) {
		string command;
		cin >> command;
		int start, end;
		if (command == "print") {
			cin >> start >> end;
			for (int j = 0; j < (end - start + 1); j++) {
				cout << source[start + j];
			}
			cout << endl;
		}
		else if (command == "reverse") {
			cin >> start >> end;
			for (int j = 0; j <= ((start + end) / 2-start); j++) {
				char temp;
				temp = source[end - j];
				source[end-j] = source[start + j];
				source[start + j] = temp;
			}
		}
		else if (command == "replace") {
			cin >> start >> end;
			string target;
			cin >> target;
			for (int j = 0; j < target.size(); j++) {
				source[start + j] = target[j];
			}
		}

	}

	return 0;
}

Measured memory_bytes: 3212
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int a,b;
    cin>>a>>b;
    int c = a*b;
    if(c%2==0)  cout<<"Even\n";
    else        cout<<"Odd\n";
    return 0;
}



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

int main() {
	string s;
	cin >> s;
	long long int ans = 0;
	int a = 0;
	for (int i = 0; i < s.size()-1; i++) {
		if (s[i] == 'A') {
			a++;
		} else if (s[i] == 'B' && s[i+1] == 'C') {
			ans += a;
			i++;
		} else {
			a = 0;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>

int main(void){   

int a,b;

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

if(a<b){

printf("a < b\n");

}

if(a>b){

printf("a > b\n");

}

if(a==b){

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

}

return 0;

}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#include<algorithm>

using namespace std;
typedef long long ll;

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

    vector<ll> e(n+1, 0);

    for (ll i = 1; i <= n; i++){
        for (ll j = i; j <= n; j += i) e[j]++;
    }

    ll ans = 0;
    FOR(i, 1, n) ans += i*e[i];

    cout << ans << endl;

}

Measured memory_bytes: 81312
import java.util.Scanner;

public class Main {
	//C問題

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a;
		int h;
		int ans;

		h = scanner.nextInt();
		a = scanner.nextInt();
		ans = 0;

		while (true) {
			ans++;

			h = h - a;

			if (h <= 0) {
				break;
			}
		}

		System.out.println(ans);

	}

}

Measured memory_bytes: 22740
A = [list(map(int,input().split())) for i in range(3)]
N = int(input())
B = [list(map(int,input().split())) for i in range(N)]
for k in range(N):
    for i in range(3):
        for j in range(3):
            if B[k][0] == A[i][j]:
                A[i][j] = 0

if A[0][0] == A[0][1] == A[0][2] ==0:
    print("Yes")
elif A[1][0] == A[1][1] == A[1][2] ==0:
    print("Yes")
elif A[2][0] == A[2][1] == A[2][2] ==0:
    print("Yes")
elif A[0][0] == A[1][0] == A[2][0] ==0:
    print("Yes")
elif A[0][1] == A[1][1] == A[2][1] ==0:
    print("Yes")
elif A[0][2] == A[1][2] == A[2][2] ==0:
    print("Yes")
elif A[0][0] == A[1][1] == A[2][2] ==0:
    print("Yes")
elif A[0][2] == A[1][1] == A[2][0] ==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ps push_back
#define fi first
#define so second

double t=0;
int n;
pair<double,double> c[8];

double dist(int a,int b)
{
    double d = pow(c[a].first-c[b].first,2)+pow(c[a].second-c[b].second,2);
    return sqrt(d);
}

void findsum(int s,int used[],int l,double sum)
{
    if(l==n) t+=sum;
    else
    {
        for(int i=0;i<n;i++)
        {
            if(used[i]==0)
            {
                used[i]=1;
                findsum(i,used,l+1,sum+dist(s,i));
                used[i]=0;
            }
        }
    }
}

signed main()
{
   int i,j;
   cin>>n;
   for(i=0;i<n;i++)
   {
       cin>>c[i].first>>c[i].second;
   }
   int u[n]={0};
   for(i=0;i<n;i++) {u[i]=1;findsum(i,u,1,0);u[i]=0;}
   double f=1;
   for(i=1;i<=n;i++) f*=i;
   cout<<setprecision(10)<<t/f;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int calc(const vector<string>& S){
  int N = S.size();

  int ret = 0;
  rep(A,N){
    bool flg = true;
    rep(y,N){
      rep(x,N){
        if(y==x) break;
        if(S[y][(x-A+N)%N] != S[x][(y-A+N)%N]) flg = false;
      }
    }
    if(flg) ret += N;
  }

  return ret;
}

int main(){
  int N;
  cin >> N;
  vector<string> S;
  rep(i,N){
    string str;
    cin >> str;
    S.push_back(str);
  }

  cout << calc(S) << endl;
  
  return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    string S;
    cin >> S;
    int red = 0;
    int blue = 0;
    int n = S.size();
    for(int i = 0; i < n; i++) {
        if(S[i] == '0') red++;
        else blue++;
    }
    cout << n - abs(red - blue) << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int a, b, c;
	cin >> a >> b >> c;

	if (a == b + c || b == c + a || c == b + a) cout << "Yes";
	else cout << "No";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[3] ;
  int _5 = 0 , _7 = 0 ;
  for (auto &X : arr) {
    cin >> X ;
    if (X == 5 ) _5++ ;
    if (X == 7 ) _7++ ;
  }
  if (_5 == 2 && _7 == 1)cout << "YES" << endl ;
  else cout << "NO" << endl ;
  return 0 ;
}

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

int N, M, K;

int main(){
	scanf("%d%d%d", &N, &M, &K);
	for(int i=0; i<=N; i++)
		for(int j=0; j<=M; j++)
			if(i*(M-j)+j*(N-i)==K){
				printf("Yes");
				return 0;
			}
	printf("No");
	return 0;
}

Measured memory_bytes: 256
//__builtin_popcount()//计算二进制位有多少个1
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> pll;
const int maxn=1e5+10;
int n;
vector<pll> v;
int main()
{
    LL n;
    cin>>n;
    LL pre=n;
    v.clear();
    for(LL i=2;i*i<=n;i++){
        if(pre%i==0){
            LL num=0;
            while(pre%i==0){
                pre/=i;
                num++;
            }
            v.push_back(make_pair(i,num));
        }
    }
    if(pre>1){
        v.push_back(make_pair(pre,1LL));
    }
   /* for(int i=0;i<v.size();i++){
        printf("%lld %lld\n",v[i].first,v[i].second);
    }*/
    LL res=0;
    for(int i=0;i<v.size();i++){
       map<LL,LL>mp;mp.clear();
       LL x=v[i].second;
       LL sum=0;
       LL pre=1;
       while(sum+pre<=x){
         mp[pre]++;
         sum+=pre;
         pre++;
         res++;
       }
       //printf("sum:%lld x:%lld\n",sum,x);
       if(sum<x){
        if(!mp[x-sum]){
            res++;
        }
       }
     }
     printf("%lld\n",res);
    return 0;
}


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




int main()
{
char s[10];
scanf("%s",s);
if(s[0] == s[1] && s[1] != s[2] && s[2] == s[3])printf("Yes\n");
else if(s[0] == s[2] && s[2] != s[3] && s[1] == s[3])printf("Yes\n");
else if(s[0] == s[3] && s[3] != s[1] && s[1] == s[2])printf("Yes\n");
else printf("No\n");
}


Measured memory_bytes: 256
N = int(input().split()[0])
all_sum = int(N * (N+1) / 2)

for i in range(3, N+1, 3):
    all_sum -= i

for i in range(5, N+1, 5):
    all_sum -= i

for i in range(15, N+1, 15):
    all_sum += i

print(all_sum)

Measured memory_bytes: 9192
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define rep(i, beg, end) for (int i = (beg); i < (end); i++)
#define rrep(i, beg, end) for (int i = (beg); i >= (end); i--)
#define sp(i) setprecision(i) << fixed
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
typedef unsigned long long ull;
const ll INF = 1e18+10;
const int mod = 1e9 + 7;
const int N = 30;
ull p_hash(ull x, ull y) { return (x + y) * (x + y + 1) / 2 + y; } //NxN->N
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
 
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll a[2], b[2];
    cin >> a[0] >> a[1] >> b[0] >> b[1];
 
    ll ans = -INF;
    rep(i, 0, 2)
        rep(j, 0, 2)
            ans = max(ans, a[i] * b[j]);
 
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int a[100009];

int main(){
  int n,s=0,cnt=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int t;
    cin>>t;
    a[t]++;
  }
  for(int i=1;i<=100000;i++){
    if(a[i]!=0){
      if(a[i]%2==0){
	s++;
      }
      cnt++;
    }
  }
  if(s%2==1)cout<<cnt-1<<endl;
  else cout<<cnt<<endl;
  return(0);
}


Measured memory_bytes: 640
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
import copy
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

n = int(input())
A = list(map(int, input().split()))

state = 0
money = 1000
stock = 0
for i in range(n-1):
    if A[i] < A[i+1] and state == 0:
        stock = money // A[i]
        money = money % A[i]
        state = 1
    elif A[i] > A[i+1] and state == 1:
        money += stock*A[i]
        stock = 0
        state = 0
    # print(state, money, stock)

if state == 1:
    money += stock * A[-1]

print(money)


Measured memory_bytes: 68076
// In the name of Allah
// #Isart

#include<bits/stdc++.h>

#define int long long
#define pii pair<int, int>
#define pb push_back
#define F first
#define S second
#define ll long long
#define ld long double

using namespace std;

const int MAXN = 2e6 + 10, mod = 1e9 + 7;
ll dp[MAXN];

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

	int n, ps = 0; cin >> n;
	dp[n] = n;
	dp[n - 1] = n * n % mod;
	
	for(int i = n + 1; i <= 2 * n; i ++) dp[i] = 1;
	for(int i = n + 1; i <= n + n - 1; i ++) ps += dp[i];
	for(int i = n - 2; i >= 1; i --){
		dp[i] = (dp[i + 1] + (n - 1) * (n - 1) % mod + ps % mod) % mod;
		ps = (ps - dp[i + n] + dp[i + 2] + mod) % mod;
	}	
	cout << dp[1] % mod << endl;

	return 0;	
}

Measured memory_bytes: 15872
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;

        while ((line = br.readLine()) != null) {
            String[] input = line.split(",");
            double weight = Double.parseDouble(input[1]);
            double height = Double.parseDouble(input[2]);
            double bmi = weight / height / height;
            if (bmi >= 25) {
                System.out.println(input[0]);
            }
        }
    }
}


Measured memory_bytes: 24416
#include <stdio.h>

int main(void){

  char c[2][4];
  scanf("%s", c[0]);
  scanf("%s", c[1]);
  if (c[0][0] == c[1][2] && c[0][1] == c[1][1] && c[0][2] == c[1][0]) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }

  return 0;
}

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

using namespace std;

int N;
int L[8];
int A, B, C;

int dfs(int k, int a, int b, int c) {
    if (k == N) {
        if (a == 0 || b == 0 || c == 0) return 1e9;
        return abs(a - A) + abs(b - B) + abs(c - C);
    }
    int ans = 1e9;
    ans = min(ans, dfs(k + 1, a + L[k], b, c) + (a > 0 ? 10 : 0));
    ans = min(ans, dfs(k + 1, a, b + L[k], c) + (b > 0 ? 10 : 0));
    ans = min(ans, dfs(k + 1, a, b, c + L[k]) + (c > 0 ? 10 : 0));
    ans = min(ans, dfs(k + 1, a, b, c));
    return ans;
}

int main() {
    cin >> N >> A >> B >> C;
    for (int i = 0; i < 8; i++) {
        cin >> L[i];
    }
    cout << dfs(0, 0, 0, 0) << endl;
}


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

#define int long long
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;

#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

#define len(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const int INF = 1e18;

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 0; i <= n; i++) cin >> a[i];
    if (n == 0) {
        if (a[0] == 1) {
            cout << "1\n";
        } else {
            cout << "-1\n";
        }
        return 0;
    }
    if (a[0] > 0) {
        cout << "-1\n";
        return 0;
    }
    vector<int> b(n + 1);
    b[0] = 1;
    for (int i = 0; i < n; i++) {
        if (2 * b[i] < a[i + 1]) {
            cout << "-1\n";
            return 0;
        }
        b[i + 1] = min(INF, 2 * b[i] - a[i + 1]);
    }
    b[n] = 0;
    for (int i = n - 1; i >= 0; i--) {
        b[i] = min(b[i], b[i + 1] + a[i + 1]);
    }
    if (b[0] != 1) {
        cout << "-1\n";
        return 0;
    }
    int ans = 0;
    for (int i = 0; i <= n; i++) ans += a[i] + b[i];
    cout << ans;
    return 0;
}


Measured memory_bytes: 4780
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int arr[n];
    int pos;
    for(int i=0;i<n;i++)
    {cin>>arr[i];
    if(arr[i]==1)
    pos=i/(k-1);
    }
    int s=0;
    while(s<pos*(k-1))
    {
        s++;
    }
    pos=s;
    int cnt=0;
    int z=pos;
    while(z<n)
    {
        if(z==n-1)
        break;
        cnt++;
        z+=(k-1);
        
    }
    z=pos;
    while(z>=0)
    {if(z==0)
    break;
        cnt++;
        z-=(k-1);
    }
    
    cout<<cnt<<endl;
}


Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int tt=1;
    //cin>>tt;
    while(tt--){
        string s,t;
        cin>>s>>t;
        if(t.length()-s.length()!=1){
            cout<<"No"<<endl;
            continue;
        }
        else {
            for(int i=0;i<s.length();i++){
                if(s[i]!=t[i]){
                    cout<<"No"<<endl;
                    return 0;
                }
            }
            cout<<"Yes"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define mod 1000000007
#define ull unsigned ll
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi acos(-1)
#define nui 100
#define INF 100000000000
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define F(i,a,n) for(ll i=a;i<n;i++)
#define B(i,a,n) for(ll i=n-1;i>=a;i--)
#define tc int t;cin>>t;while(t--)
#define tcf int t;cin>>t;for(int w=1;w<=t;w++)
#define pfn cout<<"-1\n"
#define pfp cout<<"1\n";



using namespace std;


ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res *= a;
        }
        a *= a;
        b >>= 1;
    }
    return res;
}

ll fermat_inv(ll y) {return binpow(y, mod - 2);}



int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

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



    /*ll n, x;
    cin >> n >> x;
    ll a[n];
    F(i, 0, n)
    {
        cin >> a[i];
    }
    ll ans = 0;
    F(i, 0, n)
    {
        if (i - 1 >= 0)
        {
            if (a[i] + a[i - 1] > x)
            {
                if (a[i] >= a[i - 1])
                {
                    ans += a[i] + a[i - 1] - x;
                    a[i] -= a[i] + a[i - 1] - x;

                }
                else
                {
                    ans += a[i] + a[i - 1] - x;
                    a[i] -= a[i] + a[i - 1] - x;

                }
            }
        }
        if (i + 1 < n)
        {
            if (a[i] + a[i + 1] > x)
            {
                if (a[i] > a[i + 1])
                {
                    ans += a[i] + a[i + 1] - x;
                    a[i+1] -= a[i] + a[i + 1] - x;

                }
                else if (a[i] == a[i + 1])
                {
                    ans += a[i] + a[i + 1] - x;
                    a[i + 1] -= a[i] + a[i + 1] - x;
                }
                else
                {
                    ans += a[i + 1] + a[i] - x;
                    a[i + 1] -= a[i] + a[i + 1] - x;

                }
            }
        }
    }
    cout << ans << "\n";*/
    ll a, b;
    cin >> a >> b;
    ll out=1;
    ll ans=0;
    while(out<b)
    {
        out--;
        out+=a;
        ans++;
    }
    cout<<ans<<"\n";
    return 0;

}

Measured memory_bytes: 3660
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>

using namespace std;
#define LOCAL  1
#define UPLOAD 2
#define ll long long
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
  int A = input();

  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      if(i*j == A){
        output("Yes");
        return 0;
      }
    } 
  }

  output("No");

  return 0;
}

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

string N;
ll dp[1001001][11];
bool visited[1001001][11];

ll rec(int idx, int k) {
    if (idx < 0) return min(k, 11 - k);
    if (visited[idx][k]) return dp[idx][k];
    visited[idx][k] = true;
    bool k_n = false;
    int cur = N[idx] - '0' + k;
    if (cur > 10) { cur -= 10; k_n = true; }
    ll ret = min(rec(idx - 1, k_n) + cur, rec(idx - 1, 1 + k_n) + 10 - cur);
    return dp[idx][k] = ret;
}

signed main() {

    cin >> N;
    cout << rec(N.size() - 1, 0) << endl;

}

Measured memory_bytes: 160516
N = int(input())
p = [int(i) for i in input().split()]

ps = sorted(p)
count = 0
for j in range(N):
  if p[j] != ps[j]:
    count += 1

if count == 0:
  print('YES')
elif count == 2:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 3060
N = int(input())
line = (input())

strL = line.split()

lenL = len(strL)
ans = 0

#L = []
L = list(map(int, strL))

if lenL < 3:
    ans = 0
else:
    L.sort()
    for i in range(0, lenL-2):
        for j in range(i+1, lenL-1):
            if L[i] == L[j] :
                continue
            for k in range(j+1, lenL):
                #print(i, j, k)
                if L[j] == L[k] or L[k] == L[i]:
                    #print(L[i], L[j], L[k], "NG1")
                    continue
                if L[i] + L[j] <= L[k]:
                    #print(L[i], L[j], L[k], "NG2")
                    break
                else:
                    #print(L[i], L[j], L[k], "OK")
                    ans += 1
print(ans)

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

int main(){
    long long h;
    cin >> h;
    long long n=0;
    long long ans=0;
    while(pow(2,n)<=h){    
        ans+=pow(2,n);
        //cout << "n："<<n <<"ans:"<<ans<<endl;
        //cout << ans <<endl;
        n++;
    } 
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main(){
    char str[10000]={0};
    while(scanf("%s",str) != EOF){
        char ans[10000]={0};
        int x = 0;
        for(int i = 0;str[i] != 0;){
            if(str[i] != '@'){
                ans[x] = str[i];
                x++;
                i++;
            }
            else {
                int q = 0;
                q = str[i+1] - 48;
                for(int j = x;j < q+x; j++){
                    ans[j] = str[i+2];
                }
                i += 3;
                x += q;
            }
        }
        //printf("x = %d\n",x);
        printf("%s\n",ans);
    }
    return 0;
}

Measured memory_bytes: 972
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let s = get!(String).chars().collect::<Vec<char>>();
    let len = s.len();
    let first = s.first();
    let last = s.last();
    println!("{}", if (first == last && len%2 == 0) || (first != last && len%2 == 1) {
        "First"
    } else {
        "Second"
    });
}

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

using namespace std;

int n;
int tb[11][11];

int main() {
	while (1) {
		cin >> n; if (n == 0) break;
		memset(tb, 0, sizeof(tb));
		
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cin >> tb[i][j];
			}
		}
		
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				tb[i][n] += tb[i][j];
				tb[n][j] += tb[i][j];
				tb[n][n] += tb[i][j];
			}
		}
		
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j <= n; j++) {
				cout << setw(5) << tb[i][j];
			}
			cout << endl;
		}
	}	
	
	return 0;
}

Measured memory_bytes: 1172
implicit none
integer :: n10,n2,n,x
integer :: i,j,k,ans
read *,n10
read *,n2
read *,n
read *,x
x = x / 50

ans = 0
do i = 0, n10
   do j = 0, n2
      do k = 0, n
         if (10*i + 2*j + k == x) then
            ans = ans + 1
         endif
      enddo
   enddo
enddo

print '(i0)',ans
end

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int sz = 2e5+5;
ll int arr[sz]={0},arr1[sz]={0},arr2[sz]={0};
//char arr[205][205];
//int arr1[205][205] = {0};
bool visited[205][205];
int prime[10005]= {0};
//vector <ll int> vec,vec1,vec2, edge, node;
//vector<pair<int, int>> vec[100],vec1;
set<ll int> st;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);

int main()
{
    int n;
    cin>>n;
    ll int sum =0;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        if(i!=0)
        {
            if(arr[i]<arr[i-1])
            {
                ll int k = arr[i-1]-arr[i];
                arr[i]+=k;
                sum+=k;
            }
        }
    }
    
    
    cout<<sum<<endl;



}


Measured memory_bytes: 5172
#include <iostream>
#include <vector>
#include <stack>

using namespace std;

struct Node {
    int visit = 0;
    vector<int> next;
    int s = 0;
    int start = 0;
    int end = 0;
};

int main() {
    int n, id, k, temp, time = 1;
    Node node[101];
    stack<int> st;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> id >> k;
        for (int j = 0; j < k; j++) {
            cin >> temp;
            node[id].next.push_back(temp);
        }
    }

    while (1) {
        int s = -1;
        for (int i = 1; i <= n; i++) {
            if (node[i].visit == 0) {
                s = i;
                break;
            }
        }
        if (s == -1) {
            break;
        }
        
        node[s].start = time++;
        node[s].visit = 1;
        st.push(s);
        while (!st.empty()) {
            temp = st.top();
            if (node[temp].s < node[temp].next.size()) {
                if (node[node[temp].next[node[temp].s]].visit == 0) {
                    node[node[temp].next[node[temp].s]].start = time++;
                    node[node[temp].next[node[temp].s]].visit = 1;
                    st.push(node[temp].next[node[temp].s++]);
                }
                else {
                    node[temp].s++;
                }
            }
            else {
                node[temp].visit = 2;
                node[temp].end = time++;
                st.pop();
            }
        }
    }

    for (int i = 1; i <= n; i++) {
        cout << i << " " << node[i].start << " " << node[i].end << endl;
    }

    return 0;
}

Measured memory_bytes: 3156
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll dp[110][4][4][4], n;

ll pow(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2)
	{
		return pow(x, y - 1) * x % mod;
	}
	else
	{
		ll yyy = pow(x, y / 2);
		return yyy * yyy % mod;
	}
}

ll div(ll x)
{
	return pow(x, mod - 2);
}

int main(void)
{
	cin >> n;
	for (int i = 0; i < 4; i++)
	{
		for (int j = 0; j < 4; j++)
		{
			for (int k = 0; k < 4; k++)
			{
				dp[3][i][j][k] = 1;
			}
		}
	}
	dp[3][0][3][2] = 0, dp[3][0][2][3] = 0, dp[3][3][0][2] = 0;
	for (int l = 4; l <= n; l++)
	{
		for (int i = 0; i < 4; i++)
		{
			for (int j = 0; j < 4; j++)
			{
				for (int k = 0; k < 4; k++)
				{
					if (i == 0 && j == 3 && k == 2) continue;
					if (i == 0 && j == 2 && k == 3) continue;
					if (i == 3 && j == 0 && k == 2) continue;
					if ((k == 2 && i == 3) || (k == 2 && j == 3))
					{
						dp[l][i][j][k] = (dp[l - 1][1][i][j] + dp[l - 1][2][i][j] + dp[l - 1][3][i][j]) % mod;
					}
					else
					{
						dp[l][i][j][k] = (dp[l - 1][0][i][j] + dp[l - 1][1][i][j] + dp[l - 1][2][i][j] + dp[l - 1][3][i][j]) % mod;
					}
				}
			}
		}
	}
	ll ans = 0;
	for (int i = 0; i < 4; i++)
	{
		for (int j = 0; j < 4; j++)
		{
			for (int k = 0; k < 4; k++)
			{
				(ans += dp[n][i][j][k]) %= mod;
			}
		}
	}
	cout << ans << endl;
	int www;
	cin >> www;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

int main() {
	lint H, W;
	while (cin >> H >> W, H != 0 && W != 0) {
		vector<vector<char>>A(H, vector<char>(W));
		rep(i, H) {
			rep(j, W) {
				cin >> A[i][j];
			}
		}
		map<char, lint>X;
		map<char, lint>Y;
		rep(i, H) {
			rep(j, W) {
				if (A[i][j] != '_') {
					X[A[i][j]] = i;
					Y[A[i][j]] = j;
				}
			}
		}
		string S;
		cin >> S;
		lint ans = 0;
		rep(i, S.size()) {
			if (i == 0) {
				ans += X[S[i]];
				ans += Y[S[i]];
			}
			else {
				ans += abs(X[S[i - 1]] - X[S[i]]);
				ans += abs(Y[S[i - 1]] - Y[S[i]]);
			}
		}
		ans += S.size();
		cout << ans << endl;
	}
}


Measured memory_bytes: 2992
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

S = n()
seen = set()
seen.add(S)
m = 1
while True:
    m += 1
    if S % 2 == 0:
        S //= 2
    else:
        S = 3*S + 1
    if S in seen:
        print(m)
        import sys
        sys.exit()
    seen.add(S)





Measured memory_bytes: 3060
x = input().strip()
n = int(x[:2])
m = int(x[2:])
#print(n)
#print(m)

if n>=1 and n<=12 and m>=1 and m<=12:
    print('AMBIGUOUS')
elif  (n<1 or n>12) and m>=1 and m<=12 :
    print('YYMM')
elif n>=1 and n<=12 and (m<1 or m>12):
    print('MMYY')
else:
    print('NA')

Measured memory_bytes: 3064
#!/usr/bin/env ruby

N = gets.chomp.to_i
A = gets.chomp.split.map(&:to_i)

D = 10 ** 9 + 7

sum = [0]

1.upto(N) do |i|
  sum[i] = sum[i-1] + A[i-1]
end

ans = 0

0.upto(N-2) do |i|
  #p "#{A[i]} * (#{sum[N]} - #{sum[i+1]})"
  ans += A[i] * (sum[N] - sum[i+1])
  ans %= D
end

puts ans


Measured memory_bytes: 37580
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define cool ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long
#define MAX 1000001
#define mod 1000000007
#define pie 3.14159265358979323846
void solve()
{
	int cnt=0;
	string s;
	string t;
	cin>>s>>t;
	for(int i=0;i<s.size();i++){
		if(s[i]!=t[i])
		cnt++;
	}
	cout<<cnt;
}
int main()
{ 
    cool;
    int t;
    //cin>>t;
    t=1;
    while(t--){
    	solve();
	}
    return 0;
}


Measured memory_bytes: 3796
<?php
// B
fscanf(STDIN, '%s', $s);
fscanf(STDIN, '%s', $t);
for ($i = 0; $i < strlen($s); $i++) {
    $ss = substr($s, $i) . substr($s, 0, $i);
    if ($ss === $t) exit('Yes');
}
echo 'No';

Measured memory_bytes: 4856
import java.util.Scanner;

public class Main {

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

		StringBuilder sb = new StringBuilder();
		sb.append(c2.substring(2)).append(c2.substring(1, 2)).append(c2.substring(0, 1));

		String c2Reverse = sb.toString();

		if (c1.equals(c2Reverse)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

		sc.close();
	}
}

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

int main()
{
	vector<int> v(5);
	
	for(int i = 0 ; i<5 ; i++)
		cin >> v[i];
		
	int ans = INT_MAX;
		
	do{
		int cur = 0;
		for(int i = 0 ; i<4 ; i++)
		{
			cur = (cur + v[i]) + 9;
			cur = (cur/10)*10;
		}
		cur+=v[4];
		ans = min(ans , cur);
	}while(next_permutation(v.begin() , v.end()));
	
	
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 256
# = int(input())
# = str(input())
# = map(int, input().split())
S = list(input())
T = list(input())
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]
lt = len(T)
ls = len(S)
count = []
for i in range(ls-lt+1):
    counter = 0
    for j in range(lt):
        if S[j] != T[j]:
            counter += 1
    count.append(counter)
    del S[0]

print(min(count))


Measured memory_bytes: 9064
//★#1014918 Solution for 0557: A First Grader by daiota
#include<iostream>
using namespace std;
 
int a[110];
long long dp[110][25];
int main(){
	int i,j;
	int N;
	cin >> N;
	for(i=1; i<=N; i++) {cin >> a[i];}
	dp[1][a[1]] = 1;
	for(i=2; i<N; i++){
		for(j=0; j<=20; j++){
			if(j-a[i] >=  0) dp[i][j] += dp[i-1][j-a[i]];
			if(j+a[i] <= 20) dp[i][j] += dp[i-1][j+a[i]];
		}
	}
	cout << dp[N-1][a[N]] << endl;
	return 0;
}



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

long long int N, ans;

int main() {
  cin >> N;
  for (int i = 0; i <= sqrt(N); i++) {
    if (N % (i+1) == 0) {
      if (i && (i+1) * (N / i) == N) ans += i;
      if (i && i == N / i) continue;
      if (N/(i+1)-1 && (N/(i+1)) * (N / (N/(i+1)-1)) == N) ans += N/(i+1)-1;
    }
  }
  cout << ans << endl;
}

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

#ifdef RUBICK
#include "dbg.h"
#endif

using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;

const ll MOD = 1e9+7;
const int MAX = 2e5;

ll factorial[MAX+1];
ll invfact[MAX+1];

ll power(ll a, ll b) {
    ll rc = 1;
    while (b > 0) {
        if (b & 1) rc = (rc * a) % MOD;
        a = (a * a) % MOD;
        b >>= 1;
    }

    return rc;
}

ll gridwalk(ll x, ll y) {
    ll rc = factorial[x+y];
    rc = (rc * invfact[x]) % MOD;
    rc = (rc * invfact[y]) % MOD;

    return rc;
}

int main() {
    factorial[0] = 1;
    invfact[0] = 1;
    for (int x = 1; x <= MAX; x ++) {
        factorial[x] = (x * factorial[x-1]) % MOD;
        invfact[x] = power(factorial[x], MOD-2);
    }

    int h, w, a, b;
    scanf("%d %d %d %d", &h, &w, &a, &b);

    int y = h - a - 1;
    ll ans = 0;
    for (int x = b; x < w; x ++) {
        ll rc1 = gridwalk(y, x);
        ll rc2 = gridwalk(h - y - 2, w - x - 1);

        ans += (rc1 * rc2) % MOD;
        ans %= MOD;
    }

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

    return 0;
}



Measured memory_bytes: 3328
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
const int MAXN = 510;

int N;
ll A[MAXN][MAXN];
ll ps[MAXN][MAXN];
ll vs[MAXN][MAXN];
ll dp[MAXN][MAXN]; // size of cur comp, prev comp
ll ndp[MAXN][MAXN];

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> N;
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (j == i) A[i][j] = 0;
            else cin >> A[i][j];
        }
    }

    for (int i = 0; i < N; i++)
    {
        ps[i][0] = 0;
        for (int j = 0; j < N; j++)
            ps[i][j+1] = ps[i][j] + A[i][j];
        vs[i][0] = 0;
        for (int j = 0; j < N; j++)
            vs[i][j+1] = vs[i][j] + A[j][i];
    }

    for (int i = 0; i < MAXN; i++)
        for (int j = 0; j < MAXN; j++)
            dp[i][j] = 1e17;
    dp[0][0] = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j <= N; j++)
            for (int k = 0; k <= N; k++)
                ndp[j][k] = 1e17;

        for (int j = 0; j <= i; j++)
        {
            for (int k = 0; k <= i - j; k++)
            {
                if (dp[j][k] > 9e16) continue;

                int ostart = i - j;
                int mstart = i - j - k;

                // route 1, join comp
                ll rtot = 0;
                rtot += vs[i][i] - vs[i][ostart];
                rtot += ps[i][mstart];
                ndp[j+1][k] = min (ndp[j+1][k], dp[j][k] + rtot);

                // route 2, start new
                rtot = 0;
                rtot += ps[i][ostart];
                ndp[1][j] = min (ndp[1][j], dp[j][k] + rtot);
            }
        }

        for (int j = 0; j <= N; j++)
            for (int k = 0; k <= N; k++)
                dp[j][k] = ndp[j][k];
    }

    ll ans = 1e18;
    for (int i = 0; i <= N; i++)
        for (int j = 0; j <= N; j++)
            ans = min (ans, dp[i][j]);
    cout << ans << "\n";
}

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


int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int N; cin >> N;
  int vmax = 0;
  int vsum = 0;
  for (int i = 0; i < N; i++) {
    int l; cin >> l;
    vmax = max(vmax, l);
    vsum += l;
  }
  vsum -= vmax;
  cout << (vsum > vmax ? "Yes" : "No") << endl;

  return 0;
}



Measured memory_bytes: 256
import numpy as np

AB=np.array(input().split(" "),dtype=np.int32)

A=AB[0]
B=AB[1]

canA=A/0.08
canB=B/0.1

start=0
if(canA<canB):
    start=canA
else:
    start=canB

ans=-1
th=2*start
while (True):
    outA=int(start*0.08)
    outB=int(start*0.10)
    if(outA==A and outB==B):
        ans=start
        break
    if(start>2*th):
        break
    start+=1

print(int(ans))

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

int main(){
    string S,T;
    cin >> S >> T;
    rep(i,S.size()){
        if(S[i] != T[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define LL long long
#define Max 100005
#define Mod 1e9+7
const LL mod=1e9+7;
const LL inf=0x3f3f3f3f;
using namespace std;
int main()
{
	int a[11]={0};
	int b;
	for(int i=0;i<4;i++)
	{
		scanf("%d",&b);
		a[b]=1;
	}
	if(a[1]&&a[9]&&a[7]&&a[4])
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}


Measured memory_bytes: 256
N, M, C = map(int, input().split())
lst1 = [int(x) for x in input().split()]
ret = 0
for x in range(N):
    lst2 = [int(y) for y in input().split()]
    if (sum([x * y for x, y in zip(lst1, lst2)]) + C) > 0:
        ret += 1
print(ret)   

Measured memory_bytes: 3060