akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	const long MOD = 1E9+7;
    int N; cin >> N;
    vector<int> T(N), A(N); bool flg=false; long long ans=1;
    for(int i=0;i<N;i++) cin >> T[i];
    for(int i=0;i<N;i++) cin >> A[i];
    if(T[N-1]!=A[0]) flg = true;
    else{
    	vector<int> a(N);
    	for(int i=1;i<N-1;i++){
    		if(T[i]==T[i-1] && A[i]==A[i+1]){
    			a[i]=min(T[i], A[i]);
    		}
    		if(T[i]!=T[i-1] && A[i]!=A[i+1]){
    			if(T[i]==A[i]) a[i]=1;
    			else flg=true;
    		}
    		if(T[i]!=T[i-1] && A[i]==A[i+1]){
    			if(T[i]<=A[i]) a[i]=1;
    			else flg=true;
    		}
    		if(T[i]==T[i-1] && A[i]!=A[i+1]){
    			if(T[i]>=A[i]) a[i]=1;
    			else flg=true;
    		}
    		ans = ans*a[i]%MOD;
    	}
    }
    if(flg) cout << 0 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<functional>
using namespace std;
long long gcd(long long a, long long b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
long long n, p = 1, q;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> q;
		long long r = q / gcd(p, q);
		p *= r;
	}
	cout << p << endl;
	return 0;
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string s, t;
  cin >> s >> t;
  int ns = (int)s.size(), nt = (int)t.size(), mn = nt;
  for (int i = 0; i <= ns - nt; i++) {
    int c = 0;
    for (int j = 0; j < nt; j++) {
      if (s[i + j] != t[j]) {
        c++;
      }
    }
    mn = min(mn, c);
  }
  cout << mn << '\n';
  return 0;
}

Measured memory_bytes: 3520
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define Ma7moud_7amdy                 \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define Open_Sesame Open()
#define all(v) ((v).begin()), ((v).end())
#define allr(v) ((v).rbegin()), ((v).rend())
#define clr(arr, x) memset(arr, x, sizeof arr)
#define endl "\n"
#define Accepted 0
#define watch(x) cout << #x << " = " << x << endl;
#define RT(x) return cout << (x), 0;
#define sc(a) scanf("%d", &a)
#define pr(a) printf("%d", a)
#define scll(x) scanf("%I64d", &x)
#define prll(x) printf("%I64d", x)
#define scan(s) scanf("%[^\n]%*c", &s)
#define print(s) printf("%s", s.c_str()); // print string
#define sz(v) v.size()
typedef long long ll;
typedef vector<int> vi;
const int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const int Mx = INT_MAX;
const int Mn = INT_MIN;
const ll MX = LLONG_MAX;
const ll MN = LLONG_MIN;
const double PI = acos(-1.0);
void Open()
{
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
#endif
}
const double EPS = -1e-2;
const ll mod = ll(1e9 + 7);
const int N = 2000 + 5;

//“Nobody but you have to believe in your dreams to make them a reality.” ― Germany Kent

int arr[N][N],frq[N];
int main() {

	Ma7moud_7amdy;
	//Open_Sesame;
	int n,x, y;
	cin >> n >> x >>y;
	if (x > y)swap(x, y);
	for (int i = 1; i <= n; i++)
	{
		for (int j = i + 1; j <= n; j++)
		{
			arr[i][j] = min(j - i, abs(i - x) + abs(j - y) + 1);
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = i+1; j <= n; j++) {
			frq[arr[i][j]]++;
		}
	}
	for (int i = 1; i < n; i++)cout << frq[i] << endl;

}

Measured memory_bytes: 15360
///created: 4/Jul/2019 18:18:11

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
const int modulo = 1e9 + 7;

#ifdef LOCAL_DEBUG_NTV1612
template<class __Ty>
string to_string(__Ty a) {
	string res = "[ ";
	bool f = true;
	for (auto &p : a) { res += (f ? string("") : string(", ")) + to_string(p); f = false;	}
	return res + " ]";
}
void _debug() { fprintf(stderr, "\n"); }
template<typename __Ty_head, typename... __Ty_tail>
void _debug(__Ty_head head, __Ty_tail... tail) { fprintf(stderr, "%s ", to_string(head).c_str()); _debug(tail...); }
#define debug(...) fprintf(stderr, "DEBUG [%s]: ", #__VA_ARGS__), _debug(__VA_ARGS__)
#else
#define debug(...) 0
#endif

template<class __Ty> bool mini(__Ty& a, __Ty b) { return a > b ? ((a = b) | 1) : (0); }
template<class __Ty> bool maxi(__Ty& a, __Ty b) { return a < b ? ((a = b) | 1) : (0); }
template<class __Ty> __Ty add(__Ty a, __Ty b) { return (a + b) % (__Ty(modulo)); }
template<class __Ty> __Ty sub(__Ty a, __Ty b) { __Ty m(modulo); return ((a - b) % m + m) % m; }

