akhauriyash/Code-Regression huggingface dataset:
S = input()
T = ['dream', 'dreamer', 'erase', 'eraser']

for i, t in enumerate(T):
    T[i] = t[::-1]

cursor = 0
S = S[::-1]

while cursor < len(S):
    if S[cursor:cursor+7] == T[1]:
        cursor += 7

    elif S[cursor:cursor+6] == T[3]:
        cursor += 6

    elif S[cursor:cursor+5] == T[0]:
        cursor += 5

    elif S[cursor:cursor+5] == T[2]:
        cursor +=5

    else:
        print('NO')
        exit()

print('YES')

Measured memory_bytes: 3188
//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize ("Ofast")
#pragma GCC optimize("unroll-loops")
#define int long long

using namespace std;

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

const int N = 100000 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000000000010;
const ll LOG = 25;

ll n, a[N], dp[N];
int res, ans;

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i <= n; i++) cin >> a[i];
	dp[0] = 1;
	if (a[0] > 1) return cout << -1, 0;
	for (int i = 1; i <= n; i++){
		dp[i] = min(INF, (dp[i - 1] - a[i - 1]) * 2);
//		cout << dp[i] << '\n';
		if (dp[i] < a[i]) return cout << -1, 0;
	} 
	ll ans = a[n];
	for (int i = n - 1; i >= 0; i--){
		a[i] = min(dp[i] - a[i], a[i + 1]) + a[i];
//		cout << i << ' ' << a[i] << '\n';
		ans += a[i]; 
	}
	cout << ans;








	return 0;
}


Measured memory_bytes: 5220
class UnionFind:
    def __init__(self, n):
        self.parent = [-1] * n
        self.rank = [1] * n
        self.count = [1] * n

    def get_root(self, i):
        while self.parent[i] != -1:
            i = self.parent[i]
        return i

    def is_same_tree(self, i, j):
        return self.get_root(i) == self.get_root(j)

    def merge(self, i, j):
        i = self.get_root(i)
        j = self.get_root(j)
        if i == j:
            return

        if self.rank[i] > self.rank[j]:
            self.parent[j] = i
            self.rank[i] = max(self.rank[i], self.rank[j] + 1)
            self.count[i] += self.count[j]
        else:
            self.parent[i] = j
            self.rank[j] = max(self.rank[j], self.rank[i] + 1)
            self.count[j] += self.count[i]

n, m = [int(i) for i in input().split()]
uf = UnionFind(n)
for _ in range(m):
    x, y, _ = [int(i) - 1 for i in input().split()]
    uf.merge(x, y)
print(uf.parent.count(-1))

Measured memory_bytes: 8564
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printaa(x) for(int i = 0; i < (sizeof(x)/sizeof(x[0])); i++){ for(int j = 0; j < (sizeof(x[0])/sizeof(x[0][0])); j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;
const int MOD = 1e9 + 7;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int N = S.size();
    ll dp[100010][4] = {};
    for(int i = N; i >= 0; i--){
        for(int j = 3; j >= 0; j--){
            if(i == N){
                dp[i][j] = (j == 3 ? 1 : 0);
            }else{
                dp[i][j] = (S[i] == '?' ? 3 : 1) * dp[i+1][j];
                if(j < 3 && (S[i] == '?' || "ABC"[j] == S[i])){
                    dp[i][j] += dp[i+1][j+1];
                }
            }
            dp[i][j] %= MOD;
        }
    }
    print(dp[0][0]);
}


Measured memory_bytes: 3664
import java.util.*;
import java.io.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int d = sc.nextInt();
    long D = d*1l*d;
    int count = 0;
    for(int i = 0; i<n; i++) {
        int x = sc.nextInt();
        int y = sc.nextInt();
        long z = x*1l*x + y*1l*y;
        if(z<=D) count++;
    }
    System.out.println(count);
  }
}

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

using namespace std;

int main(){
	int n = 5;
	vector<pair<int, int> > v(n);
	
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		int y = x%10;
		if(y==0) y = 9;
		v[i] =  {y, x};
	}
	sort(v.rbegin(),v.rend());
	
	int sum = 0;
	for(int i=0;i<n;i++){
		if(i == n-1){
			sum += v[i].second;
		}
		else if(v[i].second%10 != 0){
			sum += ((v[i].second/10) * 10 + 10);
		}
		else{
			sum += v[i].second;
		}
	}
	cout<<sum<<"\n";
	return 0;
}

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

using namespace std;


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

