akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

class UnionFind
  attr_accessor :par, :size

  def initialize(n)
    @par = Array.new(n) { |i| i }
    @size = Array.new(n) { 1 }
  end

  def root(x)
    return x if @par[x] == x

    return @par[x] = root(@par[x])
  end

  def unite(x, y)
    rx = root(x)
    ry = root(y)

    return if rx == ry

    @par[rx] = ry
    @size[ry] += @size[rx] # ここはry = rxであってる
  end

  def same(x, y)
    root(x) == root(y)
  end

  def to_h
    @par.each.with_index.each_with_object({}) do |(_, i), sum|
      ri = root(i)
      sum[ri] = [] unless sum[ri]
      sum[ri].push(i)
    end
  end

  def size(x)
    @size[root(x)]
  end
end

N, M = get_ints

X = []
M.times do |i|
  X[i] = get_ints
end

ans = []
ans << (N * (N-1)) / 2

union_find = UnionFind.new(N+1)

X.reverse.each do |a, b|
  if union_find.same(a, b)
    ans << ans.last
  else
    ans << (ans.last - union_find.size(a) * union_find.size(b))
    union_find.unite(a,b)
  end
end

ans.reverse[1..].each do |x|
  puts x
end


Measured memory_bytes: 26424
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<cmath>
#include<string>

#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back

#define N 100005
#define M 200005
#define seed 23333

using namespace std;
vector<int>v[N];
int i,j,m,n,p,k,ve[N],d[N],c[N],vis[N][11],col[N],x,y,Q;
pair<int,int>Que[N*20]; 
void work(int x,int dis,int ci)
{
		int i,l,r;
		if (vis[x][dis]) return;
		Que[r=1]=mk(x,dis);
		if (!col[x]) col[x]=ci;
		for (l=1;l<=r;++l)
		{
				int px=Que[l].fi,py=Que[l].se;
				if (!py) continue;
				for (i=0;i<(int)v[px].size();++i)
				{
						int k=v[px][i];
						if (vis[k][py-1]) continue;
						vis[k][py-1]=1;
						Que[++r]=mk(k,py-1);
						if (!col[k]) col[k]=ci;
				}
		}
}
int main()
{
		scanf("%d%d",&n,&m);
		for (i=1;i<=m;++i)
		{
				scanf("%d%d",&x,&y);
				v[x].pb(y);v[y].pb(x); 
		}
		scanf("%d",&Q); 
		for (i=1;i<=Q;++i)
				scanf("%d%d%d",&ve[i],&d[i],&c[i]);
		for (i=Q;i;--i) work(ve[i],d[i],c[i]);
		for (i=1;i<=n;++i) printf("%d\n",col[i]);
}


Measured memory_bytes: 17784
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 100005
#define pb push_back
#define vit vector<int>::iterator
typedef pair<int,int> pii;
map<int,int>M;
vector<int> V[MAX];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    while(k--){
        if(a>=b){
            b*=2;
        }
        else{
            c*=2;
        }
    }
    if(b>a && c>b) cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 6004
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let n = read_as_vec::<u64>()[0];
    let a = read_as_vec::<u64>();

    let mut students = a.into_iter().enumerate().collect::<Vec<(usize, u64)>>();

    students.sort_by_key(|s| s.1);

    for s in  students{
        print!("{} ", s.0+1);
    }
    println!("");
}


Measured memory_bytes: 8444
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
//////////////////////////////////

int main() {
  long long n, d; cin >> n >> d;
  int cnt = 0;
  long long x, y;
  for(int i=0; i<n; i++) {
    cin >> x >> y;
    if (d*d >= x*x + y*y) cnt++;
  }
  cout << cnt << endl;

  return 0;
}

// EOF

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int a,b,c;
    Scd3(a,b,c);
    printf ("%s\n", a+b+c>21?"bust":"win" );

    return 0;
}



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

N,Q=map(int,input().split())

seg_el=1<<(N.bit_length()) # Segment treeの台の要素数
SEG=[(1<<31)-1]*(2*seg_el) # 1-indexedなので、要素数2*seg_el.Segment treeの初期値で初期化
LAZY=[None]*(2*seg_el) # 1-indexedなので、要素数2*seg_el.Segment treeの初期値で初期化