int a[501][501], h, w, sum = 0;
bool vs[601][601] = {0};
vector<ii> ans[2];

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> h >> w;
	for (int i = 1; i <= h; ++i)
		for (int j = 1; j <= w; ++j)
			cin >> a[i][j];
	for (int i = 1; i <= h; ++i) {
		for (int j = 1; j < w; ++j) {
			if (a[i][j] % 2 != 0) {
				ans[0].push_back(ii(i, j));
				ans[1].push_back(ii(i, j + 1));
				a[i][j]--;
				a[i][j + 1]++;
			}
		}
		if (i < h && a[i][w] % 2 != 0) {
			a[i][w]--;
			a[i + 1][w]++;
			ans[0].push_back(ii(i, w));
			ans[1].push_back(ii(i + 1, w));
		}
	}
	cout << ans[0].size() << '\n';
	for (int i = 0; i < int(ans[0].size()); ++i) {
		for (int j = 0; j < 2; ++j) {
			if (j == 0) {
				assert(!vs[ans[j][i].first][ans[j][i].second]);
				vs[ans[j][i].first][ans[j][i].second] = true;
			}
			assert(1 <= ans[j][i].first && ans[j][i].first <= h);
			assert(1 <= ans[j][i].second && ans[j][i].second <= w);
			cout << ans[j][i].first << ' ' << ans[j][i].second << (j == 1 ? '\n' : ' ');
		}
	}
	int cnt = 0;
	for (int i = 1; i <= h; ++i)
		for (int j =1; j <= w; ++j)
			cnt += a[i][j] % 2;
	assert(cnt <= 1);	
	return 0;
}


Measured memory_bytes: 5612
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31))

//セグ木ここから
//*
//↓ここを変える
typedef struct atai{ll a;}atai;
atai xx(atai x,atai y){
	atai r;
	r.a=max(x.a,y.a);
	return r;
}
atai aid={0};
//↑ここを変える

int segNUM;
atai *segN,*seg;
void seguse(int n){
	segN=(atai*)calloc(2*n,sizeof(atai));
	segNUM=n;
	seg=segN+segNUM;
	rep(i,1,2*segNUM)segN[i]=aid;
}
//seg[]に値を与えてから初期化
void seginit(){for(int node=segNUM-1;node;node--)segN[node]=xx(segN[node*2],segN[node*2+1]);}
void segupdate(int node,atai x){
	//seg[node]をxに更新
	node+=segNUM;
	segN[node]=x;
	while(node/=2)segN[node]=xx(segN[node*2],segN[node*2+1]);
}

atai segcalcsub(int l,int r,int k,int cl,int cr){
	if(l>=r)return aid;
	//完全に含むとき
	if(l<=cl&&cr<=r)return segN[k];

	int cm=(cl+cr)/2;
	//左側だけ
	if(r<=cm)return segcalcsub(l,r,2*k  ,cl,cm);
	//右側だけ
	if(cm<=l)return segcalcsub(l,r,2*k+1,cm,cr);
	//両方
	return xx(segcalcsub(l,r,2*k,cl,cm),segcalcsub(l,r,2*k+1,cm,cr));
}
atai segcalc(int l,int r){return segcalcsub(l,r,1,0,segNUM);}
//セグ木ここまで
//*/

int n,q;
int bs(int L,int v){
	//f([L,r))>=vなる最小のr-1
	int l=L,r=n+2;//lはng,rはok
	while(r-l>1){
		int m=(l+r)/2;
		if(segcalc(L,m).a>=v)r=m;
		else l=m;
	}
	return r-1;
}

int main(){
	seguse(1<<18);
	scanf("%d%d",&n,&q);
	rep(i,1,n+1){
		int t;
		scanf("%d",&t);
		seg[i].a=t;
	}
	seg[n+1].a=INF;
	seginit();
	while(q--){
		int t;
		scanf("%d",&t);
		if(t==1){
			int i,v;
			scanf("%d%d",&i,&v);
			atai xx={v};
			segupdate(i,xx);
		}else if(t==2){
			int l,r;
			scanf("%d%d",&l,&r);
			printf("%lld\n",segcalc(l,r+1).a);
		}else{
			int l,v;
			scanf("%d%d",&l,&v);
			printf("%d\n",bs(l,v));
		}
	}
}

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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int x = Integer.parseInt(str[1]);
    int[] m = new int[n];
    int sum = 0;
    int min = 1000;
    for(int i=0; i<n; i++) {
      m[i] = Integer.parseInt(in.readLine());
      sum += m[i];
      min = Math.min(min,m[i]);
    }
    System.out.println(n+((x-sum)/min));
  }
}

Measured memory_bytes: 32696
N, P = list(map(int, input().split(" ")))
A = list(map(int, input().split(" ")))

odd_flag = False
for a in A:
    if a % 2 == 1:
        odd_flag = True
        break
        
if odd_flag == True:
    print(2**(N-1))
elif((odd_flag == False) and (P == 0)):
    print(2**N)
else:
    print(0)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define double long double
