akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

using R = long double;
constexpr R pi = acos((R)-1), eps = 1e-10;

int sgn(R a) { return (a > eps) - (a < -eps); }
int sgn(R a, R b) { return sgn(a - b); }
using P = complex<R>;
istream& operator>>(istream& i, P& p) { R x, y; i >> x >> y; p = P(x, y); return i; }
ostream& operator<<(ostream& o, P p) { return o << fixed << setprecision(15) << real(p) << ' ' << imag(p); }
bool cmp(P p, P q) { return 2 * sgn(real(p), real(q)) + sgn(imag(p), imag(q)) < 0; }
bool eql(P p, P q) { return !cmp(p, q) and !cmp(q, p); }
R dot(P p, P q) { return real(conj(p) * q); }
R crs(P p, P q) { return imag(conj(p) * q); }
int ccw(P p, P q) {
  int s = sgn(crs(p, q));
  if (s) return s;
  if (dot(p, q) < 0) return -2;
  if (dot(p, q - p) > 0) return 2;
  return 0;
}
int ccw(P o, P p, P q) { return ccw(p - o, q - o); }
struct L {
  P s, t;
  P vec() const { return t - s; }
  R abs() const { return std::abs(vec()); }
  R arg() const { return std::arg(vec()); }
};
int ccw(L s, P p) { return ccw(s.s, s.t, p); }

// BEGIN CUT HERE
P proj(P p, L l) {
  P e = l.vec() / l.abs();
  return l.s + dot(p - l.s, e) * e;
}
P refl(P p, L l) { return (R)2 * proj(p, l) - p; }
R distPP(P p, P q) { return abs(q - p); }
R distPL(P p, L l) { return distPP(p, proj(p, l)); }
R distPS(P p, L s) {
  P q = proj(p, s);
  if (!ccw(s, q)) return distPP(p, q);
  return min(distPP(p, s.s), distPP(p, s.t));
}
R distLL(L l, L m) {
  if (sgn(crs(l.vec(), m.vec()))) return 0;
  return distPL(l.s, m);
}
R distLS(L l, L s) {
  if (ccw(l, s.s) * ccw(l, s.t) != 1) return 0;
  return min(distPL(s.s, l), distPL(s.t, l));
}
R distSS(L s, L t) {
  if (ccw(s, t.s) * ccw(s, t.t) <= 0 and ccw(t, s.s) * ccw(t, s.t) <= 0) return 0;
  return min({distPS(s.s, t), distPS(s.t, t), distPS(t.s, s), distPS(t.t, s)});
}
// END CUT HERE

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int q; cin >> q;
  while (q--) {
    L s, t; cin >> s.s >> s.t >> t.s >> t.t;
    cout << fixed << setprecision(15) << distSS(s, t) << '\n';
  }
}

// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3573104#1


Measured memory_bytes: 3384
#include <iostream>

using namespace std;

