akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll H, W, K;
	cin >> H >> W >> K;
	ll dp[110][10];
	REP(i, 110)REP(j, 10) dp[i][j] = 0;

	dp[0][0] = 1;
	REP(i, H){
		REP(mask, 1<<(W-1)){
			bool flag = true;
			REP(j, W-2) if((mask>>j & 1) && (mask>>(j+1) & 1)) flag = false;
			if(!flag) continue;
			REP(j, W){
				if(j>0 && (mask>>(j-1) & 1)) dp[i+1][j] += dp[i][j-1];
				else if(j<W-1 && (mask>>j & 1)) dp[i+1][j] += dp[i][j+1];
				else dp[i+1][j] += dp[i][j];
				dp[i+1][j] %= mod;
			}
		}
	}
	cout << dp[H][K-1] << endl;
    return 0;
}

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

const ll MOD = 1000000007;


// 剰余の形での pow(x,n)
long long pow_(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x = x * x % MOD;
        n >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}

int main() {
  ll n;cin>>n;
  ll cnt;
  ll a,b,c;
  a = pow_(10, n);
  b = pow_(9, n);
  c = pow_(8, n);
  a %= MOD;
  b %= MOD;
  c %= MOD;
  cnt = (a - b + MOD) % MOD;
  cnt = (cnt - b + MOD) % MOD;
  cnt = (cnt + c) % MOD;
  /*cnt = pow(10, n) - pow(9, n) - pow(9, n) + pow(8, n);
  cnt = (cnt + MOD) % MOD;*/

  cout<<cnt;
}


Measured memory_bytes: 3628
#include <stdio.h>

int main(void)

{

  int a,b,c;

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

  if(a<b && b<c)

  {

    printf("Yes\n");

  }

  else

  {

    printf("No\n");

  }

  return 0;

}

Measured memory_bytes: 580
#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }

    int ans = 1;
    for (int i = 1; i < n; i++) {
        bool flag = 1;
        for (int j = 0; j < i; j++) {
            if (h[i] < h[j]) {
                flag = 0;
                break;
            }
        }
        if (flag) {
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
//olume0-0077
import java.util.*;

public class Main {

	public static void main(String[] args) {

		//declare
		String s;
		char[] ch;
		int    d;

		//input
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			
			//calculate
			s = "";
			ch = sc.nextLine().toCharArray();
			for(int i=0;i<ch.length;i++){
				if(ch[i] == '@'){
					i++;
					d = Character.digit(ch[i],10);
					i++;
					for(int j=0;j<d;j++){
						s += String.valueOf(ch[i]);
					}
				} else {
					s += String.valueOf(ch[i]);
				}
			}
			
			//output
			System.out.println(s);
		}
	}
}

Measured memory_bytes: 17164
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int a[40];
int main()
{
	int n,m,k,x;
	memset(a,0,sizeof(a));
	cin>>n>>m;
	rep(i,n){
		cin>>k;
		rep(j,k){
			cin>>x;x--;a[x]++;
		}
	}
	int out=0;
	rep(i,m){
		if(a[i]>=n) out++;
	}
	cout<<out<<endl;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    cout<<((n>999)?"ABD":"ABC");
    return 0;
}

Measured memory_bytes: 256
N, A, B, C = gets.split.map(&:to_i)
L = N.times.map{gets.to_i}

def dfs(n, a, b, c)
  if n == N then
    return 1e9 if [a, b, c].min == 0
    return (a - A).abs + (b - B).abs + (c - C).abs - 30
  end
  ret0 = dfs(n + 1, a, b, c)
  ret1 = dfs(n + 1, a + L[n], b, c) + 10
  ret2 = dfs(n + 1, a, b + L[n], c) + 10
  ret3 = dfs(n + 1, a, b, c + L[n]) + 10
  [ret0, ret1, ret2, ret3].min
end

puts dfs(0, 0, 0, 0)


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

int main() {

  int n, l;
  cin >> n >> l;
  int ans = 0;
  for(int i = 1; i < n+1; i++) {
    ans = ans + i + l - 1;
  }
  if(l >= 0) {
    ans = ans - (1 + l - 1);
    cout << ans << endl;
    return 0;
  } else if (l < 0) {
    if((l * -1) +1 >= n) {
      ans = ans - (n + l - 1);
      cout << ans << endl;
      return 0;
    } else {
      for(int i = 1; i < n; i++) {
        if((l * -1) +1 == i) {
          ans = ans - (i + l - 1);
          cout << ans << endl;
          return 0;
        }
      }
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <unordered_map>
#define int long long int
#define double long double
#define endl "\n"
#define PI 3.141592653589793238462643383279502884
#define sp(x)   setprecision(x)
#define ceil(a,b)   (a+(b-1))/b
#define LCM(a,b)    (a*b)/__gcd(a,b)
#define all(v)  v.begin(),v.end()
#define alls(s,v)  s.begin(),s.end(),v
#define gena(arr,n,nxt)  generate(arr,arr+n, nxt)
#define genv(v,nxt)  generate(v.begin(),v.end(), nxt)
#define base ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define exit return 0;
using namespace std;
const int N=1000000;
bool prime[N];
void sieve()
{
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<100000000; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<100000; i += p)
                prime[i] = false;
        }
    }
}
int power(int x, int y)
{
    int res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x*x;
    }
    return res;
}
int nxt()
{
    int x;
    cin >> x;
    return x;
}
int findTileCount(int x, int y, int l, int r)
{
    int lcm = (x * y) / __gcd(x, y);
    int countl = (l - 1) / lcm;
    int countr = r / lcm;
    return countr - countl;
}
int32_t main()
{
    base
    int n=nxt(),k=nxt();
    int d[k];
    gena(d,k,nxt);
    int a=n;
    int ans=n;
    int flag=0;
    while(1){
        flag=0;
        a=ans;
        while(a!=0){
            for(int i=0;i<k;i++){
                if(d[i]==a%10){
                    flag=1;
                    break;
                }
            }
            if(flag==1)break;
            a/=10;
        }
        if(flag==0)break;
        ans++;
    }
    cout<<ans<<endl;
    exit
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
	string S; cin >> S;
	if (S.back() == 's') cout << S + "es" << endl;
	else cout << S + "s" << endl;
 }


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