#define int long long
#define mii map<int,int>
#define pii pair<int,int>
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf (int)50000000000 //5･10^10
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
int fact(int x) {
  if(x==0) return 1;
  return x*fact(x-1)%mod;
}
signed main() {
  int a,b;
  cin>>a>>b;
  if(1<abs(a-b)) {
    cout<<0<<endl;
  }
  else {
    if(a-b==0) {
      cout<<2*fact(a)*fact(b)%mod<<endl;
    }
    else {
      cout<<fact(a)*fact(b)%mod<<endl;
    }
  }
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;
using static Atcoder.IO;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                Out.Flush();
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var h = RInt;
            var w = RInt;
            var n = RInt;

            var ans = n / Max(h, w);
            if (n % Max(h, w) != 0) ans++;
            WriteLine(ans);
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 27124
#include <stdio.h>

#define Mod 998244353

long long div_mod(long long x, long long y, long long z)
{
	if (x % y == 0) return x / y;
	else return (div_mod((1 + x / y) * y - x, (z % y), y) * z + x) / y;
}

int main()
{
	int i, N, S, A[3001];
	scanf("%d %d", &N, &S);
	for (i = 1; i <= N; i++) scanf("%d", &(A[i]));
	
	int j;
	long long pow[3001], pow_inv[3001], dp[2][3001];
	for (i = 1, pow[0] = 1; i <= N; i++) pow[i] = pow[i-1] * 2 % Mod;
	for (i = N - 1, pow_inv[N] = div_mod(1, pow[N], Mod); i >= 0; i--) pow_inv[i] = pow_inv[i+1] * 2 % Mod;
	for (i = 1, dp[0][0] = 1; i <= N; i++) {
		for (j = 0; j <= S; j++) dp[i%2][j] = dp[1-i%2][j];
		for (j = S - A[i]; j >= 0; j--) dp[i%2][j+A[i]] = (dp[i%2][j+A[i]] + dp[1-i%2][j] * pow_inv[1]) % Mod;
	}
	printf("%lld\n", dp[1-i%2][S] * pow[N] % Mod);
	fflush(stdout);
	return 0;
}

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

int main() {
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        if(i <= k) ans += x;
        else ans += y;
    }
    cout << ans << endl;
}


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

using namespace std;

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

  if(K % 2 == 1){
    cout << (K/2)*(K/2+1) << endl;
  }else{
    cout << (K/2)*(K/2) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(){

    int brpBanyak;
    scanf("%d", &brpBanyak);
    char arrKata[brpBanyak+1];
    char kataPertama[100];
    char kataKedua[100];
    scanf("%s", arrKata);
    if(brpBanyak%2==0){
/*        for(int i=0;i<(brpBanyak/2);i++){
            kataPertama[i]=arrKata[i];
        }
        printf("dan ini kata pertama %s\n", kataPertama);
        int pasangan=(brpBanyak/2);
        for(int j=0;j<(brpBanyak/2);j++){
            kataKedua[j]=arrKata[pasangan];
            printf("ini bawah ke %d\n", j);
            pasangan++;
        }
        printf("dan ini kata kedua %s\n", kataKedua);
        if (strcmp(kataPertama, kataKedua)==0){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }
    }
    else{
        printf("No\n");
    }
*/  int j=0;
    int flag=0;
    for(int i=(brpBanyak/2);i<brpBanyak;i++){
        if(arrKata[i]!=arrKata[j]){
            printf("No\n");
            flag++;
            break;
        }
        j++;
    }
    if(flag==0){
    printf("Yes\n");
    }
    }
    else{
        printf("No\n");
    }


    return 0;   
}

Measured memory_bytes: 1628
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
 
int main()
{
    long long int x, y, z, ans = 0;

    std::cin >> x >> y >> z;

    x -= z;
    while(x >= y + z){
        x -= y + z;
        ans++;
    }

    std::cout << ans;

    return 0;
}

Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

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

        Queue<int[]> q = new LinkedList<>();
        int[][] adj = {{-1,0},{0,-1},{0,1},{1,0}};

        char[][] m = new char[H][W];
        int[][] dist = new int[H][W];

        for (int i = 0; i < H; i++) {
            String s = sc.next();
            for (int j = 0; j < W; j++) {
                dist[i][j]=-1;//infinity
                m[i][j] = s.charAt(j);
                if(m[i][j]=='#'){
                    int[] cord = {i,j};
                    q.add(cord);
                    dist[i][j]=0;
                }
            }
        }
        int maxDis = 0;

        while(!q.isEmpty()){
            int[] t = q.poll();
            int i= t[0];
            int j= t[1];
            int d = dist[i][j];

            for (int k = 0; k < adj.length; k++) {
                int ni=i+adj[k][0];
                int nj=j+adj[k][1];
                if(ni >=0 && ni< H && nj>=0 && nj<W &&  dist[ni][nj] == -1 ){
                    q.add(new int[]{ni,nj});
                    dist[ni][nj] = d+1;
                    maxDis = Math.max(maxDis,dist[ni][nj]);
                }
            }
        }
        System.out.println(maxDis);
    }
}


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

