akhauriyash/Code-Regression huggingface dataset:
import sys
def shu(j):
    t=list(set((range(1,11)))-set(j))
    if sum([1 for i in t if sum(j[:2])+i<=20])/len(t)>0.5:
        return "YES"
    else:
        return "NO"
    
[print(shu(i)) for i in [list(map(int,l.split())) for l in sys.stdin]]



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

int used[20] = {};

double ans = 0.0;

void func(int now, int last, int n, int m, vector<vector<double> >& table){

    if(now == m){

        /*for(int i = 0; i < n; i++){
            cout << used[i] << " ";
        }cout << endl;
        */

        vector<int> array;
        for(int i = 0; i < n; i++){
            if(used[i] == 1) array.push_back(i);
        }

        /*for(int i = 0; i < m; i++){
            cout << array[i] << " ";
        }cout << endl;
        */

        double temp = 0.0;
        for(int i = 0; i < m-1; i++){
            for(int j = i+1; j < m; j++){
                temp += table[array[i]][array[j]];
            }
        }
        //cout << temp << endl;

        if(ans < temp) ans = temp; 
    }

    for(int i = last + 1; i < n; i++){
        used[i] = 1;
        func(now + 1, i, n, m, table);
        used[i] = 0;
    }
}

int main(void){

    int n, m; cin >> n >> m;
    double l[30];
    double a[30];
    double b[30];

    for(int i = 0; i < n; i++){
        cin >> l[i] >> a[i] >> b[i];
    }
     
    vector<vector<double> > table(22, vector<double>(22, 0.0));


    for(int i = 0; i < n-1; i++){
        for(int j = i+1; j < n; j++){
            table[i][j] = (a[i] - a[j])*(a[i] - a[j]) + (l[i] - l[j])*(l[i] - l[j]) + (b[i] - b[j])*(b[i] - b[j]);
        }
    }

    /*for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cout << table[i][j] << " ";
        }cout << endl;
    }*/

    func(0, -1, n, m, table);

    //cout << fixed;
    //cout << setprecision(10);
    //cout << ans << endl;
    printf("%.10f\n", ans);
}

Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;

public class Main {
    public static void main(String[] args) throws IOException {
        final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        final char[] line = reader.readLine().toCharArray();
        reader.close();

        final Deque<Integer> stack = new ArrayDeque<Integer>(line.length);
        final StringBuilder answer = new StringBuilder();

        int sum = 0;
        int count = 0;
        int indexLastZero = 0;
        final int[] process = new int[line.length + 1];
        final int[] graph = new int[line.length + 1];
        for (int i = 0; i < line.length; ++i) {
            if (stack.isEmpty()) indexLastZero = i;
            graph[i] = stack.size();
            process[i] = sum;
            switch (line[i]) {
                case '\\':
                    stack.push(i);
                    break;
                case '/':
                    if (!stack.isEmpty()) {
                        sum += i - stack.pop();
                        if (stack.isEmpty()) {
                            ++count;
                            answer.append(" ").append(sum - process[indexLastZero]);
                        }
                    }
                    break;
                default:
            }
        }
        if (stack.isEmpty()) indexLastZero = line.length;
        graph[line.length] = stack.size();
        process[line.length] = sum;


        for (int i = indexLastZero + 1, min; i < graph.length; ++i) {
            min = i;
            for (int j = graph.length - 1; i < j; --j) {
                if (graph[i] == graph[j] && process[i] != process[j]) {
                    min = j;
                }
            }
            if (min != i) {
                ++count;
                answer.append(" ").append(process[min] - process[i]);
                i = min - 1;
            }
        }
        System.out.println(sum);
        System.out.println(count + answer.toString());
    }
}

Measured memory_bytes: 25136
import java.util.*; 
import java.io.*;

public class Main {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));

        
        int K = nextInt();
        String S = next();//strength 
 
        if(S.length()<=K){
            System.out.println(S);
        }
        else{
            System.out.println(S.substring(0, K) + "..."); 
        }
 
        
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}

Measured memory_bytes: 36208
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n int64
	fmt.Scan(&n)

	s := strconv.FormatInt(n, 10)
	all9 := true
	for _, c := range s {
		tmp, _ := strconv.Atoi(string(c))
		if tmp != 9 {
			all9 = false
		}
	}
	if all9 {
		fmt.Println(len(s) * 9)
		return
	}

	var first string
	first = string(s[0])
	f, _ := strconv.Atoi(first)
	count9 := len(s) - 1

	all9 = true
	for i := 1; i < len(s); i++ {
		tmp, _ := strconv.Atoi(string(s[i]))
		if tmp != 9 {
			all9 = false
		}
	}
	if all9 {
		fmt.Println(f + count9*9)
		return
	}

	ans := f - 1 + count9*9

	fmt.Println(ans)
}


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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll oo = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/

struct edge{
    int from, to, w;

    edge(){}
    edge(int x, int y, int we): from(x), to(y), w(we){}

    bool operator < (const edge &rhs) const{
        return w > rhs.w;
    }

};