int main ()
{
    int A[5];
    int max=9,index=0;
    for(int i=0;i<5;i++)
    {
        cin>>A[i];
        if(A[i]%10<max && A[i]%10!=0)
        {
            max=A[i]%10;
            index=i;
        }
    }
    int shuma=0;
    for(int i=0;i<5;i++)
    {
        if(i!=index)
        {
            shuma+=A[i];
        }
        while (shuma%10!=0)
        {
            shuma++;
        }
    }
    shuma+=A[index];
    cout<<shuma<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main
{
   public static void main(String[] args)
   {
      Scanner stdIn = new Scanner(System.in);
      int a = stdIn.nextInt();
      int b = stdIn.nextInt();
      int c = a*b;
      int d = 2*(a+b);
      System.out.println( c + " " + d );
   }
}

Measured memory_bytes: 26164
import itertools

n=int(input())
a=[[] for i in range(n)]
#print(a)

for i in range(n):
    an=int(input())
    for j in range(an):
        a[i].append(list(map(int,input().split())))

#print(a)
ls=tuple(range(1,n+1))
res=0
for i in range(1,n+1):
    for s in list(itertools.combinations(ls,i)):
        c=list(s)
        my_bool=True
        for j in c:
            for k in range(len(a[j-1])):
                if a[j-1][k][1]==0:#lier
                    if a[j-1][k][0] in c:
                        my_bool=False
                        break
                else:
                    if not a[j-1][k][0] in c:
                        my_bool=False
                        break
            if not my_bool:
                break
        if my_bool:
            #print(c)
            res=max(res,len(c))
print(res)

Measured memory_bytes: 4852
X,Y = map(int,input().split())
b = 0
for i in range(1,X+1):
    a = X - i
    if (i*4)+(a*2) == Y:
        b = 1
    elif (i*2)+(a*4) == Y:
        b = 1
        
if b == 1:
    print("Yes")
else:
    print("No")

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

int main(void)
{
	int x,y,z,a=0,b,c;
	char s[4],t[4] = "abc";
	scanf("%s",s);
	for(x =0;x<3;x++)
	{
		for(y=0;y<3;y++) if (s[y] == t[x]) break;
		if (y==3)
		{
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,l;
  cin >> n >> l;
  vector<int>a(n);
  int c = INT_MAX;
  int d = 0;
  int sum  = 0;
  for(int i = 0;i<n;i++){
    a[i] = l+i;
    c = min(c,abs(a[i]));
  }
  for(int i = 0;i<n;i++){
    if(abs(a[i])==c) {d = i;sum -= a[d];}
  }
  for(int i = 0;i<n;i++){
   sum += a[i];
  }
  cout << sum;
  return 0;

  
}

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

int main(){
  int K;
  cin >> K;
  vector<int> v{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << v.at(K-1);
}

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


#define long long long int

using namespace std;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef pair<int, int> pi;


int main() {

    int n, k;
    cin >> n >> k;

    cout << (n * 500 >= k ? "Yes" : "No") << "\n";

    return 0;
}

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

int main()
{
    // freopen("input01.txt", "r", stdin);
    // freopen("output01.txt", "w", stdout);
    int n,d;
    cin>>n>>d;
    int a,b,ct=0;
    int i,j;
    for(i=0;i<n;i++)
    {
        cin>>a>>b;
        if((int)ceil(sqrt(pow(a,2) + pow(b,2))) <=d)
            ct++;
    }
    cout<<ct;
    return 0;
}

Measured memory_bytes: 3536
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

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

	int r;
	cin >> r;
	cout << r * r << endl;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109311;
const long double pi = 3.1415926535897932384626433;
typedef pair<int, int> P;
typedef pair<int, P> PP;
struct edge { int to, cost; };
int t[13];
int w[25];
signed main() {
	int n; cin >> n;
	t[0]++;
	rep(i, n) {
		int d; cin >> d; t[d]++;
	}
	vector<int>V;
	rep(i, 13) {
		if (i==0||i==12) {
			if (t[i] == 1) {
				w[i]++;
			}
			if(t[i]>1){
				cout << 0 << endl;
				return 0;
			}
		}
		else {
			if (t[i] == 2) {
				w[i]++;
				w[24 - i]++;
			}
			else if (t[i] > 2) {
				cout << 0 << endl;
				return 0;
			}
			else if (t[i] == 1) {
				V.push_back(i);
			}
		}
	}
	int res = 0;

	for (int i = 0; i < (1 << V.size()); i++) {
		int nw[30];
		rep(j, 24)nw[j] = w[j];
		rep(j, V.size()) {
			if (i&(1 << j))nw[V[j]] = 1;
			else nw[24 - V[j]] = 1;
		}
		vector<int>ans;
		rep(j, 24) {
			if (nw[j]) {
				ans.push_back(j);
				ans.push_back(24 + j);
			}
			
		}
		sort(ans.begin(), ans.end());
		//rep(j, ans.size())cout << ans[j] << endl; cout << endl;
		int k = 24;
		rep(j, ans.size() - 1) {
			k = min(k, ans[j + 1] - ans[j]);
		}
		res = max(res, k);
	}
	cout << res << endl;
}

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

typedef long long ll;
const ll MOD = 1e9+7;


int main(){
	int N,M;
    int a,b;
    int A_used=0,B_used=0;
    int margin=0;
    ll sum=1;
    set<int> A,B;
    cin>>N>>M;
    for(int i = 0;i<N;i++){
        cin>>a;
        if(A.count(a)>0){
            cout<<0<<endl;
            return 0;
        }
        A.insert(a);
    }
    for(int i = 0;i<M;i++){
        cin>>b;
        if(B.count(b)>0){
            cout<<0<<endl;
            return 0;
        }
        B.insert(b);
    }
    for(int num = M*N;num>0;num--){
        bool A_num=false,B_num=false;
        if(A.count(num)>0)A_num=true;
        if(B.count(num)>0)B_num=true;
        
        if(A_num&&B_num){
            margin+=A_used+B_used;
            A_used++,B_used++;
        }else if(!A_num&&!B_num){
            sum *= margin;
            sum %= MOD;
            margin--;
        }else if(A_num){
            sum *= B_used;
            sum %= MOD;
            margin+= B_used-1;
            A_used++;
        }else{//B_num
            sum *= A_used;
            sum %= MOD;
            margin+= A_used-1;
            B_used++;
        }
        if(sum==0){
            cout<<0<<endl;
            return 0;
        }
    }
    cout<<sum<<endl;
    
}


Measured memory_bytes: 512
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#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 rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
#define fi first
#define se second
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
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; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

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

    ll n,m;
    cin>>n>>m;
    vector<pair<ll,ll>> drink(n);
    rep(i,n){
        cin>>drink[i].first;
        cin>>drink[i].second;
    }

    sort(all(drink));

    ll total=0;
    ll bottle=0;
    rep(i,n){
        total+=drink[i].first*drink[i].second;
        bottle+=drink[i].second;

        while(bottle>m){
            total-=drink[i].first;
            bottle--;
        }

        if(bottle==m){
            cout<<total<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 4772
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main(){
    int D;
    cin >> D;
    vector<int> C(26);
    rep(i, 26) cin >> C[i];
    Graph S(D, vector<int>(26));
    rep(i, D){
        rep(j, 26) cin >> S[i][j];
    }

    vector<int> T(D), last(26, -1);
    rep(i, D){
        cin >> T[i];
        T[i]--;
    } 
    
    ll sum = 0;
    rep(i, D){
        sum += S[i][T[i]];
        last[T[i]] = i;
        rep(j, 26){
            sum -= C[j] * (i - last[j]);
        }
        cout << sum << endl;
        //cout << max(1000000 + sum, 0LL) << endl;
    }

}

Measured memory_bytes: 3644
import heapq
import sys

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

h,w = get_nums_l()
grid = [ input() for _ in range(h) ]
dp = [ [99999999999999999999] * w for _ in range(h)]

def bfs(cost, x, y):
    # log(cost, y, x)
    if dp[y][x] <= cost:
        return

    dp[y][x] = cost

    if x < w-1:
        if grid[y][x] == "." and grid[y][x+1] == "#":
            heapq.heappush(heap, (cost+1, x+1, y))
        else:
            heapq.heappush(heap, (cost, x+1, y))

    if y < h-1:
        if grid[y][x] =="." and grid[y+1][x] == "#":
            heapq.heappush(heap, (cost+1, x, y+1))
        else:
            heapq.heappush(heap, (cost, x, y+1))

heap = []

if grid[0][0] == ".":
    heapq.heappush(heap, (0,0,0))
else:
    heapq.heappush(heap, (1,0,0))

while heap:
    cost, x, y = heapq.heappop(heap)
    bfs(cost, x, y)

print(dp[h-1][w-1])


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

struct node{
  struct node *r;
  struct node *l;
  struct node *par;
  int key;
};
typedef struct node * Node;
#define NIL NULL
Node treeSearch(Node,int);
Node nextnode(Node);
Node root;

Node treeSearch(Node u, int k){
  if(u == NIL || u->key == k) return u;
  if(k<u->key){
    return treeSearch(u->l,k);
  }
  else if(k>u->key){
    return treeSearch(u->r,k);
  }
  return NIL;
}

void treeDelete(Node o,int tar){
  Node z; // node to be deleted
  int k;
  z=treeSearch(o,tar);
  if(z->l == NIL && z->r == NIL){
    if(z->par->l == z){
      z->par->l=NIL;
    }
    else{
      z->par->r=NIL;
    }
    free(z);
  }
  else if(z->l != NIL && z->r == NIL){
    if(z->par->l == z){
      z->par->l=z->l;
      z->l->par=z->par;
    }
    else{
      z->par->r=z->l;
      z->l->par=z->par;
    }
    free(z);
  }
  else if(z->l == NIL && z->r != NIL){
    if(z->par->l == z){
      z->par->l=z->r;
      z->r->par=z->par;
    }
    else{
      z->par->r=z->r;
      z->r->par=z->par;
    }
    free(z);
  }
  else{
    k = nextnode(z)->key;
    treeDelete(o,k);
    z->key = k;
  }
}
Node nextnode(Node del){
  Node x;
	if(del->r!=NIL){
		del=del->r;
		while(del->l!=NIL){
			del=del->l;
		}
		return del;
	}
	x=del->par;
	while(x!=NIL&&del==x->r){
		del=x;
		x=x->par;
	}
	return x;
}
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->l = NIL;
  z->r = NIL;
  while(x!=NIL){
    y=x;
    if(z->key<x->key) x = x->l;
    else x = x->r;
  }
  z->par = y;
  if(y==NIL) root = z;
  else if(z->key < y->key) y->l = z; // z �� y �̍��̎q�ɂ���
    else y->r = z; // z �� y �̉E�̎q�ɂ���
}

void inorder(Node u){
  if(u->l!=NIL) inorder(u->l);
  printf(" %d",u->key);
  if(u->r!=NIL) inorder(u->r);
  return;
}

void preorder(Node u){
  printf(" %d",u->key);
  if(u->l!=NIL) preorder(u->l);
  if(u->r!=NIL) preorder(u->r);
  return;
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    }
    else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    }
  	else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(root,x);
    }
  }

  return 0;
}


Measured memory_bytes: 20616
<?php
list($a, $b, $c) = explode(" ", trim(fgets(STDIN)));
echo hantei($a, $b, $c);

function hantei($A, $B, $C){
    if($A < $B && $B < $C){
        return "Yes".PHP_EOL;
    }else{
        return "No".PHP_EOL;
    }
}

Measured memory_bytes: 15176
// Submitted By SUbhash Yadav

import java.util.*;
import java.lang.*;
import java.io.*;


public class Main
{
	
	public static void main (String[] args) throws java.lang.Exception
	{
		
		FastScanner sc=new FastScanner();
		int a=sc.nextInt(), b=sc.nextInt(), c=sc.nextInt(), k=sc.nextInt();
		if(a<b&&b<c) System.out.println("Yes");
		else {
			int x=0;
			if(a<b) x=0;
		
			else {
				double d= Math.log(1.0*a/b)/Math.log(2.0);
			
				x=(int)Math.ceil(d);
				//System.out.println(x);
				b=b*(int)Math.pow(2, x);
				 if(a==b) {
					 
						x+=1;
						b=2*b;
					}
			}
			
			if(b<c) x=0;
			
			else {
				double d= Math.log(1.0*b/c)/Math.log(2.0);
				//System.out.println(d);
				
				 x+=(int)Math.ceil(d);
				//System.out.println(x);
				c=c*(int)(int)Math.pow(2, (int)Math.floor(d));
				if(b==c) x+=1;
			}
			//System.out.println(a+" "+b+" "+c+" "+x);
			if(x>k) System.out.println("No");
			else System.out.println("Yes");
			
			
			
			
		}
		
		
		//System.out.println(ans);
		
		}
		static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
}
}