using namespace std;

int main()
{
	int N,i,temp;
	cin>>N;
	vector<int> A(N-1);
	vector<int> B(N);
	for(i=0 ; i<N-1 ; i++)
	{
		cin>>A[i];
	}
	for(i=0 ; i<N-1 ; i++)
	{
		temp=A[i]-1;
		B[temp]++;
	}
	for(i=0 ; i<N ; i++)
	{
		cout<<B[i]<<"\n";
	}
	return 0;
}

Measured memory_bytes: 4792
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]

point = [0] * N
for a in A :
    point[a-1] += 1
    
for i in range(N) :
    if K - Q + point[i] > 0 :
        print('Yes')
    else :
        print('No')

Measured memory_bytes: 56536
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  int a,b,t;
  cin>>a>>b>>t;
  cout << b*(t/a) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int N, Y;
	cin >> N >> Y;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N - i; j++) {
			int k = N - i - j;
			int total = 10000 * i + 5000 * j + 1000 * k;
			if (total == Y) {
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1" << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
dlist = [list(map(int,input().split())) for _ in range(n)]

cnt = 0
renzoku = 0
for d in dlist:
    if d[0] == d[1]:
        cnt+=1
        renzoku += 1
    else:
        renzoku = 0
        cnt = 0
    if cnt == 3 and renzoku == 3:
        print('Yes')
        break
else:
    print('No')

Measured memory_bytes: 9188
# coding:utf-8

import sys

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()


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


N, K = LI()
A = LI()
if max(A) < K:
    print('IMPOSSIBLE')
    exit()

g = A[0]
for a in A: g = gcd(g, a)

print('POSSIBLE' if K % g == 0 else 'IMPOSSIBLE')


Measured memory_bytes: 14040
#include <bits/stdc++.h>
using namespace std;
#define  f first
#define s second
#define ll long long int
#define vll vector<long long int>
#define vi  vector<int>
#define vpi vector<pair<int,int>>
#define prec fixed<<setprecision(10)
#define set(x) __builtin_popcount(x)
#define ffs(x) __builtin_ffs(x)
#define clz(x) __builtin_clz(x)
#define inf 1000000007
#define linf 1000000000000000007
#define a(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);

int main(){
    fast
    int n;
    cin >> n;
    set<string> s;
    string s1;
    for(int i=0;i<n;i++){
        cin >> s1;
        s.insert(s1);
    }
    cout << (int)s.size();
}

Measured memory_bytes: 19132
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   int n,a;
   cin >> n >> a;

   cout << n*n-a << endl;


   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define maxn 100005
#define ll long long

#define DEBUG
#ifdef DEBUG
#define debug(x) cout << #x << ": " << x << "  "
#else
#define debug(x) ;
#endif

int x, y, a, b, c;
int p[maxn], q[maxn], r[maxn];
vector<int> ans, co;

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

    cin >> x >> y >> a >> b >> c;
    for (int i = 0; i < a; i++) {
        cin >> p[i];
    }
    for (int i = 0; i < b; i++) {
        cin >> q[i];
    }
    for (int i = 0; i < c; i++) {
        cin >> r[i];
    }
    sort(p, p + a);
    sort(q, q + b);
    sort(r, r + c);
    for (int i = a - x; i < a; i++) {
        ans.push_back(p[i]);
    }
    for (int i = b - y; i < b; i++) {
        ans.push_back(q[i]);
    }
    sort(ans.begin(), ans.end());
    int ri = c - 1;
    for (int i = 0; i < ans.size(); i++) {
        if (ans[i] < r[ri]) {
            ans[i] = r[ri--];
        }
    }
    ll s = 0;
    for (int i = 0; i < ans.size(); i++) {
        s += ans[i];
    }
    cout << s;
    return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>  
using namespace std;
const int INF = 1 << 30;

int N, M, b, Exit, mask;
int v[1 << 15];
int ret;
void rec(int digit, int cnt){
  if(cnt >= ret) return;
  if((digit & mask) == (Exit & mask) || (digit & mask) == ((~Exit) & mask)){
    ret = min( ret, cnt);
    return;
  } else if(v[digit & mask] <= cnt){
    return;
  } else {
    v[digit] = cnt;
    const int prev = digit;
    for(int i = 0; i < N - 1; ++i){
      digit &= ~(3 << i);
      digit |= ((prev >> i) & 1) << (i + 1);
      digit |= ((prev >> (i + 1)) & 1) << i;
      rec( digit, cnt + 1);
      digit = prev;
    }
  }
}

int main(){
  fill_n( v, 1 << 15, INF);
  ret = INF;

  cin >> N >> M;
  mask = (1 << N) - 1;
  for(int i = 0; i < N; ++i){
    bool d;
    cin >> d;
    b |= d << (N - i - 1);
  }
  int cnt = 0;
  bool flip = false;
  for(int i = 0; i < M; ++i){
    int p;
    cin >> p;
    while(p--){
      Exit |= (int)flip << (N - cnt - 1);
      ++cnt;
    }
    flip ^= 1;
  }
  rec(b, 0);
  cout << ret << endl;
}

Measured memory_bytes: 1532
#include<iostream>

using namespace std;

int main() {
  int a, b, seki;
  cin >> a >> b;
  seki = a * b;
    
  if (seki % 2 == 0) {
      cout << "Even" << endl;
  }
  else {
      cout << "Odd" << endl;;
  }
}

Measured memory_bytes: 3100
n = gets.to_i
ans = STDIN.read.split("\n").reduce(0.0) do |acc,xu|
    x,u = xu.split
    case u
    when "JPY"
        acc += x.to_f
    when "BTC"
        acc += x.to_f * 380000.0
    end
    acc
end
puts ans


Measured memory_bytes: 1788
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
  int k, n;
  cin >> k >> n;
  vector<int> a(n);
  for (int& x : a) cin >> x;
  sort(a.begin(), a.end());
  vector<int> d(n);
  for (int i = 0; i < n - 1; i++) {
    d[i] = a[i + 1] - a[i];
  }
  d[n - 1] = a[0] + (k - a[n - 1]);
  sort(d.begin(), d.end());
  cout << k - d.back() << endl;
}

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

using namespace std;

int main () {
    int n, y;
    scanf("%d%d", &n, &y);
    for (int i = 0; i < n + 1; i++)
        for (int j = 0; j < n - i + 1; j++)
            if (i * 10000 + j * 5000 + (n - i - j) * 1000 == y) {
            	int coin = n - i - j;
            	printf("%d %d %d", i, j, coin);
            	return 0;
			}
    printf("-1 -1 -1");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    string S;
    cin >> S;
    if (S[0] == S[1] && S[1] == S[2]) {
        cout << "Yes" << endl;
    } else if (S[1] == S[2] && S[2] == S[3]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define _size(X) (int)((X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 200000;
int N;
ll a[MAX_N], b[MAX_N];
ll bitsum[30];

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

  cin >> N;
  rep(i, N) cin >> a[i];
  rep(i, N) cin >> b[i];
    
  vector<ll> vecA;
  vector<ll> vecB;
  for (int i = 0; i <= 29; ++i) {
      vecA.clear(); vecB.clear();
      ll m = 1l<<(i+1);
      for (int j = 0; j < N; ++j) {
          vecA.push_back(mod(a[j], m));
      }
      for (int j = 0; j < N; ++j) {
          vecB.push_back(mod(b[j], m));
      }
      sort(all(vecA));
      sort(all(vecB));
      for (int j = 0; j < N; ++j) {
          int tmp = lower_bound(all(vecB), (1l<<(i+1))-vecA[j]) - lower_bound(all(vecB), (1l<<i)-vecA[j]);
          tmp += lower_bound(all(vecB), (1l<<(i+2))-vecA[j]) - lower_bound(all(vecB), ((1l<<(i+1)) + (1l<<i))-vecA[j]);
          bitsum[i] += tmp;
      }
  }

  ll ans = 0;
  for (int i = 0; i <= 29; ++i) {
      ans += (bitsum[i]%2)<<i;
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 8048
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <numeric>
#include <functional>
#include <stack>

int main (){
	int a;

	std::cin >> a;

	std::cout << a * a << std::endl;
	return 0;
}

Measured memory_bytes: 256
mod = 10**9+7
from collections import defaultdict
N = int(input())
C = defaultdict(list)
dp = [1] * N
for i in range(N):
    col = int(input())
    dp[i] = dp[i-1]
    if not len(C[col]) == 0:
        if not C[col][-1] + 1 == i:
            dp[i] = (dp[C[col][-1]] +dp[i])%mod
    C[col].append(i)
print(dp[N-1])

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

int main() {
  int K;
  cin >> K;
  
  vector<int> vec;
  // 3個の入力を受け取れるように 3要素の配列 {0, 0, 0} で初期化
 vec = {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};
  cout << vec.at(K -1) << endl;
}   

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

int main()
{
    int n, ans=0;
    cin >> n;
    vector<ll> l(n);
    for(int i=0; i<n; ++i)cin >> l[i];
    for(int i=0; i<n; ++i){
        for(int j=i+1; j<n; ++j){
            for(int k=j+1; k<n; ++k){
                if(l[i] != l[j] && l[j] != l[k] && l[k] != l[i] && l[i] + l[j] > l[k] && l[j] + l[k] > l[i] && l[k] + l[i] > l[j]){
                    ++ans;
                }
            }
        }
    }
    cout << ans;
    return 0;
}


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

using namespace std;

int main(void)
{
	long long n, k;
	cin >> n >> k;
	long long a = n%k;
	while (1) {
		if (k%2 == 0 && a > k/2 && a < k)
			a = k-a;
		else if (k%2 == 1 && a >= k/2+1 && a < k)
			a = k-a;
		else
			break;
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;
    string s1;
    cin>>s1;
    int c = 0;
    for(int i=0;i<3;i++)
    {
        if(s1[i]=='7')
            c++;
    }
    if(c>0)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 3652
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in);
		int pasta[] =new int[3];
		int juice[] =new int[2];
		int sum=0,min=0;
		for(int i=0;i<5;i++){
			if(i<3){ //３個入れる。
			pasta[i] = sc.nextInt(); //
			}
			else{ //2個入れる。
				juice[i-3] = sc.nextInt(); //i-3にしてjuice[0]から数値を入れる。
			}
		}
		min = pasta[0]+juice[0];
		for(int i=0;i<3;i++){
			for(int j=0;j<2;j++){
				sum = pasta[i]+juice[j]; //合計を出す
				if(min > sum){  //最安値と比較
					min = sum; //最安値を更新
				}
			}
		}
		min -= 50; //50円引く
		System.out.println(min);
	}

}

Measured memory_bytes: 17228
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int ans=0;
    rep(i,3){
        if(s[i]==t[i])ans++;
    }
    cout<<ans<<endl;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin >> S;
    int n = S.size();
    for (int i = 0; i + 8 < n; ++i) cout << S[i];
    cout << endl;
    return 0;
}

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<ll, int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int d, n;
  n = 26;
  cin >> d;
  vi c(n);
  rep(i, n) cin >> c[i];
  vvi s(d, vi(n));
  rep(i, d) rep(j, n) cin >> s[i][j];
  vi l(n, -1);
  vector<vector<P>> g(d, vector<P>(n));
  vi ans(d);
  rep(i, d) {
    rep(j, n) {
      g[i][j].first = s[i][j];
      g[i][j].second = j;
      rep(k, n) {
        if (j != k) g[i][j].first -= (ll)c[k] * (i - l[k]);
      }
    }
    sort(g[i].rbegin(), g[i].rend());
    // dump(g[i]);
    int mi = g[i][0].second;
    l[mi] = i;
    ans[i] = mi;
  }
  auto score = [&] (vi& sel) {
    ll sc = 0;
    l.assign(n, -1);
    rep(i, d) {
      sc += s[i][sel[i]];
      l[sel[i]] = i;
      rep(k, n) sc -= (ll)c[k] * (i - l[k]);
    }
    return sc;
  };
  ll msc = score(ans);
  dump(msc);
  rep(k, 10) {
    rep(i, d) {
      int ix = i;
      for (int j = 1; j < n; j++) {
        vi sel = ans;
        sel[ix] = g[ix][j].second;
        ll ss = score(sel);
        // dump(i, ss, sel);
        if (msc < ss) {
          ans = sel;
          msc = ss;
        }
      }
    }
    dump(k, msc);
  }
  rep(i, d) {
    int j = ans[i];
    g[i][j].first = s[i][j];
    g[i][j].second = j;
    rep(k, n) {
      if (j != k) g[i][j].first -= (ll)c[k] * (i - l[k]);
    }
    sort(g[i].rbegin(), g[i].rend());
  }
  rep(k, 2) {
    rep(i, d) {
      int ix = i;
      for (int j = 1; j < n; j++) {
        vi sel = ans;
        sel[ix] = g[ix][j].second;
        ll ss = score(sel);
        // dump(i, ss, sel);
        if (msc < ss) {
          ans = sel;
          msc = ss;
        }
      }
    }
    dump(k, msc);
  }
  rep(i, d) {
    int j = ans[i];
    g[i][j].first = s[i][j];
    g[i][j].second = j;
    rep(k, n) {
      if (j != k) g[i][j].first -= (ll)c[k] * (i - l[k]);
    }
    sort(g[i].rbegin(), g[i].rend());
  }
  rep(k, 2) {
    rep(i, d) {
      int ix = i;
      for (int j = 1; j < n; j++) {
        vi sel = ans;
        sel[ix] = g[ix][j].second;
        ll ss = score(sel);
        // dump(i, ss, sel);
        if (msc < ss) {
          ans = sel;
          msc = ss;
        }
      }
    }
    dump(k, msc);
  }
  rep(i, d) cout << ans[i] + 1 << endl;
  dump(msc);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

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

int main()
{   long long  n,m;
   while(~scanf("%lld%lld",&n,&m))
   {
		    long long ans=0;
			if(m/2>=n)
			{ ans+=n;
			  m-=n*2;
			  ans+=m/4.0;
			}
			else {
				ans+=m/2.0;
			}
    	 printf("%lld\n",ans);
   }
	
	
	return 0;
}

Measured memory_bytes: 256
K, N = map(int, input().split())
houses = list(map(int, input().split()))
# syaku_houses = []
# for i, num in enumerate(houses):
#     if i == 0:
#         syaku_houses.append(num)
#     else:
#         syaku_houses.append(num - houses[i - 1])
# print(syaku_houses)

# min_costs = []
# for house in syaku_houses:

# 右回りか左回りか？
for i in range(N - 1):
    houses.append(K + houses[i])

min_costs = []
for i in range(N):
    min_costs.append(houses[N - 1 + i] - houses[i])
print(min(min_costs))


Measured memory_bytes: 92620
#define _LIBCPP_DEBUG 0
#include <bits/stdc++.h>
using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;
    if(s == t.erase(t.size() - 1))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int cnt=0;
    for(int i=0;i<6;i++)
    {
        if((s[2]==s[3])&&(s[4]==s[5]))
        {
            cnt=1;
        }
    }
    if(cnt==1)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;

}


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

int main(){
  vector<int> num(5);
  for(int x=0;x<5;x++){
    cin>>num[x];
  }
  int n;
  cin>>n;
    if(num[4]-num[0]>n){
      cout<<":("<<endl;
      return 0;
    }
  
  cout<<"Yay!"<<endl;
}

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

vector<int> v;

signed main(){

  int n,m; cin >> n >> m;
  for(int i = 1; i*i <= m; i++){
    if(m%i == 0){
      v.push_back(i);
      v.push_back(m/i);
    }
  }
  sort(v.begin(),v.end());
  v.erase( unique(v.begin(),v.end()),v.end() );
  cout << *(lower_bound(v.begin(),v.end(),m/n+1) - 1) << endl;

  return 0;
}


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

using namespace std;

string s, t;

int main() {
  cin >> s;
  t = "CODEFESTIVAL2016";
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}

void solve()
{
	int s, w;
	cin >> s >> w;
	if(w >= s) cout << "unsafe";
	else cout << "safe";
}


 // a b c a b c a b c a b c
 
int main()
{
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
    Red;
  	int T = 1;
  //	cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

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

int main(){
    int n,k;
    vector<long> h(200000);
    cin>>n>>k;
    if(n<=k){
        cout<<0<<endl;
        return 0;
    }
    for(int i=0;i<n;i++){
        cin>>h.at(i);
     
    }
    sort(h.begin(), h.end()); // {1, 2, 2, 5}
    reverse(h.begin(), h.end());
    for(int i=0;i<k;i++){
        h.at(i)=0;
    }
    long ans=0;
    for(int i=0;i<n;i++){
        ans+=h.at(i);
    }
    cout<<ans<<endl;

}


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

int a[212345];
int b[212345];
int c[412345];
int n,m,k;

int main(){
    ios_base::sync_with_stdio(0);
    //freopen("input.txt","r",stdin);

    cin>>n>>m>>k;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<m;i++) cin>>b[i];

    for(int i=0;i<n;i++)
    {
        c[n-i-1] = a[i];
    }
    for(int i=0;i<m;i++)
    {
        c[n+i] = b[i];
    }
    int res = 0;
    int cursum=0;
    int ind = -1;
    for(int s=0;s<=n;s++)
    {
        if(s>0) cursum -= c[s-1];
        while(ind+1<n+m&&cursum+c[ind+1]<=k)
        {
            cursum += c[ind+1];
            ind++;
        }
        if(s<=n&&ind>=n-1) res = max(res,ind-s+1);
    }
    cout<<res;
}


Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int x, y, a, b, c; cin >> x >> y >> a >> b >> c;
  vector<ll> red(a), green(b), col(c);
  for (ll& v: red) cin >> v;
  for (ll& v: green) cin >> v;
  for (ll& v: col) cin >> v;

  sort(red.rbegin(), red.rend());
  red.resize(x);
  sort(green.rbegin(), green.rend());
  green.resize(y);

  vector<ll> vals = red;
  for (ll v: green) vals.push_back(v);
  sort(vals.rbegin(), vals.rend());

  ll ans = 0;
  for (ll v: vals) ans += v;

  sort(col.rbegin(), col.rend());
  for (ll v: col) {
    if (vals.empty()) break;
    if (vals.back() >= v) break;
    ans -= vals.back();
    vals.pop_back();
    ans += v;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4032
use std::io::stdin;

fn main() {
    let mut a = String::new();
    let mut b = String::new();
    stdin().read_line(&mut a).unwrap();
    stdin().read_line(&mut b).unwrap();
    let a: Vec<isize> = a.trim().split_whitespace().flat_map(str::parse).collect();
    let b: Vec<isize> = b.trim().split_whitespace().flat_map(str::parse).collect();
    let (H, W) = (a[0], a[1]);
    let (h, w) = (b[0], b[1]);
    println!("{}", (H - h) * (W - w));
}


Measured memory_bytes: 4352
import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.LinkedList;
	import java.util.List;
	import java.util.Stack;
	 
	public class Main {
	    public static void main(String[] args) {
	        List<String> inputDataList = new LinkedList<String>();
	        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	        String input = null;
	        try {
	            while ((input = in.readLine()) != null) {
	                inputDataList.add(input);
	            }
	        } catch (IOException e) {
	            e.printStackTrace();
	        } finally {
	            try {
	                in.close();
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	        }
	 
	        for (String inputData : inputDataList) {
	            double result = cast(inputData.split(" "));
	            System.out.println(result);
	        }
	    }
	    private static double cast(String[] formula) {
	 
	        Stack<Double> stack = new Stack<Double>();
	        double num1;
	        double num2; 
	        for (String data : formula) {
	
	            if ("+".equals(data)) { 
	                num2 = stack.pop().doubleValue();
	                num1 = stack.pop().doubleValue();
	                stack.push(new Double(num1 + num2));
	            } else if ("-".equals(data)) {
	                num2 = stack.pop().doubleValue();
	                num1 = stack.pop().doubleValue();
	                stack.push(new Double(num1 - num2));
	            } else if ("*".equals(data)) {
	                num2 = stack.pop().doubleValue();
	                num1 = stack.pop().doubleValue();
	                stack.push(new Double(num1 * num2));
	            } else if ("/".equals(data)) {
	                num2 = stack.pop().doubleValue();
	                num1 = stack.pop().doubleValue();
	                stack.push(new Double(num1 / num2));
	 
	            } else {
	 
	                stack.push(Double.parseDouble(data));
	 
	            }
	        }
	 
	        return stack.pop().doubleValue();
	    }
	}

Measured memory_bytes: 24196
my $s = <STDIN>;
chomp $s;
my ($a, $b) = split ' ', $s;

my $amin = $a * 100 / 8;
if ($amin != int($amin)) {
    $amin = int($amin + 1);
}
my $amax = ($a + 1) * 100 / 8;
if ($amax == int($amax)) {
    $amax--;
}
else {
    $amax = int($amax);
}

my $bmin = $b * 10;
if ($bmin != int($bmin)) {
    $bmin = int ($bmin + 1);
}
my $bmax = ($b + 1) * 10;
if ($bmax == int($bmax)) {
    $bmax--;
}
else {
    $bmax = int($bmax);
}

my $min = ($amin > $bmin) ? $amin : $bmin;
my $max = ($amax < $bmax) ? $amax : $bmax;

if ($min <= $max) {
    print "$min\n";
}
else {
    print "-1\n";
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
const ll mod = 1e9+7;
#define rep(i,a,b) for(ll i=a;i<b;i++)

void swap(ll &a , ll &b){
    ll t = a;
    a = b;
    b = t;
}

ll min(ll a, ll b){
    if(a<b)return a;
    return b;
}

ll max(ll a, ll b){
    if(a>b)return a;
    return b;
}

 ll pow(ll a, ll b) {
    a %= mod;
    ll ans = 1;
    while (b > 0) {
        if (b & 1)
            ans = ans * a % mod;
        a = a * a % mod;
        b /= 2;
    }
    return ans;
}


int main(){

//   #ifndef ONLINE_JUDGE
//      freopen("input.txt", "r", stdin);
//   #endif
   ios_base :: sync_with_stdio(0);
   cin.tie(0);
   /// 1 2 3 4  ....
   ll n;
   cin>>n;
   ll a[n];
   rep(i ,0 , n){
    cin>>a[i];
   }
    vector<ll> dp( n , INT_MAX);
   dp[0] = 0;

   for(int i = 0;i<n;i++){
        if(i+1 <n)
            dp[i+1] = min(dp[i+1] , abs(a[i+1]-a[i])+dp[i]);
        if(i+2 < n)
            dp[i+2] = min(dp[i+2] , abs(a[i+2]-a[i])+dp[i]);
   }
   cout<<dp[n-1];





}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
 vector<vector<int>> to(4);
 vector<bool> visited(4,false);
 vector<int>vec(4); for(int i = 0; i < 4; i++){ vec[i] = i;}
 
  for(int i = 0; i < 3; i++){
    int a,b; cin >> a >> b; a--; b--; 
    to[a].push_back(b); to[b].push_back(a);}
    
  
  do{
    for(int i = 0; i < 4; i++){ visited[i] = false;}
    
    //vec[0]↪︎...↪︎vec[3]の順にたどり着けるかを調べる
    visited[vec[0]] = true;
    bool f = true;
    for(int j = 0; j <= 2; j++){
      bool flag = false;
    for(int i = 0; i < (int)to[vec[j]].size(); i++){
      if(to[vec[j]][i] == vec[j+1]){ visited[vec[j+1]] = true; flag = true;
          if( j == 2){ cout << "YES" << endl; return 0;}}}
      if(!flag){ f = false; break;} }
    
    if(!f){ continue;}
    
        
    
  }while(next_permutation(vec.begin(),vec.end()));
         
   cout << "NO" << endl; return 0;}
    

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

int main(){
    ll N, A[100010];
    cin >> N;
    for (int i = 0; i < N; ++i){
        cin >> A[i];
    }
    
    ll minus = 0, m = 1e9, sum = 0;
    for (int i = 0; i < N; ++i){
        if (A[i] < 0) minus++;
        m = min(m, abs(A[i]));
        sum += abs(A[i]);
    }
    if (minus % 2 == 1){
        sum -= m * 2;
    }
    cout << sum << endl;
}


Measured memory_bytes: 1024
n,a,b,c,d=map(int,input().split())
s=input()
if c<d:
  if '##' in s[a-1:d]:
    print('No')
  else:
    print('Yes')
else:
  if '##' in s[a-1:c] or '...' not in s[b-2:d+1]:
    print('No')
  else:
    print('Yes')
  


Measured memory_bytes: 3572
n = gets.to_i
t,a = gets.split.map(&:to_i)
h = gets.split.map(&:to_i)
result = 0
zantei = 1000000
n.times do |i|
  if zantei > (a - (t-h[i]*0.006)).abs
    zantei = (a - (t-h[i]*0.006)).abs 
    result = i
  end
end
puts result + 1


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

#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/2;
const ll MOD = 1e9+7;
const double EPS=1e-12;

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N,M;cin>>N>>M;
  vll g[3*N];
  for(ll i=0;i<M;i++){
    ll u,v;cin>>u>>v;u--;v--;
    for(ll j=0;j<3;j++){
      g[u*3+j].push_back(v*3+(j+1)%3);
    }
  }
  ll S,T;cin>>S>>T;S--;T--;
  bool used[3*N]={};
  queue<pair<ll,ll>> Q;
  Q.push({0,3*S});
  ll ans=-1;
  while(!Q.empty()){
    ll c,v;tie(c,v)=Q.front();Q.pop();
    if(used[v])continue;
    used[v]=true;
    if(v==3*T){
      ans=c/3;
      break;
    }
    for(ll u:g[v]){
      Q.push({c+1,u});
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 17024
import sys
input = sys.stdin.readline

from collections import deque

class Factorial:
    def __init__(self, n, mod):
        self.f = [1]
        self.mod = mod
        for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
        self.i = [pow(self.f[-1], mod - 2, mod)]
        for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
        self.i.reverse()
    def factorial(self, j):
        return self.f[j]
    def ifactorial(self, j):
        return self.i[j]
    def comb(self, n, k):
        return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0


MOD = 10 ** 9 + 7


N = int(input())

c = Factorial(N + 2, MOD)

G = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    G[a].append(b)
    G[b].append(a)

edge_num = [len(G[i]) for i in range(N + 1)]

que = deque()
check = [0] * (N + 1)
order = []
o_append =order.append
q_pop = que.pop
q_append = que.append

q_append((1, 0))
check[1] = 1
while que:
    now = q_pop()
    o_append(now)
    for next_ in G[now[0]]:
        if check[next_] == 0:
            q_append((next_, now[0]))
            check[next_] = 1

# print (order)

size1 = [0] * (N + 1) #自身を頂点とする部分木のサイズ、木の根は頂点0
dp1 = [1] * (N + 1)
for child, parent in order[::-1]:
    dp1[child] *= c.factorial(size1[child])
    dp1[child] %= MOD
    s = size1[child] + 1
    size1[parent] += s
    dp1[parent] *= c.ifactorial(s) * dp1[child]
    dp1[parent] %= MOD

# print (size1)
# print (dp1)

size2 = [N - 2 - x for x in size1]
dp2 = [1] * (N + 1)

# print (size1)
# print (size2)
for child, parent in order[1:]:
    x = dp1[parent]
    x *= dp2[parent]
    x *= c.ifactorial(size1[parent])
    x *= c.factorial(size1[child] + 1)
    x *= pow(dp1[child], MOD - 2, MOD) #割り算
    x *= c.factorial(size2[child])
    x *= c.ifactorial(size2[parent] + 1)
    dp2[child] = x % MOD

# print (dp2)

for x1, x2, s1, s2 in zip(dp1[1:], dp2[1:], size1[1:], size2[1:]):
    s2 += 1
    x = x1 * x2 * c.factorial(s1 + s2) * c.ifactorial(s1) * c.ifactorial(s2) % MOD
    print (x)

Measured memory_bytes: 103748
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))

max_x=max(x)
min_y=min(y)

for z in range(X+1,Y+1):
    if max_x<z and z<=min_y:
        print("No War")
        exit()

print("War")


Measured memory_bytes: 3060
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef long double lb;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)

int main() {
    string A,B;
    cin >> A >> B;
    if(A == B){
        cout << "EQUAL" << endl;
        return 0;
    }

    if(A.size() > B.size()){
        cout << "GREATER" << endl;
    }else if(A.size() < B.size()){
        cout << "LESS" << endl;
    }else{
        rep(i,A.size()){
            if(A[i] == B[i]){
                continue;
            }else if(A[i] > B[i]){
                cout << "GREATER" << endl;
                return 0;
            }else if(A[i] < B[i]){
                cout << "LESS" << endl;
                return 0;
            }
        }
    }


}



Measured memory_bytes: 3580
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
#include <iomanip>
using namespace std;

int main(){
  int N ;
  cin >> N ;
  int Stu[N+1], rank[N+1] ;
  for(int i=0;i<N;i++){
    cin >> Stu[i+1] ;
    rank[Stu[i+1]] = i+1 ;
  }
  for(int i=0;i<N;i++){
    cout << rank[i+1] << " " ;
  }
  cout << endl ;
  return 0 ;
}  

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define ROF(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define REP(i, n) FOR(i, 0, (n)-1)
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define reset(x, y) memset(x, y, sizeof(x))
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define BUG(x) cerr << #x << " = " << (x) << endl
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define _1 first
#define _2 second
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)

int main() {
  string s, t;
  int n;
  cin >> n >> s >> t;
  REP(i, n) cout << s[i] << t[i];
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long 
#define M 1000000007
#define P pair<int,int>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) FOR(i,0,n)
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

int n;
int x;

int main(){

  cin>>n>>x;
  if(x==1||x==2*n-1){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
    vector<int> ans(2*n-1);
    rep(i,2*n-1){
      ans[(n+i-1)%(2*n-1)]=(x+i-1)%(2*n-1)+1;
    }
    rep(i,2*n-1){
      cout<<ans[i]<<endl;
    }
  }


  return 0;
}



Measured memory_bytes: 2304
a=[]
n,*b=map(int,open(0).read().split())
a.append(b[0])
a.append(b[0])
for i in range(1,n-1):
  if a[-1]>b[i]:
    a[-1]=b[i]
    a.append(b[i])
  else:
    a.append(b[i])
print(sum(a)) 

Measured memory_bytes: 3060
import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;

void main(){

    while(true){
	int n = readln().chomp().to!int;
	if(n==0) break;
	int ans = 100000000;
	for(int i=0;i<=25;i++){
	    for(int j=0;j<=17;j++){
		for(int k=0;k<=10;k++){
		    if((200*i+300*j+500*k)==n){
			double p1,p2,p3;
			p1 = 380 * 5 * (i/5) * 0.8 + 380 * (i % 5);
			p2 = 550 * 4 * (j/4) * 0.85 + 550 * (j % 4);
			p3 = 850 * 3 * (k/3) * 0.88 +  850 * (k % 3);
			ans = min(ans , to!int(p1+p2+p3));
		    }
		}
	    }
	}
	writeln(ans);
    }
}

Measured memory_bytes: 2380
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N; cin >> N;
    vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        A[i] *= 2;
    }
    
    long long sum = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2) {
            sum -= A[i];
        } else {
            sum += A[i];
        }
    }
    vector<long long> ans(N);
    ans[0] = sum/2;
    for (int i = 1; i < N; i++) {
        ans[i] = A[i-1] - ans[i-1];
    }
    
    for (int i = 0; i < N; i++) {
        cout << ans[i] << " ";
    }
    cout << endl;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll a,b,c;cin >>a>>b>>c;
    bool flg=true;
    ll d=c-a-b;if(d<0)flg=false;
    if(4*a*b>=d*d)flg=false;
    if(flg)puts("Yes");
    else puts("No");
    return 0;
}


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

namespace{
 
  bool isSosu(int x)
  {
    if( x == 1 ) return false;
    if( x == 2 ) return true;
    if( x == 3 ) return true;
    if( x % 2 == 0 ) return false;
    if( x % 3 == 0 ) return false;
	
    for(int i = 3; i < x/2 + 1; i+=2)      
    {
      if(x % i==0)
      {
        return false;
      }
    }
	return true;    
  }
  
}

int main( void )
{
	int X;
  std::cin >> X;
  
    while(true)
    {
      //std::cout << X << " " << (isSosu(X) ? "true" : "false") << std::endl;

      if(isSosu(X)){
	  	std::cout << X << std::endl;
        break;
      }
      else
      {
        X++;
      }
    }

	return 0;
}


Measured memory_bytes: 384
A,B,C,D,E,F = map(int,input().split())

conc = 0
total = 0

ans = [100 * A,0]

for a in range(0,31):
  for b in range(0,31):
    water = (A * a + B * b) * 100
    if water > F:
      break
    else:
      for c in range(3001):
        water = (A * a + B * b) * 100
        if water == 0:
          break
        #探索中の水量に解かせる砂糖の量
        sugar_limit = int(water * E / 100)
        #操作Cで投入された砂糖の量
        sugarC = c * C
        
        if sugarC > sugar_limit:
          break
        #ビーカーに溶かせる容量
        else:
          rest = F - water - sugarC
          #水に溶かせられる砂糖量
          sugar_rest = sugar_limit - sugarC
          
          if rest < 0:
            break
          
          else:
            #操作Dで溶かせられる砂糖領
            sugarD = (min(rest,sugar_rest) // D) * D
            sugar = sugarC + sugarD
            temp = (sugar) / (water + sugar)
            if conc < temp and temp < E:
              conc = temp
              total = water + sugar
              ans = [total,sugar]
        
print(ans[0],ans[1])



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

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

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	unsigned short row;            	/* 行数格納用変数 */
	unsigned short col;            	/* 列数格納用変数 */
	unsigned long sheet[101][101];	/* 表格納用配列 */
	unsigned short i,j;            	/* ループ変数 */
	
	/* 配列の初期化 */
	for(i = 0;i < 101;i++){
		for(j = 0;j < 101;j++){
			sheet[i][j] = 0;
		}
	}
	
	/* 行数、列数の入力 */
	scanf("%d %d", &row, &col);
	
	/* 表の要素の入力 */
	for(i =0;i < row;i++){
		for(j = 0;j < col;j++){
			/* i行j列の要素の入力 */
			scanf("%ld", &sheet[i][j]);
		}
	}
	
	/* 各行の要素の合計の計算 */
	for(i =0;i < row;i++){
		for(j = 0;j < col;j++){
			/* i行j列の要素をi行末端に加算 */
			sheet[i][col] += sheet[i][j];
		}
	}
	
	/* 各列の要素の合計の計算 */
	for(i =0;i < row;i++){
		for(j = 0;j < col;j++){
			/* i行j列の要素をj列末端に加算 */
			sheet[row][j] += sheet[i][j];
		}
	}
	
	/* 全要素の合計の計算 */
	for(i = 0;i < row;i++){
		/* 各行の合計を表の末端に加算 */
		sheet[row][col] += sheet[i][col];
	}
	
	/* 表を出力 */
	for(i =0;i <= row;i++){
		for(j = 0;j < col;j++){
			/* i行j列の要素の出力 */
			printf("%ld ", sheet[i][j]);
		}
		/* 末列の出力 */
		printf("%ld\n", sheet[i][col]);
	}
	return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;

const int MAX_M=50;
int n,m,a[MAX_M],b[MAX_M],list[MAX_M];

int main(){
	for(int i=0;i<MAX_M;i++){
		list[i]=0;
	}
	cin >> n >> m;
	for(int i=0;i<m;i++){
		cin >> a[i] >> b[i];
		list[a[i]-1]+=1;
		if(a[i]-b[i]){
			list[b[i]-1]+=1;
		}
	}
	for(int i=0;i<n;i++){
		cout << list[i] << endl;
	}	
	return 0;
}


Measured memory_bytes: 256