int main(){
    fIO

    ll a, b;
    cin >> a >> b;

    cout << (a * b) / __gcd(a, b);
}










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

int main(void){
    std::string s;
    std::cin >> s;
    if(s[s.size() - 1] == 's')
        std::cout << s << "es" << std::endl;
    else std::cout << s << "s" << std::endl;

    return 0;
}

Measured memory_bytes: 3624
n = int(input())
h = list(map(int, input().split()))
dp = [ 10**10 for _ in range(n)]
dp[0] = 0
dp[1] = dp[0] + abs(h[1] - h[0])
if(n > 2):
  for i in range(2, n):
    dp[i] = min([dp[i-1] + abs(h[i] - h[i - 1]), dp[i-2] + abs(h[i] - h[i - 2])])
print(dp[-1])

Measured memory_bytes: 13976
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long


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

    int n; cin >> n;
    string s,t; cin >> s >> t;

    int ans = n * 2;

    for(int i = n;i >= 1;i --){
        if(s.substr(n-i,i) == t.substr(0,i)){
            ans -= i;
            break;
        }
    }

    cout << ans << endl;
}



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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = a; i < n; ++i)
#define ford(i, a, n) for (int i = n - 1; i >= a; --i)
#define fore(i, a, n) for (int i = a; i <= n; ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

const int N = 1e5 + 100;
int pr[N];