Measured memory_bytes: 32848
#![allow(unused_imports)]
#![allow(unused_variables)]

use itertools::Itertools;
use proconio::{fastout, input};
use std::collections::{HashMap, HashSet, VecDeque};

#[fastout]
fn main() {
    input! {
        n: usize, m: usize,
        ab: [(usize, usize); m],
    }
    // annotate for rust-analyzer
    let n: usize = n;
    let m: usize = m;
    let ab: Vec<(usize, usize)> = ab;

    let mut map = HashMap::new();
    for (a, b) in ab {
        (*map.entry(a).or_insert(Vec::new())).push(b);
        (*map.entry(b).or_insert(Vec::new())).push(a);
    }

    let mut ans = vec![0; n + 1];
    let mut q = VecDeque::new();
    q.push_back(1);

    while let Some(cur) = q.pop_front() {
        for &next in &map[&cur] {
            //println!("cur:{} next:{} ans:{}", cur, next, ans[next]);
            if ans[next] == 0 {
                ans[next] = cur;
                q.push_back(next);
            }
        }
    }

    println!("{}", "Yes");
    for i in 2..n + 1 {
        println!("{}", ans[i]);
    }
}


Measured memory_bytes: 17968
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<cmath>
#include<cstdio>
#include<cassert>
using namespace std;

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

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

