akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n;
    int s[110];
    cin>>n;
    for(int i=0;i<n;i++) cin>>s[i];
    sort(s,s+n);
    int sum=0;
    for(int i=0;i<n;i++){
        sum+=s[i];
    }
    int k=0;
    int cnt=0;  
     if(sum%10!=0){
        cout<<sum<<endl; 
     }
    else{  
    for(int i=0;i<n;i++){
        if((sum-s[i])%10!=0){
            sum-=s[i];
            break;
        }
        else {
            cnt++;
        }
        
    }
    if(cnt==n) cout<<0<<endl;
    else cout<<sum<<endl;
     }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll solve(ll v[], ll n) {
	ll res = 0;
	ll maxi = v[0];
	for (ll i = 1; i < n; i++) {

		if (v[i] < maxi) {
			res += (maxi - v[i]);
		}
		maxi = max(maxi, v[i]);
	}
	return res;
}
int main() {
	ll n;
	cin >> n;
	ll  v[n];
	for (ll i = 0; i < n; i++)
		cin >> v[i];
	cout << solve(v, n) << "\n";

	return 0;
}






Measured memory_bytes: 5100
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
    int n,v[40],c[40],i,sum;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&v[i]);
    }
    for(i=0;i<n;i++)
    {
        scanf("%d",&c[i]);
    }
    for(i=0,sum=0;i<n;i++)
    {
        if(v[i]-c[i]>0)
            sum+=(v[i]-c[i]);
    }
    printf("%d",sum);
    return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)

using namespace std;

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

	int ans = 0;
	for (int i = 1;i < n;i++) {
		int cnt = 0;

		for (char c = 'a';c <= 'z';c++) {
			bool l = false, r = false; 

			for (int j = 0;j < i;j++) {
				if (s[j] == c)l = true;
			}

			for (int j = i;j < n;j++) 
				if (s[j] == c)
					r = true;

			if (r&&l) 
				cnt++;
		}

		if (ans < cnt)
			ans = cnt;
	}

	cout << ans << endl;

}

Measured memory_bytes: 256
#coding:utf-8
#1_1_A
def insertion_sort(cards, n):
    for i in range(n):
        v = cards[i]
        j = i - 1
        while j >= 0 and cards[j] > v:
            cards[j+1] = cards[j]
            j -= 1
        cards[j+1] = v
        print(*cards)

n = int(input())
cards = list(map(int, input().split()))
insertion_sort(cards, n)

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

int main() {
  string S;
  cin >> S;
  
  int minValue = 1<<19;
  for (int i = 0; i < S.size()-2; i++) {
    string s = S.substr(i, 3);
    int si = stoi(s);
    minValue = min(minValue, abs(753-si));
  }
  cout << minValue << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
typedef int64_t ll;

void bfs(vector<vector<int>> &chizu, vector<int> &ans, vector<bool> &check){
    queue<int> Next;
    Next.push(0);
    while(Next.size() != 0){
        int t = Next.front();
        Next.pop();
        for (int i = 0; i < chizu.at(t).size(); i++){
            if (!check.at(chizu.at(t).at(i))){
                check.at(chizu.at(t).at(i)) = true;
                ans.at(chizu.at(t).at(i)) = t + 1;
                Next.push(chizu.at(t).at(i));
            }
        }
    }
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> chizu(N, vector<int>());
    vector<int> ans (N);
    for (int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        chizu.at(a - 1).emplace_back(b - 1);
        chizu.at(b - 1).emplace_back(a - 1);
    }
    vector<bool> check(N, false);
    bfs(chizu, ans, check);
    cout << "Yes" << endl;
    for (int i = 0; i < N - 1; i++){
        cout << ans.at(i + 1) << endl;
    }


}

Measured memory_bytes: 10260
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
	ll n,p;
	scanf("%lld%lld",&n,&p);
	ll ans = 1;
	for(ll i = 2;i * i <= p;i++){
		if(p % i == 0){
			int cnt = 0;
			while(p % i == 0){
				p /= i;
				cnt++;
				if(cnt % n == 0) ans *= i;
			}
		}
	}
	if(p != 1){
		if(n == 1) ans *= p;
		p = 1;
	}
	printf("%lld\n",ans);
	return 0;
}


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