def indexes(L,R):
    INDLIST=[]

    R-=1
    
    L>>=1
    R>>=1

    while L!=R:
        if L>R:
            INDLIST.append(L)
            L>>=1
        else:
            INDLIST.append(R)
            R>>=1

    while L!=0:
        INDLIST.append(L)
        L>>=1

    return INDLIST
        

def updates(l,r,x): # 区間[l,r)をxに更新
        
    L=l+seg_el
    R=r+seg_el

    L//=(L & (-L))
    R//=(R & (-R))

    UPIND=indexes(L,R)
    
    for ind in UPIND[::-1]:
        if LAZY[ind]!=None:
            LAZY[ind<<1]=LAZY[1+(ind<<1)]=SEG[ind<<1]=SEG[1+(ind<<1)]=LAZY[ind]
            LAZY[ind]=None
    
    while L!=R:
        if L > R:
            SEG[L]=x
            LAZY[L]=x
            L+=1
            L//=(L & (-L))

        else:
            R-=1
            SEG[R]=x
            LAZY[R]=x
            R//=(R & (-R))

    for ind in UPIND:
        SEG[ind]=min(SEG[ind<<1],SEG[1+(ind<<1)])  
        
def getvalues(l,r): # 区間[l,r)に関するminを調べる

    L=l+seg_el
    R=r+seg_el

    L//=(L & (-L))
    R//=(R & (-R))

    UPIND=indexes(L,R)
    
    for ind in UPIND[::-1]:
        if LAZY[ind]!=None:
            LAZY[ind<<1]=LAZY[1+(ind<<1)]=SEG[ind<<1]=SEG[1+(ind<<1)]=LAZY[ind]
            LAZY[ind]=None
            
    ANS=1<<31

    while L!=R:
        if L > R:
            ANS=min(ANS , SEG[L])
            L+=1
            L//=(L & (-L))

        else:
            R-=1
            ANS=min(ANS , SEG[R])
            R//=(R & (-R))

    return ANS

ANS=[]

for _ in range(Q):
    query=list(map(int,input().split()))
    if query[0]==0:
        updates(query[1],query[2]+1,query[3])

    else:
        ANS.append(getvalues(query[1],query[2]+1))


print("\n".join([str(ans) for ans in ANS]))



Measured memory_bytes: 17616
#include <bits/stdc++.h>
using namespace std;
#define maxn 200010
#define left _left
#define right _right
vector <int> adj[maxn];
set <int> st[maxn];
int left[maxn], right[maxn], vis[maxn], n;


bool dfs (int v){
	if (vis[v]) return 0;
	vis[v]=1;
	for (int i=0; i<adj[v].size(); i++){
		int nt= adj[v][i];
		if (right[nt]==-1 or dfs(right[nt])){
			right[nt]=v;
			left[v]=nt;
			return 1;
		}
	}
	return 0;
}

int match (){
	memset(left, -1, sizeof(left));
	memset(right, -1, sizeof(right));
	int res=0;
	while(1){
		int ok= 0;
		for (int i=1; i<=n; i++) vis[i]=0;
		for (int i=1; i<=n; i++){
			if (left[i]==-1 and !vis[i] and dfs(i)){
				res++;
				ok=1;
			}
		}
		if (!ok) break;
	}
	return res;
}

int par[maxn], tk[maxn];

int U[maxn], V[maxn];