const double PI = (1*acos(0.0)); 
const double INF = 0x3f3f3f3f;
const double INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const double mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int n,m;
pii s[50],c[50];

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    cin >> n >> m;
    rep(i,n) cin >> s[i].fi >> s[i].se;
    rep(i,m) cin >> c[i].fi >> c[i].se;
    rep(i,n){
        int mi = INF, ans = -1;
        rep(j,m){
            int d = abs(s[i].fi - c[j].fi) + abs(s[i].se - c[j].se);
            if(d < mi){ mi = d; ans = j+1; }
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
using namespace std; using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
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;}
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll ans = 0;
    vl a(n);
    rep(i,n) cin >> a[i];
    sort(all(a),greater<ll>());
    a.push_back(-1);
    ll cnt = 1;
    vl len;
    rep(i,n){
        if(a[i+1]==a[i]) cnt++;
        else{
            if(cnt >= 4){
                if(!len.empty()) ans = len[0]*a[i];
                else ans = a[i]*a[i];
                break;
            }else if(cnt >= 2){
                if(!len.empty()){
                    ans = len[0]*a[i];
                    break;
                }else{
                    len.push_back(a[i]);
                }
            }
            cnt = 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

bool p[200001];
int x;
int main() {
    cin >> x;
    for (int i = 2; i <= x; ++i) {
        if (p[i]) continue;
        for (int j = 2 * i; j <= 2 * x; j += i) {
            p[j] = true;
        }
    }
    for (int i = x; i <= 2 * x; ++i) {
        if (!p[i]) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 384
import java.util.*;

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_2_A&lang=jp
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int V = sc.nextInt();
        int E = sc.nextInt();

        @SuppressWarnings("unchecked")
        List<Edge>[] edges = new ArrayList[V];
        for (int i = 0; i < V; i++) {
            edges[i] = new ArrayList<>();
        }
        for (int i = 0; i < E; i++) {
            int s = sc.nextInt();
            int t = sc.nextInt();
            int w = sc.nextInt();
            edges[s].add(new Edge(s, t, w));
            edges[t].add(new Edge(t, s, w));
        }

        boolean[] done = new boolean[V];
        Arrays.fill(done, false);
        Queue<Edge> q = new PriorityQueue<>();
        q.add(new Edge(0, 0, 0));
        int costSum = 0;
        while (!q.isEmpty()) {
            Edge e = q.poll();
            if (done[e.t]) {
                continue;
            }
            done[e.t] = true;
            costSum += e.w;
            q.addAll(edges[e.t]);
        }
        System.out.println(costSum);
    }

    public static class Edge implements Comparable<Edge> {
        public int s, t, w;

        Edge(int s, int t, int w) {
            this.s = s;
            this.t = t;
            this.w = w;
        }

        @Override
        public int compareTo(Edge o) {
            return this.w - o.w;
            // return o.w - this.w;
        }
    }
}

Measured memory_bytes: 112460
#include<bits/stdc++.h>
using namespace std;
double x[100005],y[100005];
double dx[100005],dy[100005];
int n;
double check(double a){
	double mnx=1e18,mxx=-1e18,mny=1e18,mxy=-1e18;
	for(int i=0;i<n;i++){
		double xx=x[i]+a*dx[i];
		double yy=y[i]+a*dy[i];
		mnx=min(mnx,xx);
		mxx=max(mxx,xx);
		mny=min(mny,yy);
		mxy=max(mxy,yy);
	}
	return (mxx-mnx)*(mxy-mny);
}
int main(){
	
	cin>>n;
	char s;
	memset(dx,0,sizeof(dx));
	memset(dy,0,sizeof(dy));
	for(int i=0;i<n;i++){
		cin>>x[i]>>y[i]>>s;
		if(s=='D')
			dy[i]=-1;
		if(s=='U')
			dy[i]=1;
		if(s=='R')
			dx[i]=1;
		if(s=='L')
			dx[i]=-1;
	}
	double l=0,r=1e9;
	double ans=1e18;
	for(int i=0;i<200;i++){
		double ll=(l*2+r)/3;
		double rr=(r*2+l)/3;
		double lll=check(ll),rrr=check(rr);
		ans=min(ans,lll);
		ans=min(ans,rrr);
		if(lll<rrr)
			r=rr;
		else l=ll;
	}
	printf("%lf\n",ans);
}

Measured memory_bytes: 3328
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <map>
#include <vector>
//#include <unordered_map>
//#include <unordered_set>
#include <stack>
#include <set>
#include <queue>
#include <list>

using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if((a*100+b*10+c)%4==0) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
/// Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

using namespace std;

const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define PII pair<int, int>
#define pf printf

#define sf scanf

#define ALL(x) x.begin(),x.end()
#define pb push_back

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define for0(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=n-1;i>=0;i--)
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}

int main()

{
    IOS;
    //freopen("input.txt", "r", stdin);
     //freopen("output.txt", "w", stdout);
     int k,n;
     while(cin>>k>>n){
        int arr[n];
        vector<int>ans;
        for(int i=0;i<n;i++){
            cin>>arr[i];
            if(i==0) continue;
            ans.pb(arr[i]-arr[i-1]);
        }
        ans.pb(arr[0]+k-arr[n-1]);
        sort(ALL(ans));
        cout<<k-ans[n-1]<<endl;
     }

     return 0;

}
///Alhamdulillah


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

using namespace std;
typedef long long int lli;
typedef vector<int> iv;
typedef vector<bool> bv;
typedef vector<string> sv;
typedef vector<long long int> llv;
typedef vector<double> dv;
#define debug_ printf("OK\n")

#define sor_(vec) sort(vec.begin(),vec.end())
#define rev_(vec) reverse(vec.begin(),vec.end())
#define rep(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define reps(i,n,s) for(int i=static_cast<int>(s);i<static_cast<int>(n);i++)
#define isposi(num) if(num>0)

const long long mod = 1000000007;

/*
 *
 *
 *
 */

void solve(){

}

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    char a;
    std::cin>>a;
    printf("%c",a+1);
    return 0;
}


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

int a,b,h;
void solve(){
    cout << (a*h+b*h)/2 <<endl;
}

int main() {
    cin >> a;
    cin >> b;
    cin >> h;
    solve();
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> a(N+2);
    a[0] = 0;
    int anum = 0;
    for (int i = 1; i <= N; i++)
      {
	long long int b;
        cin >> b;
	if(a[anum] != b){
	  anum++;
	  a[anum] = b;
	}

      }
   a.push_back(0);
    vector<long long int> kado;
    kado.push_back(0);
    for (int i = 1; i < a.size()-1; i++)
        if ((a[i] > a[i-1] && a[i] > a[i+1]) ||
            (a[i] < a[i-1] && a[i] < a[i+1]))
            kado.push_back(a[i]);
    // for(int i =0 ; i < kado.size(); i++)cout << kado[i] << endl;
    vector<long long int> mountain;
    vector<long long int> valley;
    for (int i = 0; i < kado.size(); i++)
        if (i%2 == 1)
            mountain.push_back(kado[i]);
        else
            valley.push_back(kado[i]);
    sort(kado.begin(), kado.end());
    sort(mountain.begin(), mountain.end());
    sort(valley.begin(),valley.end());
    int ans = 0, max = 0;
    if(kado.size() == 1){
      max = 0;
      cout << max << endl;
      return 0;
    }
    int m = 0, b= 0;
    for(int i = 0; i < kado.size(); i ++){
      if(mountain[m] == kado[i]){
	m++;
	ans--;
      }
      if(valley[b] == kado[i]){
	b++;
	ans++;
      }
      if(kado[i] < kado[i+1]){
	if(ans > max)max = ans;
      }
    }
    cout << max << endl;
}



Measured memory_bytes: 4992
#include<iostream>
using namespace std;
int main(){
    string A,B,C;
    cin>>A>>B>>C;
    int a,b;
    a=A.length();
    b=B.length();
    if (A[a-1]==B[0] && B[b-1]==C[0]){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int a;
	int b;
	int c;
	cin >> a >> b >> c;
	if ( a < b ) {
		if (b < c) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		cout << "No" << endl;
	} 
}



Measured memory_bytes: 3096
#include<iostream>
#include<vector>
#include<iomanip>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> v[n];
    for(int i = 0; i < m; i++){
        int s, t;
        cin >> s >> t;
        v[--s].push_back(--t);
    }
    vector<double> dp(n, 0);
    for(int i = n-1; i >= 0; i--){
        for(int j : v[i])   dp[i] += (double)(1+dp[j])/((int)v[i].size());
    }
    double ans = dp[0];
    for(int i = 0; i < n; i++){
        if(v[i].size() <= 1)    continue;
        int block = -1;
        for(int k : v[i]){
            if(block == -1 || dp[block] < dp[k]){
                block = k;
            }
        }
        vector<double> ndp(n, 0);
        for(int j = n-1; j >= 0; j--){
            double d = v[j].size() - (j == i);
            for(int k : v[j])   if(j != i || k != block)  ndp[j] += (double)(1+ndp[k])/d;
        }
        ans = min(ans, ndp[0]);
    }
    cout << fixed << setprecision(12) << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var list = nextIntArray();
  list.push(0);
  var min = 24;
  list.sort(function(a, b){
  	return a - b;
  });
  for(var i = 1; i <= N; i += 2){
  	list[i] = 24 - list[i];
  }
  list.sort(function(a, b){
  	return a - b;
  });
  for(var i = 1; i < N + 1; i++){
  	var di = list[i] - list[i - 1];
  	min = Math.min(min, di);
  }
  min = Math.min(min, 24 - list[N]);
  myout(min);
}


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

typedef long long ll;
typedef long double ld;


#define debug(a)         cerr<<#a<<": "<<a<<endl;
#define pb               push_back
#define all(x)           (x).begin(),(x).end()
#define rall(x)          (x).rbegin(),(x).rend()
#define ps               " "
#define nln              "\n"
#define ff               first
#define ss               second
#define vi               vector<int>
#define vll              vector<ll>
#define vstr             vector<string>
#define vc               vector<char>
#define pii              pair<int,int>
#define PLL              pair<ll,ll>
#define PI               acos(-1)
#define sq(x)            x*x
#define forr(i,a,b)      for(int i=(int)a;i<(int)b;i++)
#define forn(i,a,b)      for(int i=(int)a;i>(int)b;i--)
#define mod              1000000007
#define inf              9223372036854775807



///knight moves:
///int dx[]= {-2,-1,1,2,2,1,-1,-2};
///int dy[]= {1,2,2,1,-1,-2,-2,-1};

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

vi g[200005];
int color[200005];
int parent[200005];
int cost[200005];

void bfs(int s)
{
	color[s]=1;
	parent[s]=1;
	queue<int>q;
	q.push(s);
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		for(int i=0;i<(int)g[u].size();i++)
		{
			int adj=g[u][i];
			if(color[adj]==0)
			{
				color[adj]=1;
				parent[adj]=u;
				q.push(adj);
				cost[adj]+=cost[u];
			}
		}
	}
}
		

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

    int n,q;
    cin>>n>>q;
    
    for(int i=0;i<n-1;i++)
    {
    	int u,v;
    	cin>>u>>v;
    	g[u].pb(v);
    	g[v].pb(u);
    }
    
    while(q--)
    {
    	int p,x;
    	cin>>p>>x;
    	cost[p]+=x;
    }
    
   	bfs(1);
    
    for(int i=1;i<=n;i++) cout<<cost[i]<<ps;
  
    return 0;
}

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



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    pass

