akhauriyash/Code-Regression huggingface dataset:
n, k = map(int, input().split())
ar = list(sorted(map(int, input().split())))

def lcm(x, y):
    return x if y == 0 else lcm(y, x % y)

l = ar[0]
for a in ar[1:]:
    l = lcm(l, a)

ans = 'POSSIBLE' if k % l == 0 and k <= ar[-1] else 'IMPOSSIBLE'
print(ans)


Measured memory_bytes: 14252
# coding: utf-8
H,N=map(int,input().split())
AB=[[0,0]]
for i in range(N):
    AB.append(list(map(int,input().split())))

INF=10**9

dp=[[INF for i in range(H+1)] for j in range(N+1)]

for i in range(N+1):
    dp[i][0]=0


for i in range(1,N+1):
    for j in range(1,H+1):
        dp[i][j]=min(dp[i-1][j],dp[i-1][max(j-AB[i][0],0)] + AB[i][1],dp[i][max(j-AB[i][0],0)] + AB[i][1])
        #print(dp[i-1][j],dp[i-1][max(j-AB[i][0],0)] + AB[i][1],dp[i][max(j-AB[i][0],0)] + AB[i][1])
        


print(dp[N][H])


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



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

int main(void){
    char Sbuf;
    bool AExists = false;
    bool BExists = false;
    for(int i=0; i<3; i++){
        cin >> Sbuf;
        if(Sbuf == 'A'){
            AExists = true;
        }else{
            BExists = true;
        }
    }
    if(AExists && BExists){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

int main(){
	int n,p;
	cin >> n >> p;
	int odd_n = 0;
	int even_n = 0;
	int a[n];
	long long sum = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(a[i] % 2 == 0)even_n++;
		else odd_n++;
	}
	if(odd_n == 0 && p == 0)cout << (long long)(pow(2,n)) << endl;
	else if(odd_n == 0 && p == 1)cout << 0 << endl;
	else cout << (long long)(pow(2,n - 1)) << endl;
	return 0;
}

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

 long gcd(long a,  long b){
    if(a < b) {
        long tmp = b;
        b = a;
        a = tmp;
    }

    long r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main(){

    int N;
    long X;
    cin >> N >> X;
    vector<long> city(N+1);
    city[0] = X;
    for(int i = 1; i <= N; i++) cin >> city[i];

    // (N+1)個の座標を昇順に並べる
    sort(city.begin(), city.end());

    // (N+1)個の座標の距離を記録する
    vector<long> distance(N+1, 0);
    for(int i = 1; i <= N; i++) distance[i] = city[i] - city[i-1];


    vector<long> d_gcd(N+1, 0);
    for(int i = 1; i <= N; i++){
        if(i == 1) d_gcd[i] = distance[i];
        else d_gcd[i] = gcd(d_gcd[i-1], distance[i]);
    }

    cout << d_gcd[N] << endl;

    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define int long long 
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std ;

int32_t main(){IOS;

	string s , t ; cin >> s >> t ;
	t += s; 
	cout << t << endl; 
	return 0;

}

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

int N, ans;

int main() {
    cin >> N;
    int a[N];
    int b[N];
    for (int i=0; i<N; i++) cin >> a[i];
    for (int i=0; i<N; i++) b[i]=1;
    for (int i=0; i<N; i++) {
        if (a[i]%2==0 && a[i]!=2) b[i] = 0;
        for (int j=3; j*j<=a[i] && b[i]==1; j+=2) {
            if (a[i]%j==0 && a[i]!=j) b[i] = 0;
        }
    }
    for (int i=0; i<N; i++) ans+=b[i];
    cout << ans << endl;
}


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

typedef long long ll;
const int N = 2e5 + 10;
const int mod = 1e9 + 7;
ll pos[N], gp;
ll neg[N], gn;
int zero;
int n, k;

bool cmp(int a, int b) {
	return a > b;
}

int main()
{
	scanf("%d%d", &n, &k);
	for(int i = 1; i <= n; i++) {
		ll x; scanf("%lld", &x);
		if(x == 0) zero++;
		else if(x > 0) pos[++gp] = x;
		else neg[++gn] = x;
	}	
	
	sort(pos + 1, pos + 1 + gp, cmp);
	sort(neg + 1, neg + 1 + gn);
	
	ll res = 1;
	if(gp == n) {
		for(int i = 1; i <= k; i++) res = res * pos[i] % mod;
	} else if(gn == n) {
		if(k & 1) for(int i = n, j = 0; i >= 1 && j < k; i--, j++) res = res * neg[i] % mod;
		else for(int i = 1; i <= k; i++) res = res * neg[i] % mod;
	} else if(zero == n) {
		res = 0;
	} else {
 		if(gp + gn >= k) {
 			if(k & 1) {
 				if(gp >= 1) {		
 					//判断是否可以得到正答案 
 					if(gp + gn / 2 * 2 >= k) {
 						res = res * pos[1] % mod;
 						int i = 2, j = 1, cnt = k - 1;
 						while(i + 1 <= gp && j + 1 <= gn && cnt) {
 						if(pos[i] * pos[i + 1] >= neg[j] * neg[j + 1]) {
 							res = res * pos[i] % mod * pos[i + 1] % mod;
 							i += 2, cnt -= 2;
 						}
 						else {
 							res = res * neg[j] % mod * neg[j + 1] % mod;
 							j += 2, cnt -= 2;	
						}
 						}
	 					while(cnt && i + 1 <= gp) {
	 						res = res * pos[i] % mod * pos[i + 1] % mod;
	 						i += 2, cnt -= 2;
	 					}
	 					while(cnt && j + 1 <= gn) {
	 						res = res * neg[j] % mod * neg[j + 1] % mod;
	 						j += 2, cnt -= 2;
	 					}
 					}
 					
 					//gp+gn=k
					else {
						for(int i = 1; i <= gp; i++) res = res * pos[i] % mod;
						for(int i = 1; i <= gn; i++) res = res * neg[i] % mod;
					}
 				}
 				
 				else if(gp < 1){
 					int j = 0;
 					for(int i = gn; i >= 1 && j < k; i--, j++) res = res * neg[i] % mod;
 					if(j < k) res = 0;
 				}
 			}
 			
 			//k为偶 
 			else {
 				int cnt = gp / 2 * 2 + gn / 2 * 2;
 				if(cnt >= k) {
 					cnt = k;
 					int i = 1, j = 1;
 					while(i + 1 <= gp && j + 1 <= gn && cnt) {
 						if(pos[i] * pos[i + 1] >= neg[j] * neg[j + 1]) {
 							res = res * pos[i] % mod * pos[i + 1] % mod;
 							i += 2, cnt -= 2;
 						}
 						else {
 							res = res * neg[j] % mod * neg[j + 1] % mod;
 							j += 2, cnt -= 2;	
						}
 					}
 					while(cnt && i + 1 <= gp) {
 						res = res * pos[i] % mod * pos[i + 1] % mod;
 						i += 2, cnt -= 2;
 					}
 					while(cnt && j + 1 <= gn) {
 						res = res * neg[j] % mod * neg[j + 1] % mod;
 						j += 2, cnt -= 2;
 					}
				 }
 				
 				else {
 					int sur = (gp & 1) + (gn & 1);
 					if(cnt + sur >= k) {
 						if(zero > 0) res = 0;
 						else {
 							for(int i = 1; i <= gn; i++) res = res * neg[i] % mod;
 							for(int i = 1; i <= gp; i++) res = res * pos[i] % mod;
 						}
 					} 
 					
 					else res = 0;
 				}
 			}
 		}
 		
 		else res = 0;
	}
	
	if(res < 0 && zero > 0) res = 0;
	else res = (res % mod + mod) % mod;
	
	printf("%lld\n", res);
	
	return 0;
} 

Measured memory_bytes: 5304
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  string s,t;cin >> s >> t;
  sort(all(s));
  sort(all(t),greater<char>());
  bool canmake = false;
  rep(i,s.length()){
    if(i==t.length()) break;
    if(s[i]<t[i]){
      canmake = true;
      break;
    }else if(s[i]>t[i])break;
    if(i==s.length()-1&& i!=t.length()-1){
      canmake = true;
      break;
    }
  }
  YesNo(canmake);
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int max(std::vector<int> &v)
{
    int maxVal = 0;
    for(int i = 0; i < (int)v.size(); ++i) {
        if( v[i] > maxVal )
            maxVal = v[i];
    }
    return maxVal;
}

int min(std::vector<int> &v)
{
    int minVal = INF;
    for(int i = 0; i < (int)v.size(); ++i) {
        if( v[i] < minVal )
            minVal = v[i];
    }
    return minVal;
}

int main(){

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

    vector<int> l(m), r(m);

    for (int i = 0; i < m; i++)
    {
        cin >> l[i] >> r[i];
    }

    int left = max(l);
    int right = min(r);

    int ans;
    if(right - left < 0){
        ans = 0;
    }else{
        ans = right - left +1;
    }

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

Measured memory_bytes: 1024
#include <stdio.h>

int main(int argc, char const *argv[])
{
	int N;
	int p[10];
	int sum = 0,max = 0,maxi;

	scanf("%d",&N);
	for (int i = 0; i < N; ++i){
		scanf(" %d", &p[i]);
		if(max < p[i]){
			max = p[i];
			maxi = i;
		}
	}
	p[maxi] /= 2;
	for (int i = 0; i < N; ++i){
		sum += p[i];
	}
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

//f
int main(){FIN
    ll n,k;cin>>n>>k;
    vll a(n); REP(i,n) cin>>a[i];
    ll left=0, right=1e9;
    ll mid = 1;
    while(left+1<right){
        mid = (left+right) /2;
        ll sub=0;
        REP(i,n){
            sub += a[i] / mid -1;
            if (a[i]%mid!=0) sub++;
        }
        // cout<<sub<<endl;
        if (sub>k) left = mid;
        else right = mid;
    }
    cout<<right<<endl;

    return 0;
}


Measured memory_bytes: 4784
import math
from decimal import Decimal

A,B,H,M = map(int,input().split())

sinrad1 = Decimal(str(math.sin(math.radians(6*M))))
cosrad1 = Decimal(str(math.cos(math.radians(6*M))))
sinrad2 = Decimal(str(math.sin(math.radians(30*H+0.5*M))))
cosrad2 = Decimal(str(math.cos(math.radians(30*H+0.5*M))))
ans = (float((B*sinrad1-A*sinrad2))**2 + float((B*cosrad1-A*cosrad2))**2)**0.5
print(ans)

Measured memory_bytes: 71848
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	long long int A,B;
	int K;
	
	cin >> A >> B >> K;

	for(int i=A; i<A+K; i++){
		cout << i << "\n";
		if(i >= (A+B)/2){
			for(int j=i+1; j<=B;j++){
				cout << j << "\n";
			}
			return 0;
		}
	}
	for(int i=B-K+1; i<=B; i++){
		cout << i <<"\n";
	}

	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))
#n,k=100,100000
#a=range(1,101)

dp=[False for _ in range(k+1)]
calted=[False for _ in range(k+1)]
# dp[i]:残り石i個で自分のターンになった時、勝てるならTrue
# dp[0]=False,dp[a]=True,求めるのはdp[k]
mi=min(a)
ma=max(a)
for ai in a:
	dp[ai]=True
	calted[ai]=True
# dp[i]={dp[i-a]の中にFalseがあればTrue、すべてTrueならFalse}
for i in range(mi+1,k+1):
      if calted[i]:
            continue
      il=[i-ai for ai in a if i-ai>=0]
      f=1
      for l in il:
        f*=dp[l]
      if f == 0:
            dp[i]=True
      else:
            dp[i]=False
print('First' if dp[k] else 'Second')
#print(dp)
#print(datetime.datetime.now())

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

int main()
{
	string N;
	getline(cin,N);
	int ans = 0;
	for( int i = 0; i < N.length(); i++ ) {
		ans += N[i]-'0';
		ans %= 9;
	}
	if( ans == 0 ) { cout << "Yes" << endl;}
	else {cout << "No" << endl;}

}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD = 998244353;

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

signed main(){
	int x1,y1,x2,y2,x,y;
	cin >> x1 >> y1 >> x2 >> y2;
	x = x2 - x1;
	y = y2 - y1;
	printf("%lld %lld %lld %lld\n",x2 - y,y2 + x,x2 - y - x,y2 + x - y);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
using namespace std;

int main(){
  long long N,M; cin >> N >> M;
  long long ans=0;
  long long a=min(N,M/2);
  long long b=(M-2*a)/4;
  ans=a+b;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<int,int>
int main()
{
    cin.tie(0),cout.tie(0),ios::sync_with_stdio(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int r = s.size()-1, l = 0;
    int ans = 0;
    while(r > l)
    {
        if (s[l] == 'W' && s[r] == 'R')
        {
            ans++;
            r--;
            l++;
        }
        else
        {
            if (s[l] == 'R')
                l++;
            if (s[r] == 'W')
                r--;
        }
    }
    cout << ans ;
    return 0;
}

Measured memory_bytes: 3680
using System;

namespace msol
{
    class Program
    {
        static void Main()
        {
            var abc = Console.ReadLine().Split(' ');
            var k = int.Parse(Console.ReadLine());
            Console.WriteLine(B(int.Parse(abc[0]), int.Parse(abc[1]), int.Parse(abc[2]), k));

        }
        static string B(int a, int b, int c, int k)
        {
            var mp = k;
            var lb = (long)b;
            var lc = (long)c;
            while (lb <= a && mp > 0)
            {
                lb *= 2;
                --mp;
            }
            while (lc <= lb && mp > 0)
            {
                lc *= 2;
                --mp;
            } 
            return (lb > a && lc > lb) ? "Yes" : "No";
        }
    }
}


Measured memory_bytes: 27504
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  for(auto &c: s) c = (c - 'A' + n) % 26 + 'A';
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  ll N, W;
  cin >> N >> W;
  ll dp[110][100010] = {0};
  ll weight[110] = {0}, value[110] = {0};
  for (int i = 0; i < N; i++){
    cin >> weight[i] >> value[i];
  }

  for (int i = 0; i < N; i++){
    for (int wh = 0; wh <=W; wh++){
        if(wh>=weight[i])
          chmax(dp[i + 1][wh], dp[i][wh - weight[i]] + value[i]);
        chmax(dp[i + 1][wh], dp[i][wh]);
    }
  }
  cout << dp[N][W] << endl;
  return 0;
}

Measured memory_bytes: 89544
#include<stdio.h>
#define N 500000
#define INF 1000000000
int cnt;
void merge(int *, int ,int ,int);
void mergeSort(int *,int, int);

int main(){
    int a,A[N],i;

    scanf("%d",&a);
    for(i = 0;i < a;i++){
        scanf("%d",&A[i]);
    }
    mergeSort(A,0,a);

    for(i = 0;i < a;i++){
        if(i == a - 1){
            printf("%d\n",A[i]);
        }else printf("%d ",A[i]);
    }

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

    return 0;
}
void merge(int *A,int left,int mid,int right)
{
int n1,n2;
int i,j,k;

n1 = mid - left;
n2 = right - mid;

int L[n1 + 1],R[n2 + 1];

for(i = 0;i < n1;i++){
    L[i] = A[left + i];
}
for(i = 0;i < n2;i++){
    R[i] = A[mid + i];
}
L[n1] = INF;
R[n2] = INF;

i = 0;
j = 0;

for(k = left;k < right;k++){
    if(L[i] <= R[j]){
        A[k] = L[i];
        i++;
        cnt++;
    }else{
        A[k] = R[j];
        j++;
        cnt++;
    }
  }
}
void mergeSort(int *A,int left,int right){
    int mid;

    if(left+1 < right){
    mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid,right);
    merge(A,left,mid,right);
    }
}




Measured memory_bytes: 5756
using System;

public class Hello
{
    public static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        if (n == 1) { Console.WriteLine(1); goto end; }
        var w = getNum(n);
        var te = w * (w + 1) / 2;
        if (te == n) write(w, 0);
        else
        {
            var ng = (w + 1) * (w + 2) / 2 - n;
            write(w + 1, ng);
        }
        end:;
    }
    public static void write(long n, long ng)
    {
        for (int i = 1; i <= n; i++)
            if (i != ng) Console.WriteLine(i);
    }
    public static long getNum(long n)
    {
        var ok = 1L; var ng = n;
        while (ng - ok > 1)
        {
            var mid = (ng + ok) / 2;
            if (check(mid, n)) ok = mid;
            else ng = mid;
        }
        return ok;
    }
    public static bool check(long n, long t) => n * (n + 1) / 2L <= t;
}


Measured memory_bytes: 13140
h,w,n = map(int,input().split())
sr,sc = map(int,input().split())
t = input()
s = input()
hei = [1,h]
wid = [1,w]
for i in range(n-1,-1,-1):
  if s[i] == "L":
    wid[1] = min(wid[1]+1,w)
  elif s[i] == "R":
    wid[0] = max(wid[0]-1,1)
  elif s[i] == "U":
    hei[1] = min(hei[1]+1,h)
  elif s[i] == "D":
    hei[0] = max(hei[0]-1,1)
  if t[i] == "L":
    wid[0] += 1
  elif t[i] == "R":
    wid[1] -= 1
  elif t[i] == "U":
    hei[0] += 1
  elif t[i] == "D":
    hei[1] -= 1
  if wid[0]>wid[1] or hei[0]>hei[1]:
    print("NO")
    exit(0)
if hei[0] <= sr <= hei[1] and wid[0] <= sc <= wid[1]:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3888
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
puts A[gets.to_i-1]

Measured memory_bytes: 1788
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int N,M,X,Y;cin>>N>>M>>X>>Y;
    vector<int> x(N),y(M);
    for(int i=0;i<N;i++) cin>>x[i];
    for(int i=0;i<M;i++) cin>>y[i];
    bool f=false;
    for(int i=X+1;i<Y;i++){
        bool ftmp=true;
        for(int j=0;j<N;j++) if(x[j]>=i) ftmp=false;
        for(int j=0;j<M;j++) if(y[j]<i) ftmp=false;
        if(ftmp) f=true;
    }
    if(f) cout<<"No War"<<endl;
    else cout<<"War"<<endl;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

template<typename T,typename... Ts> 
auto make_vector(size_t sz, Ts... ts){
	return vector<decltype(make_vector<T>(ts...))>(sz, make_vector<T>(ts...));
}

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

int main(void){
	string s;
	cin >> s;
	int lose = 0;

	for(auto &c: s){
		if(c == 'x'){
			lose++;
		}
	}

	if(lose <= 7)
		puts("YES");
	else
		puts("NO");
	return 0;
}

Measured memory_bytes: 256
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

string A,B,C;
inline void solve(){
  IN3(A,B,C);
  OUT(A.back()==B.front()&&B.back()==C.front()?"YES":"NO");
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
package main

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

const (
	defaultBufferSize = 1024
	maxBufferSize     = 1e6
	Mod               = 1e9 + 7
)

var sc = bufio.NewScanner(os.Stdin)

// sc.Buffer(make([]byte, defaultBufferSize), maxBufferSize)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func intSliceReverse(slice []int) []int {
	for i, j := 0, len(slice)-1; i < j; i, j = i+1, j-1 {
		slice[i], slice[j] = slice[j], slice[i]
	}
	return slice
}

func stringReverse(str string) string {
	runes := []rune(str)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func primeFactorization(x int) map[int]int {
	result := make(map[int]int, 0)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			result[i]++
			x /= i
		}
	}
	if x != 1 {
		result[x]++
	}
	return result
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	for i := 2; i*i <= x; i++ {
		if i == x {
			continue
		}
		if x%i == 0 {
			return false
		}
	}
	return true
}

func main() {
	sc.Split(bufio.ScanWords)
	a := readString()
	var r rune
	for _, v := range a {
		r = v
	}
	if 'a' <= r && r <= 'z' {
		fmt.Println("a")
		return
	}
	if 'A' <= r && r <= 'Z' {
		fmt.Println("A")
		return
	}
}


Measured memory_bytes: 1776
/* ****TCIITB**** */

#include<bits/stdc++.h>
#define io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

#define N  100005
ll expo(ll base, ll exponent, ll mod) {								//return base^exponent modulo modulus
    ll ans = 1;
    while(exponent !=0 ) {
        if((exponent&1) == 1) {
            ans = ans*base ;
            ans = ans%mod;
        }
        base = base*base;
        base %= mod;
        exponent>>= 1;
    }
    return ans%mod;
}
int main()
{
	
	io
	
	ll n;
	cin>>n;
	std::vector<ll> a(n);
	ll ts=0;
	rep(i,0,n)
	{
		cin>>a[i];
		ts+=a[i];
		ts%=hell;
	}
	ts%=hell;
	ll res=0;
	rep(i,0,n)
	{
		res=(res%hell+((a[i]%hell)*((ts-a[i]+hell)%hell))%hell)%hell;
	}
	res=(res*(expo(2,hell-2,hell))%hell)%hell;
	cout<<res;
}

Measured memory_bytes: 4752
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include <queue>
using namespace std;
int main(){
    int N,M;
    cin >> N >> M;
    std::priority_queue<int> que;
    for(int i=0;i<N;i++){
        int tmp;
        cin >> tmp;
        que.push(tmp);
    }

    int tmp;
    for(int i=0;i<M;i++){
        tmp = que.top();
        que.pop();
        que.push(tmp/2);
    }
 
    long long ans = 0;

    for(int i=0;i<N;i++){
        ans += que.top();
        que.pop();
    }
 
    cout << ans << endl;
 
    return 0;
}

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

using ll = long long int;
using llu = unsigned long long int;
using ld = long double;
const long long int NUM = 1000000;
const long double PI = 2*acos(0.0);
const int INF = 1e9 + 10 ;
const long long int maximum = (-1*INF);
#define LCM(a,b)            (a / __gcd(a,b)) * b
#define GCD(a,b)            __gcd(a,b)
#define dist(x1,y1,x2,y2)   sqrtl((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
#define sqr(a)              ((a)*(a))
#define fast                ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define precision(a)        fixed<<setprecision(a)
#define endl                "\n"
#define pb                  push_back
#define bp                  pop_back
#define pf                  push_front
#define fp                  pop_front
#define mp                  make_pair
#define ff                  first
#define ss                  second
#define ub                  upper_bound
#define lb                  lower_bound
#define all(x)              x.begin(), x.end()
#define debug(x)            cout<<"debug "<<x<<"\n"
#define ms(a,b)             memset((a),(b),sizeof(a))
#define min3(a,b,c)         min(a,min(b,c))
#define max3(a,b,c)         max(a,max(b,c))
#define min4(a,b,c,d)       min(min(a,b),min(c,d))
#define max4(a,b,c,d)       max(max(a,b),max(c,d))
#define max5(a,b,c,d,e)     max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e)     min(min3(a,b,c),min(d,e))
#define REP(i,b)            for(long long int i = 0; i < b; i++)
#define READ(f)             freopen("f", "r", stdin)
#define WRITE               freopen("out.txt", "w", stdout)

/*bool compare(const pair<ll, ll> &a, const pair<ll, ll> &b)
{
    if(a.ff == b.ff)
        return a.ss <= b.ss;
    return a.ff < b.ff;
}*/

/*map<char, ll> m = { {'q', 9}, {'r', 5}, {'b', 3}, {'n', 3},
                      {'p', 1}, {'k', 0}, {'.', 0} };*/

int main() {
    llu x, sum = 100;
    cin >> x;
    llu cnt = 0;
    while (true) {
        if(sum >= x)
            break;
        sum += sum/100;
        cnt++;
    }
    cout << cnt;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int a, b, k;
int main() {
	int i;
	cin>>a>>b>>k;
	for(i=a; i<=b && i<a+k; i++) cout<<i<<endl;
	for(i=max(i, b-k+1); i<=b; i++) cout<<i<<endl;
	return 0;
}

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

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<double,double> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;

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

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int A,B;
bool grid[100][100];

void genWhite() {
    int i = 0, j = 0;
    while (B > 1) {
        grid[i][j] = 1;
        if (i == 48) {
            i = 0; j += 2;
        } else {
            i += 2;
        }
        B --;
    }
}

void genBlack() {
    FOR(i,50,100) F0R(j,100) grid[i][j] = 1;
    int i = 51, j = 0;
    while (A > 1) {
        grid[i][j] = 0;
        if (i == 99) {
            i = 51; j += 2;
        } else {
            i += 2;
        }
        A --;
    }
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> A >> B;
    genWhite();
    genBlack();
    cout << "100 100\n";
    F0R(i,100) {
        F0R(j,100) {
            if (grid[i][j]) cout << '#';
            else cout << '.';
        }
        cout << "\n";
    }
}

// read the question correctly (is y a vowel?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll  long long int
#define pb push_back
#define IO ios::sync_with_stdio(false);
typedef vector<int> vi;
#define H return 0;
#define C continue;
#define B break;
#define sec second
int countDivisors(int n)
{
    int cnt = 0;
    for (int i = 1; i <= sqrt(n); i++) {
        if (n % i == 0) {
            // If divisors are equal,
            // count only one
            if (n / i == i)
                cnt++;

            else // Otherwise count both
                cnt = cnt + 2;
        }
    }
    return cnt;
}
int main()
{IO
  string s;
  ll k;
  cin>>s;cin>>k ;int pos=-1;char t;
  for(int i=0;i<s.size();i++)
  {
      if(s[i]!='1')
      {pos=i;t=s[i];break;}
  }
  if(pos==-1)
   cout<<1;
  else if(k<=pos)
    cout<<1;
  else
    cout<<t;
}


Measured memory_bytes: 256
from collections import deque
def belman(s,n,w,es):
    d = [-float("inf")] * n #d[i] : s→iの最短距離
    d[s] = 0
    c = 0
    while True:
      update = False
      for p,q,r in es:
        if d[p] != -float("inf") and d[q] < d[p] + r:
          d[q] = d[p] + r
          update = True
          c += 1
        if c > w:
          return 'inf'
      if not update:
        break
    return d[n-1]

def use_path(n,start,es):
    q = deque()
    chk = [False] * n
    q.append(start)
    chk[start] = True
    used = {start}
    while len(q) > 0:
        node = q.popleft()
        for nex in es[node]:
            if not chk[nex]:
                chk[nex] = True
                q.append(nex)
                used.add(nex)
    return used

n,w = map(int,input().split())
es = []
l = [[] for i in range(n)]
r = [[] for i in range(n)]

for i in range(w):
    a,b,c = map(int, input().split())
    a -= 1
    b -= 1
    l[a].append(b)
    r[b].append(a)
    es.append((a,b,c))

use = use_path(n,0,l) & use_path(n,n-1,r)
ess = [(a,b,c) for a,b,c in es if a in use and b in use]
print(belman(0,n,w*2,ess))

Measured memory_bytes: 10000
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#define rep(i, n) for(int i=0; i<n; i++)
#define rep_one(i, n) for(int i=1; i<n; i++)
using namespace std;
typedef long long ll;

int main(){
    int x, n; cin >> x >> n;
    int p[150] = {};
    int tmp;
    rep(i, n){
        cin >> tmp;
        p[tmp] = 1;
    }
    int min_p = 0;
    int d = 0 - x;
    rep(i, 150){
        if(p[i]) continue;
        if(i-x < abs(d)){
            d = i -x;
            min_p = i;
        }else if(i-x == abs(d) && i-x < d){
            d = i -x;
            min_p = i;
        }
    }
    cout << min_p << endl;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	while (1) {
		int M; cin >> M;
		if (!M)break;
		vector<pair<int, int>>constes;
		for (int i = 0; i < M; ++i) {
			int x, y; cin >> x >> y;
			constes.emplace_back(x, y);
		}
		int N; cin >> N;
		vector<pair<int, int>>stars;
		for (int i = 0; i < N; ++i) {
			int x, y; cin >> x >> y;
			stars.emplace_back(x, y);
		}
		sort(stars.begin(), stars.end());
		sort(constes.begin(), constes.end());

		for (int i = 0; i < N; ++i) {
			const int dx = stars[i].first - constes[0].first;
			const int dy = stars[i].second - constes[0].second;
			bool ok = true;
			for (int j = 0; j < M; ++j) {
				if (!binary_search(stars.begin(), stars.end(), make_pair(constes[j].first + dx, constes[j].second + dy)))ok = false;
			}
			if (ok) {
				cout << dx << " " << dy << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3104
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu) FUNC(printe) FUNC(printe0);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int a; cin >> a;
    cout << a + a * a + a * a * a << '\n';
}


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

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

typedef long long ll;
using namespace std;

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

  int N;
  cin >> N;
  vector<int> P(N);
  REP(i, N) { cin >> P.at(i); }
  vector<int> P2(P);
  sort(P2.begin(), P2.end());
  int diff = 0;
  REP(i, N) {
    if (P.at(i) != P2.at(i)) {
      ++diff;
    }
  }
  if (diff == 0 || diff == 2) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << 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;
using ll = long long;
using P = pair<int,int>;

int main() {
    int n;
    ll d, a;
    cin >> n >> d >> a;
    vector<P> p(n);
    rep(i,n) {
        cin >> p[i].first >> p[i].second;
    }
    d *= 2;
    sort(p.begin(),p.end());
    ll tot = 0;
    queue<pair<ll,ll>> q;
    ll ans = 0;
    rep(i,n) {
        ll x = p[i].first;
        ll h = p[i].second;
        while (q.size() && q.front().first < x) {
            tot -= q.front().second;
            q.pop();
        }
        h -= tot;
        if (h > 0) {
            ll num = (h+a-1)/a;
            ans += num;
            ll damage = num*a;
            tot += damage;
            q.emplace(x+d, damage);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6428
h,w = map(int,input().split())
data = []
for i in range(h):
    s = input().rstrip().split()
    data.append(s)
def func(x,y):
    sum = 0
    for i in range(h):
        for j in range(w):
            if abs(i-x) >= abs(j-y):
                pop = abs(j-y)*int(data[i][j])
            else:
                pop = abs(i-x)*int(data[i][j])
            sum = sum+pop
    return sum
result = []
for i in range(h):
    for j in range(w):
        result.append(func(i,j))
print(min(result))     


Measured memory_bytes: 5600
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
#define lson l,mid,p<<1
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
using namespace std;
const int inf=1e9+10;
const int mod=1e9+7;
const int maxn=1e5+10;
int a[3][3],n,b[111];
int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	for (int i = 0; i < 3; ++i)
	{
		for (int j = 0; j < 3; ++j)
		{
			cin>>a[i][j];
		}
	}
	cin>>n;
	for (int i = 0,x; i < n; ++i)
	{
		cin>>x;
		b[x]=1;
	}
	int flag=0;
	if(b[a[0][0]]&&b[a[1][1]]&&b[a[2][2]]) flag=1;
	if(b[a[2][0]]&&b[a[1][1]]&&b[a[0][2]]) flag=1;
	for (int i = 0; i < 3; ++i)
	{
		if(b[a[i][0]]&&b[a[i][1]]&&b[a[i][2]]) flag=1;
		if(b[a[0][i]]&&b[a[1][i]]&&b[a[2][i]]) flag=1;
	}
	if(flag) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
# 積が負で絶対値が T 以上の組合せ数を求める
# A, B は昇順
def count1(T, A, B):
	if T <= 0 or len(A) == 0 or len(B) == 0:
		return 0

	count, it = 0, -1
	for i in range(len(A) - 1, -1, -1):
		while it + 1 < len(B) and A[i] * B[it + 1] < T:
			it += 1

		# A[i] * B[it], A[i] * B[it + 1], ... は条件を満たす
		count += len(B) - it - 1
	return count


# 積が正で絶対値が T 以下の組合せ数を求める
# 絶対値が T より大きいものの組合せ数を求めてから全体から引く
# A は昇順
def count2(T, A):
	count_all = len(A) * (len(A) - 1) // 2
	count = count1(T + 1, A, A)

	# A[i] * A[i] が余計にカウントされた分を減らす．
	for e in A:
		if e * e >= T + 1:
			count -= 1

	count /= 2 # 同じ配列を渡しているため (i, j) == (j, i) が二回カウントされる

	return count_all - count


if __name__ == "__main__":
	N, K = map(int, input().split())
	A = list(map(int, input().split()))

	# X: 負の数の絶対値の配列
	# Y: 正の数の配列
	# Z: 0 の個数
	X, Y, Z = [], [], 0
	for e in A:
		if e < 0:
			X.append(-e)
		elif e > 0:
			Y.append(e)
		else:
			Z += 1
	X.sort()
	Y.sort()


	# 積が T 以下な組合せ数が K 未満か？
	def check(T):
		count = 0
		if T < 0:
			count += count1(abs(T), X, Y)
		else:
			count += len(X) * len(Y) # 結果が負
			count += Z * (Z - 1) // 2 + Z * (N - Z) # 結果が 0
			count += count2(T, X) + count2(T, Y)

		return count < K


	ok, ng = -10 ** 18, 10 ** 18
	while ng - ok > 1:
		mid = (ok + ng) // 2
		
		if check(mid):
			ok = mid
		else:
			ng = mid

	print(ok + 1)


Measured memory_bytes: 96852
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 競プロ_Csharp {
    class Program {
        static void Main(string[] args) {

            int n = NextInt();
            List<int> list = new List<int>();

            for (int i = 3; i <= n; i++) {

                if (i % 3 == 0 || i.ToString().Contains("3")) {
                    Print(" " + i);
                }

            }

            Println("");

        }

        public static void Print (Object o) {
            Console.Write(o);
        }

        public static void Println (Object o) {
            Console.WriteLine(o);
        }

        public static string NextString() {
            return Console.ReadLine();
        }

        public static string[] NextStrings () {
            return Console.ReadLine().Split();
        }

        public static int NextInt () {
            return int.Parse(Console.ReadLine());
        }

        public static int[] NextInts () {
            string[] a = Console.ReadLine().Split();
            int[] b = new int[a.Length];
            for (int i = 0; i < a.Length; i++) {
                b[i] = int.Parse(a[i]);
            }
            return b;
        }

        public static double NextDouble () {
            return double.Parse(Console.ReadLine());
        }

    }
}



Measured memory_bytes: 15940
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <climits>

using namespace std;
#define ll long long
#define ve vector
#define umap unordered_map

int main() {
    umap<char, int> mp;
    string s;cin>>s;
    for(char i:s) mp[i]++;
    umap<char,int>::iterator it=mp.begin();
    bool ans=1;
    while(it!=mp.end()) {
        if(it->second%2) ans=0;
        it++;
    }
    if(ans) cout<<"Yes\n";
    else cout<<"No\n";
}

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
//const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  string S;
  cin >> S;
  if(S[2] == S[3] && S[4] == S[5]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main ( )  {
	int n, k ;
	scanf ( "%d%d", & n, & k ) ;
	int x = 1 ;
	for ( int i = 1 ; i <= n ; ++ i )  {
		x = std :: min ( x << 1, x + k ) ;
	}
	printf ( "%d\n", x ) ;
	return 0 ;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
typedef unsigned long long ull;
using namespace std;

#define INF 0x7FFFFFFFFFFFFFFF

ull ABS(ull a,ull b)
{
  return a>b?a-b:b-a;
}

int main()
{
  ull i,N,a,b,c;
  cin >> N;
  vector<vector<ull>> dp;
  dp.resize(3);
  for(i=0;i<3;++i)
  {
    dp[i].resize(N);
    cin >> dp[i][0];
  }
  for(i=1;i<N;++i)
  {
    cin >> a >> b >> c;
    dp[0][i] = a + max(dp[1][i-1],dp[2][i-1]);
    dp[1][i] = b + max(dp[0][i-1],dp[2][i-1]);
    dp[2][i] = c + max(dp[0][i-1],dp[1][i-1]);
  }
  cout << max(max(dp[0][N-1],dp[1][N-1]),dp[2][N-1]);
  return 0;
}

Measured memory_bytes: 2688
h, w = gets.split.map(&:to_i)
s = []
for i in 0...h do
  s[i] = gets.chomp
end
for i in 0...h do
  for j in 0...w do
    if s[i][j] == "."
      count = 0
      if i-1 >= 0
        count += 1 if j-1 >= 0 && s[i-1][j-1] == "#"
        count += 1 if s[i-1][j] == "#"
        count += 1 if j+1 <= w-1 && s[i-1][j+1] == "#"
      end
      count += 1 if j-1 >= 0 && s[i][j-1] == "#"
      count += 1 if j+1 <= w-1 && s[i][j+1] == "#"
      if i+1 <= h-1
        count += 1 if j-1 >= 0 && s[i+1][j-1] == "#"
        count += 1 if s[i+1][j] == "#"
        count += 1 if j+1 <= w-1 && s[i+1][j+1] == "#"
      end
      s[i][j] = count.to_s
    end
  end
end
for i in 0...h do
  puts s[i]
end


Measured memory_bytes: 1788
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;


//ここから編集する
ll mod = 1000000007;


int main() {
    int N;
    int cnt[100001] = {};
    cin >> N;
    REP(i,0,N){
        int tmp;
        cin >> tmp;
        cnt[tmp]++;
    }
    int ans = 0;
    REP(i,1,100000){
        ans = max(ans,cnt[i-1] + cnt[i] + cnt[i+1]);
    }
    cout << ans << endl;


    return 0;

}


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

using namespace std;

#define MOD 1000000007
#define ll long long int
#define ld long double
#define pb push_back
#define mkp make_pair
#define pii pair<int, int> 
#define pll pair<long long int, long long int>
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%lld", &x)
#define fi first
#define sc second
#define deb 0

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

	string s;
	cin >> s;

	int i = s.size();
	if (!(i&1)) i--;
	i /= 2;

	for (; i > 0; --i) {
		if (i+i > s.size()) continue;
		string a = s.substr(0, i);
		string b = s.substr(i, i);
		if (a == b) {
			cout << i+i << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256