int main(){
	int x, y;
	cin>>n;
	for (int i=1; i<n; i++){
		cin>>x;
		while (x--){
			cin>>y;
			st[i].insert(y);
			adj[y].push_back(i);

		}
	}
	if(match()<n-1){
		cout<<-1<<endl;
		return 0;
	}
	int root;
	for (int i=1; i<=n; i++){
		if (left[i]==-1) root=i;
	}
	tk[root]=1;
	queue <int> Q;
	memset(par, -1, sizeof(par));
	par[root]=root;
	Q.push(root);
	for (int i=0; i<adj[root].size(); i++){
		int nst= adj[root][i];
		st[nst].erase(st[nst].find(root));
	}
	while(!Q.empty()){
		int v= Q.front(), ok=0;
		for (int i=0; i<adj[v].size(); i++){
			int nst= adj[v][i], nt= right[nst];
			if (tk[nt]) continue;
			ok=1;
			par[nt]= v;
			tk[nt]=1;
			U[nst]= nt;
			V[nst]= v;
			Q.push(nt);
		}
		if (!ok) Q.pop();
	}
	for (int i=1; i<=n; i++){
		if (par[i]<0){
			cout<<-1<<endl;
			return 0;
		}
	}
	for (int i=1; i<n; i++) cout<<U[i]<<" "<<V[i]<<endl;
}

Measured memory_bytes: 40320
a,b,c,d = map(int,input().split())
from fractions import gcd

def lcm(x, y):
    return (x * y) // gcd(x, y)

count_b = b - b//c - b//d + b//lcm(c,d)
count_a = a-1 - (a-1)//c - (a-1)//d + (a-1)//lcm(c,d)
print(count_b-count_a)

Measured memory_bytes: 64492
// C - Write and Erase
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; cin>>N;
	set<int> S;
	rp(i, 0, N){
		int a; scanf("%d", &a);
		if(S.count(a)) S.erase(a);
		else S.insert(a);
	}
	printf("%d\n", (int)S.size());
}

Measured memory_bytes: 4864
//根号讨论的套路 
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll check_(ll b,ll n)
{
  if(n<b)
    return n;
  else
    return check_(b,n/b)+n%b;
}
ll n,s;
int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	scanf("%lld%lld",&n,&s);
	if(n<s)
	{
	  puts("-1");
	  return 0;
	}
	if(n==s)
	{
	  printf("%lld\n",n+1);
	  return 0;
	}
	ll m=(ll)sqrt(n)+1;
	for(ll i=2;i<=m;i++)
	{
	  if(check_(i,n)==s)
	  {
	    printf("%lld\n",i);
	    return 0;
	  }
	}
	n-=s;
	ll ans=1e11+1;
	for(ll i=1;i*i<=n;i++)
	{
	  if(n%i==0)
	  {
	    ll b=n/i+1;
	    ll a1=s-i;
	    ll a2=i;
	    if(b>=2&&a1>=0&&a1<b&&a2<b)
	      ans=min(ans,b);
	  }
	}
	if(ans==1e11+1)
	  puts("-1\n");
	else
	  printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 384
num = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(num[k-1])

Measured memory_bytes: 3060
import itertools
import math
import fractions
import functools
import copy

n = int(input())
v = list(map(int, input().split()))

kisu = [0]*(10**6)
gusu = [0]*(10**6)
for i in range(n):
    if i % 2 == 0:
        gusu[v[i]] += 1
    else:
        kisu[v[i]] += 1

count = 0
gusu_m = gusu.index(max(gusu))
kisu_m = kisu.index(max(kisu))

if gusu_m == kisu_m:

    gusu[gusu_m] = 0
    kisu[kisu_m] = 0
    if max(gusu) > max(kisu):
        gusu_m = gusu.index(max(gusu))
    else:
        kisu_m = kisu.index(max(kisu))

for i in range(n):
    if i % 2 == 0 and gusu_m != v[i]:
        count += 1
    if i % 2 != 0 and kisu_m != v[i]:
        count += 1

print(count)


Measured memory_bytes: 94312
n = int(input())
Pre = list(map(int, input().split()))
In = list(map(int, input().split()))

def gao(Pre, l, r, In: list, L, R):
    if l > r:
        return []
    offset = In.index(Pre[l]) - L
    return gao(Pre, l + 1, l  + offset, In, L, L + offset - 1) + gao(Pre, l + offset + 1, r, In, L + offset + 1, R) + [Pre[l]]

print(*gao(Pre, 0, n - 1, In, 0, n - 1))