int main() {
	int N, K, X, Y;
	cin >> N;
	cin >> K;
	cin >> X;
	cin >> Y;

	if (N > K) {
		cout << (X*K) + (N - K)*Y << endl;
	}
	else
	{
		cout << (X*N) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>

using namespace std;

bool data[90][90];
int w, h, dy[] = {-1, 0, 1, 0}, dx[] = {0, 1, 0, -1};

int dfs(int y, int x, int d){
  int res = d;
  for(int i=0;i<4;i++){
    int ny = y + dy[i], nx = x + dx[i];
    if(0<=ny && ny<h && 0<=nx && nx<w && data[ny][nx]){
      data[ny][nx] = false;
      res = max(res, dfs(ny, nx, d+1));
      data[ny][nx] = true;
    }
  }
  return res;
}

main(){
  while(scanf("%d %d", &w, &h) && (w|h)){
    for(int i=0;i<h;i++) for(int j=0;j<w;j++) scanf("%d", &data[i][j]);
    int ans = 0;
    for(int i=0;i<h;i++) for(int j=0;j<w;j++) if(data[i][j]) ans = max(ans, dfs(i, j, 0));
    printf("%d\n", ans);
  }
}

Measured memory_bytes: 0
/*                    ___          |\    /|           ____   ____   ____  ____
   |     |    /\    /    \ |     | | \  / |    /\    |    \ |    \ |     |    \
   |_____|   /__\   \____  |_____| |  \/  |   /__\   |____/ |____/ |__   |____/
   |     |  /    \       \ |     | |      |  /    \  |      |      |     |   \
   |     | /      \ \____/ |     | |      | /      \ |      |      |____ |    \
*/
#include<bits/stdc++.h>
using namespace std;
#define lb lower_bound
#define ub upper_bound
#define pf push_front
#define pb push_back
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pi pair<int,int>
#define pl pair<long,long>
#define pll pair<long long,long long>
#define pld pair<long double,long double>
#define gc getchar_unlocked
#define pc putchar_unlocked
#define endl '\n'
#define loop(i,n) for(ll i=0;i<n;i++)
#define mod 1e9+7
#define in(x) scanf("%lld",&x)
#define in2(x,y) scanf("%lld %lld",&x,&y)
#define vl vector<ll>
#define vpll vector<pair<ll,ll>>
#define INF 0x3f3f3f3f
#define mp make_pair

int main()
{
    ll n;
    in(n);
    ll dp[3][n+1];
    ll v[3][n];
    for(ll i=0;i<n;i++) {
        cin>>v[0][i]>>v[1][i]>>v[2][i];
    }
    dp[0][0] = dp[1][0] = dp[2][0] = 0;
    for(ll i=1;i<=n;i++) {
        dp[0][i] = v[0][i-1] + max(dp[1][i-1],dp[2][i-1]);
        dp[1][i] = v[1][i-1] + max(dp[0][i-1],dp[2][i-1]);
        dp[2][i] = v[2][i-1] + max(dp[0][i-1],dp[1][i-1]);
    }
    cout<<max(dp[0][n],max(dp[1][n],dp[2][n]));
    return 0;
}

Measured memory_bytes: 4992
/*
god taekyu
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int n,m;
char A[1005][1005];
ll dp[1005][1005];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n>>m;
    for(int i=1;i<=n;i++) {
        cin>>(A[i]+1);
    }
    dp[1][1] = 1ll;
    for(int i=1;i<=n;i++) {
        for(int j=1;j<=m;j++) {
            if(i==1 && j==1) continue;
            if(A[i][j] == '#') continue;
            dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % (ll)(1e9+7);
        }
    }
    cout<<dp[n][m];
    return 0;
}

/*
god taekyu
*/


Measured memory_bytes: 9088
#include <algorithm>
#include <cctype>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

int main(void) {
    int a, b;
    cin >> a >> b;
    int sum = a + b;
    cout << ((sum / 2) + (sum % 2 != 0)) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	string s;
	cin>>s;
	int i=s.size()-1;
	//cout<<i<<endl;
	while(i!=0){
		if(s[i]=='m' && s[i-1]=='a' && s[i-2]=='e' && s[i-3]=='r' && s[i-4]=='d'){
			i-=5;
			continue;
		}
		else if(s[i]=='r' && s[i-1]=='e' && s[i-2]=='m' && s[i-3]=='a' && s[i-4]=='e' && s[i-5]=='r' && s[i-6]=='d'){
				i-=7;
				continue;
		}
		else if(s[i]=='e' && s[i-1]=='s'&& s[i-2]=='a'&& s[i-3]=='r'&& s[i-4]=='e'){
			i-=5;
			continue;
		}
		else if(s[i]=='r' && s[i-1]=='e'&& s[i-2]=='s'&& s[i-3]=='a' &&s[i-4]=='r' &&s[i-5]=='e'){
			i-=6;
			continue;
		}
		else if(i==-1){
			cout<<"YES"<<endl;
			break;
		}
		else{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	
		
			
	return 0;
}
	

Measured memory_bytes: 512
import Data.List
f::Int->Int->Int
f n m
   |(n `mod` m) == 0 =min n m
   |otherwise = f m (n `mod` m)

main = do
	   e<-getLine
	   es<-getLine
	   let x=read e::[Int]
	       xs=sort $ map read (words es)::[Int]
	   putStrLn $ show $ foldl1 f xs

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

int main(){
  int N;
  vector<int>a(3);
  cin >> N;
  for(int i=0;i<N;i++){
    cin >>a.at(0)>>a.at(1)>>a.at(2);
    //cout <<a.at(0)<<a.at(1)<<a.at(2)<<endl;
    sort(a.begin(),a.end());
    if((a.at(0)*a.at(0)+a.at(1)*a.at(1))==a.at(2)*a.at(2)){
      cout <<"YES"<<endl;
    }
    else{
      cout <<"NO"<<endl;
    }
    //cout <<a.at(0)*a.at(0)<< a.at(1)*a.at(1)<<a.at(2)*a.at(2)<<endl;
  }
    return 0;
}


Measured memory_bytes: 3088
n,m=map(int,input().split())

if n>=3 and m>=3:
  a=n*m
  b=n*2+m*2-4
  ans=a-b
elif n==1 and m==1:
  ans=1
elif n==1 or m==1:
  a=n*m
  b=2
  ans=a-b
elif n==2 or m==2:
  ans=0
  
print(ans)


Measured memory_bytes: 9052
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip> //fixed << setprecision(10)
 
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
 
typedef long long ll;
typedef vector<int> vi;
 
int main(){
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y;

    return 0;
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
char s[125252];
int ans[125252];
const int SHEEP = 0, WOLF = 1;

bool valid(){
  REP(i,n){
    int a = i;
    int b = (i+1)%n;
    int c = (i+2)%n;
    int ox = (int)(s[b]!='o');
    if(ans[b]==WOLF)ox^=1;
    if(ans[a]^ox!=ans[c])return false;
  }
  return true;
}

int main(){
  scanf("%d",&n);
  scanf("%s",s);
  REP(a,2)REP(b,2){
    ans[0] = a;
    ans[1] = b;
    FOR(i,2,n){
      int ox = (int)(s[i-1]!='o');
      if(ans[i-1]==WOLF)ox^=1;
      ans[i] = ans[i-2]^ox;
    }
    if(valid()){
      REP(i,n)putchar(ans[i]==SHEEP?'S':'W');
      return 0;
    }
  }
  puts("-1");
  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
class Solution {
  vector<int> A;
  vector<long long> altPre, pre;
  struct Query {
    int x;
    int id;
    long long ans;
    Query(int x, int id) : x(x), id(id) {}
  };
  vector<Query> Qs;
  int n;
  void solve() {
    sort(Qs.begin(), Qs.end(), [](Query a, Query b) { return a.x < b.x; });
    int k = (n - 1) / 2;
    for (Query &q : Qs) {
      int x = q.x;
      while (k and abs(A[n - 2 * k - 1] - x) > abs(A[n - k - 1] - x)) --k;
      q.ans = altPre[n - 2 * k - 1] + pre[n] - pre[n - k - 1];
    }
  }
public:
  void run(istream &in, ostream &out) {
    int Q; 
    in >> n >> Q;
    A.resize(n);
    pre.resize(n + 1);
    altPre.resize(n + 1);
    for (int i = 0; i < n; ++i) in >> A[i];
    for (int i = 0; i < n; ++i) {
      altPre[i + 1] = altPre[i] + (i % 2 == n % 2 ? 0 : A[i]),
      pre[i + 1] = pre[i] + A[i];
    }
    for (int i = 0; i < Q; ++i) {
      int x;
      cin >> x;
      Qs.emplace_back(x, i);
    }
    solve();
    sort(Qs.begin(), Qs.end(), [](Query a, Query b) { return a.id < b.id; });
    for (int i = 0; i < Q; ++i) cout << Qs[i].ans << " \n"[i == Q - 1];
  }
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  Solution().run(cin, cout);
}


Measured memory_bytes: 5360
function Main(input){
  input = input.split("\n");
  
  var N = parseInt(input[0]);
  var A = parseInt(input[1]);
  
  if(N%500 <= A){
    console.log("Yes");
  }else{
    console.log("No");
  }
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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



int main(){
    ll n;
    cin >> n;
    if(n==0){
        cout << 0 << endl;
        return 0;
    }
    if(n%2==1){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0;
    ll now = n;
    while(now%10==0){
        ans+=1;
        now/=10;
    }
    while(now%5==0){
        ans++;
        now/=5;
    }
    n-=2;
    n/=10;
    ll j = 1;
    while(n/j>0){
        ans+=n/j;
        j*=5;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    vector<int> L;
    int ans = 0;

    scanf("%d", &N);

    for ( int i = 0; i < (2 * N); i++ ) {
        int l;
        scanf("%d", &l);
        L.push_back( l );
    }

    sort(L.begin(), L.end()); // 昇順

    for ( int i = 0; i < (2 * N); i += 2 ) {
        ans += L[i];
    }

    printf("%d\n", ans);
    
    return 0;
}


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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

using A = array<int, 2>;
const int INF = TEN(9) + TEN(6);

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

    int h;
    cin >> h;
    int n = 1<<h;
    V<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    a.push_back(-INF);

    auto mrg = [&](A l, A r) {
        array<int, 4> v = {l[0], l[1], r[0], r[1]};
        sort(begin(v), end(v), [&](int x, int y){
            return a[x] > a[y];
        });
        return A{v[0], v[1]};
    };
    V<A> dp(n);
    for (int i = 0; i < n; i++) dp[i] = A{i, n};
    for (int ph = 0; ph < h; ph++) {
        for (int i = 0; i < n; i++) {
            if (i & (1<<ph)) continue;
            int j = i ^ (1<<ph);
            dp[j] = mrg(dp[j], dp[i]);
        }
    }
    V<int> ans(n); ans[0] = -INF;
    for (int i = 1; i < n; i++) {
        ans[i] = max(ans[i-1], a[dp[i][0]] + a[dp[i][1]]);
        cout << ans[i] << endl;
    }
    return 0;
}


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

using namespace std;

int main() {
  string s;
  cin >> s;
  if (s.length() % 2) {
    cout << "No\n";
    return 0;
  }
  for (int i = 0; i < s.length(); i += 2) {
    if (s[i] == 'h' && s[i+1] == 'i') continue;
    cout << "No\n";
    return 0;
  }
  cout << "Yes\n";
   return 0;
}

Measured memory_bytes: 256
N = int(input())
W = list(map(int, input().split()))
s = sum(W) / 2
sum_ = 0
idx = 0
for i in range(N):
  sum_ += W[i]
  if sum_ > s:
    idx = i
    break
    
diff_0 = abs(sum(W[:idx]) - sum(W[idx:]))
diff_1 = abs(sum(W[:idx+1]) - sum(W[idx+1:]))

print(min(diff_0, diff_1))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define MOD 1000000007
#define all(c) c.begin(), c.end()
#define peek(v)      \
	for (auto i : v) \
		cout << i << ' ';

void solve()
{
	ll S, c;
	cin >> S >> c;
	if (S >= c / 2)
		cout << c / 2;
	else
	{
		c -= S * 2;
		cout << S + c / 4;
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	solve();
	cerr << "\n\n~" << 500 * clock() / CLOCKS_PER_SEC << "ms\n";
	return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
A = []
D = []
for i in range(k):
  D.append(int(input()))
  A.append(list(map(int, input().split())))
ans = 0
a = [0]*n

for j in range(k):
  for l in range(D[j]):
    a[A[j][l]-1] += 1

print(a.count(0))

Measured memory_bytes: 9200
#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--)

vector<ll> sz(51);

ll solve(ll n, ll x) {
  if(n==0) {
    if(x==0) {
      return 0;
    }
    if(x==1) {
      return 1;
    }
    //cout << "Something goes wrong."<<endl;
    return 0;
  }
  if(1+sz[n-1]>=x) {
    return solve(n-1,x-1);
  }
  if(x<=2+2*sz[n-1]) {
    return solve(n-1,sz[n-1]) + 1LL + solve(n-1,x-sz[n-1]-2);
  }
  return 1LL+2*solve(n-1,sz[n-1]);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  sz[0]=1;
  repeat(i,1,51) {
    sz[i]=2*sz[i-1]+3;
  }
  ll n,x;
  cin>>n>>x;
  cout << solve(n,x) << endl;
  return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define cpy(a,b) memcpy(a,b,sizeof(a))
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int a,b;
	cin>>a>>b;
	if(a>=13)cout<<b;
	else if(6<=a&&a<=12)cout<<b/2;
	else cout<<0;
	return 0;
}


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

int n;
map<string, int> results;

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    results[s]++;
  }
  
  cout << "AC x " << results["AC"] << "\n";
  cout << "WA x " << results["WA"] << "\n";
  cout << "TLE x " << results["TLE"] << "\n";
  cout << "RE x " << results["RE"];
}

Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;
const int maxn = 1e3+10;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int k,m,n,num;
int a[maxn],w[maxn],dp[1<<21];
int main(){
	n=read();m=read();num=(1<<n)-1;
	for(register int i=1;i<=m;i++){
		a[i]=read();
		int numm=read(),sum=0;
		for(register int j=1;j<=numm;j++){
			int x=read();
			sum|=1<<(x-1);
		}
		w[i]=sum;
	}
	memset(dp,0x3f,sizeof(dp));
	dp[0]=0;
	for(register int i=0;i<=num;i++){
		for(register int j=1;j<=m;j++){
			dp[i|w[j]]=min(dp[i|w[j]],dp[i]+a[j]);
		}
	}
	if(dp[num]>1e8)puts("-1");
	else printf("%d\n",dp[num]);
	return 0;
}

Measured memory_bytes: 8448
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

struct mat {
	ll r, c;
};

int main() {
//	cout << fixed << setprecision(15);
	int n;
	cin >> n;
	vector<mat> m(n);
	rep(i, n) cin >> m[i].r >> m[i].c;

	if(n == 1) {cout << 0 << endl; return 0; }

	vector<vll> dp(n, vll(n));
	rep(i, n) dp[i][i] = 0;
	int l, r;
	for(int d = 1; d <= n - 1; d++) {
		for(l = 0; l + d < n; l++) {
			r = l + d;
			dp[l][r] = INFL;
			for(int k = l; k + 1 <= r; k++) {
				dp[l][r] = min(dp[l][k] + dp[k + 1][r] + m[l].r * m[k].c * m[r].c, dp[l][r]);
			}
		}
	}
	cout << dp[0][n - 1] << endl;
}



Measured memory_bytes: 3240
/*{{{*/
#include<bits/stdc++.h>
#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 REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T, class U> void _W(const pair<T, U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
#define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
#define DEBUG(...)
#endif
int MOD = 1e9 + 7;
void ADD(LL& x, LL v) {x = (x + v) % MOD; if (x < 0)x += MOD;}
/*}}}*/
void solve() {
	LL x;
	R(x);
	int y = x / 500;
	x -= y * 500;
	int z = x / 5;
	int ans = 1000 * y + z * 5;
	W(ans);
}

int main() {

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

#define MULTITEST 0
#if MULTITEST
	CASET {
		solve();
	}
#else
	solve();
#endif
	return 0;
}


Measured memory_bytes: 3720
<?php
while (true) {
  list($n, $x) = explode(" ", trim(fgets(STDIN)));
  if (!$n && !$x) break;

  $count = 0;
  for ($i = 1; $i <= $n; $i++)
    for ($j = $i + 1; $j <= $n; $j++)
      for ($k = $j + 1; $k <= $n; $k++)
        if ($i != $j && $i != $k && $j != $k && $i + $j + $k == $x) $count++;

  echo "$count\n";
}



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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;
 
constexpr int INF = 1e9;
constexpr int MOD = 1e9+7;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll cur = a[0],sum = 0;
    for(int i = 1; i < n; i++){
        sum += max(0ll,cur-a[i]);
        cur = max(cur,a[i]);
    }
    cout << sum << endl;
	return 0;
}

Measured memory_bytes: 4752
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926525
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------
int a[100],b[100];
bool visited[100];
bool edge[100][100];
int n,m;

void bfs(int v){
  visited[v]=true;
  REP(i,n){
    if(edge[v][i]==false)continue;
    if(visited[i]==true)continue;
    bfs(i);
  }
}

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  cin>>n>>m;
  int cnt=0;
  REP(i,m){
    cin>>a[i]>>b[i];
    a[i]--;b[i]--;
    edge[a[i]][b[i]]=true;
    edge[b[i]][a[i]]=true;
  }
  REP(i,m){
    edge[a[i]][b[i]]=false;
    edge[b[i]][a[i]]=false;
    REP(i,n)visited[i]=false;
    bfs(0);
    REP(i,n){
      if(visited[i]==false){
        cnt++;
        break;
      }
    }
    edge[a[i]][b[i]]=true;
    edge[b[i]][a[i]]=true;
  }
  P(cnt);
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(){

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

    int total = a+b;
    
    if (total > 23){
        int d = total - 24;
        printf("%d",d);
    }
    else{
        printf("%d",a+b);
    }
    return 0;
    
}


Measured memory_bytes: 128
import java.util.*;


class Main {
	Scanner sc = new Scanner(System.in);

	public void run() {
		while(sc.hasNext()){
			P p1=new P(sc.nextDouble(),sc.nextDouble());
			P p2=new P(sc.nextDouble(),sc.nextDouble());
			P p3=new P(sc.nextDouble(),sc.nextDouble());
			P p4=new P(sc.nextDouble(),sc.nextDouble());

			P p5=new P(Math.max(p1.x,p3.x),Math.max(p1.y,p3.y));
			P p6=new P(Math.min(p2.x,p4.x),Math.min(p2.y,p4.y));

			ln((p5.x<=p6.x && p5.y<=p6.y)?"YES":"NO");
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

class P{
	double x;
	double y;
	P(double _x,double _y){
		x=_x;
		y=_y;
	}
}

Measured memory_bytes: 12000
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////
bool check(int N) {
	vector<bool> res(3, false);
	vector<int> ter = { 3,5,7 };
	while (N) {
		for (int i = 0; i < 3; ++i) {
			if (N % 10 == ter[i]) { res[i] = true; }
		}
		N /= 10;
	}
	return res[0] && res[1] && res[2];
}
void solve() {
	int N;
	cin >> N;
	
	vector<int> res = { 3,5,7 };
	for (int i = 0; i < 3; ++i) {
		if (res[i] == N) {
			cout << "YES" << endl;
			return;
		}
	}
	cout << "NO" << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(),x.end()

int main()
{
  int N, T, time, cost;
  cin >> N >> T;
  int C[N], M[N];
  for (int i = 0; i < N; ++i) {
    cin >> C[i] >> M[i];
  }

  time = T+1;
  cost = 1001;
  for (int i = 0; i < N; ++i) {
    if (M[i] <= T) {
      if (C[i] < cost) {
        cost = C[i];
        time = 0;
      }
    }
  }
  if (time == T+1) {
    cout << "TLE" << "\n";
  }else {
    cout << cost << "\n";
  }

  return 0;
}


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

int main(){

    string S, T;
    cin >> S >> T;

    if (S == T.substr(0,S.size())) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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


void solve(std::string b){

    string ans;
    if ( b == "A") ans = "T";
    if ( b == "T") ans = "A";
    if ( b == "C") ans = "G";
    if ( b == "G") ans = "C";
    cout << ans << endl;
}

// Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string b;
    std::cin >> b;
    solve(b);
    return 0;
}


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

const int N = 100010;
int n, co;

vector<int> G[N];
vector<pair<int, int>> Edge(N);
vector<bool> Seen(N);
map<pair<int, int>, int> mp; // {{a, b}, color}

void dfs(int now, int pre_co){
    Seen[now] = true;
    int c = pre_co;
    for(int i = 0; i < G[now].size(); i++){
        int to = G[now][i];
        if(Seen[to]) continue;

        int a = min(now, to);
        int b = now + to - a;

        c++;
        if(c > co){
            c = 1;
        }
        mp[{a, b}] = c;
        dfs(to, c);
    }
}

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

    cin >> n;
    Edge.resize(n - 1);
    Seen.resize(n);

    for(int i = 0; i < n - 1; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
        if(a > b) swap(a, b);
        Edge[i] = {a, b}; // a < b
    }

    int idx = -1;
    for(int i = 0; i < n; i++){
        if(co < (int)G[i].size()){
            co = G[i].size();
            idx = i;
        }
    }

    dfs(idx, 0); 

    cout << co << endl;
    for(int i = 0; i < n - 1; i++){
        cout << mp[Edge[i]] << endl;
    }

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

ll mi(ll a, ll b){
	return a < b ? a : b;
}

int main( int argc, char *argv[] ) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n, neg = 0;
	ll res = 0, m = 1E10, tmp;
	cin >> n;
	for ( int i = 0 ; i < n ; i++ ){
		cin >> tmp;
		if ( tmp < 0LL ){
			neg++;
			tmp *= (ll) -1LL;
			res += tmp;
			m = mi(tmp, m);
		}else{
			res += tmp;
			m = mi(tmp, m);
		}
	}
	if ( neg & 1 )
		res -= 2LL * m;

	cout << res << "\n";

	return 0;
}


Measured memory_bytes: 256
h,w,d=map(int,input().split())
ans=[0 for _ in range(h*w+1)]
za=[[] for _ in range(h*w+1)]
for i in range(h):
  a=list(map(int,input().split()))
  for x in range(w):
    za[a[x]].append(i)
    za[a[x]].append(x)
  

for x in range(1,h*w+1):
  if x+d<=w*h:
    ans[x+d]=ans[x]+abs(za[x+d][0]-za[x][0])+abs(za[x+d][1]-za[x][1])
    
q=int(input())
for _ in range(q):
  e,f=map(int,input().split())
  print(ans[f]-ans[e])
  




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

int main()
{
	string str;
	int count = 0;
	int len;

	cin >> str;

	len = str.length();

	for (int i = 0; i < len; i++)
	{
		if (i % 2 == 0)
		{
			if ((str[i] == 'L'))
			{
				count++;
			}
		}
		else
		{
			if ((str[i] == 'R'))
			{
				count++;
			}
		}
	}

	

	if (count != 0)cout << "No";
	else if(count == 0)cout << "Yes";
	cout << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int W, H, x, y, r;

	while (1)
	{
		scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
		if (-100 <= x, y&&x, y <= 100 && 0<W, H, r&&W, H, r <= 100)
			break;
	}

	if (0 <= x - r&&x + r <= W && 0 <= y - r&&y + r <= H)
		printf("Yes\n");

	else
		printf("No\n");

	return 0;
}

Measured memory_bytes: 584
import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        int t[] = new int[10001];
        Scanner input = new Scanner(System.in);
        int n = 0;
        while(true){
            t[n++] = input.nextInt();
            if (t[n-1] == 0){
                break;
            }
        }
        for (int i = 0; i < (n-1); i++){
            System.out.printf("Case %d: %d\n",i+1,t[i]);
        }
    }
}


Measured memory_bytes: 63084
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
int main(){
    int H, W; cin >> H >> W;
    vector<vector<char>> C(H, vector<char>(W));
    rep(i, H){
        rep(j, W){
            cin >> C[i][j];
        }
    }

    rep(i, 2*H){
        rep(j ,W) cout << C[i/2][j];
        cout << endl;
    }
}

Measured memory_bytes: 256
#!/usr/bin/env python3

from pprint import pprint
import sys

sys.setrecursionlimit(10 ** 6)


N, M, Q = map(int, input().split())
trains = []
for _ in range(M):
    l, r = map(int, input().split())
    # 0-index
    trains.append([l-1, r-1])
# pprint(trains)
queries = []
for _ in range(Q):
    p, q = map(int, input().split())
    # 0-index
    queries.append([p-1, q-1])
# pprint(queries)

# s[l][r] := (0, 0) ~ (l-1, r-1) の領域に含まれる列車の数
# s[l+1][r+1] = s[l][r+1] + s[l+1][r] + A[l][r] - s[l][r]
s = [[0 for r in range(N+1)] for l in range(N+1)]

for l, r in trains:
    s[l+1][r+1] += 1

for l in range(N):
    for r in range(N):
        s[l+1][r+1] += s[l][r+1] + s[l+1][r] - s[l][r]

# s[q+1][q+1] - s[p][q+1] - s[q+1][p] + s[p][p]

for p, q in queries:
    ans = s[q+1][q+1] - s[p][q+1] - s[q+1][p] + s[p][p]
    print(ans)


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

using namespace std;
using ll = long long;

int main() {
    int N = 0;
    cin >> N;
    vector<string> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    bool check = 1;
    
    for(int i = 0; i < N - 1; i++) {
        if(A.at(i).at(A.at(i).size() - 1) != A.at(i + 1).at(0)) {
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            if(A.at(i) == A.at(j)) {
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;

    return 0;
}

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

int main() {
    int n; cin >> n;
    n %= 100; n %=10;
    if(n == 2 || n == 4 || n==5 || n==7 || n==9 )
        cout << "hon" << endl;
    else if(n==0 || n==1 || n==6 || n==8)
        cout << "pon" << endl;
    else
        cout << "bon" << endl;
    return 0;
}

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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define FORR(i, a, b) for(int i=(b-1);i>=(a);--i)
#define FORRE(i, a, b) for(int i=(b);i>=(a);--i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define repr(i, n) for(int i=(n-1);i>=0;--i)
#define repre(i, n) for(int i=(n);i>=0;--i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, k;
	cin >> n >> k;
	
	cout << n - k + 1 << endl;
	
	return 0;
}

Measured memory_bytes: 256