int main() {
  int a, b; cin >> a >> b;
  
  int digit = pow(10, to_string(b).length());
  int ab = a * digit + b;
  
  bool answer = false;
  for (int i = 0; i <= 400; i++) if (ab == i * i) answer = true;
  
  if (answer) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

#define int long long
#define DEBUG(x) cerr <<#x<<":"<<x<<endl;
#define DEBUG2(x, y) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<endl;
#define DEBUG3(x, y, z) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl;
#define DEBUGVC(x) cerr <<#x<<": "; for(auto a:x) cerr << a <<" "; cerr << endl;
#define DEBUGMP(x) cerr <<#x<<":"<<endl; for(auto a:x) cerr << a.first <<" "<< a.second << endl;
#define MAX_N (1000006)
#define INF (1LL << 60)
const int MOD = (int)1e9+7;


signed main() {
    while(1) {
        int n, p;
        cin >> n >> p;
        if(n==0 && p==0) break;
        vector<int> c(n, 0LL);
        int idx = 0;
        int q = p;
        while(1) {
            //DEBUG2(idx, p);
            //DEBUGVC(c);
            if(p!=0) {
                c[idx]+=1;
                p--;
                if(p==0){
                    if(c[idx]==q){
                        cout << idx << endl;
                        break;
                    }
                }
            }
            else if(p==0) {
                p += c[idx];
                c[idx] = 0;
            }
            idx++;
            idx %= n;
        }
    }
}



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

int main(){
	long long int n,c;
	cin>>n>>c;
	vector<pair<long long int,long long int>> sushi(n);
	for (int i = 0; i < n; i++) {
		cin>>sushi[i].first>>sushi[i].second;
	}
	long long int ans=0;
	//eatcal_r[i]:時計回りにi個食べた時の摂取カロリー
	vector<long long int> eatcal_r(n+1,0),eatcal_l(n+1,0);
	//max_r[i]:時計回りに0~i個食べた時で、カロリー収支が最大のもの
	vector<long long int> max_r(n+1),max_l(n+1);
	//時計回りに回る時の最大値
	for (int i = 0; i < n; i++) {
		eatcal_r[i+1]=eatcal_r[i]+sushi[i].second;
		max_r[i+1]=max(max_r[i],eatcal_r[i+1]-sushi[i].first);
		ans=max(ans,max_r[i+1]);
	}
	//反時計回りに回る時の最大値
	for (int i = 0; i < n; i++) {
		eatcal_l[i+1]=eatcal_l[i]+sushi[n-1-i].second;
		max_l[i+1]=max(max_l[i],eatcal_l[i+1]-(c-sushi[n-1-i].first));
		ans=max(ans,max_l[i+1]);
	}
	//時計回りにi個食べて折り返す時の最大値
	for (int i = 1; i < n; i++) {
		ans=max(ans,eatcal_r[i]-sushi[i-1].first*2+max_l[n-i]);
	}
	//反時計回りにi個食べて折り返す時の最大値
	for (int i = 1; i < n; i++) {
		ans=max(ans,eatcal_l[i]-(c-sushi[n-i].first)*2+max_r[n-i]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4992
import itertools
import sys
import math
import numpy as np
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
sys.setrecursionlimit(10**9)

def main():
    S = input()
    f = S[0] == S[1] == S[2]

    print("No" if f else "Yes")




if __name__ == "__main__":
  main()


Measured memory_bytes: 21384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
const int mod=998244353;
const int INF=0x3f3f3f3f;
ll quick(ll a,ll b)
{
	ll ret=1;
	while(b)
	{
		if(b&1)
			ret=ret*a%mod;
		a=a*a%mod;
	}
	return ret;
}
ll inv(ll a){return quick(a,mod-2);}
const int maxn=1e5+7;
ll l[maxn],u[maxn],b[maxn];
struct val{
	ll value;
	int id;
	bool operator<(const val &a)const{
		return value>a.value;
	}
}v[maxn];
ll n,x;
ll tot;
bool check(ll cur)
{
	ll cnt=cur/x;
	ll ret=0;
	ll rm=cur%x;
	for(int i=0;i<cnt+(rm!=0);i++)
		ret+=v[i].value;
	ll mx=0;
	if(rm)
	{
		for(int i=0;i<n;i++)
		{
			int id=v[i].id;
			mx=max(mx,ret-(i>=cnt?v[cnt].value:v[i].value)+(rm>b[id]?(rm-b[id])*u[id]+b[id]*l[id]:rm*l[id]));
		}
	}
	else mx=ret;
	return mx>=tot;
}
int main()
{
	scanf("%lld%lld",&n,&x);
	tot=0;
	for(int i=0;i<n;i++)
	{
		scanf("%lld%lld%lld",&b[i],&l[i],&u[i]);
		tot+=l[i]*b[i];
		v[i].value=b[i]*l[i]+(x-b[i])*u[i];
		v[i].id=i;
		//dbg(i,v[i].value);
	}
	sort(v,v+n);
	ll L=0,R=n*x;
	ll ans;
	while(L<=R)
	{
		ll mid=L+R>>1;
		if(check(mid)) R=mid-1,ans=mid;
		else L=mid+1;
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 4096
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()


using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;


// UnionFind木(サイズ持ち)
class UnionFind {
    public : 

        vector<int> par;

        UnionFind(int N){
            par = vector<int>(N, -1);
        }

        int parent(int x){
            return par[x];
        }

        int root(int x){
            if(par[x] < 0)return x;
            return par[x] = root(par[x]);
        }

        int size(int x){
            return -par[root(x)];
        }

        void connect(int x, int y){
            int rx = root(x);
            int ry = root(y);
            if(rx == ry)return;

            if(size(rx) < size(ry))swap(rx, ry);

            par[rx] += par[ry];
            par[ry] = rx;

            return;
        }

        bool same(int x, int y){
            return root(x) == root(y);
        }
};



int main(){
    ll n, m;
    cin >> n >> m;
    vector<P> p;
    rep(i, n){
        ll a, b;
        cin >> a >> b;
        p.emplace_back(a, b);
    }
    ll res = 0;
    ll cnt = 0;

    sort(ALL(p));
    rep(i, n){
        if(cnt + p[i].second >= m){
            res += p[i].first * (m - cnt);
            break;
        }
        else {
            cnt += p[i].second;
            res += p[i].first * p[i].second;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 2420
#include<iostream>

int main(void){
  int n, m, max=0;
  int price[1000];

  for(int t=0; t<10000; t++){

    max = 0;
    std::cin >> n;
    std::cin >> m;
    if(n == 0 && m == 0){
      break;
    }

    for(int i=0; i<n; i++){
      std::cin >> price[i];
    }

    for(int j=0; j<n; j++){
      for(int s=0; s<n; s++){
	if(j == s){
	  break;
	}
	if(price[j] + price[s] > max && price[j] + price[s] <= m){
	  max = price[j] + price[s];
	}
      }
    }
    if(max > 0){
      std::cout << max << "\n";
    }else{
      std::cout << "NONE\n";
    }
  }
  return 0;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n; cin >> n;
    bool isOK = false;
    int l = n / 4; 
    for(int i = l; i >= 0; --i){
        if((n - i * 4) % 7 == 0) isOK = true;
    }
    if(isOK) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

const int INF = 1001001001;

int main(){
  string s;
  cin >> s;
  int n = s.size() + 1;
  vector<int> a(n,-1 * INF);
  for(int i=0;i<n-2;i++){
    if(s.at(i) == '>' && s.at(i+1) == '<'){
      a.at(i+1) = 0;     
    }else{
      continue;
    }
    int l = 0;
    for(int j=i;s.at(j) == '>';j--){
      l++;
      a.at(j) = max(a.at(j),l);
      if(j ==0) break;
    }
    int r = 0;
    for(int j=i+1;s.at(j) == '<';j++){
      r++;
      a.at(j+1) = max(a.at(j+1),r);
      if(j == n-2) break;
    }    
  }   
  for(int j = 0;s.at(j) == '<';j++){
    if(j == 0) a.at(j) = 0;
    a.at(j+1) = max(a.at(j+1),j+1);
    if(j == n-2) break;
  }
  for(int j = n-2;s.at(j)== '>';j--){
    if(j == n-2) a.at(j+1) = 0;
    a.at(j) = max(a.at(j),a.at(j+1)+1);
    if(j == 0) break;
  }
  ll ans = 0;
  for(int i=0;i<n;i++){
    ans+=a.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 2820
#include<stdio.h>
main()
{
	int A,B,C,D,a,b;
	scanf("%d %d %d %d",&A,&B,&C,&D);
	if(A<D&&C<B)
	{
	if(A<C)
	a=C;
	else
	a=A;
	if(B<D)
	b=B;
	else
	b=D;
	printf("%d\n",b-a);
   }
  else
  printf("0\n");
	return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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; }
int main(){
  ll n,x,y;
  cin>>n>>x>>y;
  V<ll> a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  if(n==1){
    cout<<abs(a[0]-y)<<"\n";
  }
  else cout<<max(abs(a[n-2]-a[n-1]),abs(a[n-1]-y))<<"\n";
}


Measured memory_bytes: 3636
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

def cond():
    total = sum(a)
    limit = total / (4 * m)
    ans = []
    for v in a:
        if v >= limit:
            ans.append(v)
    return len(ans) >= m


if cond():
    print('Yes')
else:
    print('No')


Measured memory_bytes: 38384
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.min;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void solve() throws Exception {
		int n = scanInt();
		long a = scanInt(), b = scanInt();
		long dyn[] = new long[n + 1];
		for (int i = 0; i < n; i++) {
			int p = scanInt();
			long c = Long.MAX_VALUE;
			for (int j = 0; j < p; j++) {
				c = min(c, dyn[j]);
				dyn[j] += a;
			}
			dyn[p] = c;
			for (int j = p + 1; j <= n; j++) {
				dyn[j] += b;
			}
		}
		long ans = Long.MAX_VALUE;
		for (int i = 0; i <= n; i++) {
			ans = min(ans, dyn[i]);
		}
		out.print(ans);
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

Measured memory_bytes: 23508
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

ll dp[405][405], a[405], sum[405];
const ll INF = 100000000000000;


ll rec(int l, int r) {
	if (dp[l][r] != -1) return dp[l][r];
	if (l == r) return 0;
	ll res = INF;
	for (int i = l; i < r; i++) 
	chmin(res, rec(l, i) + rec(i+1, r) + sum[r] - sum[l-1]);
	return dp[l][r] = res;
}

int main() {
	int n;
	cin >> n;
	rep (i, n) cin >> a[i];

	for (int i = 1; i <= n; i++) sum[i] += sum[i-1] + a[i-1];

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

	rec(1, n);

	cout << dp[1][n] << endl;
	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define pi 3.1415926535
#define endl '\n'
using namespace std;
struct custom {
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
//using namespace __gnu_pbds;
//typedef tree<ll,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
const ll inf=1e19;
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=(y>>1);
    }
    return res;
}*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(15);
    cout.setf(ios::fixed,ios::floatfield);
    long double b,d;
    ll a,x;
    cin>>a>>b;
    d=(long double)a*b;
    ll c;
    c=(ll)(floor(d));
    x=b*100;
    x=(a*x)/100;
    cout<<max(c,x)<<endl;
}


Measured memory_bytes: 3720
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int h = in.nextInt();
            int w = in.nextInt();
            in.nextLine();
            while (h-- > 0) {
                String line = in.nextLine();
                out.println(line);
                out.println(line);
            }
        }

    }
}



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

#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);

	string S;
	cin >> S;

	vector<vector<lint>> dp(S.size() + 1, vector<lint>(4));
	dp[0][0] = 1;
	for (int i = 0; i < S.size(); i++) {
		for (int j = 0; j <= 3; j++) {
			for (int k = 0; k <= 2; k++) {
				if (!(S[i] != '?' && S[i] != 'A' + k)) {

					dp[i + 1][j] += dp[i][j];
					dp[i + 1][j] %= MOD;

					if (j == k) {
						dp[i + 1][j + 1] += dp[i][j];
						dp[i + 1][j + 1] %= MOD;
					}

				}
			}
		}
	}

	cout << dp[S.size()][3] << "\n";

	return 0;
}

Measured memory_bytes: 7376
#include <bits/stdc++.h>
using namespace std;
const int MAX_N=100005;
int n,m; 
vector <int> g[MAX_N];
int in[MAX_N];
int dp[MAX_N];
int main()
{
	cin>>n>>m;
	while(m--)
	{
		int x,y;
		cin>>x>>y;
		g[x].push_back(y);
		in[y]++;
	}
	queue <int> q;
	for(int i=1;i<=n;i++)
	{
		if(!in[i])q.push(i);
	}
	while(!q.empty())
	{
		int v=q.front();
		q.pop();
		for(int i=0;i<g[v].size();i++)
		{
			int u=g[v][i];
			in[u]--;
			if(!in[u])q.push(u);
			dp[u]=max(dp[u],dp[v]+1);
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		ans=max(ans,dp[i]);
	}
	cout<<ans<<endl;
	return 0;
}


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

int fact(int n) {
  int a = 1;
  for(int i = 0; i < n; i++) {
    a *= (n - i);
  }
  return a;
}

int main() {
  int n;
  cin >> n;
  
  vector<int> p(n);
  vector<int> q(n);
  
  for(int i = 0; i < n; i++) {
    cin >> p.at(i);
  }
  
  for(int i = 0; i < n; i++) {
    cin >> q.at(i);
  }
  
  int countp = 1;
    
  for(int i = 0; i < n; i++) {
    int ord = p.at(i) - 1;
    for(int j = 0; j < i; j++) {
      if(p.at(j) < p.at(i)) {
        ord--;
      }
    }
    countp += ord * fact(n - i - 1);
  }
  
  int countq = 1;
  for(int i = 0; i < n; i++) {
    int ord = q.at(i) - 1;
    for(int j = 0; j < i; j++) {
      if(q.at(j) < q.at(i)) {
        ord--;
      }
    }
    countq += ord * fact(n - i - 1);
  }
  
  int ans = max(countp, countq) - min(countp, countq);
  
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int unit[4][2] = { { 0, 1 }, { 0, -1 }, { 1, 0 }, { -1, 0 } };

void solve( int x, int y, char data[9][9] ){
	data[y][x] = '0';

	for( int i = 0;i < 4;i++ ){
		for( int j = 1;j <= 3;j++ ){
			int dx = x + unit[i][0] * j;
			int dy = y + unit[i][1] * j;

			if( dx < 0 || dx > 7 || dy < 0 || dy > 7 ) continue;

			if( data[dy][dx] == '1' ){
				solve( dx, dy, data );
			}
		}
	}
}



int main(int argc, char const* argv[])
{
	char data[9][9];
	int n;
	int x,y;

	cin >> n;

	for( int i = 1;i <= n;i++ ){
		for( int j = 0;j < 8;j++ ){
			cin >> data[j];
		}

		cin >> x >> y;

		solve( x - 1, y - 1, data );

		cout << "Data " << i << ":" << endl;
		for( int j = 0;j < 8;j++ ){
			cout << data[j] << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, N);
  VAR(string, S);
  vi vw(N), ve(N);
  vw[0] = S[0] == 'W';
  ve[N - 1] = S[N - 1] == 'E';
  rep(i, 1, N) {
    vw[i] = vw[i - 1] + (S[i] == 'W');
    ve[N - i - 1] = ve[N - i] + (S[N - i - 1] == 'E');
  }
  int ans = INF;
  rep(i, 0, N) {
    ans = min(ans, vw[i] + ve[i] - 1);
  }
  print(ans);
}


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

using namespace std;

struct data{
	int to;
	long long w;
};

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

	vector<vector<struct data> > tree(N);
	vector<long long> d(N, 0);
	queue<int> q;

	for (int i = 0; i < N - 1; i++){
		int u;
		struct data temp;
		cin >> u >> temp.to >> temp.w;
		u--;
		temp.to--;
		tree[u].push_back(temp);

		swap(u, temp.to);
		tree[u].push_back(temp);
	}

	q.push(0);

	while(q.size()){
		int node = q.front();
		q.pop();

		for (int i = 0; i < tree[node].size(); i++){
			if(d[tree[node][i].to] == 0 && tree[node][i].to != 0){
				d[tree[node][i].to] = d[node] + tree[node][i].w;
				q.push(tree[node][i].to);
			}
		}
	}

	for (int i = 0; i < N; i++) {
		cout << d[i] % 2 << endl;
	}

	return 0;
}

Measured memory_bytes: 8704
import java.util.*;
public class Main {
    public static int findMaxDiff(int[] arr) {
      int min_so_far = arr[0];
      int global_max = arr[1] - arr[0];
      
      for(int i=1; i<arr.length; i++) {
        global_max = Math.max(global_max, arr[i]-min_so_far);
        min_so_far = Math.min(min_so_far, arr[i]);
      }
      
      return global_max;
    }
    
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int n = Integer.parseInt(sc.next());
      int[] arr = new int[n];
      for(int i=0; i<n; i++){
        arr[i] = Integer.parseInt(sc.next());
      }
      
      int result = findMaxDiff(arr);
      System.out.println(result);
    }
}


Measured memory_bytes: 72232
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>
#include<cassert>

using namespace std;

typedef long long ll;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n-1;i >= 0;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second

const long double pi = 3.141592653589793;
const int mod = 1e9 + 7;

int N, K, num, ans = 0;
vector<int> pos, neg;

int main() {

 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);

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

 cin >> N >> K;
 rep(i, N) {
   cin >> num;
   if(num > 0) pos.pb(num);
   if(num < 0) neg.pb(-num);
 }

 int cp = pos.size(), cn = neg.size();
 int cz = N - cp - cn;

 if(K > cp + cn) {cout << 0 << endl;return 0;}

 // check positive ans possible
 if(ceil((K-cp)/2.0) <= floor(K/2.0) && ceil((K-cp)/2.0) <= cn/2) {
   sort(pos.begin(), pos.end());
   sort(neg.begin(), neg.end());
   reverse(pos.begin(), pos.end());
   reverse(neg.begin(), neg.end());

   // pos neg
   int i = 0, j = 0, ans = 1;
   while(i + j != K) {
     if(j+1 >= cn) {
       ans = (1LL * ans * pos[i++])%mod;
       continue;
     }
     if(K-i-j == 1) {
       ans = (1LL * ans * pos[i++])%mod;
       continue;
     }
     if(i+1 >= cp) {
      ans = (1LL * ans * neg[j++])%mod;
      ans = (1LL * ans * neg[j++])%mod;
     } else if(1LL* pos[i] * pos[i+1] > 1LL* neg[j] * neg[j+1]) {
      ans = (1LL * ans * pos[i++])%mod;
      ans = (1LL * ans * pos[i++])%mod;
     } else {
      ans = (1LL * ans * neg[j++])%mod;
      ans = (1LL * ans * neg[j++])%mod;
     }
   }

   cout << ans << endl;

 } else if(cz > 0) {
   cout << 0 << endl;
   return 0;
 }
 else {
   rep(i, pos.size()) neg.pb(pos[i]);
   sort(neg.begin(), neg.end());
   ans = 1;
   rep(i, K) ans = (1LL * ans * neg[i])%mod;
   cout << (mod-ans)%mod << endl;
 }


 return 0;
}


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

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}

int main() {
	ll n, k, s; cin >> n >> k >> s;
	if(s<1000000000){
		for(ll i=0;i<k;i++){
			cout << s << ' ';
		}
		for(ll i=k;i<n;i++){
			cout << s+1 << ' ';
		}
		cout << endl;
		return 0;
	}else{
		for(ll i=0;i<k;i++){
			cout << s << ' ';
		}
		for(ll i=k;i<n;i++){
			cout << 1 << ' ';
		}
		cout << endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 1280
#include<iostream>
using namespace std;
struct data{char type,value;};
void bubblesort(struct data[],int);
void selection(struct data[],int);
bool isStable(struct data[],struct data[],int);
void print(struct data [],int );

  int main(){
    int N;
    data A[50],B[50];
    char c;
    int i;
  
    cin>>N;
    if(N>=1&&N<=36){//Nの条件は問題文に応じて変更する
      for(i=0;i<N;i++){
	cin>>A[i].type>>A[i].value;
	B[i]=A[i];
      }
      bubblesort(A,N);
      selection(B,N);
    }
    print(A,N);
    cout<<"Stable"<<endl;
    print(B,N);
    if(isStable(A,B,N)){
      cout<<"Stable"<<endl;
    }
    else{
      cout<<"Not stable"<<endl;
    }
    return 0;
  }

void bubblesort(struct data A[],int N){
  data tmp;
  for(int i=0;i<N;i++){
    int min=i;
    for(int j=N-1;j>=i+1;j--){
      if(A[j].value<A[j-1].value)
	{
	  tmp=A[j];
	  A[j]=A[j-1];
	  A[j-1]=tmp;
	}
    }
  }
}

void selection(struct data B[],int N){
  data tmp;
  for(int i=0;i<N;i++){
    int minj=i;
    for(int j=i;j<N;j++){
      if(B[j].value<B[minj].value)minj=j;   
    }
    tmp=B[i];
    B[i]=B[minj];
    B[minj]=tmp;
  }
}

bool isStable(struct data A[],struct data B[],int N){
  for(int i=0;i<N;i++){
    if(A[i].type!=B[i].type)return false;
  }
  return true;
}

void print(struct data A[],int N){
  for(int i=0;i<N;i++){
    if(i!=N-1)cout<<A[i].type<<A[i].value<<" ";
    else if(i==N-1)cout<<A[i].type<<A[i].value;
  }
  cout<<endl;
}



Measured memory_bytes: 3084
#include <iostream>
using namespace std;
int main(int argc, const char * argv[])
{
    string s;
    cin>>s;
    s.push_back('0');
    int ans=0,t=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T') t++;
        else
        {
            if(ans<t) ans=t;
            t=0;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define space " "
#define MOD (long long) 1000000007
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename T> void __f(const char* variable_name, T&& value){cout << variable_name << ": " << value << endl;}
template <typename T1, typename... T2> void __f(const char* names, T1&& arg1, T2&&... args){const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << ": " << arg1 << " |";__f(comma + 1, args...);}

const ll N = 15;
ll v[N][N], cost[N], curr[N];
ll n,m, x, ans;

void rec(ll i, ll cst){
    // trace(i);
    bool ok = true;
    for(ll j = 1; j <= m; j++)
        if(curr[j] < x){
            ok = false;
            break;
        }
    if(ok)
        ans = min(ans, cst);
    if(i > n){
        return;
    }
    // take
    for(ll j = 1; j <= m; j++)
        curr[j] += v[i][j];
    rec(i + 1, cst + cost[i]);
    // dont
    for(ll j = 1; j <= m; j++)
        curr[j] -= v[i][j];
    rec(i + 1, cst);
}

void solve(){
    ans = INT_MAX;
    cin >> n >> m >> x;
    for(ll i = 1; i <= n; i++){
        cin >> cost[i];
        for(ll j = 1; j <= m; j++)
            cin >> v[i][j];
    }
    rec(1, 0);
    if(ans == INT_MAX)
        cout << -1 << endl;
    else
        cout << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll t = 1;
    // cout << "\n\nBLAH BLAH BLAH\n\n";
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3608
package main

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

func solve() {
	n := nextInt()
	y := nextInt()

	for i := 0; i <= n; i++ {
		for j := 0; i+j <= n; j++ {
			for k := 0; i+j+k <= n; k++ {
				if n != i+j+k {
					continue
				}
				if y == i*1000+j*5000+k*10000 {
					printf("%d %d %d\n", k, j, i)
					return
				}
			}
		}
	}
	println("-1 -1 -1")
	return
}

func main() {
	defer out.Flush()
	in.Split(bufio.ScanWords)

	solve()
}

// --- template ---

var (
	in  = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func println(a ...interface{}) {
	fmt.Fprintln(out, a...)
}

func printf(format string, a ...interface{}) {
	fmt.Fprintf(out, format, a...)
}

func next() string {
	in.Scan()
	return in.Text()
}

func nextInt() int {
	s := next()
	i, e := strconv.Atoi(s)
	if e != nil {
		fmt.Println(e)
	}
	return i
}

func nextInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = nextInt()
	}
	return res
}

func unique(list []int) []int {
	m := make(map[int]bool)
	uniq := make([]int, 0)
	for _, e := range list {
		if !m[e] {
			m[e] = true
			uniq = append(uniq, e)
		}
	}
	return uniq
}


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

using namespace std;

class Solution {
public:
	void solve() {
		long long n,a,b;
		cin >> n >> a >> b;
		long long ret = a * (n/(a+b));
		n %= (a+b);
		ret += min(n, a);
		cout << ret << endl;
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 256
#配列内の全ての数値の積を求める際に必要
from operator import mul
from functools import reduce

# リスト内包表記で入力を変数やリストに代入
n, m = [int(i) for i in input().split()]
arr = [int(input()) for i in range(m)]

#始点（0）と終点（n）をarrに追加するが、壊れた床間の差分をとる際にずれるので、視点は-1,終点は+1しておく
arr.append(n+1)
arr.insert(0, -1)
#壊れた床同士の差分をとる
div_arr = [arr[i+1]-arr[i]-1 for i in range(len(arr)-1)]


def Fib(n):
    a, b = 0, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b

print(reduce(mul, [Fib(i+1) for i in div_arr])%1000000007)
  

Measured memory_bytes: 9100
N, Y = map(int, input().split())
num_1000 = -1
num_5000 = -1
num_10000 = -1

for i in range(N + 1):
    for j in range(N + 1):
        if i + j > N:
            continue
        k = N - i - j
        if 10000 * i + 5000 * j + 1000 * k == Y:
            num_1000 = i
            num_5000 = j
            num_10000 = k
            break

print(num_1000, num_5000, num_10000)


Measured memory_bytes: 41068
#include <stdio.h>

int main(void){
  int a,b;
  scanf("%d%d",&a,&b);

  if(a<b){
    printf("a < b\n");
  }else if(a==b){
    printf("a == b\n");
  }else{
    printf("a > b\n");
  }
  return 0;
}

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

int main() {
    int a, b, h, m;
    cin >> a >> b >> h >> m;

    int fullMinutes = h * 60 + m;
    double angleHour = fullMinutes % 720;
    angleHour *= M_PI / 360.0;
    double angleMinute = fullMinutes % 60;
    angleMinute *= M_PI / 30.0;

    double angle = max(angleHour, angleMinute) - min(angleHour, angleMinute);

    double dist = sqrt(a * a + b * b - 2 * a * b * cos(angle));
    cout << setprecision(9) << fixed << dist << endl;

    return 0;
}

Measured memory_bytes: 4160
#include<stdio.h>
#include<stdlib.h>
int asc(const void* a, const void* b)
{
	if (*(int*)a > * (int*)b)return 1;
	if (*(int*)a < *(int*)b)return -1;
	return 0;
}
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	int a[200005];
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	qsort(a, n, sizeof(int), asc);
	for (i = 0; i < n - 1; i++)
	{
		if (a[i] == a[i + 1])
		{
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 1788
#include <iostream>


using namespace std;

 

int main()
{
    int a, b;
    
    cin >> a >> b;
    if (a < b)
    cout << "a < b" << endl;
    else if (a > b)
      cout << "a > b" << endl;
    else if (a == b)
      cout << "a == b" << endl;
   
    return 0;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define setDP(arr) memset(arr,-1,sizeof arr)
#define Clear(arr) memset(arr,0,sizeof arr)
#define li(x) x.size()-1
#define oo 1000000000
#define inf 1000000000000000000
#define M 1000000007
#define M2 1000000009
#define M3 998244353
#define pii pair<int,int>
#define cpx complex<double>
typedef long long ll;
using namespace std;
const int N = 255000;
const int SQRTN = 320;
const int LOGN = 20;
const long double PI = acos(-1);
const long double TAU = 2*acos(-1);

int n , h[N] , dp[N];

int calc(int i){
    if(i==n-1)return 0;
    if(i>=n)return oo;
    int&ret = dp[i];
    if(ret!=-1)return ret;
    ret = min(calc(i+1)+abs(h[i]-h[i+1]),calc(i+2)+abs(h[i]-h[i+2]));
    return ret;
}

signed main(){
    /*#ifndef ONLINE_JUDGE
        freopen("in.txt","r",stdin);
    #endif*/
    cin >> n ;
    setDP(dp);
    for(int i = 0 ; i < n ; i++)scanf("%d",h+i);
    h[n]=0;
    cout << calc(0);
    return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,r;
  while(cin >> n >> r,n){
    vector<int> a(n);
    for(int i=0; i<n; i++) a[i] = n-i;

    for(int i=0; i<r; i++){
      int p,c;
      cin >> p >> c;

      vector<int> v1,v2;
      for(int j=0; j<p-1; j++) v1.push_back(a[j]);
      for(int j=0; j<c; j++) v2.push_back(a[j+p-1]);
      for(int j=0; j<c; j++) a[j] = v2[j];
      for(int j=0; j<p-1; j++) a[j+c] = v1[j];
    }
    cout << a[0] << endl;
  }
  return 0;
}



Measured memory_bytes: 3120
#include <stdio.h>
#include <iostream>

#include <sstream>
#include <fstream>
#include <cmath>
#include <vector>


using namespace std;


void check( int val ){
	
	cout << val << endl;
}

int main( int argc , char ** argv ){
	
	int N = 0;
	cin >> N;

	// check(N);
	bool check = true;


	long long T_max=0;
	vector<long long> T;
	for(int i = 0 ; i < N ; i++){
		long long buf;
		cin >> buf;
		T.push_back(buf);
		if(T_max > buf) check = false;
		if(T_max < buf) T_max = buf;
	}

	vector<long long> A;
	for(int i = 0 ; i < N ; i++){
		long long buf;
		cin >> buf;
		A.push_back(buf);
	}
	
	if(A[0] != T[N-1]) check = false;

	long long A_max=0;
	for(int i = N-1 ; i >= 0 ; i--){
		if(A_max > A[i]) check = false;
		if(A_max < A[i]) A_max = A[i];
	}

	if(A_max != T_max) check = false;

	long long result = 1;
	long long waru = 1000000000 +7;
	for(int i = 1 ; i < N-1 ; i ++){

		if(T[i] == T[i-1] && A[i] == A[i+1]){
			result *= (A[i] < T[i]) ? A[i] : T[i];
			result %= waru;
		}
		if(T[i] > T[i-1]) if(T[i] > A[i]) check = false;
		if(A[i] > A[i+1]) if(A[i] > T[i]) check = false;

		
	}

	

	if(check) cout << result << endl;
	else cout << 0 << endl;


}



Measured memory_bytes: 2548
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<iostream> 
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#define ll long long
#define ull unsigned long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define lowbit(x) (x& -x)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define eps 1e-18
#define maxn 100010
inline ll read(){ll tmp=0; char c=getchar(),f=1; for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1; for(;'0'<=c&&c<='9';c=getchar())tmp=(tmp<<3)+(tmp<<1)+c-'0'; return tmp*f;}
inline ll power(ll a,ll b){ll ans=1; for(;b;b>>=1){if(b&1)ans=ans*a%mod; a=a*a%mod;} return ans;}
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void swap(int &a,int &b){int tmp=a; a=b; b=tmp;}
using namespace std;
int n,m,x,y;
int main()
{
	n=read(); m=read(); x=read(); y=read();
	for(int i=1;i<=n;i++){
		int k=read(); x=max(x,k);
	}
	for(int i=1;i<=m;i++){
		int k=read(); y=min(y,k);
	}
	if(x<y)printf("No War\n");
	else printf("War\n");
}

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

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define mod 1000000007
#define M 100001
#define endl "\n"
#define all(a) (a).begin(),(a).end()
#define lp(i,a,b) for(i=a;i<b;i++)
#define lpr(i,a,b) for(i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair

typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;

int main(){

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

	fast;  
  int i,j,n,r;
  cin>>n>>r;
  int ans=(n<10)?r+(100*(10-n)):r;
  cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
s = []
dh = [-1, 1, 0, 0]
dw = [0, 0, -1, 1]
ans = "Yes"

for i in range(h):
    s.append(list(input()))

for i in range(h):
    for j in range(w):
        ok = False
        if s[i][j] == '#':
            for k in range(len(dh)):
                if 0<=i+dh[k]<=h-1 and 0<=j+dw[k]<=w-1:
                    if s[i+dh[k]][j+dw[k]] == '#':
                        ok = True
                        break
            if not(ok):
                ans = "No"
            

print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int r = scanner.nextInt();
        int d = scanner.nextInt();
        int x = scanner.nextInt();

        for (int i = 0; i < 10; i++) {
            x = r * x - d;
            System.out.println(x);
        }
    }
}

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

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++){
    string y;
    cin >> y;
    if (y == "Y"){
      cout << "Four" << endl;
      break;
    }
    else if (i == N - 1)
      cout << "Three" << endl;
  }
  
}

Measured memory_bytes: 256
N = int(input())
T, A = map(int, input().split())
H = [int(i) for i in input().split()]

cur  = float('inf')
ans = 0
for i in range(N):
    x = abs(A - (T - H[i] * 0.006))
    if cur > x:
        cur = x
        ans = i + 1
print(ans)

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

int main(){
    int n;
    cin >> n;
    vector<string> S(n);
    copy_n(istream_iterator<string>(cin), n, S.begin());
    
    map<char, int> C;
    const constexpr int INF = 1e6;
    for (char a = 'a'; a <= 'z'; a++)
        C[a] = INF;
    for (const auto &s: S){
        map<char, int> D;
        for (const auto &c: s)
            D[c]++;
        for (const auto &c: C)
            C[c.first] = min(C[c.first], D[c.first]);
    }

    string T = "";
    for (const auto &c: C)
        T += string(c.second, c.first);

    cout << T << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<int>ans(n);
    rep(ri,2) {
        int cnt = 0;
        rep(i,n) {
            if(s[i] == 'R') cnt++;
            else {
                ans[i] += cnt/2;
                ans[i-1] += (cnt+1)/2;
                cnt = 0;
            }
        }
        reverse(ans.begin(),ans.end());
        reverse(s.begin(),s.end());
        rep(i,n) {
            if(s[i] == 'R') s[i] = 'L';
            else s[i] = 'R';
        }
    }
    rep(i,n) {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<queue>
#include<string>
#include<stack>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
long long num[100];
int n,k;
priority_queue<long long,vector<long long>,greater<long long> >q;
long long solve(int l,int r)
{
	while(!q.empty())q.pop();
	long long ans=0;
	for(int i=1;i<=l;i++)
	{
		ans+=num[i];
		q.push(num[i]);
	}
	for(int i=n;i>=n-r+1;i--)
	{
		ans+=num[i];
		q.push(num[i]);
	}
	for(int i=0;i<k-l-r;i++)
	{
		if(q.empty())break;
		ans-=min(q.top(),(long long)0);
		q.pop();
	}
	return ans;
}
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>num[i];
	}
	long long maxn=0;
	for(int i=0;i<=k;i++)
	{
		for(int j=0;(i+j)<=min(n,k);j++)
		{
			maxn=max(solve(i,j),maxn);
		}
	}
	cout<<maxn;
	return 0;
}


Measured memory_bytes: 256
n, m, x = map(int, input().split())
L = [[0 for i in range(m+1)] for j in range(n)]
for i in range(n):
    L[i] = list(map(int, input().split()))

ans = [[0 for i in range(m+1)] for j in range(2**n)]
b = []
count = 0
for i in range(2 ** n):
    tmp = []
    for j in range(n):  
        if ((i >> j) & 1):
            tmp = L[j]  
            for k in range(m+1):
                ans[i][k] = ans[i][k] + tmp[k]

    check = 1
    for k in range(1,m+1):
        if ans[i][k] < x:
            check = 0
    if check:
        b.append(ans[i])


if len(b) == 0:
    print("-1")
else:
    b.sort()
    print(b[0][0])

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

int n;
int h[100010];

bool dp[100010];

int main(){
  cin >> n;
  for(int i = 0; i < n; ++i){
    cin >> h[i];
  }
  memset(dp,false,sizeof(dp));
  dp[0] = true;
  for(int i = 0; i < n-1; ++i){
    if(h[i] < h[i+1]){
      --h[i+1];
      dp[i+1] = dp[i];
    }else if(h[i] == h[i+1]){
      dp[i+1] = dp[i];
    }else{
      dp[i+1] = false;
    }
  }
  if(dp[n-1]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 4072
mod = 10 **9 + 7



n = int(input())
match_list = []
for i in range(n):
    match_list.append(list(map(int, input().split())))
    
    
c = [0]
for i in range(n):
    c += [j+1 for j in c]


dp = [0] * (1 << n)
dp[0] = 1
for i in range((1 << n)-1):
    for j in range(n):
        if match_list[c[i]][j]:
            dp[(1<<j)^i] = (dp[(1<<j)^i] + dp[i])%mod


print(dp[-1])

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;

signed main(){
    string s;
    cin >> s;
    if(s[0] == '7' || s[1] == '7' || s[2] == '7') PRINT("Yes");
    else PRINT("No");
    return 0;
}

Measured memory_bytes: 3628
#include <cmath>

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

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;

int n;

void input() {
  cin >> n;
}

void solve() {
  int x = round(1.0l * n / 1.08);

  string ans = ":(";

  for (int i = max(1, x - 10); i < x + 10; ++i) {
    if ((int)floor(i * 1.08l) == n) {
      ans = to_string(i);

      break;
    }
  }

  cout << ans << '\n';
}

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

  cout.precision(16);
  cout << fixed;

  int _times = 1;

#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  _times = 3;
#endif

  // cin >> _times;

  while (_times--) {
    input();
    solve();
  }
}


Measured memory_bytes: 3740