Measured memory_bytes: 5608
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        n: usize,
    }
    for i in 0..n + 1 {
        let x = i * 108 / 100;
        if x == n {
            println!("{}", i);
            return;
        }
    }
    println!(":(");
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        static long Eat(ref long x, ref long y)
        {
            long count = Min(x, y);
            x -= count;
            y -= count;
            return count;
        }

        static void Main(string[] args)
        {
            long a, b, c;
            ReadLong(out a, out b, out c);

            long ans = 0;
            ans += Eat(ref a, ref c);
            ans += Eat(ref b, ref c) * 2;
            ans += b;
            if (c > 0)
            {
                ans++;
            }

            Console.WriteLine(ans);
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}

Measured memory_bytes: 13396
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] x = new int[N];
		for(int i = 0;i < N;++i)
			x[i] = sc.nextInt();
		sc.close();
		
		int ans = 0;
		for(int i = 0;i < N;++i) {
			if(x[i] > K - x[i])
				ans += 2 * (K - x[i]);
			else
				ans += 2 * x[i];
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 22868
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <iterator>
#include <queue>
#include <stack>
#include <deque>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <string>
#include <cmath>
#include <complex>
#include <functional>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cstdlib>
#include <cctype>

#define REP(i,m,n) for(int i=m;i<(int)n;i++)
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rrep(i,n) for(int i = 1; i <= n; i++)
#define drep(i,n) for(int i = n; i >= 0; i--)
#define rp(i,c) rep(i,(int)c.size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(u) (u).rbegin(),(u).rend()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl
#define v_delete(a,b) (a).erase(remove((a).begin(), (a).end(), b), (a).end())
#define v_unique(a) (a).erase(unique((a).begin(), (a).end()), (a).end())
#define VV(T) vector<vector< T > >
#define init(a,b) memset((a), (b), sizeof((a)))
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;


template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}

template <class T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
template <class T> void input(T* a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }

int chmax(int& a,int b){
	if(b > a){
		a=b;
	}
	return a;
}
int chmin(int& a,int b){
	if(b < a){
		a=b;
	}
	return a;
}

int dp [1 << 16 ][16];
int d[16][16]={inf};
int main(){
	int V,E;
	cin >> V >> E;
	rep(i,16){
		rep(j,16){
			d[i][j]=inf;
		}
	}
	rep(i,1 << 16){
		rep(j,16){
			dp[i][j]=inf;
		}
	}
	rep(i,E){
		int s,t,di;
		cin >> s >> t >> di;
		d[s][t]=di;
	}
	dp[(1 << V) -1][0]=0;
	for(int S=(1 << V)-2;S >= 0;S--){
		for(int s=0;s<V;s++){
			for(int t=0;t<V;t++){
				if(!(S >> t & 1)){
					dp[S][s]=min(dp[S][s],dp[S | 1 << t][t]+d[s][t]);
				}
			}
		}
	}
	cout << ((dp[0][0] == inf ) ? -1 : dp[0][0]) << endl;
	return 0;
}

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

vector <int> from[10];
int vis[10];

bool dfs(int x, int tot){
	vis[x] = 1;
	if (tot == 4) return 1;
	for (int i = 0; i < from[x].size(); i++){
		int v = from[x][i];
		if (vis[v]) continue;
		if (dfs(v, tot + 1)) return 1;
	}
	vis[x] = 0;
	return 0;
}