int get(int i) {
    if (pr[i] == i) return i;
    return pr[i] = get(pr[i]);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> x(n), y(n);
    vector<tuple<int, int, int>> e;
    forn(i, 0, n) cin >> x[i] >> y[i];
    vector<int> a(n);
    forn(i, 0, n) a[i] = i;
    sort(all(a), [&](int i, int j) {
            return x[i] < x[j];
            });
    forn(i, 0, n - 1) {
        e.eb(x[a[i + 1]] - x[a[i]], a[i], a[i + 1]);
    }
    sort(all(a), [&](int i, int j) {
            return y[i] < y[j];
            });
    forn(i, 0, n - 1) {
        e.eb(y[a[i + 1]] - y[a[i]], a[i], a[i + 1]);
    }
    sort(all(e));
    ll ans = 0;
    forn(i, 0, n) pr[i] = i;
    for (auto p : e) {
        int w, u, v;
        tie(w, u, v) = p;
        //cerr << u << ' ' << v << ' ' << w << '\n';
        u = get(u);
        v = get(v);
        if (u == v) continue;
        ans += w;
        pr[u] = v;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 6132
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n,a,b;
  cin >> n >> a >> b;
  string s;
  cin >> s;
  int y = 0; // 予選通過者
  int k = 0; //海外の順位
  for(int i=0;i<n;i++){
    if(s[i] == 'a'){
      if(y<a+b){
        cout << "Yes" << "\n";
        y++;
      }
      else cout << "No" << "\n";
    }
    else if(s[i] == 'b'){
      if(y<a+b && k<b){
        cout << "Yes" << "\n";
        y++;
        k++;
      }
      else cout << "No" << "\n";
    }
    else cout << "No" << "\n";
  }
  return 0;
}

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

int main(){
    string S,T;
    int N,K=0;
    cin >> S >> T;

    N = S.size();

    for(int i = 0; i < N ; i++){
        if (S[i] != T[i]){
            K++;
        }
    }
    cout << K << endl;
}



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

int main()
{
    string s[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string a;
    cin >> a;
    rep(i, 7)
    {
        if (a == s[i])
        {
            cout << (7 - i) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;

int main()
{

   char a[11];
   scanf("%s",a);

   int n=strlen(a);
   int maxn=0;
   for(int i=0;i<n;i++)
   {
       int m=0;
       for(int j=i;j<n;j++)
       {
           if(a[j]=='A'||a[j]=='T'||a[j]=='C'||a[j]=='G')
            m++;
            else
            {

                break;
            }
       }
        maxn=max(maxn,m);
   }
   cout<<maxn<<endl;
       return 0;
}


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

int main()
{
	int n, k;
	while (cin >> n >> k, n | k) {
		vector<string> ss(n);
		for (int i = 0; i < n; i++) {
			cin >> ss[i];
		}
		set<int> st;
		if (k == 2) {
			for (int i = 0; i < n; i++) {
				for (int j = i + 1; j < n; j++) {
					st.insert(stoi(ss[i] + ss[j]));
					st.insert(stoi(ss[j] + ss[i]));
				}
			}
		}
		else if (k == 3) {
			for (int i = 0; i < n; i++) {
				for (int j = i + 1; j < n; j++) {
					for (int k = j + 1; k < n; k++) {
						st.insert(stoi(ss[i] + ss[j] + ss[k]));
						st.insert(stoi(ss[i] + ss[k] + ss[j]));
						st.insert(stoi(ss[j] + ss[i] + ss[k]));
						st.insert(stoi(ss[j] + ss[k] + ss[i]));
						st.insert(stoi(ss[k] + ss[i] + ss[j]));
						st.insert(stoi(ss[k] + ss[j] + ss[i]));
					}
				}
			}
		}
		else {
			for (int i = 0; i < n; i++) {
				for (int j = i + 1; j < n; j++) {
					for (int k = j + 1; k < n; k++) {
						for (int l = k + 1; l < n; l++) {
							vector<int> val = { i, j, k, l };
							do {
								st.insert(stoi(ss[val[0]] + ss[val[1]] + ss[val[2]] + ss[val[3]]));
							} while (next_permutation(val.begin(), val.end()));
						}
					}
				}
			}
		}
		cout << st.size() << endl;
	}
	return 0;
}



Measured memory_bytes: 3308
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int l, r;
    cin >> l >> r;
    if (r - l >= 2019)
    {
        cout << 0 << endl;
        return 0;
    }
    l %= 2019;
    r %= 2019;
    int a = min(l, r), b = max(l, r);
    int ans = INF;
    for (int i = a; i <= b; i++)
    {
        for (int j = i + 1; j <= b; j++)
        {
            ans = min(ans, (i * j) % 2019);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <list>
#include <iomanip>

using namespace std;

#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)
#define rep(i,a,n) for(Int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(Int (i)=(a); (i)<=(n); (i)++)
const int MAX_N = 1000000;
const Int MAX_N_Int = 1000000000000;

template <typename T>
void printV(const std::vector<T>& v, const char * const separator = " ")
{
    if(!v.empty())
    {
        std::copy(v.begin(),
                  --v.end(),
                  std::ostream_iterator<T>(std::cout, separator));
        std::cout << v.back() << "\n";
    }
}

bool isPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

Int lcm(Int a, Int b) {
    return a / gcd(a, b) * b;
    //a*bは64bit integer overflow
}

int Max(int a, int b, int c) {
    int temp = max(a, b);
    return max(temp, c);
}

int Min(int a, int b, int c) {
    int temp = min(a, b);
    return min(temp, c);
}

bool integer(double num) {
    return floor(num) == num;
}

Int fact(int num) {
    if (num == 0)
        return 1;
    else
        return num * fact(num - 1);
}

Int yakusu(int n) {
    int cnt = 0;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            cnt++;
            if (i * i != n) cnt++;
        }
    }
    return cnt;
}


Int fact_mod(Int n, Int mod) {
    Int f = 1; repq(i,2,n) f = f * (i % MOD) % MOD;
    return f;
}

// 繰り返し二乗法 (modの世界での累乗)
Int mod_pow(Int x, Int n, Int mod) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

// 組み合わせ nCr を求める
Int combination_mod(Int n, Int r, Int mod) {
    if(r > n-r) r = n-r;
    if(r == 0) return 1;
    Int a = 1;
    rep(i, 0, r) a = a * ((n-i) % mod) % mod;
    Int b = mod_pow(fact_mod(r, mod), mod-2, mod);
    return (a % mod) * (b % mod) % mod;
}

int main() {
    //COMinit();
    IOS;
    prec;
    Int a,b,c,n,m,k,x,y=0,ans=1;
    string str,s="",t,u;
    cin>>s;
    cout<<s[0]<<s[1]<<s[2];



    cout<<endl;
    return 0;
}




Measured memory_bytes: 3612
from itertools import permutations

def f(n, m, uu, vv):
    a = [[0] * n for _ in range(n)]
    for u, v in zip(uu, vv):
       
        a[u][v] = 1
        a[v][u] = 1
 
    res = 0
    for p in permutations(range(n)):
        if p[0] != 0:
            break
     
        ok = True
        for i in range(n-1):
            if a[p[i]][p[i+1]] == 0:
                ok = False
                break
        if ok:
            res += 1
    return res


n,m = map(int,input().split())
a = []
b = []

for i in range(m):
    _a, _b = map(int, input().split())
    _a -= 1
    _b -= 1
    a.append(_a)
    b.append(_b)

print(f(n, m, a, b))


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		sc.close();
		if(r - l >= 2018) {
			System.out.println(0);
			return;
		}
		long lMod = (l + 2019) % 2019;
		long rMod = (r + 2019) % 2019;
      if(rMod < lMod)
        rMod += 2019;
		long min = 100000;
		for(long i = lMod ; i <= rMod - 1 ; i++) {
			for(long j = i + 1 ; j <= rMod ; j++) {
				min = Math.min((i * j) % 2019 , min);
			}
		}
      System.out.println(min);

	}
}



Measured memory_bytes: 35972
#line 1 "d.cpp"
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 09/19/20 20:59:59
// -----------------------------------

#include <bits/stdc++.h>
#line 3 "/mnt/c/Users/tkmma/competitive_programming/CPBF/library/include/modular.hpp"

template <long long MOD>
class Modular {
 private:
  long long val_;

 public:
  constexpr Modular() : val_(0) {}
  constexpr Modular(long long v) : val_(v%MOD) {
    if (val_ < 0) val_ += MOD;
  }

  constexpr long long val() const { return val_; }
  constexpr Modular operator+(Modular x) const { return (val() + x.val())%MOD; }
  constexpr Modular operator+=(Modular x) { return *this = *this + x; }
  constexpr Modular operator++() { return *this += 1; }
  constexpr Modular operator++(int) { Modular c = *this; ++(*this); return c; }
  constexpr Modular operator-(Modular x) const { return (val() + MOD - x.val())%MOD; }
  constexpr Modular operator-=(Modular x) { return *this = *this - x; }
  constexpr Modular operator--() { return *this -= 1; }
  constexpr Modular operator--(int) { Modular c = *this; --(*this); return c; }
  constexpr Modular operator*(Modular x) const { return (val() * x.val())%MOD; }
  constexpr Modular operator*=(Modular x) { return *this = *this * x; }
  friend constexpr Modular pow(Modular x, long long p) {
    Modular t = 1;
    Modular u = x;
    while (p) {
      if (p & 1)
        t *= u;
      u *= u;
      p >>= 1;
    }
    return t;
  }
  constexpr Modular operator/(Modular x) const { return *this * pow(Modular{x}, MOD-2); }
  constexpr Modular operator/=(Modular x) { return *this = *this / x; }

  constexpr bool operator==(Modular x) const { return val() == x.val(); }
  constexpr bool operator!=(Modular x) const { return val() != x.val(); }
  constexpr bool operator<(Modular x) const { return val() < x.val(); };
  constexpr bool operator<=(Modular x) const { return val() <= x.val(); };
  constexpr bool operator>(Modular x) const { return val() > x.val(); };
  constexpr bool operator>=(Modular x) const { return val() >= x.val(); };

  friend std::ostream& operator<<(std::ostream& os, const Modular& x) {
    return os << x.val();
  }
  friend std::istream& operator>>(std::istream& is, Modular& x) {
    return is >> x.val_;
  }

};

#line 9 "d.cpp"

using namespace std;
using ll = long long;

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

  int n,k; cin>>n>>k;
  vector<pair<int,int>> LR(k);
  for (int i = 0; i < k; i++) {
    int l,r; cin>>l>>r;
    LR[i] = {l,r+1};
  }
  using mint = Modular<998244353>;
  vector<mint> dp(n, 0);
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    auto cv = dp[i];
    for (auto [l,r]:LR) {
      if (i+l < n)
        dp[i+l] += cv;
      if (i+r < n)
        dp[i+r] -= cv;
    }
    if (i > 0)
      dp[i+1] += cv;
  }
  cout << dp[n-1] << endl;

  return 0;
}


Measured memory_bytes: 4784
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

class Main {

    public static void main(String[] args) throws Exception {

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            int K = Integer.parseInt(br.readLine());
            List<String> inputString = Arrays.asList(br.readLine().split(" "));
            List<Integer> numbers = new ArrayList<>();
            for (String str : inputString) {
                numbers.add(Integer.parseInt(str));
            }
            
            String ans = "NG";
            int start = numbers.get(0);
            int end = numbers.get(1);
            for (int i = start; i <= end; i++) {
                if (i % K == 0) {
                    ans = "OK";
                    break;
                }
            }

            System.out.println(ans);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

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

using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<int> vtL(n + 1, 0);
    vector<int> vtR(n + 1, 0);

    for (int i = 0; i < n; ++i) {
        vtL[i + 1] = vtL[i];
        if (s[i] == '#') vtL[i + 1]++;

        if (n - 2 - i < 0) continue;
        vtR[n - 2 - i] = vtR[n - 1 - i];
        if (s[n - 1 - i] == '.') vtR[n - 2 - i]++;
    }

    int ans = INT_MAX;
    for (int i = 0; i < n; ++i) {
        ans = min(ans, vtL[i] + vtR[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2180
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	while(true){
	cin>>n;
	if(n==0)
		break;
	int set[4]={0},best[4];
	best[0]=100000,best[1]=100000,best[2]=0,best[3]=0;
	int c,ans,m,s;
	for(int i=0;i<n;i++){
		cin>>c;
		ans=0;
		for(int j=0;j<4;j++){
			cin>>m>>s;
			ans+=m*60+s;
		}
		if(ans<best[1]){
			set[1]=c;
			best[1]=ans;
		}
		if(ans<best[0]){
			best[1]=best[0];
			best[0]=ans;
			set[1]=set[0];
			set[0]=c;
		}
		if(ans>best[2]){
			set[2]=c;
			best[2]=ans;
		}
		if(ans>best[3]){
			best[2]=best[3];
			best[3]=ans;
			set[2]=set[3];
			set[3]=c;
		}
	}
	for(int i=0;i<3;i++)
		cout<<set[i]<<endl;
	}
	return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

const int I=0;
const int O=1;
const int T=2;
const int J=3;
const int L=4;
const int S=5;
const int Z=6;
ll A[7];
ll ret;

void solve() {
	int i,j,k,l,r,y; string s;

	FOR(i,7) cin>>A[i];
	
	ll x=min(min(A[J],A[L]),A[I]);
	for(ll v=max(x-10,0LL);v<=x;v++) {
		ll r=v*3;
		r += (A[J]-v)/2*2;
		r += (A[L]-v)/2*2;
		r += (A[I]-v)/2*2;
		ret=max(ret,A[O]+r);
	}
	
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
//scanf("%d", &a) '\n'

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	if (n % 2 != 0) { cout << "No" << endl; 
	return 0;
	} 
	rep(i, n/2) {
		if (s[i] != s[n / 2 + i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;

}
	

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n, m;
    cin >> n >> m;
    const ll N = 1<<n;

    vector<pair<ll, ll>> key;
    rep(i, m) {
        ll a, b;
        cin >> a >> b;
        ll s = 0;
        rep(j, b) {
            ll c;
            cin >> c;
            c--;
            s |= 1<<c;
        }
        key.emplace_back(s, a);
    }

    vl dp(N, INF);  // dp[S] : Sのiビット目が1のとき宝箱iを空けられるとする。状態がSとなるために必要な費用の最小値
    dp[0] = 0;
    rep(s, N) {
        rep(i, m) {
            ll t = s | key[i].first;
            ll cost = dp[s] + key[i].second;
            chmin(dp[t], cost);
        }
    }

    if(dp[N-1] == INF) {
        out(-1);
    }
    else {
        out(dp[N-1]);
    }

    re0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    int ans=INF;
    for(int i=-100;i<=100;i++){
        int sum=0;
        for(int j=0;j<n;j++){
            sum+=(i-a[j])*(i-a[j]);
        }
        ans=min(ans,sum);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string a,b,c;
int main(){
    c = "";
    cin >> a >> b;
    for(int i = 0;i < b.size();i++){
        c += a[i];
        c += b[i];
    }
    if(a.size() > b.size())c += a[a.size() - 1];
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
//d
#include<iostream>
using namespace std;
long long w[200];
long long v[200];
long long f[100010];
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>w[i]>>v[i];
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=m;j>=w[i];j--)
		{
			f[j]=max(f[j],f[j-w[i]]+v[i]);
		}
	}
	cout<<f[m];
}

Measured memory_bytes: 1024
require 'prime'
n = gets.chomp.to_i
data = Array.new
n.times { |i|
	data[i] = gets.chomp.to_i
}
data.sort!
prime = Prime.each(10000).to_a

cnt=0
n.times { |i|
	limit = Math::sqrt(data[i])
	j = 0
	flg = 1
	while j<prime.length && limit>=prime[j]
		if data[i]%prime[j]==0
			flg = 0
			break
		end
		j += 1
	end
	if flg == 1
		cnt += 1
	end
}
puts cnt

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

template<int um> class UF {
	public:
	vector<int> par,rank;
	UF() {rank=vector<int>(um,0); for(int i=0;i<um;i++) par.push_back(i);}
	int operator[](int x) {return (par[x]==x)?(x):(par[x] = operator[](par[x]));}
	int operator()(int x,int y) {
		if((x=operator[](x))==(y=operator[](y))) return x;
		if(rank[x]>rank[y]) return par[x]=y;
		rank[x]+=rank[x]==rank[y]; return par[y]=x;
	}
};
UF<500000> uf;

int H,W;
string S[404];
int C[404*404][2];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W;
	FOR(y,H) cin>>S[y];
	
	FOR(y,H) FOR(x,W) {
		if(y && S[y][x]!=S[y-1][x]) uf(y*W+x,(y-1)*W+x);
		if(x && S[y][x]!=S[y][x-1]) uf(y*W+x,y*W+x-1);
	}
	
	FOR(y,H) FOR(x,W) C[uf[y*W+x]][(y+x)%2]++;
	
	
	ll ret=0;
	FOR(i,H*W) ret+=1LL*C[i][0]*C[i][1];
	cout<<ret<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 5744
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include<math.h>
#define QUEUE_SIZE 7
typedef struct{
  char name[10];
  int ms;
  
}P;
void Calc (int ,int);
void enque(P);
P deque(void);
P pro[100000];
int head =0,tail=0;
int main(){
  int d,s,i;
  scanf("%d %d",&d,&s);
  for(i=0;i<d;i++){
    scanf("%s%d",pro[tail].name,&pro[tail].ms);
    tail=(tail+1)%100000;
  }
    Calc(s,d);
    return 0;
}
  void Calc(int q,int n)
  {int Q=0;
    P a;
    while (1){
      a=deque();
      if(a.ms >q){
	a.ms=a.ms-q;
	enque(a);
	Q+=q;}
      else if(a.ms<=q){
	Q+=a.ms;
	printf("%s %d\n",a.name,Q);
	n--;
	if(n==0)break;
      }
    }
  }
  

  void enque(P k){
    pro[tail]=k;
    tail=(tail+1)%100000;
  }
  P deque(void){
    P k;
    k=pro[head];
    head=(head+1) %100000;
    return k;
  }



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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

struct rule{
  int a;
  int b;
  int c;
  int k;
};

int main(){
  while(1){
    int p,q;
    cin >> p >> q;
    if(p==0) return 0;
    vector<rule> r(p);
    string s;
    int a=0,b=0,c=0;
    rep(i,p){
      cin >> s;
      bool ok=true;
      int id=0;
      rep(j,s.length()){
        if(ok){
          if(s[j]=='.'){
            id++;
          }else{
            ok=false;
          }
        }
      }
      r[i]={a,b,c,id};
      rep(j,s.length()){
        if(s[j]=='('){
          a++;
        }else if(s[j]==')'){
          a--;
        }else if(s[j]=='{'){
          b++;
        }else if(s[j]=='}'){
          b--;
        }else if(s[j]=='['){
          c++;
        }else if(s[j]==']'){
          c--;
        }
      }
    }
    vector<rule> t(q);
    rep(i,q){
      cin >> s;
      bool ok=true;
      int id=0;
      t[i]={a,b,c,0};
      rep(j,s.length()){
        if(s[j]=='('){
          a++;
        }else if(s[j]==')'){
          a--;
        }else if(s[j]=='{'){
          b++;
        }else if(s[j]=='}'){
          b--;
        }else if(s[j]=='['){
          c++;
        }else if(s[j]==']'){
          c--;
        }
      }
    }
    vector<int> ans(q,-1);
    repp(x,1,21){
      repp(y,1,21){
        repp(z,1,21){
          rep(i,p){
            if(x*r[i].a+y*r[i].b+z*r[i].c!=r[i].k){
              goto next;
            }
          }
          rep(i,q){
            if(ans[i]==-1){
              ans[i]=x*t[i].a+y*t[i].b+z*t[i].c;
            }else{
              if(ans[i]!=x*t[i].a+y*t[i].b+z*t[i].c){
                ans[i]=-2;
              }
            }
          }
          next:;
        }
      }
    }
    rep(i,q){
      cout << (ans[i]>=0?ans[i]:-1);
      if(i<q-1) cout << " ";
      else cout << endl;
    }
  }
  return 0;
}



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

int main(void) {
    ll H;cin>>H;
    ll result = 0;
    ll current_monsters = 1;
    ll cnt = 1;
    while (H > 0) {
        result += current_monsters;
        current_monsters = pow(2, cnt);
        H /= 2;
        cnt++;
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int N, M, X, Y;
    scanf("%d %d %d %d", &N, &M, &X, &Y);
    int x[N],y[M];
    for(int i = 0; i < N; i++){
        scanf("%d", &x[i]);
    }
    for(int i = 0; i < M; i++){
        scanf("%d",&y[i]);
    }

    int maxx = x[0];
    for(int i = 1; i < N; i++){
        if(maxx < x[i]) maxx = x[i];
    }
    int miny = y[0];
    for(int i = 1; i < M; i++){
        if(miny > y[i]) miny = y[i];
    }

    if(maxx < miny && X < miny && Y > maxx){
        printf("No War\n");
    }else{
        printf("War\n");
    }

    // if(maxx < miny){
    //     if(X < miny && Y > maxx) 
    // }

    return 0;
}

Measured memory_bytes: 128
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn g(x: i64) -> i64 {
  (x / 4 * 4 .. x).fold(0, |acc, y| acc ^ y)
}

fn main() {
  input! {
    a: i64,
    b: i64
  }
  println!("{}", g(b+1) ^ g(a));
}


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

int main() {
	int n,k,x,sum;
	sum=0;
	cin >> n >> k;
	for(int i =0;i<n;i++){
		cin >> x;
		sum+=min(x,k-x);
	}
	cout << sum*2;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  int N, X, T;
  cin >> N >> X >> T;
  cout << (N/X + (N%X?1:0)) * T << endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

const int INF { (int)1e9 };
const int dx[] {1, 0, -1, 0};
const int dy[] {0, 1, 0, -1};

vector<vector<int>> d;

int main() {
  int H, W; cin >> H >> W;
  vector<string> s(H);
  for (int i = 0; i < H; i++) cin >> s[i];

  int sb {};
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (s[i][j] == '#') sb++;
    }
  }

  d.assign(H, vector<int>(W, INF));
  d[0][0] = 0;
  deque<P> que { P(0, 0) };
  while (!que.empty()) {
    P p = que.front(); que.pop_front();
    if (p.first == H - 1 and p.second == W - 1) break;
    for (int i = 0; i < 4; i++) {
      int nx { p.first + dx[i] }, ny { p.second + dy[i] };
      if (0 <= nx and nx < H and 0 <= ny and ny < W and s[nx][ny] != '#' and d[nx][ny] == INF) {
        que.push_back(P(nx, ny));
        d[nx][ny] = d[p.first][p.second] + 1;
      }
    }
  }

  int goal { d[H - 1][W - 1] };
  if (goal == INF) {
    cout << -1 << endl;
  } else {
    cout << H * W - sb - goal - 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
s = str(input())
s = s.replace('BC', 'D')
n = len(s)

ans = 0
cnt = 0
for i in range(n):
    if s[i] == 'A':
        cnt += 1
    if s[i] == 'D':
        ans += cnt
    if s[i] == 'B' or s[i] == 'C':
        cnt = 0
print(ans)

Measured memory_bytes: 3500
N,X = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)

ans = 0
A.map! {|n| X <= n ? (ans += n - X; X) : n }
1.step(N-1) do |i|
  n = A[i-1] + A[i]
  if X < n
    m = n - X
    A[i] -= m
    A[i-1] += A[i] if A[i] < 0
    ans += m
  end
end
puts ans


Measured memory_bytes: 8588
#include<bits/stdc++.h>
using namespace std;
vector<int> h;
int n,temp;
vector<long long> sum;
int main()
{
    int j,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>temp;
        h.push_back(temp);
        sum.push_back(INT_MAX);
    }
    sum[0]=0;
    for(int i=0;i<n-1;i++)
    {
        for(j=1;j<=k;j++)
        {
            if(i+j<n && sum[i+j]>sum[i]+abs(h[i+j]-h[i]))
                sum[i+j]=sum[i]+abs(h[i+j]-h[i]);
        }
    }
    cout<<sum[n-1]<<endl;
    return 0;

}


Measured memory_bytes: 1780
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  ll n;
  cin >> n;
  vector<ll> x(n), y(n);
  for (int i = 0; i<n; i++){
    cin >> x[i];
    y[i] = x[i];
  }
  sort(x.begin(), x.end());
  int key = x[n / 2];
  //cout << key << endl;
  for (int i = 0; i < n; i++){
    if(y[i] < key){
      cout << x[n / 2] << "\n";
    }else{
      cout << x[n / 2 - 1] << "\n";
    }
  }

  return 0;
}

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

int main(){
  int n,k,l[50],ans=0;
  cin >> n >> k;
  for(int i=0;i < n;i++) cin >> l[i];
  sort(l, l+n, greater<int>());
  for(int i=0;i<k;i++){
    ans += l[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <iomanip>

using namespace std;

int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin>>a[i];
  
  int count=0;
  for(int i=0;i<n;i++){
    while(a[i]%2==0){
      count++;
      a[i]/=2;
    }
  }
  
  cout<<count;
  
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep1c(i, n) for (int i = 1; i <= (int)(n); i++)

using namespace std;
typedef long long ll;

vector<ll> ss, ts, xs;

void solve() {
  for(const ll& x : xs) {
    decltype(ss)::iterator sitr = upper_bound(ss.begin(), ss.end(), x);
    ll rs = *sitr;
    ll ls = *(--sitr);
    decltype(ts)::iterator titr = upper_bound(ts.begin(), ts.end(), x);
    ll rt = *titr;
    ll lt = *(--titr);
    ll minv = 20000000020;
    minv = min(minv, max(rs, rt)-x);
    minv = min(minv, x-min(ls, lt));
    minv = min(minv, (x-ls)+(rt-ls));
    minv = min(minv, (x-lt)+(rs-lt));
    minv = min(minv, (rs-x)+(rs-lt));
    minv = min(minv, (rt-x)+(rt-ls));
    printf("%lld\n", minv);
  }
}

int main() {
  int A, B, Q;
  scanf("%d %d %d", &A, &B, &Q);
  ll s, t, x;
  rep(i, A) {
    scanf("%lld", &s);
    ss.push_back(s);
  }
  ss.push_back(-50000000000-1);
  ss.push_back(50000000000+1);
  sort(ss.begin(), ss.end());
  rep(i, B) {
    scanf("%lld", &t);
    ts.push_back(t);
  }
  ts.push_back(-50000000000-2);
  ts.push_back(50000000000+2);
  sort(ts.begin(), ts.end());
  rep(i, Q) {
    scanf("%lld", &x);
    xs.push_back(x);
  }
  solve();
  return 0;
}


Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int a[27]={0},x=0;
	for(int i=0;i<4;i++){
		a[int(s[i])-64]++;
	}
	for(int i=1;i<28;i++){
		if(a[i]==2){
			x++;
		}
	}
	if(x==2){
		cout<<"Yes";
	}
	else cout<<"No";
}


Measured memory_bytes: 256
import sys
def solve(xa1,ya1,xa2,ya2,xb1,yb1,xb2,yb2):
    if xa2 < xb1 or xb2 < xa1 or ya2 < yb1 or yb2 < ya1:
        return 'NO'
    return 'YES'

for line in sys.stdin.readlines():
    f=map(float, line.split())
    print solve(*f)

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

using namespace std;

#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define int long long
#define mp make_pair
#define ff first
#define ss second
#define pii pair<int,int>
#define INF LLONG_MAX
#define EPS 1e-9
#define all(v) (v).begin(),(v).end()
#define sq(x) ((x)*(x))
#define foreach(it, v) for(auto it=(v).begin(); it != (v).end(); ++it)
#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)


#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}
 
template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}
 
typedef long double dbl;
bool codejam = 0;

const int MOD = 1000*1000*1000 + 7;
const int NMAX = 1000*1000 + 11;

int arr[NMAX];
int n,m,p,q,k,a,b,c,ans;
string s,str;
char ch;
vector<int> v;

void solve()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    
    while(true){
        c = max(0LL, c-b);
        if(c == 0){
            cout<<"Yes";
            return;
        }
        a = max(0LL, a - d);
        if(a == 0){
            cout<<"No";
            return;
        }
    }
}

int32_t main(){ fio;
    int t = 1;
    int cs = 1;
    // cin>>t;
    while(t--){
        if(codejam){
            cout<<"Case #"<<cs<<": ";
        }
        cs++;
        solve();
        cout<<"\n";
    }
}

Measured memory_bytes: 3640
n, m = gets.chomp.split().map(&:to_i)
submits = Hash.new()
m.times do
 p, s = gets.chomp.split()
 if submits.has_key?(p)
  if not submits[p]['AC'] > 0
   submits[p][s] += 1
  end
 else
  submits[p] = {'AC'=>0, 'WA'=>0}
  submits[p][s] = 1
 end
end

ac = 0
wa = 0
for q, aw in submits
 if aw['AC'] > 0
  ac += 1
  wa += aw['WA']
 end
end

printf("%d %d\n", ac, wa)

Measured memory_bytes: 43516
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main(){
  int n;
  cin >> n;
  int l[100];
  int ans = 0;
  rep(i, n) cin >> l[i];
  for(int i = 0; i < n-2; i++){
    for(int j = i+1; j < n-1; j++){
      for(int k = j+1; k < n; k++){
        if(l[i] == l[j] || l[j] == l[k] || l[k] == l[i]) continue;
        int a[3];
        a[0] = l[i];
        a[1] = l[j];
        a[2] = l[k];
        sort(a, a + 3);
        if(a[2] < a[0] + a[1])
          ans++;
      }
    }
  }
  cout << ans << endl;
}
    

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

int main()
{
	int h,w;
	cin>>h>>w;
	char grid[h][w];
	for(int i=0;i<h;i++)
	{
		string a;
		cin>>a;
		for(int j=0;j<w;j++)
		{
			grid[i][j]=a[j];
		}
	}

	ll dp[h][w];
	dp[0][0]=1;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			dp[i][j]=0;
			if(i==0 && j==0)
				dp[i][j]=1;
			else if(grid[i][j]=='.')
			{
				if(i-1>=0)
				{
					dp[i][j]+=dp[i-1][j];
				}
				if(j-1>=0)
				{
					dp[i][j]+=dp[i][j-1];
				}
			}
			dp[i][j]%=M;
		}
	}

	cout<<dp[h-1][w-1]<<endl;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
ll GCD(ll a, ll b){
    return b ? GCD(b, a%b) : a;
}
ll LCM(ll a, ll b){
    return a/GCD(a,b)*b;
}
int main(){
    int A,B,X;
    cin>>A>>B>>X;
    if(X>=A&&X<=A+B) cout<<"YES";
    else cout<<"NO";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long i64;
typedef pair<i64,i64> P;


int a,b;

int main(){
	cin >> a >> b;
	if(a == b) cout << a+b << endl;
	else cout << max(a,b)*2-1 << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long INF = (1LL << 32);
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

#define Endl endl

/*--------------------template--------------------*/


int main() {
	cin >> n >> m >> k;
	ll x, y;
	cin >> x >> y;
	ans = n * x + m * y;
	sum = INF;
	if(x>y){
		sum = y * k * 2 + (x - y) * n;
		chmin(sum, x * k * 2);
	}else{
		chmin(ans, x * k * 2 + (y - x) * m);
		chmin(ans, y * k * 2);
	}
	cout << min(ans, sum) << endl;
}

Measured memory_bytes: 256
num, l = map(int, input().split())
sum = 0
for i in range(1, num + 1):
    sum += i

all_pie = num * l + sum - num
if l >= 0:
    print(all_pie - l)
elif abs(l) <= num -1:
    print(all_pie)
else:
  print(all_pie - (l + num - 1))

Measured memory_bytes: 3060
#include <stdio.h>

int main(){
	int a, b, c = 1;
	scanf("%d %d", &a, &b);
	int cont;
	while(c <= 3) {
		cont = a * b * c;
		if(cont %2 != 0) {
			printf("Yes\n");
			return 0;
		}
		else
			c++;
	}
	printf("No\n");

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>
#define MAXN 100000
using namespace std;

typedef long long int lli;

int N, M, H[MAXN], HH[MAXN], ans;
vector<int> G[MAXN];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> M;
    for(int j = 0; j < N; ++j)
        cin >> H[j];
    for(int j = 0; j < M; ++j){
        int a, b; cin >> a >> b;
        G[a - 1].push_back(b - 1);
        G[b - 1].push_back(a - 1);
    }
    for(int v = 0; v < N; ++v){
        for(int j = 0; j < G[v].size(); ++j){
            int u = G[v][j];
            HH[v] = max(HH[v], H[u]);
        }
        if(HH[v] < H[v])
            ++ans;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 9492
#include<stdio.h> 
int main()
{
    char S[100];
    scanf("%s",S);
    if(S[0]=='S'){
    printf("Cloudy\n");
        }
    else if(S[0]=='C'){
    printf("Rainy\n");
        }
    else if(S[0]=='R'){
    printf("Sunny\n");
        }
}

Measured memory_bytes: 128