if __name__ == '__main__':
    print(input().count("1"))
    main()


Measured memory_bytes: 2940
import bisect

N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

# N, M, K = [1, 1, 10]
# A = [5]
# B = [5]

tmp = 0
for i in range(N):
    A[i], tmp = A[i] + tmp, tmp + A[i]
A = [0] + A

tmp = 0
for i in range(M):
    B[i], tmp = B[i] + tmp, tmp + B[i]
B = [0] + B

re = 0
for i, element in enumerate(A):
    K_tmp = K - element
    if K_tmp < 0:
        pass
    else:
        idx_B = bisect.bisect_right(B, K_tmp)
        re_tmp = i  + idx_B - 1
        re = max(re, re_tmp)
print(re)
    


Measured memory_bytes: 41148
while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        break
    for i in range(h):
        if 0 == (i % 2):
            out = ""
            for j in range(w):
                if 0 == (j % 2):
                    out += "#"
                else:
                    out += "."
            print(out)
        else:
            out = ""
            for j in range(w):
                if 0 == (j % 2):
                    out += "."
                else:
                    out += "#"
            print(out)
    print()


Measured memory_bytes: 5608
#include<stdio.h>
 int main(void)
{
	int a,b;
	int d,r;
	double f;
	scanf("%d",&a);
	scanf("%d",&b);
	
	d=a/b;
	r=a%b;
	f=(double)a/(double)b;
	
	printf("%d %d %lf ",d,r,f);
	return 0;
}