int main(){
	for (int i = 0; i < 3; i++){
		int u, v; scanf("%d%d", &u, &v);
		from[u].push_back(v), from[v].push_back(u);
	}
	for (int i = 1; i <= 4; i++){
		memset(vis, 0, sizeof(vis));
		if (dfs(i, 1)){
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}


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

int main(){
    int N; cin >> N;
    int a[100010],imos[100010];
    fill(a,a+100010,0);
    fill(imos,imos+100010,0);
    for(int i = 0; i < N; i++){
        int s,t; cin >> s >> t;
        s--; t--;
        a[s]++;
        a[t+1]--;
    }
    for(int i = 1; i <= 100005; i++){
        imos[i] = imos[i-1]+a[i];
    }
    int ans = 0;
    for(int i = 0; i <= 100005; i++){
        if (imos[i] >= i){
            ans = i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3880
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int a;
	cin>>a;
	int out=1;
	loop(i,2,a){
		int t=i*i;
		while(t<=a){
			out=max(out,t);
			t*=i;
		}
	}
	cout<<out<<endl;
}










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

int main()
{
    int N;
    cin >> N;
    vector<int> H(N);
    for (int i = 0; i < N; i++)
        cin >> H[i];

    reverse(H.begin(), H.end());

    int ans = 0;
    int val = 0;

    for (int i = 1; i < N; i++) {
        if (H[i-1] <= H[i])
            val++;
        else
            val = 0;
        ans = max(ans, val);
    }

    cout << ans << '\n';
    return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


i64 A, B, C;


void solve() {
  if (A == B && B != C) {
    cout << "Yes" << endl;
    return;
  }
  if (B == C && C != A) {
    cout << "Yes" << endl;
    return;
  }
  if (C == A && A != B) {
    cout << "Yes" << endl;
    return;
  }
  cout << "No" << endl;
}

int main() {
  cin >> A >> B >> C;

  solve();

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <bitset>
 
using namespace std;
typedef long long ll;

#define pb push_back
#define fe first
#define se second
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef __APPLE__
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) 42
#endif
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n,ans=0; ll m;
    cin >> n >> m;
    vector<pair<ll,ll>>a(n);
    for(auto &i:a) cin >> i.fe >> i.se;
    for(auto &i:a){
        double d= sqrt(i.fe*i.fe+i.se*i.se);
        if(d<=m) ++ans;
    }
    cout << ans;
}

Measured memory_bytes: 5984
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

int main() {
	string s;
	cin >> s;
	vector<int> ans;
	rep(i, s.size()) {
		if (s[i] == '0') ans.push_back(0);
		else if(s[i] == '1') ans.push_back(1);
		else if (s[i] == 'B') {
			if(ans.size() > 0)
				ans.pop_back();
		}
	}

	rep(i, ans.size()) {
		cout << ans[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
num = gets.to_i
data = gets.chomp.split(" ").map(&:to_i)
flag = 0
count = -1

unless data.size == num
    print("elements are missing")
else
    while flag != 1
        num.times do |i|
            if data[i] % 2 == 0
                data[i] /= 2
            else
                flag = 1
            end
        end
        count += 1
    end
    p count
end


Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

int N,M;
int main(){
  int A, B, C;
  cin >> A >> B >> C;
  int ans =  max((C + B - A),0);
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        char[] s = new char[100000];
        char[] t = new char[100000];
        int n = in.read(s, 0, s.length);
        int m = in.read(t, 0, t.length);

        int[][] c = new int[26][n + 1];

        for (int i = 0; i < n; i++) {
            c[s[i] - 'a'][i] = i;
        }
        for (int i = 0; i < 26; i++) {
            int[] d = c[i];
            d[n] = -1;
            for (int j = n - 1; j >= 0; j--) {
                if (d[j] == 0) {
                    d[j] = d[j + 1];
                }
            }
        }
        c[s[0] - 'a'][0] = 0;

        long ans = 0;
        int j = 0;
        for (int i = 0; i < m; i++) {
            int k = t[i] - 'a';

            if (c[k][0] == -1) {
                ans = -1;
                j = 0;
                break;
            }

            j = c[k][j];
            if (j == -1) {
                ans += n;
                j = c[k][0];
            }

            j++;
        }
        ans += j;

        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


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

int main() {
    string w;
    cin >> w;

    string word;
    int count = 0;
    while (true) {
        cin >> word;
        if (word == "END_OF_TEXT") { break; }
        for (int i = 0; i < word.size(); i++) {
            word[i] = tolower(word[i]);
        }
        if (word == w || word == w+".") {
            count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3164
#include<stdio.h>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;
char str[310];
int dp[310][310];
int rev[310][310];
int main(){
	while(1){
		scanf("%s",str);
		if(str[0]=='#')return 0;
		int ret=0;
		string ans="";
		int len=strlen(str);
		for(int i=0;str[i+1];i++){
			int n=i+1;
			int m=len-n;
			for(int j=0;j<=n;j++)for(int k=0;k<=m;k++)dp[j][k]=-999999;
			dp[0][0]=0;
			for(int j=0;j<=n;j++)for(int k=0;k<=m;k++){
				if(j<n&&dp[j+1][k]<dp[j][k]){
					dp[j+1][k]=dp[j][k];
					rev[j+1][k]=1;
				}
				if(k<m&&dp[j][k+1]<dp[j][k]){
					dp[j][k+1]=dp[j][k];
					rev[j][k+1]=2;
				}
				if(j<n&&k<m&&dp[j+1][k+1]<dp[j][k]+1&&str[j]==str[i+1+k]){
					dp[j+1][k+1]=dp[j][k]+1;
					rev[j+1][k+1]=0;
				}
			}
			if(ret<dp[n][m]){
				ret=dp[n][m];
				string to="";
				int tn=n;
				int tm=m;
				while(tn&&tm){
					if(rev[tn][tm]==1)tn--;
					else if(rev[tn][tm]==2)tm--;
					else {
						tn--;tm--;
						to=str[tn]+to;
					}
				}
				ans=to;
			}
		}
		//printf("%d ",ret);
		printf("%s\n",ans.c_str());
	}
}

Measured memory_bytes: 1764
from collections import deque


def bfs(NEAR, S, N):  # 幅優先探索  # キュー
    dist = [-1 for _ in range(N)]
    pas = [-1 for _ in range(N)]
    dist[S], pas[S] = 0, 's'
    frag = set([S])
    que = deque([S])

    while len(que) > 0:
        q = que.popleft()
        near = NEAR[q]
        for i in near:
            if i in frag:
                continue
            que.append(i)
            frag.add(i)

    ans = 1
    if len(frag) == N:
        ans = 0
    return ans


n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

near = [set([]) for _ in range(n)]
for i, j in ab:
    near[i - 1].add(j - 1)
    near[j - 1].add(i - 1)

cnt = 0
for i, j in ab:
    near[i - 1].remove(j - 1)
    near[j - 1].remove(i - 1)
    cnt += bfs(near,1,n)
    near[i - 1].add(j - 1)
    near[j - 1].add(i - 1)
print(cnt)


Measured memory_bytes: 39792
n=int(input())
points = []
for _ in range(n):
  X,L = map(int,input().split())
  points.append([X+L, X -L])
points.sort(key = lambda x: x[0])
cur = -10**9
answer = 0
for point in points:
  if point[1] >= cur:
    answer += 1
    cur = point[0]
print(answer)

Measured memory_bytes: 21336
using System;
using System.Linq;
using System.Collections.Generic;

class Program{
  static void Main(){
    string[] NM = Console.ReadLine().Split(' ');
    int N = int.Parse(NM[0]);
    int M = int.Parse(NM[1]);
    
    // スイッチの付け方の全組み合わせ (0 ~ 2^N-1)
    var list = new List<int>();
    for (int i = 0; i < Math.Pow(2, N); i++){
      list.Add(i);
    }
    var tmplist = list.ToList();
    
    int[,] s = new int[M+1, N+1];
    for (int i = 0; i < M; i++){
      string[] input = Console.ReadLine().Split(' ');
      int k = int.Parse(input[0]);
      for (int j = 0; j < k; j++){
        s[i, j] = int.Parse(input[j + 1]);
      }
    }
    
    string[] p = Console.ReadLine().Split(' ');
    
    // 全探索
    for (int i = 0; i < M; i++){
      int mod = int.Parse(p[i]);
      list = tmplist.ToList();
      foreach (int L in list){
        string bin = Convert.ToString(L, 2);
        int binl = bin.Length;
        for (int b = 0; b < N - binl; b++){ // bin の長さを N に合わせる
          bin = "0" + bin;
        }
        
        int cnt = 0;
        
        for (int j = 0; j < N; j++){
          if (s[i, j] == 0)
            break;
          else if (bin.Substring(s[i, j] - 1, 1) == "1")
            cnt++;
        }
        if (cnt % 2 != mod)
          tmplist.Remove(L);
      }
    }
    Console.WriteLine(tmplist.Count);
  }
}


Measured memory_bytes: 13396
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

int main() {
  ios::sync_with_stdio(false);
  int H, W, d;
  cin >> H >> W >> d;
  vector<string> fld(H);
  REP(i,0,H) {
    REP(j,0,W) {
      int p = i + j;
      int q = i - j;
      int x = p % (2 * d);
      int y = (q % (2 * d) + 2 * d) % (2 * d);
      if(x < d) {
        if(y < d) {
          fld[i].push_back('R');
        } else {
          fld[i].push_back('Y');
        }
      } else {
        if(y < d) {
          fld[i].push_back('G');
        } else {
          fld[i].push_back('B');
        }
      }
    }
  }
  FOR(s,fld) {
    cout << s << endl;
  }
  return 0;
}


Measured memory_bytes: 768
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define popcnt(x) __builtin_popcount(x)
#define popcntll(x) __builtin_popcountll(x)
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class AConnectionAndDisconnection {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        string S;
        int K;
        in>>S>>K;
        int N = LEN(S);
        S += S + '*';
        int left = 0;
        lint ans = 0;
        FOR(i, 1, LEN(S)){
            if(S[left]==S[i]) continue;
            if(left==0 and i==2*N){
                out<<1ll*N*K/2<<'\n';
                return;
            }else if(i<N){
                ans += 1ll * (i-left) / 2 * K;
            }else{
                ans += 1ll * (i-left) / 2 * (K-1);
                ans += (N-left) / 2;
                ans -= 1ll * (i-N) / 2 * (K-1);
            }
            left = i;
            if(left>=N) break;
        }
        out<<ans<<'\n';
    }
};


int main() {
	AConnectionAndDisconnection solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3640
A,B = map(int, input().split())

#13 歳以上が乗るには B 円 (B は偶数) かかりますが、
#6 歳以上 12 歳以下の人はその半額で乗ることができ、 
#さらに 5 歳以下の人は無料

if A<=5:
  print("0")
elif A<=12:
  print(int(B/2))
else:
  print(B)

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

int main(){
int ary[5]={};
for(int i=0; i<5; i++){
    cin >>ary[i];
}
for(int i=0; i<5; i++){
if(ary[i]==0){
    cout <<i+1;
}
}


return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N, K, s;
ll sum, ans, a;

int main()
{
    cin >> N >> K;
    vector<ll> Sa(N + 1), S(N + 1);
    for (int i = 0; i < N; i++)
    {
        cin >> a;
        Sa[i + 1] += Sa[i] + a;
        S[i + 1] += S[i] + max(0LL, a);
    }

    for (int i = K; i <= N; i++)
    {
        ans = max((S[N] - S[i]) + S[i - K] + max(0LL, Sa[i] - Sa[i - K]), ans);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1920
/*input
3 1

*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
#define pb push_back 

int main() {
  int n,m;
  cin>>n>>m;
  if(n==2||m==2)
  	cout<<"No";
  else
  	cout<<"Yes";


return 0;
} 

Measured memory_bytes: 256
a,v = map(int, input().split())
b,w = map(int, input().split())
T = int(input())
if a>=b:
    if (a-b) > (v-w)*T:
        print('NO')
    else:
        print('YES')
else:
    if (b-a) > (v-w)*T:
        print('NO')
    else:
        print('YES')


Measured memory_bytes: 61588
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>

#include<vector>

#define INF 999999
using namespace std;
int main(){
    int N;
    while(cin>>N,N){
        int num[5500]={0},max=-INF;
        for(int i=0;i<N;i++){
            cin>>num[i];
        }
        for(int i=0;i<N;i++){
            int total=0;
            if(max<num[i])max=num[i];
            total+=num[i];
            for(int j=i+1;j<N;j++){
                total+=num[j];
                if(max<total)max=total;
            }
        }
        cout<<max<<endl;
    }
    return 0;
}

Measured memory_bytes: 1188
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
	string S;
	cin >> S;
	int s = 0;
	int r = 0;
	for(int i = 0; i < 3; i++){
		if(S[i] == 'S'){
			s++;
		}else{
			r++;
		}
	}
	
	if(r == 3){
		cout << 3 << endl;
	}else if(r == 2){
		if( S[1] == 'S'){
			cout << 1 << endl;
		}else{
			cout << 2 << endl;
		}
	}else{
		cout << r << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3624
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout]
fn main() {
    input! {
        D: i64, T: i64, S: i64
    }

    if T * S >= D {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2172
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // [b,c) イテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

int64_t N; cin >> N;
VI A(N); rep(i, 0, N) cin >> A[i];
int64_t all = abs(A[0]) + abs(A[N-1]); 
rep(i, 0, N-1) all += abs(A[i] - A[i+1]);

cout << all - abs(A[0]) - abs(A[0] - A[1]) + abs(A[1]) << "\n";
rep(i, 1, N-1)
    cout << all - abs(A[i-1] - A[i]) - abs(A[i] - A[i+1]) + abs(A[i-1] - A[i+1]) << "\n";
cout << all - abs(A[N-2] - A[N-1]) - abs(A[N-1]) + abs(A[N-2]) << "\n";


}
// 書いて考える
// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり



Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  int z=0;
  if(a+b>2*c){
    int w=min(x,y);
    z=2*w;
    x-=w;
    y-=w;
    //cout<<x<<" "<<y<<" "<<z<<endl;
    if(x>0 && a>2*c){
      z+=2*x;
      x=0;
    }
    else if(y>0 && b>2*c){
      z+=2*y;
      y=0;
    }
  }
  //cout<<x<<" "<<y<<" "<<z<<endl;
  cout<<a*x+b*y+c*z<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
#include <algorithm>
#define INF 1000000000
#define MAX_V 1000
#define MAX 10000000
using namespace std;

int V;
vector<int> G[MAX_V];
int match[MAX_V];
bool used[MAX_V];

void add_edge(int u, int v){
  G[u].push_back(v);
  G[v].push_back(u);
}

bool dfs(int v){
  used[v]=true;
  for(int i=0;i<G[v].size();i++){
    int u=G[v][i], w=match[u];
    if(w<0 || !used[w] && dfs(w)){
      match[v]=u;
      match[u]=v;
      return true;
    }
  }
  return false;
}

int bipartite_matching(){
  int res=0;
  memset(match, -1, sizeof(match));
  for(int v=0;v<V;v++){
    if(match[v]<0){
      memset(used, 0, sizeof(used));
      if(dfs(v)){
	res++;
      }
    }
  }
  return res;
}

int gcd(int x, int y){
  int r;
  if(x<y) swap(x, y);
  while(y>0){
    r=x%y;
    x=y;
    y=r;
  }
  return x;
}


main(){
  int m, n;
  while(1){
    cin >> m >> n;
    if(m==0 && n==0) break;
    for(int i=0;i<m+n;i++){
      G[i].clear();
    }
    int in1[500], in2[500];
    for(int i=0;i<m;i++){
      cin >> in1[i];
    }
    for(int i=0;i<n;i++){
      cin >> in2[i];
    }
    for(int i=0;i<m;i++){
      for(int j=0;j<n;j++){
	if(gcd(in1[i], in2[j])!=1) add_edge(i, m+j);
      }
    }
    V=m+n;
    cout << bipartite_matching() << endl;
  }
  return 0;
}

Measured memory_bytes: 3064
#include<stdio.h>

int main(){
	int N, i, ave, val;
	int ret, b;
	ret = 0;
	b = 0;
	scanf("%d\n", &N);
	int a[N];
	for(i = 0; i < N; i++){
		scanf("%d",&a[i]);
		ave += a[i];
	}
	ave = ave/N;
	for(i = 0; i < N; i++){
		val = (a[i] - ave);
		ret += val*val;
	}
	for(i = 0; i < N; i++){
		val = (a[i] - ave - 1);
		b += val*val;
	}
	if(ret > b) ret = b;
	b = 0;
	for(i = 0; i < N; i++){
		val = (a[i] - ave + 1);
		b += val*val;
	}
	if(ret > b) ret = b;
	printf("%d\n", ret);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void) {
	int n, h, w, a, b;
	cin >> n >> h >> w;
	int cnt = 0;
	for (int i = 0; i < n; ++i) {
		cin >> a >> b;
		if (a >= h && b >= w) ++cnt;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256