Measured memory_bytes: 256
import math
N,P = map(int,input().split())
A = [i%2 for i in list(map(int,input().split()))]
odd,even = A.count(1),A.count(0)
sumo = 0
for i in range(P,odd+1,2):
    sumo += int(math.factorial(odd)//(math.factorial(odd-i)*math.factorial(i)))
print(sumo*(2**even))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1e9+1;


void solve(){
    int n;
    cin >> n;
    if(n==1){
        cout << "Hello World" << endl;
    }
    else{
        int a,b;
        cin >> a >> b;
        cout << a+b << endl;
    }
}

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


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

int main() {
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  if (A + B <= C * 2) cout << A * X + B * Y << endl;
  else if (X < Y) {
    int price = X * C * 2;
    if (B < C * 2) price += (Y - X) * B;
    else price += (Y - X) * C * 2;
    cout << price << endl;
  } else {
    int price = Y * C * 2;
    if (A < C * 2) price += (X - Y) * A;
    else price += (X - Y) * C * 2;
    cout << price << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
const int N=2e3+5, INF=1e9;
using namespace std;
using namespace __gnu_pbds;
template <typename T> 
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int n, k, q, a[N], mn=INF;
vector< pii > v;
signed main()
{
    cin >> n >> k >> q;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
        v.pb({a[i], i});
    }
    sort(v.begin(), v.end());
    for(int i = 1; i <= n; i++)
    {
        int y = a[i];
        set<int> s;
        ordered_set<int> rm;
        vector<int> tk;
        s.insert(0);
        s.insert(n+1);
        for(auto e: v)
        {
            if(e.F<y)
            {
                s.insert(e.S);
                continue;
            }
            int prv = *(--s.upper_bound(e.S));
            int nxt = *(s.upper_bound(e.S));
            prv-=rm.order_of_key(prv);
            nxt-=rm.order_of_key(nxt);
         /*   if(i==7)
            {
                cout << e.S << " - " << prv << " " << nxt << endl;
            }*/
            if(nxt-prv>k)
            {
                rm.insert(e.S);
                tk.pb(e.F);
            }
            else
            {
                s.insert(e.S);
            }
        }
        if(tk.size()>=q)
        {
            /*if(i==7)
            {
                for(auto e: tk) cout << e << " ";
                cout << endl;
            }*/
            mn = min(mn, tk[q-1] - tk[0]);
        }
    }
    cout << mn;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, T;
    cin >> N >> T;
    int c, t;
    int ans=1001;
    int min_time = 1e9;
    rep(i, N)
    {
        cin >> c >> t;
        if (t<=T)
        {
            if(ans>c){
                ans = c;
            }
        }
    }
    if (ans == 1001)
    {
        cout << "TLE"<< endl;
    }
    else
    {
        cout << ans  << endl;
    }

//    system("pause");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200005
#define LL long long
using namespace std;
vector<int> G[N];
int n,m,x,y,c[N],S[N],ufs[N],a[N],la,f[N],cir[N]; LL ans;
int find(int x){ return ufs[x] ? ufs[x]=find(ufs[x]) : x;}
void dfs(int t,int fa)
{
	int i; f[t]=fa;
	c[t]=S[t]=-c[fa];
	for(i=0;i<G[t].size();i++)
		if(G[t][i]!=fa){
			dfs(G[t][i],t);
			S[t]+=S[G[t][i]];
		  }
}
int main()
{
	int i,u,v;
	scanf("%d %d",&n,&m),c[0]=x=1;
	for(i=1;i<=m;i++){
		scanf("%d %d",&u,&v);
		if(find(u)==find(v)){ x=u,y=v; continue;}
		else ufs[find(u)]=find(v);
		G[u].push_back(v);
		G[v].push_back(u);
	  }
	dfs(x,0);
	if(m==n-1){
		if(S[x]){ printf("-1"); return 0;}
		for(i=1;i<=n;i++) ans+=abs(S[i]);
		cout<<ans;
		return 0;
	  }
	for(i=y;i;i=f[i]) cir[i]=1,a[++la]=S[i];
	if(la&1){
		if(S[x]&1){ printf("-1"); return 0;}
		for(i=1;i<=n;i++) if(cir[i]) ans+=abs(S[i]-S[x]/2); else ans+=abs(S[i]);
		cout<<ans;
		return 0;
	  }
	if(S[x]){ printf("-1"); return 0;}
	sort(a+1,a+la+1);
	for(i=1;i<=n;i++) if(cir[i]) ans+=abs(S[i]-a[(la+1)/2]); else ans+=abs(S[i]);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 18176
#include<bits/stdc++.h>
#define ll long long int 
using namespace std;
int main()
{

	ll n;
	cin>>n;
	ll arr[n];
	for(ll i=0;i<n;i++)cin>>arr[i];
	ll maxi = arr[0];
	ll sum=0;
	for(ll i=1;i<n;i++)
	{
		if(maxi<arr[i])
		{
			maxi=arr[i];
		}
		else
		{
			ll count = maxi-arr[i];
			sum+=count;
			
		}
	}
		cout<<sum<<endl;
}

Measured memory_bytes: 5192
#include <stdio.h>

int main() {
    int A,B,C,X,Y,Maxchange,i,sum,minsum,x,y;
    scanf("%d%d%d%d%d",&A,&B,&C,&X,&Y);
    Maxchange = X;
    if (X<Y) Maxchange=Y;

    minsum = A*X+B*Y;
    
    for (i=0;i<Maxchange+1;i=i+1) {
        if ((X-i)<0) x=0;
        if ((X-i)>=0) x=X-i;
        if ((Y-i)<0) y=0;
        if ((Y-i)>=0) y=Y-i;
        sum = A*x+B*y+C*(i*2);
        if (minsum>sum) minsum=sum;
    }
    
    printf("%d\n",minsum);
    
    return 0;
}


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


int main() {
    int n,m;
    cin >> n >> m;
    int v1 = 0;
    int v2 = 100000;
    rep(i, m) {
        int a,b;
        // cout << i << endl;
        cin >> a >> b;
        v1 = max(v1,a);
        v2 = min(v2,b);
    }
    int res = max(v2-v1+1, 0);
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 256
#43
import sys
w = input()
c = w.lower()
mozi = []

if w !=c:
    print("No")
    sys.exit()
    
for i in range(len(w)):
    mozi.append(w[i])
    
for i in mozi:
    if w.count(i) % 2 == 1:
        print("No")
        sys.exit()
    
print("Yes")

Measured memory_bytes: 8988
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int x;
    cin >> x;
    if(x==0) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>

int table[105][105];
int time_table[105][2];

int depth_search(int tm, int id, int col) {
	int i;
	int j;
	
	time_table[id][0] = tm;
	table[id][0] = 0;

	for(i=1;i<=col;i++) {
		if(table[id][i] == 1 && table[i][0] == 1) {
			for(j=0;j<=col;j++) table[j][i] = 0;
			tm = depth_search(tm+1, i, col);
		}
	}
	return time_table[id][1] = tm+1;
}

int main(void) {
    int i, j, n, q;
    int id, t;
    char buff[1024];
    int ret;
   
    scanf("%d\n", &n);
    for(i=0;i<=n;i++) {
    	table[i][0] = 1;
        for(j=1;j<=n;j++) {
            table[i][j] = 0;
        }
    }
   
    for(i=0;i<n;i++) {
        scanf("%d %d", &id, &q);
        for(j=0;j<q;j++) {
            scanf("%d", &t);
            table[id][t] = 1;
        }
        gets(buff);
    }
    ret = 0;
    for(i=1;i<=n;i++) {
    	if(table[i][0] == 1) {
			ret = depth_search(ret+1, i, n);
    	}
    }
	
	for(i=1;i<=n;i++) {
		printf("%d %d %d\n", i, time_table[i][0], time_table[i][1]);
	}

    return 0;
}

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> vec(n);
    rep(i, n){
        cin >> vec[i];
    }
    
    int ans = 0;
    rep(i, n){
        if(vec[i] < k - vec[i]){
            ans += vec[i] * 2;
        }else ans += abs(vec[i] - k) * 2;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
using namespace std;

int main(){
  int x;
  cin>>x;
  int ans=1;
  for(int i=2;i*i<=x;i++){
    int y=i;
    for(int j=2;y*i<=x;j++){
      y*=i;
      ans=max(ans,y);
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
long long  mod = 1000000007;
long long a[100000];
int main()
{
	int N;
	int count = 1;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%lld", &a[i]);
	}
	sort(a, a + N);
	long long number = a[0];
	long long bit;
	int count0 = 1;
	int count1 = 0;
	int count2 = 0;
	if (N % 3 == 0) {
		if (a[0] == 0) {
			for (int i = 1; i < N; i++) {
				if (a[i] == 0) {
					count0++;
				}
				if (a[i] != number) {
					number = a[i];
					count++;
				}
			}
			if (count == 2 && count0 == N / 3) {
				printf("Yes");
				return 0;
			}
		}
		else {
			for (int i = 1; i < N; i++) {
				if (a[i] == a[0]) {
					count0++;
				}
				if (a[i] == a[N / 3]) {
					count1++;
				}
				if (a[i] == a[N / 3 * 2]) {
					count2++;
				}
				if (a[i] != number) {
					number = a[i];
					count++;
				}
			}
			if (count == 3 && count0 == N / 3 && count1 == N / 3 && count2 == N / 3) {
				bit = a[0] ^ a[N / 3];
				if (bit == a[N / 3 * 2]) {
					printf("Yes");
					return 0;
				}
			}
		}
	}
	count0 = 0;
	for (int i = 0; i < N; i++) {
		if (a[i] == 0) {
			count0++;
		}
	}
	if (count0 == N) {
		printf("Yes");
	}
	else {
		printf("No");
	}
	return 0;
}


Measured memory_bytes: 2460
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;

int main ()
{
  int k, n;
  
  scanf("%d %d", &k, &n);
  
  vector<int> a(n);
  
  for (int x=0; x<n; x++)
    scanf("%d", &a[x]);
  
  a.push_back(k+a[0]);
  
  int longest = 0;
  
  for (int x=0; x<n; x++)
    longest = max(longest, a[x+1]-a[x]);
  
  int answer = k - longest;
  
  printf("%d", answer);
  fflush(stdout);
  
  return 0;
}


Measured memory_bytes: 1792
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>

using namespace std;
#define     loop(n,i,a)     for(int i=a;i<n;i++)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     vi              vector<int>
#define     vll             vector<ll>
#define     sz(x)           (int)x.size()
#define     pb              push_back
int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
bool sortbysecdesc(const pair<string,ll> &a,const pair<string,ll> &b)
{
       return a.second>b.second;
}
int main() {
	int n;cin>>n;
	int arr[n-1];
	loop(n-1,i,0)cin>>arr[i];
	ll res=arr[0]+arr[n-2];
	loop(n-2,i,0){
		res+=min(arr[i],arr[i+1]);
	}
	cout<<res<<endl;
	return 0;
}


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

int main()
{
	int H,W,N;
	cin >> H >> W >> N;
	int M = max(H,W);
	cout << (N+M-1) / M << endl;
	return 0;
}

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

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int calOfDough;
    vector <int> calOfTopping(n);
    cin >> calOfDough;
    rep (i, n) cin >> calOfTopping[i];
    sort(calOfTopping.rbegin(), calOfTopping.rend());
    int sumOfCal = calOfDough, sumOfDollar = a;
    rep (i, n) {
        if (1.0 * sumOfCal / sumOfDollar < 1.0 * (sumOfCal + calOfTopping[i]) / (sumOfDollar + b)) {
            sumOfCal += calOfTopping[i];
            sumOfDollar += b;
        }
    }
    cout << sumOfCal / sumOfDollar << endl;
    return 0;
}


Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <cctype>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

int main(){
    ll n;
    ll tar=0,han=0;
    cin >> n;
    rep(i,n){
        string t,h;
        cin >> t >> h;
        if(t>h) tar += 3;
        if(t<h) han += 3;
        if(t==h){
            tar++;
            han++;
        }
    }
    cout << tar << ' ' << han << endl;
}


Measured memory_bytes: 3160
#include <iostream>
#include <string>
#include <vector>

typedef long long ll;
int main(int argc, char *argv[])
{
    int n;
    ll sum = 0;

    std::cin >> n;

    for (int i = 1; i <= n; i++) {
        if ((i % 5 != 0) && (i % 3 != 0)) {
            sum += i;
        }
    }

    std::cout << sum << std::endl;

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> vec(n, 0);
  for(int i = 0; i < n; ++i)cin>>vec[i];
  long long sum = 0;
  for(int i = 0; i < n; ++i)sum += vec[i];
  long long s = 0;
  long long r = 1e18;
  for(int i = 0; i < n; ++i){
    s += vec[i];
    long long t = sum - s;
    r = min(r, abs(t - s));
  }
  cout<<r<<endl;
  return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long int
#define MOD 10000007
#define M 1e18
		
void solve() {
	int n,k,num;
	vector<int> list;
	cin >> n >> k;
	while(n-- && cin >> num) {
		list.push_back(num);
	}
	
	sort(list.begin(), list.end());
	int index = 0, sum =0;
	while(k--) {
		sum += list[index];
		index++;
	}
	cout << sum << endl;
	
}

int32_t main() {
	IOS;
	solve();
	return 0;
}


Measured memory_bytes: 3676
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.Queue;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//StringBuffer S = new StringBuffer(sc.next());
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)
	//Map<Integer, Integer> map = new HashMap<Integer, Integer>(N);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> dd=new ArrayDeque<>();//push後ろに入れる,poll(pop)後ろからとる,peek addは先頭に入るからバグ注意
	//ArrayList<Integer> cc = new ArrayList<>(N);
	//cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static long mod =1000000007;
	static long longINF=1000000000000000007L;
	static int INF=1000000007;

	
	public static void main(String[] args) {
		//StringBuffer str = new StringBuffer(sc.nextInt());
		//for(int i=0;i<N;i++) {}
		
			
		
		
		
		long A=sc.nextLong();
		StringBuffer S = new StringBuffer(sc.next());
		S.deleteCharAt(1);
		long B=(long)Integer.parseInt(S.toString());
		
		p(A*B/100);
		//String S=sc.next();
		
		
		
		
		
		
		
		
	}
		
		
		
		
		
	
	
	
	static long bi(int i) {
		long t=1;
		for(int a=1;a<=i;a++) {
			t*=a;
			t%=mod;
		}
		return t;
	}
	public static long modPow(long g,long N) {
		long T=1;
		for(int i=0;i<N;i++) {
			T*=g;
			T%=mod;
		}
		return T;
	}
	static void bit() {
		int n=3;
		String[] ar = {"a","b","c"};
		for(int i =0;i<(1<<n);i++) {
			String S="";
			for(int j=0;j<n;j++) {
				if((1&i>>j)==1) {
					S+=ar[j];
				}
			}
			p("S="+S);
		}
	}
	public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
	}
	
	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


Measured memory_bytes: 35816
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
    Scanner InData = new Scanner(System.in);
    int a = InData.nextInt();
    int b = InData.nextInt();
    if(a==b)
        System.out.println("a == b");
    else if(a>b)
        System.out.println("a > b");
    else
        System.out.println("a < b");
    }
}

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

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)

using namespace std;

//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);
 

void solve() {
    string S;
    cin >> S;
    REP(i, 26){
        if(S.find('a'+i) == S.npos) {
            cout << (char)('a'+i) << endl;
            return;
        }
    }
    cout << "None" << endl;
}
 
int main() {
    solve();
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll x,y,a,b,c;
  cin>>x>>y>>a>>b>>c;
  vll p(a),q(b),r(c);
  REP(i,a)cin>>p[i];
  REP(i,b)cin>>q[i];
  REP(i,c)cin>>r[i];

  sort(ALL(p), greater<ll>());
  sort(ALL(q), greater<ll>());
  sort(ALL(r),greater<ll>());

  vll ans;
  REP(i,x)ans.push_back(p[i]);
  REP(i,y)ans.push_back(q[i]);
  REP(i,c)ans.push_back(r[i]);

  sort(ALL(ans) ,greater<ll>());
  ll sum=0;
  REP(i,x+y)sum+=ans[i];
  cout<<sum<<endl;


}



Measured memory_bytes: 8944
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a,b,i,j;
int main()
{
	cin>>a>>b;
	for(i=0;i<=b;i+=10000)
	{
		for(j=i;j<=b;j+=5000)
		{
		//	if(i/10000==14)
		//		cout<<i/10000+(j-i)/5000+(b-j)/1000<<" "<<i/10000<<" "<<(j-i)/5000<<" "<<(b-i)/1000<<"\n";
			if(i/10000+(j-i)/5000+(b-j)/1000==a)
			{
				cout<<i/10000<<" "<<(j-i)/5000<<" "<<(b-j)/1000<<"\n";
				return 0;
			}
		}
	}
	cout<<-1<<" "<<-1<<" "<<-1<<"\n";
}

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

using namespace std;

string s;

string u;

int COUNT(string s, string u) {

	int ret = 0;

	int N = s.size();

	for (int i = 0; i < N; i++) {
		if (s[i] == 'g' && u[i] == 'p') { ret++; }
		else if (s[i] == 'p' && u[i] == 'g') { ret--; }
	}


	return ret;
}

int main(void) {

	cin >> s;

	int N = s.size();

	for (int i = 0; i < N; i++) {
		if (i % 2 == 0) { u += "g"; }
		else { u += "p"; }
	}

	cout << COUNT(s, u) << endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int N;
  cin >> N;
  
  vector<int>time(N,0);
  for(int i=0;i<N;i++){
    cin >> time[i];
  }
  
  int M;
  cin >> M;
  
  vector<vector<int>>drink(M,vector<int>(2,0));
  for(int i=0;i<M;i++){
    for(int j=0;j<2;j++){
      cin >> drink[i][j];
    }
  }
  
  for(int i=0;i<M;i++){
    int ans = 0;
    for(int j= 0;j<N;j++){
      ans += time[j];
    }
    ans += drink[i][1] - time[drink[i][0] -1];
    
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
const double pi=3.14159265358979323846264339;
struct node
{
	int x,y;
	bool useful;
	inline bool operator <(const node other)const
	{
		return x<other.x;
	}
}a[200005];
int f[200005];
int t[1000005];
int tmp[1000005];
int x1,x2,y1,y2,n,tot;
double ans;
void add(int p,int l,int r,int now,int num)
{
	t[now]=max(t[now],num);
	if(l==r) return;
	int mid=(l+r)>>1;
	if(p<=mid) add(p,l,mid,now<<1,num);
	else add(p,mid+1,r,now<<1|1,num);
}
int ask(int L,int R,int l,int r,int now)
{
	if(L>R) return 0;
	if(L<=l&&r<=R) return t[now];
	int mid=(l+r)>>1,ans=0;
	if(L<=mid) ans=ask(L,R,l,mid,now<<1);
	if(R>mid) ans=max(ans,ask(L,R,mid+1,r,now<<1|1));
	return ans;
}
int main()
{
	scanf("%d%d%d%d%d",&x1,&y1,&x2,&y2,&n);
	for(int i=1;i<=n;i++)
	  scanf("%d%d",&a[i].x,&a[i].y),tmp[++tot]=a[i].y;
	tmp[++tot]=y1,tmp[++tot]=y2;
	if(x1==x2)
	{
		for(int i=1;i<=n;i++)
		  if(a[i].x==x1)
		  {
			if(a[i].y<min(y1,y2)||a[i].y>max(y1,y2)) return printf("%.15lf",100.0*abs(y1-y2)),0;
			else return printf("%.15lf",100.0*abs(y1-y2)-20+10.0*pi),0;
		  }
		return printf("%.15lf",100.0*abs(y1-y2)),0;
	}
	if(y1==y2)
	{
		for(int i=1;i<=n;i++)
		  if(a[i].y==y1)
		  {
		  	if(a[i].x<min(x1,x2)||a[i].x>max(x1,x2)) return printf("%.15lf",100.0*abs(x1-x2)),0;
		  	else return printf("%.15lf",100.0*abs(x1-x2)-20+10.0*pi),0;
		  }
		return printf("%.15lf",100.0*abs(x1-x2)),0;
	}
	sort(tmp+1,tmp+tot+1);
	tot=unique(tmp+1,tmp+tot+1)-tmp-1;
	for(int i=1;i<=n;i++)
	  a[i].y=lower_bound(tmp+1,tmp+tot+1,a[i].y)-tmp;
	sort(a+1,a+n+1);
	ans=abs(x1-x2)+abs(y1-y2);
	ans*=100;
	int Y1=y1,Y2=y2;
	y1=lower_bound(tmp+1,tmp+tot+1,y1)-tmp;
	y2=lower_bound(tmp+1,tmp+tot+1,y2)-tmp;
	int num=0,l=0,r=0;
	for(int i=1;i<=n;i++)
		if(a[i].x>=min(x1,x2)) {l=i;break;}
	for(int i=n;i;i--)
		if(a[i].x<=max(x1,x2)) {r=i;break;}
	for(int i=1;i<=n;i++)
	  if(a[i].x<min(x1,x2)||a[i].x>max(x1,x2)||a[i].y<min(y1,y2)||a[i].y>max(y1,y2)) continue;
	  else a[i].useful=1;
	if(x1>x2) swap(x1,x2),swap(y1,y2);
	int Case;
	if(y1<y2) Case=1;else Case=0;
	for(int i=l;i<=r;i++)
	  if(a[i].useful)
	  {
		f[i]=1;
		int tmp;
		if(Case) tmp=ask(1,a[i].y-1,1,tot,1);
		else tmp=ask(a[i].y+1,tot,1,tot,1);
		f[i]=max(f[i],tmp+1);
		add(a[i].y,1,tot,1,f[i]);
	  }
	for(int i=l;i<=r;i++)
	  num=max(num,f[i]);
	if(num==min(abs(x1-x2),abs(Y1-Y2))+1) ans-=num*20.0,ans+=pi*5.0*(num+1);
	else ans-=num*(20.0-5.0*pi);
	printf("%.15lf",ans);
	return 0;
}

Measured memory_bytes: 9984
#include <vector>
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

long long int N, K;
long long int x[100010], y[100010], col[100010];

const long long int MAXK = 2005;
long long int black[MAXK + 5][MAXK + 5], white[MAXK + 5][MAXK + 5];

long long int getSum(long long int arr[][MAXK + 5], int sx, int sy, int gx, int gy) {
    long long int ret = 0;
    ret += arr[sx][sy];
    ret += arr[gx][gy];

    ret -= arr[sx][gy];
    ret -= arr[gx][sy];
    return ret;
}

int main() {
    cin >> N >> K;
    for(int i=0; i<N; i++) {
        char c;
        cin >> x[i] >> y[i] >> c;
        x[i] %= (2*K);
        y[i] %= (2*K);
        col[i] = (c == 'W' ? 1 : 0);

        if(col[i]) white[ x[i]+1 ][ y[i]+1 ]++;
        else       black[ x[i]+1 ][ y[i]+1 ]++;
    }

    for(int i=0; i<MAXK; i++) {
        for(int j=0; j<MAXK; j++) {
            white[i][j+1] += white[i][j];
            black[i][j+1] += black[i][j];
        }
    }
    for(int j=0; j<MAXK; j++) {
        for(int i=0; i<MAXK; i++) {
            white[i+1][j] += white[i][j];
            black[i+1][j] += black[i][j];
        }
    }

    // 黒四角の左上を固定
    long long int ans = 0;
    for(int i=0; i<=K; i++) {
        for(int j=0; j<=K; j++) {
            long long int sum = 0;
            sum += getSum(black, 0  , 0  , i  , j  );
            sum += getSum(black, i+K, 0  , 2*K, j  );
            sum += getSum(black, i  , j  , i+K, j+K);
            sum += getSum(black, 0  , j+K, i  , 2*K);
            sum += getSum(black, i+K, j+K, 2*K, 2*K);

            sum += getSum(white, 0  , j  , i  , j+K);
            sum += getSum(white, i  , 0  , i+K, j  );
            sum += getSum(white, i+K, j  , 2*K, j+K);
            sum += getSum(white, i  , j+K, i+K, 2*K);

            ans = max({ans, sum, N - sum});
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 65664
package main

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

func main() {
	io := newIo()
	defer io.Flush()
	N, K := io.NextInt(), io.NextInt()
	S := io.Next()
	if N == 1 {
		fmt.Println(0)
		return
	}
	point := 0
	changeCount := 0
	for i := range S {
		if i == 0 {
			continue
		}
		if S[i] == S[i-1] {
			point++
		} else {
			changeCount++
		}
	}
	if changeCount > 2*K {
		fmt.Println(point + 2*K)
	} else {
		fmt.Println(N - 1)
	}
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}


Measured memory_bytes: 1280
N = int(input())
A = list(map(int, input().split()))

P = [None]*N
M = [None]*N

for i in range(N):
    P[i] = i + A[i]
    M[i] = i - A[i]

P.sort() 
M.sort()

P_ = []
M_ = []

for i in range(N):
    if i == 0 or P[i] != P[i-1]:
        ele = [P[i], 1]
    else:
        ele[1] += 1
    if i == N-1 or P[i] != P[i+1]:
        P_.append(ele)
        
for i in range(N):
    if i == 0 or M[i] != M[i-1]:
        ele = [M[i], 1]
    else:
        ele[1] += 1
    if i == N-1 or M[i] != M[i+1]:
        M_.append(ele)
        

cnt = 0
lp = len(P_)
lm = len(M_)
for i in range(lp):
    idx = P_[i][0]
    head = 0
    tail = lm
    while tail - head > 1:
        center = (tail + head)//2
        if idx > M_[center][0]:
            head = center
        elif idx < M_[center][0]:
            tail = center
        else:
            cnt += P_[i][1] * M_[center][1]
            break
            
print(cnt)

Measured memory_bytes: 141980
#!/usr/bin/env python
from collections import deque

def main():
    h, w = map(int, input().split())
    maze = [[] for _ in range(h+2)]
    maze[0] = ['#' for _ in range(w+2)]
    maze[h+1] = ['#' for _ in range(w+2)]
    score = h * w
    for i in range(1, h+1):
        maze[i] = list('#' + input() + '#')
        for j in range(1, w+1):
            if maze[i][j] == '#':
                score -= 1

    direct = [(-1,0), (0,-1), (1,0), (0,1)]
    que1 = deque([(1, 1)])
    que2 = deque([])
    score -= 1
    maze[1][1] = '#'
    while que1:
        x, y = que1.popleft()
        if (x, y) == (h, w):
            print(score)
            break
        for d in direct:
            dx, dy = d
            if maze[x+dx][y+dy] == '.':
                maze[x+dx][y+dy] = '#'
                que2.append((x+dx, y+dy))
        if len(que1) == 0:
            score -= 1
            que1.extend(que2)
            que2.clear()
    else:
        print(-1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

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

		int ans = 0;
		for (int i = 0; i < n; i++) {
			String s2 = "";
			String s3 = "";
			for (int j = 0; j < n; j++) {
				s2 = s.substring(0, 1 + j);
				s3 = s.substring(j + 1);
				int cnt = 0;
				List<Character> list = new ArrayList<>();
				for (int j2 = 0; j2 < s2.length(); j2++) {
					if (!list.contains(s2.charAt(j2))) {
						for (int k = 0; k < s3.length(); k++) {
							if (s2.charAt(j2) == s3.charAt(k)) {
								cnt++;
								break;
							}
						}
					}
					list.add(s2.charAt(j2));
					ans = Math.max(ans, cnt);
				}
			}
		}

		System.out.println(ans);

	}
}

Measured memory_bytes: 35056
#include <stdio.h>
#define N 200000
int main ()
{
  int n,b=0,a[N],i,j,minv,maxv;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  
  minv=a[0];
  maxv=a[1]-a[0];
  for(j=1;j<n;j++){
    
    if((a[j]-minv)>maxv)
      maxv=a[j]-minv;
    if(minv>a[j])
      minv=a[j];
  }

  printf("%d\n",maxv);

  return 0;
}
    
    
   



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

using namespace std;
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
const int N=1e9+5;///1e18+5

void solve()
{
    long long a,b,c,d;
    cin>>a>>b>>c>>d;

    //cout<<max(-2,-4);

    long long x=a*c;
    long long y=a*d;
    long long z=b*c;
    long long v=b*d;

    cout<<max(max(x,y),max(z,v))<<endl;
}


int main()
{
    IO;
    int tc=1;
    //cin>>tc;
    while(tc--)
    {
        solve();
    }
    return 0;
}


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

void impl(std::vector<int>& results, std::vector<int>& dp, int node, int parent, std::vector<int> const& A, std::vector<std::vector<int>> const& paths)
{
    auto const a = A.at(node);

    auto iter = std::lower_bound(dp.begin(), dp.end(), a);
    int prev;
    bool pushed = false;
    if (iter == dp.end()) {
        dp.push_back(a);
        pushed = true;
    } else {
        prev = *iter;
        *iter = a;
    }

    results.at(node) = static_cast<int>(dp.size());

    for (auto child : paths.at(node)) {
        if (child != parent) {
            impl(results, dp, child, node, A, paths);
        }
    }

    if (pushed){
        dp.pop_back();
    } else {
        *iter = prev;
    }
}

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

    std::vector<int> A;
    A.reserve(N);
    for (auto i = 0; i < N; i++) {
        int a;
        std::cin >> a;
        A.push_back(a);
    }

    std::vector<std::vector<int>> paths(N);
    for (auto i = 0; i < N - 1; i++) {
        int u, v;
        std::cin >> u >> v;
        u--;
        v--;

        paths.at(u).push_back(v);
        paths.at(v).push_back(u);
    }

    std::vector<int> results(N);
    std::vector<int> dp;
    dp.reserve(N);
    impl(results, dp, 0, -1, A, paths);

    for (auto result : results) {
        std::cout << result << std::endl;
    }

    return 0;
}


Measured memory_bytes: 35768
max_v = 100001
N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
dp = [[float('inf') for _ in range(max_v+1)] for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
  for j in range(max_v):
    if j - wv[i][1] >= 0:
      dp[i+1][j] = min(dp[i][j], dp[i][j-wv[i][1]]+wv[i][0])
    else:
      dp[i+1][j] = min(dp[i+1][j], dp[i][j])

for i in range(max_v):
  if dp[N][i] <= W:
    ans = i

print(ans)

Measured memory_bytes: 321392
/*
　　　　　　 ＿＿
　　　　　／＞　　 フ
　　　　　|   _　 _l  
　 　　　／` ミ＿x ノ   Zzz..
　　 　 /　 　 　 |   コード見ちゃだめ！！
　　　 /　 ヽ　　  ﾉ
　 　 │　　|　|  |   
　／￣|　　 |　|  |
　| (￣ヽ＿_ヽ_)_ _)
　＼二つ
*/

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) reverse((a).begin(),(a).end())
#define REP(i, n) for(int i = 0; i < n; i++)
const int MOD = 1e9+7;
typedef long long ll;


int main(){
  int N,M;
  cin >> N >> M;
  map<int, int> mp_0,mp_N;
  for(int i=0; i<M; i++){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    if(a == 0){
      mp_0[b]++;
    }
    if(b == 0){
      mp_0[a]++;
    }
    if(a == N-1){
      mp_N[b]++;
    }
    if(b == N-1){
      mp_N[a]++;
    }
  }
  bool can=false;
  for(auto m: mp_0){
    if(mp_N.find(m.first) != mp_N.end()){
      can = true;
    }
  }
  if(can){
    cout << "POSSIBLE" << endl;
  }else{
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}



Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vdo=vector<double>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vvdo=vector<vector<double>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using pqin=priority_queue<int>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBUG
int main()
{
    int k,s;
    cin>>k>>s;
    int sum=0;
    rep(i,k+1){
        rep(j,k+1){
            if(0<=s-i-j&&s-i-j<=k)sum++;
        }
    }
    cout<<sum<<endl;
}

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

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


typedef long long ll;
const int INF = 1001001001;



int main() {
	int n=0;
	cin >> n;
	cout << n*n*n<<endl;


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 1000000007;
double pi = 3.1415926535;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;

signed main(){
    cin >> n;
    vec(a,n);
    int ans = 1;
    int t;
    int m = 0;
    cin >> t;
    if(t != 0){
        print(0);
        return 0;
    }
    REP(i,n-1){
        cin >> t;
        a[t]++;
    }
    REP(i,n){
        if(a[i]!=0){
            m = i;
        }
    }
    if(a[0] != 0){
        print(0);
        return 0;
    }
    FOR(i,1,m){
        REP(j,a[i+1]){
            ans *= a[i];
            ans %= 998244353;
        }
    }
    print(ans);




    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 1024
// Problem : A - Air Conditioner
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
int main()
{
	ll i,j,k,m,n,t;
	cin>>n;
	if(n>=30) cout<<"Yes\n";
	else cout<<"No\n";
}

Measured memory_bytes: 3628
#include <iostream>

const int N = 7;

typedef struct {
  int panels[N];
  int upper;
  int east;
  int south;
} Dice;

void rotate_dice(int *x, int *y, int d) {
  *x = *y;
  *y = d;
}

int main(void) {
  int RIGHT_PANLES[N] = {0, 3, 3, 5, 2, 4, 3};
  
  Dice dice;

  for (int i = 1; i < N; i++) {
    std::cin >> dice.panels[i];
  }

  int n = 0;

  std::cin >> n;

  for (int i = 0; i < n; i++) {
    dice.upper = 1;
    dice.east = 3;
    dice.south = 2;
    
    int u = 0;
    int s = 0;
    
    std::cin >> u >> s;

    const int ROTATION_MAX = 4;

    for (int i = 1; i < ROTATION_MAX; i++) {
      if (dice.panels[dice.upper] == u) {
	break;
      }
      
      rotate_dice(&dice.south, &dice.upper, N - dice.south);
    }

    if (dice.upper != u) {
      for (int i = 1; i < ROTATION_MAX; i++) {
	if (dice.panels[dice.upper] == u) {
	  break;
	}
      
	rotate_dice(&dice.east, &dice.upper, N - dice.east);
      }
    }

    for (int i = 0; i < ROTATION_MAX; i++) {
      if (dice.panels[dice.south] == s) {
	break;
      }
      
      rotate_dice(&dice.south, &dice.east, N - dice.south);
    }

    std::cout << dice.panels[dice.east] << std::endl;
  }
  
  return 0;
}

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

int main() {
	int x, res;
	cin>>x;	
	if(x>=400 && x<600) res=8;
	else if(x<800) res=7;
	else if(x<1000) res=6;
	else if(x<1200) res=5;
	else if(x<1400) res=4;
	else if(x<1600) res=3;
	else if(x<1800) res=2;
	else res=1;
	cout<<res<<endl;
}

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

#dp[l][r] = [l, r)区間のスライムを合体するときのコストの最小値
dp = [[float("inf")]*(n+1) for i in range(n+1)]
for i in range(n):
    dp[i][i] = 0

#cost[r]-cost[l] = [l, r)区間を合計したときのスライムの総和
cost = [0]*(n+1)
for i in range(n):
    cost[i+1] = cost[i] + a[i]

#メモ化再帰でdp[0][n]求める
def dfs(l, r, infnum):
    if dp[l][r] != infnum:
        return dp[l][r]
    elif (r - l) == 1:
        dp[l][r] = 0
        return dp[l][r]
    else:
        res = float("inf")
        for k in range(l + 1, r):
            #dp[l][k] + dp[k][r] + 合体に必要なコスト
            res = min(res, dfs(l, k, infnum) + dfs(k, r, infnum) + (cost[r] - cost[l]))
        dp[l][r] = res
    return dp[l][r]

dfs(0, n, float("inf"))
print(dp[0][n])

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

using namespace std;

#define INF 0x7FFFFFFF

int main() {
  int N, T, ans = INF;
  
  cin >> N >> T;
  
  for (int i = 0; i < N; i++) {
    int cost, taken_time;
    
    cin >> cost >> taken_time;
    
    if (taken_time <= T) {
      ans = min(ans, cost);
    }
  }
  
  cout << (ans == INF ? "TLE" : to_string(ans)) << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
 int K, A, B;
 cin >> K >> A >> B;  
  bool a = true;
for (int i=A; i<B+1; i++){
  if (i%K == 0){
    cout << "OK" << endl;
    a = false;
    break;
  }
}
  if (a)
    cout << "NG" << endl;

}

Measured memory_bytes: 3676
import sys
m=166666;a=[[1]*m for _ in[0]*2]
for i in range(m):
 if a[0][i]:
  k=6*i+5
  a[0][i+k::k]=[0]*len(a[0][i+k::k])
  a[1][-2-i+k::k]=[0]*len(a[1][-2-i+k::k])
 if a[1][i]:
  k=6*i+7
  a[0][-2-i+k::k]=[0]*len(a[0][-2-i+k::k])
  a[1][i+k::k]=[0]*len(a[1][i+k::k])
for e in map(int,sys.stdin):
 print([e-1,sum(a[0][:(e+1)//6]+a[1][:(e-1)//6])+2][e>3])


Measured memory_bytes: 13848
using System;
using System.IO;

// arihon p335
// This solution is O(|T|log^2|T| + Q|P|log|T|) order.
namespace ALDS1_14_D
{
    class SuffixArray
    {
        internal int[] sa, rank, tmp;
        internal string S;
        internal int n, k;
 
        public SuffixArray(string SS)
        {
            S = SS;
            n = S.Length;
            sa = new int[n + 1];
            rank = new int[(n << 1) + 1];
            tmp = new int[n + 1];
            Construct_SA();
        }
 
        public int Compare_SA(int i, int j)
        {
            return (rank[i] != rank[j]) ? rank[i] - rank[j] : rank[i + k] - rank[j + k];
        }
 
        public void Construct_SA()
        {
            for (int i = 0; i < n; i++)
            {
                sa[i] = i;
                rank[i] = S[i];
            }
            sa[n] = n;
 
            for (k = 1; k <= n; k <<= 1)
            {
                Array.Sort(sa, Compare_SA);
 
                int d;
                d = tmp[sa[0]] = 1;
 
                for (int i = 1; i <= n; i++)
                {
                    d = tmp[sa[i]] = d + ((Compare_SA(sa[i - 1], sa[i]) < 0) ? 1 : 0);
                }
 
                for (int i = 0; i <= n; i++)
                {
                    rank[i] = tmp[i];
                }
            }
        }
 
        public string Contains(string pattern)
        {
            int l = 1, r = n + 1;
            int pl = pattern.Length;
 
            while (l < r)
            {
                int m = (l + r) >> 1;
 
                string subStr = (sa[m] + pl > n) ? S.Substring(sa[m]) : S.Substring(sa[m], pl);
 
                int comp = subStr.CompareTo(pattern);
                if (comp == 0) return "1";
 
                if (comp < 0) l = m + 1;
                else r = m;
            }
            return "0";
        }
    }
 
 
    class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var T = Console.ReadLine();
            var SA = new SuffixArray(T);
            var Q = int.Parse(Console.ReadLine());
            for (int i = 0; i < Q; i++)
            {
                var P = Console.ReadLine();
                Console.WriteLine(SA.Contains(P));
            }
            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 38860