Measured memory_bytes: 636
s=input()
n=len(s)
rst=[0 for j in range(2019)]
rst[0]=1
x=0
ans=0
drst=1
for i in range(n):
    y=(int(s[n-1-i])*drst)%2019
    drst=(drst*10)%2019
    x+=y
    if x>=2019:
        x%=2019
    #print(x,y,drst)
    ans+=rst[x]
    rst[x]+=1
#if rst[0]==1:
    #ans+=0

print(ans)

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

using namespace std;

int main(void)
{
    int N;
    cin >> N;

    int a[N];
    for(int i = 0; i < N; ++i)
    {
        cin >> a[i];
    }

    int count = 0;
    for (int i = 0; i < N; i += 2)
    {
        if(a[i] % 2 != 0)
        {
            ++count;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3540
/*  ***  In The Name of God ... ***  */ 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;

 
#define int long long
#define all(v) v.begin() , v.end()

template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

const int N = ( int ) 3e4 ;

int n ;
vector < int > two , three , op ; 

bool chk ( ) {
	int g = 0 ; 
	for ( int i = 0 ; i < n ; ++ i ) {
		int sum = 0 ;
		g = __gcd ( op [ i ] , g ) ;
		for ( int j = 0 ; j < n ; ++ j ) {
			if ( i == j ) continue ;
			sum += op [ j ] ; 
		}
		if ( __gcd ( sum , op [ i ] ) == 1 ) return 0 ; 
	}
	if ( g == 1 ) return 1 ;
	return 0 ; 
}

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n ;
	if ( n == 3 ) {
		cout << "2 5 63" << endl ;
		return 0 ; 
	}
	for ( int i = 2 ; i <= N ; i += 2 )
		two . push_back ( i ) ;
	for ( int i = 3 ; i <= N ; i += 6 )
		three . push_back ( i ) ;
	int sum = 0 ; 
	for ( int i = 0 ; i < ( int ) two . size ( ) ; ++ i ) {
		sum += two [ i ] ; 
		op . push_back ( two [ i ] ) ;
		if ( sum % 3 ) continue ; 
		int rem = n - ( int ) op . size ( ) ;
		if ( rem & 1 || rem <= 0 || rem > ( int ) three . size ( ) ) continue ;
		for ( int j = 0 ; j < rem ; ++ j )
			op . push_back ( three [ j ] ) ;
		for ( int x : op )
			cout << x << ' ' ;
		cout << endl ;
		return 0 ; 
	}
}


Measured memory_bytes: 960
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second
 
int main(int argc, char **argv) {
	string s, t;
	cin >> s >> t;
	sort(ALL(s));
	sort(ALL(t));
	reverse(ALL(t));
	cout << (s < t ? "Yes" : "No") << endl;
	return 0;
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << x << endl

using ld = double;
using P = complex<ld>;
using G = vector<P>;
const ld pi = acos(-1);
const ld eps = 1e-10;
const ld inf = 1e12;

ld cross(const P& a, const P& b) { return a.real()*b.imag() - a.imag()*b.real(); }
ld dot(const P& a, const P& b) { return a.real()*b.real() + a.imag()*b.imag(); }

using C = pair<ld, P>;
#define rad first
#define pnt second

C smallest_enclosing_disc(vector<P> ps){
    auto c3 = [](const P &a, const P &b, const P &c){
        ld A = norm(b - c);
        ld B = norm(c - a);
        ld C = norm(a - b);
        ld S = abs(cross(b - a, c - a));
        P p = (A*(B+C-A)*a + B*(C+A-B)*b + C*(A+B-C)*c) / (4*S*S);
        ld r = abs(p - a);
        return make_pair(r, p);
    };

    auto c2 = [](const P &a, const P &b){
        P c = (a + b) / (ld)2;
        ld r = abs(a - c);
        return make_pair(r, c);
    };

    auto in_circle = [](const P &a, const C &c){
        return norm(a - c.pnt) <= c.rad*c.rad + eps;
    };

    int n = ps.size();
    random_shuffle(ps.begin(), ps.end());
    C c = c2(ps[0], ps[1]);
    for(int i = 2; i < n; ++i){
        if(!in_circle(ps[i], c)){
            c = c2(ps[0], ps[i]);
            for(int j = 1; j < i; ++j){
                if(!in_circle(ps[j], c)){
                    c = c2(ps[j], ps[i]);
                    for(int k = 0; k < j; ++k){
                        if(!in_circle(ps[k], c)){
                            c = c3(ps[i], ps[j], ps[k]);
                        }
                    }
                }
            }
        }
    }
    return c;
}

// http://www.spoj.com/problems/QCJ4/
// http://www.spoj.com/status/ns=18116289

// int main(){
//     srand(time(0));
//     int n;
//     cin >> n;
//     vector<P> ps(n);
//     for(int i = 0; i < n; ++i){
//         ld x,y;
//         cin >> x >> y;
//         ps[i] = P(x,y);
//     }

//     printf("%.2lf\n", (double)smallest_enclosing_disc(ps).rad*2);
// }


int main(){
    int n;
    cin >> n;
    G g(n);
    rep(i, n){
        ld x, y;
        cin >> x >> y;
        g[i] = P(x, y);
    }
    double r = smallest_enclosing_disc(g).rad;
    double ans = r;
 
    printf("%.12f\n", ans);
 
    return 0;
}
 

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

int main()
{
    char seq[105];
    int N,i;
    cin>>seq;
    if((seq[0]==seq[1]&&seq[1]==seq[2])||(seq[1]==seq[2]&&seq[2]==seq[3])) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

using namespace std;
typedef long long lint;

#define RPT(i, b, e) for (int i = (b); i <= (e); i++)
#define RPT0(i, n) RPT(i, 0, n - 1)
#define RPT1(i, n) RPT(i, 1, n)
#define EACH(it, v) for (const auto& it : v)
#define ALL(v) v.begin(), v.end()

void resolve()
{
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    int total = 0;
    RPT0(i, N)
    {
        cin >> A[i];
        total += A[i];
    }

    double th = (double)total / (4.0 * (double)M);

    sort(A.rbegin(), A.rend());
    string ans = (A[M - 1] >= th) ? "Yes" : "No";
    cout << ans << endl;
}

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


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int maxn = 300300;
int s[maxn], t[maxn], cc[maxn];
int xx[maxn];
int main(){
    int n, c;
    scanf("%d %d", &n, &c);
    for(int e = 0; e < n; e++){
        scanf("%d %d %d", s + e, t + e, cc + e);
        s[e] *= 2; s[e] += 1;
        t[e] *= 2; t[e] += 1;
        xx[s[e]] |= 1<<cc[e];
        xx[t[e]+1] |= 1<<cc[e];
    }
    for(int e = 1; e < maxn; e++) xx[e] ^= xx[e-1];
    int nd = 0;
    for(int e = 0; e < maxn; e++){
        nd = max(nd, __builtin_popcount(xx[e]));
    }
    cout << nd << endl;
    return 0;
}


Measured memory_bytes: 3840
#include<iostream>
using namespace std;
int main()
{
  //定義
  int a;
  string s;
  
  //標準入力をインプット
  cin >> a >> s;
  //3200未満か否か確認
  string answer;
  if(a < 3200){
    answer = "red";
  }else{
    answer = s;
  }
  //偶奇に応じて標準出力
  
  cout << answer << endl;
  return 0;
}

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

#define pb push_back
#define ppp pop_back
#define fi first
#define se second
#define pii pair<int,int>

const int N = 2e5 + 5;

int a[N];
unordered_map<int, int> cnt;
int two[32];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    int n;
    cin >> n;
    for (int i=1; i<=n; i++) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    sort(a+1, a+n+1);
    reverse(a+1, a+n+1);
    two[0] = 1;
    for (int i=1; i<=30; i++) two[i] = 2 * two[i-1];
    int ans = 0;
    for (int i=1; i<=n; i++) {
        if (cnt[a[i]] == 0) continue;
        for (int j=1; j<=30; j++) {
            if (two[j] > a[i] && cnt.count(two[j] - a[i]) && cnt[two[j] - a[i]] > 0) {
                if (a[i] == two[j] - a[i] && cnt[a[i]] == 1) continue;
                ans++;
                cnt[a[i]]--;
                cnt[two[j] - a[i]]--;
                break;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 9288
# using dp with memoization, TLE
from sys import stdin
N, W = map(int, input().split())
m = stdin.read().splitlines()
s = [[int(i) for i in line.split()] for line in m]

dp = [[0] * (W + 1) for _ in range(N + 1)]
dp[0][0] = 0

for n in range(1, N + 1):
    for w in range(0, W + 1):
        if w == 0:
            dp[n][0] = 0
            continue
        if w < s[n - 1][0]:
            dp[n][w] = dp[n - 1][w]
        else:
            dp[n][w] = max(dp[n - 1][w],
                           dp[n - 1][w - s[n - 1][0]] + s[n - 1][1])

print(dp[N][W])


Measured memory_bytes: 120172