akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;

int gcd(int x, int y);

const int INF = 1001001001;

/*struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }*/

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> num(1000001, 0);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    int flag = 0;
    rep(i, n) {
        if (a[i] == 1) {
            if (a[i + 1] == 1) {
                cout << 0 << endl;
            }
            else {
                cout << 1 << endl;
            }
            return 0;
        }
        if (num[a[i]] == 1) {
            num[a[i]]++;
            continue;
        }
        int j = 1;
        while (1) {
            int num1 = a[i] * j;
            if (num1 > 1000000) break;
            num[num1]++;
            j++;
        }
    }

    int ans = 0;
    rep(i, n) {
        if (num[a[i]] == 1)
            ans++;
    }

    cout << ans << endl;
    return 0;
}
/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

Measured memory_bytes: 8008
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	if a*b <= 0 {
		fmt.Println("Zero")
	} else if a > 0 {
		fmt.Println("Positive")
	} else {
		if (b-a)%2 == 0 {
			fmt.Println("Negative")
		} else {
			fmt.Println("Positive")
		}
	}
}


Measured memory_bytes: 512
#include<cstdio>
typedef long long LL;
const int N = 1e5+5;
const LL mod = 1e9+7;
//预处理阶乘的逆元
LL inv[2*N];
LL fac[2*N],finv[2*N];

LL pow(LL a,LL b){
    LL res = 1%mod;
    while(b){
        if(b&1) res = (res*a)%mod;
        a = (a*a)%mod;
        b /= 2;
    }
    return res;
}

void pre_work(int n){
    fac[0] = 1; finv[0] = 1;
    inv[0] = 0;
    for(LL i = 1; i <= 2*n; i++){
        inv[i] = pow(i,mod-2);
        fac[i] = fac[i-1]*i%mod;
        finv[i] = (finv[i-1]*inv[i])%mod;
    }
}

LL C(int a,int b){
    //printf("%lld %lld %lld\n",fac[a],finv[b],finv[a-b]);
    return fac[a]*finv[b]%mod*finv[a-b]%mod;
}

int main(){
    pre_work(100000);
    /*for(int i = 0; i <= 10; i++){
        for(int j = 0; j <= i; j++){
            printf("%d, %d: %lld\n",i,j,C(i,j));
        }
    }*/
    LL n,a,b,c;
    scanf("%lld%lld%lld%lld",&n,&a,&b,&c);
    LL pa = a*pow(a+b,mod-2)%mod;
    LL pb = b*pow(a+b,mod-2)%mod;
    LL ans = 0;
    //总局数为i局,性质判断
    for(int i = n; i <= 2*n-1; i++){
        ans = (ans + C(i-1,n-1)*pow(pa,n)%mod*pow(pb,i-n)%mod*i%mod)%mod;
        ans = (ans + C(i-1,n-1)*pow(pb,n)%mod*pow(pa,i-n)%mod*i%mod)%mod;
    }
    ans = ans*pow(100-c,mod-2)%mod*100ll%mod;
    printf("%lld\n",ans);
    return 0;
}







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

int main() {
    int n; cin>>n;
    long long int a[n],prev=0;
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    long long int xorr=0;
    
    for(int i=0;i<n;i++)
    {
        if((a[i]-prev)%2!=0)
        xorr^=n-i;
        prev=a[i];
    }
    if(xorr)
    cout<<"first\n";
    else
    cout<<"second\n";
	return 0;
}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	H, W := sc.nextInt(), sc.nextInt()
	var C [10][10]int
	var D [10][10]int
	for i := 0; i < 10; i++ {
		for j := 0; j < 10; j++ {
			C[i][j] = sc.nextInt()
			D[i][j] = C[i][j]
		}
	}
	A := make([][]int, H)
	for i := 0; i < H; i++ {
		A[i] = sc.nextIntSlice(W)
	}
	for k := 0; k < 10; k++ {
		for i := 0; i < 10; i++ {
			for j := 0; j < 10; j++ {
				if D[i][j] > D[i][k]+D[k][j] {
					D[i][j] = D[i][k] + D[k][j]
				}
			}
		}
	}
	ans := 0
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			a := A[i][j]
			if a != -1 {
				ans += D[a][1]
			}
		}
	}

	fmt.Fprintln(wtr, ans)
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
typedef long long ll;

int main()
{
	double a,b,c,d,e,f;
	cin >> a >> b >> c >> d >> e >> f;
	int answ=a*100, anss=0;
	double A=f/(a*100),B=f/(b*100),C=f/c,D=f/d;
	//cout<<A<<":"<<B<<":"<<C<<":"<<D;
	double water=0,sugar=0;
	double noudo=0;
	for(int i=0;i<=A;i++)
	{
		for(int j = 0;j<=B;j++)
		{
			water=i*a*100+j*b*100;
			
			for(int k=0;k<=C;k++)
			{				
				for(int l=0;l<=D;l++)
				{
					sugar=l*d+k*c;
					//cout<<sugar<<endl;
					double nnn=-1;
					if(water!=0)
					{
						nnn= sugar/water;
						//cout<<nnn<<endl;
						if(sugar+water <= f&&sugar/water<=e/100)
						{
							
							if(nnn>noudo)
							{
								
								noudo=nnn;
								answ=(i*a+j*b)*100;
								anss=k*c+l*d;
								//cout<<anss<<answ<<endl;
							}
						}
					}
				}
			}
		}
	}

	cout<<answ+anss<<" "<<anss<<endl;
	return 0;
}

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

vector<string> grid;
vector<vector<int>> vis;
int h, w;
int vis_num = 1;
int bfs(int i, int j)
{
    int max_dep = 0;
    queue<pair<pii, int>> qq;
    qq.push({{i, j}, 0});
    while (!qq.empty())
    {
        pair<pii, int> tt = qq.front();
        qq.pop();
        pii co = tt.first;
        if (co.first >= h || co.second >= w)
            continue;
        if (co.first < 0 || co.second < 0)
            continue;
        if (grid[co.first][co.second] == '#')
            continue;
        if (vis[co.first][co.second] == vis_num)
            continue;
        vis[co.first][co.second] = vis_num;
        int depth = tt.second;
        max_dep = max(max_dep, depth);
        qq.push({{co.first + 1, co.second}, depth + 1});
        qq.push({{co.first - 1, co.second}, depth + 1});
        qq.push({{co.first, co.second + 1}, depth + 1});
        qq.push({{co.first, co.second - 1}, depth + 1});
    }
    return max_dep;
}
int main()
{
    cin >> h >> w;
    grid.resize(h);
    for (int i = 0; i < h; i++)
        cin >> grid[i];
    vis.assign(h, vector<int>(w, 0));
    int ans = 0;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if (grid[i][j] == '.')
            {
                ans = max(bfs(i, j), ans);
                //cout << "i : " << i << " j : " << j << endl;
                //cout << "ans : " << ans << endl;
            }
            vis_num++;
        }
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<queue>
#include<string.h>
#include<algorithm>
using namespace std;
int v[100],p,q,r,sum=0;
int main()
{
    scanf("%d%d%d",&v[0],&v[1],&v[2]);
    sort(v,v+3);
    printf("%d\n",v[0]+v[1]);
    return 0;
}



Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<set>
using namespace std;
#define N 
#define ll long long
#define db double
#define dbg1(x) cout<<#x<<"="<<x<<" "
#define dbg2(x) cout<<#x<<"="<<x<<"\n"
int T,a,b;ll ans;
db cal(ll x) {return (-(ll)b*x-1)*1./(a+x);}
int main()
{
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
	for(scanf("%d",&T);T--;)
	{
		scanf("%d%d",&a,&b),ans=0;
		if(a<b) swap(a,b);
		if(a==1&&b==1) {puts("0");continue;}
		if(b>=100000)
		{
			ll dd=sqrt(1ll*a*b),ans=dd*2-1;
			if(dd*dd==1ll*a*b)
			{
				if(a==b)ans--;
				else ans-=2;
			}
			else if(dd*(dd+1)>=1ll*a*b)ans--;
			cout<<ans<<endl;
			continue;
		}
		/*
		for(ll x=-a+1,y,tmp;;x++)
		{
			tmp=floor(((ll)-b*x-1)*1./(a+x));
			dbg1(x),dbg2(tmp);
			if(tmp==-b) break;
			if(tmp)
			{
				if(tmp^last) ans++,last=tmp;
				else
				{
					ans+=tmp+b-1;
					if(tmp>0) ans--;
					break;
				}
			}
		}
		dbg2(ans);*/
		ll l=-a+1,r=1e10,mid;
		for(;l<r;)
		{
			mid=l+r>>1;
//			dbg2(mid);
//			dbg1(cal(mid+1)),dbg2(cal(mid));
			cal(mid)-cal(mid+1)<1?r=mid:l=mid+1;
		}
//		dbg2(l);
		ll tmp1=floor((-(ll)b*l-1)*1./(a+l));
		ans=l+a+tmp1+b-1;
		if(l==-a+1)
		{
			if(tmp1>=0) ans--;
			cout<<ans<<"\n";
			continue;
		}
		ll tmp2=floor((-(ll)b*(l-1)-1)*1./(a+l-1));
//		dbg1(l-1),dbg1(cal(l-1)),dbg2(tmp2);
//		dbg1(l),dbg1(cal(l)),dbg2(tmp1);
//		dbg1(tmp1),dbg2(tmp2);
		if(tmp1>=0||tmp2<=0) ans--;
//		printf("%lld\n",ans);
		cout<<ans<<"\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string.h>
 
using namespace std;
 
int a[100000 + 1];
int s[100000 + 1];
 
int main() {
 
    int n, k;
    int i, j, l;
    int sum = 0, asus = 0;
 
    while (true) {
 
        memset(s, 0, sizeof(s));
        memset(a, 0, sizeof(a));
 
        cin >> n >> k;
        if (n == 0 && k == 0) return 0;
 
        for (i = 0; i < n; ++i) cin >> a[i];
 
        for (i = 0; i < n-k; ++i) {
            for (j = 0; j < k; ++j) {
 
                sum += a[i + j];
            }
            asus = max(asus, sum);
            sum = 0;
        }
 
        cout << asus << endl;
    }
}


Measured memory_bytes: 3864
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from collections import Counter,defaultdict
def resolve():
    n,m=map(int,input().split())
    D=defaultdict(list)
    for a in map(int,input().split()):
        D[a%m].append(a)

    ans=len(D[0])//2
    if(m%2==0): ans+=len(D[m//2])//2

    for i in range(1,(m-1)//2+1):
        A=D[i]; B=D[m-i]
        if(len(A)<len(B)): A,B=B,A # len(A)>=len(B)
        n=len(B)
        ans+=n
        A=Counter(A).most_common()[::-1]
        for i in range(len(A)):
            if(n>0 and A[i][1]&1):
                n-=1
                A[i]=(A[i][0],A[i][1]-1)
        for key,val in A:
            if(n>=val): n-=val
            else:
                val-=n
                n=0
                ans+=val//2
    print(ans)
resolve()

Measured memory_bytes: 90988
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
	double l,h,n;
	bool flag=false;

	while(cin>>n){
		if(!flag){
			l=n;
			h=n;
			flag=true;
		}
		if(h<n)h=n;
		if(l>n)l=n;
	}
	cout<<h-l<<endl;

}

Measured memory_bytes: 1284
use std::vec::Vec;
use std::collections::HashMap;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let n: usize = read();
    let a: Vec<usize> = read_vec();
    let mut map = HashMap::new();

    for i in 0..n {
      if !map.contains_key(&a[i]) {
         map.insert(a[i], 1);
      } else {
        println!("NO");
        return
      }
    }

    println!("YES");
}


Measured memory_bytes: 18832
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {
	static final PrintStream out = System.out;
	Scanner sc = new Scanner(System.in);
	int H,W;
	int INF = 100010;
	List<Set<Integer>>graph;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		H = nextInt();
		W = nextInt();
		boolean f = true;
		//Set<Integer> set = new HashSet<>();
		int[][] map = new int [H][W];//# = 1
		for(int i=0;i<H;i++)Arrays.fill(map[i], INF);
		gtaphset();
		for(int i=0;i<H;i++) {
			char[] C = sc.next().toCharArray();
			for(int j=0;j<W;j++) {
				if(C[j]=='#') {
					map[i][j] = 0;
					graph.get(i).add(j);
				}
				else f = false;
			}
		}
		if(f) {out.println(0); return;}
		int max = 0;
		int t = 0;
		f = true;

		ArrayList<Set<Integer>> _graph = new ArrayList<Set<Integer>>(graph);
		gtaphset();
		//#の隣接を埋める処理
		while(f) {
			f= false;
			for(int i=0;i<H;i++) {
				for(Integer j : _graph.get(i)) {
						if(i>0) {
							if(map[i-1][j]>t+1) {
								map[i-1][j]=t+1;graph.get(i-1).add(j);
							}
						}
						if(j>0) {
							if(map[i][j-1]>t+1) {
								map[i][j-1]=t+1;graph.get(i).add(j-1);
							}
						}
						if(i<H-1) {
							if(map[i+1][j]>t+1) {
								map[i+1][j]=t+1;graph.get(i+1).add(j);
							}
						}
						if(j<W-1) {
							if(map[i][j+1]>t+1) {
								map[i][j+1]=t+1;graph.get(i).add(j+1);
							}
						}
						if(!f)f=true;
				}
			}
			t++;
			_graph = new ArrayList<Set<Integer>>(graph);
			gtaphset();
		}

		for(int i=0;i<H;i++) {
			for(int j=0;j<W;j++) {
				max=Math.max(max,map[i][j]);
			}
		}
		out.println(max);
	}

	private void gtaphset() {
		graph = new ArrayList<Set<Integer>>();
		for(int i=0;i<H;i++) {
			graph.add(new HashSet<Integer>());
		}

	}

	private int min(int a, int b) {
		return Math.min(a, b);
	}

	private int nextInt() {
		return Integer.parseInt(next());
	}
	private long nextLong() {
		return Long.parseLong(next());
	}
	private String next() {
		return sc.next();
	}

}

Measured memory_bytes: 159192
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())

const int INF = 1e9;


// code
// ------------------------------------------------
int main() {

  string s;
  int a[26] = {0};

  cin >> s;

  rep(i,sz(s)) a[s[i] - 0x61] = 1;

  int ans = -1;
  rep(i,26) if ( !a[i] ) { ans = i; break; }

  char ansc = 0x61 + ans;
  if ( ans == -1) cout << "None" << endl;
  else cout << ansc << endl;

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
	int m,n;
	scanf("%d",&n);
	for(int i=0;i<=150;i++){
		for(int j=0;j<=150;j++){
			if(i*4+j*7==n){
				printf("Yes");
				return 0;
			}
		}
	}
	printf("No");
	return 0;
} 

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using pll = pair<ll, ll>;

const int N = 110;
int n, m, low[N], num[N], vis[N];
vector<int> adj[N];
int ans, counter;

void dfs (int u, int parent) {
	num[u] = counter++;
	low[u] = num[u];
	vis[u] = true;
	for (int v : adj[u]) if (!vis[v]) {
		dfs(v, u);
		if (low[v] > num[u]) ans++;
		low[u] = min(low[u], low[v]);
	} else if (vis[v] && v != parent)
		low[u] = min(low[u], num[v]);
}

int main() {
	scanf("%d%d", &n, &m);
	int x, y;
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &x, &y);
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	ans = counter = 0;
	memset(vis, 0, sizeof vis);
	dfs(1, 0);

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



Measured memory_bytes: 256
using System;
using System.IO;

class Solve
{
    static void Main(string[] args) {
        var arr = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int N = arr[0], M = arr[1];
        var L = new (int l, int r)[M];
        for (int i = 0; i < M; i++) {
            var g = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            L[i] = (g[0], g[1]);
        }
        var lMax = 0;
        var rMin = 100000;
        for (int i = 0; i < M; i++) {
            lMax = Math.Max(lMax, L[i].l);
            rMin = Math.Min(rMin, L[i].r);
        }
        var answer = lMax <= rMin ? rMin - lMax + 1 : 0;
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
}

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

int main(){
  string S;
  cin >> S;
  if (S.at(0) != S.at(1)) {
    cout << "Yes" << endl;
  } 
  else if (S.at(1) != S.at(2)){
    cout << "Yes" << endl;
  }
  else if (S.at(0) != S.at(2)){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &d[i]);
  }
  int m;
  cin >> m;
  vector<int> t(m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &t[i]);
  }
  sort(d.begin(), d.end());
  sort(t.begin(), t.end());
  string ans = "NO";
  bool impo = false;
  int j = 0;
  for (int i = 0; i < m; i++) {    
    while (1) {
      if (j >= n || d[j] > t[i]) {
	impo = true;
	break;
      }
      if (d[j] == t[i]) {
	if (i == m-1) ans = "YES";
	j++;
	break;
      }
      j++;
    }
    if (impo) break;
  }

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)


int main() {
	int n;
	cin >> n;
	vector<int> a;
	int tmp;
	REP(i, n) {
		cin >> tmp;
		a.push_back(tmp);
	}

	REP(i, n) {
		if (i == n - 1) cout << a[i] << endl;
		else cout << a[i] << " ";
	}

	int v, j;

	FOR(i, 1, n) {
		v = a[i];
		j = i - 1;
		while (j >= 0 && a[j] > v) {
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = v;

		REP(i, n) {
			if (i == n - 1) cout << a[i] << endl;
			else cout << a[i] << " ";
		}
	}

	return 0;
}



Measured memory_bytes: 3164
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <bits/stdc++.h> // isupper, islower, isdigit, toupper, tolower
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, n) for (int i = (a); i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pl;
typedef pair<int, int> P;

int main()
{
  string N;
  cin >> N;
  rep(i, N.length())
  {
    if (N.at(i) == '7'){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;

}


Measured memory_bytes: 3624
import java.util.*;

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

      int n = Integer.parseInt(sc.next());
      int k = Integer.parseInt(sc.next());

      String s = sc.next();
      int lng = s.length();
      char[] c = new char[lng];
      for(int i=0;i<lng;i++){
        c[i] = s.charAt(i);
      }

      if(c[k-1]=='A'){
        c[k-1] = 'a';
      }
      if(c[k-1]=='B'){
        c[k-1] = 'b';
      }
      if(c[k-1]=='C'){
        c[k-1] = 'c';
      }

      for(int i=0;i<lng;i++){
        System.out.print(c[i]);
      }

    }
}


Measured memory_bytes: 21460
#pragma GCC optimize ("O2")
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic ignored "-Wsign-compare"

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, A) for (auto & a : A)
#define all(a) (a).begin (), (a).end ()
#define f first
#define s second

typedef long long ll;

const ll MOD = 1e+9+7;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const ll MAXN = 1e+6+7;

int main ()
{
	ios_base::sync_with_stdio (0);
	cin.tie (0);
	int i, j, n;
	string s, t, u;
	cin >> s >> t >> i >> j >> u;
	if (s == u) cout << i - 1 << ' ' << j << '\n';
	else cout << i << ' ' << j - 1 << '\n';

	return 0;
}



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

long f(int x) {
  if (x % 2) return x - 1;
  return x;
}

int main() {
  int I, O, J, L;
  {
    int x; cin >> I >> O >> x >> J >> L;
  }
  long r = 0;
  if (I && J && L) {
    r = 3 + f(I-1) + f(J-1) + f(L-1);
  }
  r = max(r, f(I) + f(J) + f(L));
  cout << r + O << endl;
}


Measured memory_bytes: 256
#include<iostream>
    #include<math.h>
    #define N 1000
    using namespace std;
    long long GCD(long long a,long long b)
    {
        return !(b)?a:GCD(b,a%b);
    }

    int main()
    {
        long long n,k,i,LCM,a;

        while(cin>>n)
        {
                cin>>a;
                LCM=a;
                for(i=1; i<n; i++)
                {
                    cin>>a;
                    LCM=LCM/GCD(LCM,a)*a;

                }
            cout<<LCM<<endl;
        }
        return 0;
    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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 MAX_N=1e5+10;

int N;
vector<vector<int>> G(MAX_N);
vector<bool> odd(MAX_N,false),even(MAX_N,false);
bool ok=false;

void dfs(int v,int p){
    int a=0,b=0;
    if (p>=0&&G[v].size()==1) odd[v]=true;
    for (auto nv:G[v]){
        if (nv==p) continue;
        dfs(nv,v);
        if (odd[nv]) ++a,even[v]=true;
        if (even[nv]){
            ++b;
            if (G[v].size()<3) odd[v]=true;
        }
    }
    if (p>=0&&b==(int)G[v].size()-1) odd[v]=true;
    if (p<0&&b==G[v].size()) ok=true;
    if (a>=2) ok=true;
    if (b>=2&&G[v].size()<3) ok=true;
    if (p<0&&G[v].size()==1&&odd[v]) ok=true;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    rep(i,N-1){
        int a,b; cin >> a >> b; --a,--b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs(0,-1);
    if (ok) cout << "First" << endl;
    else cout << "Second" << endl;
}

Measured memory_bytes: 5888
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

template<typename T> T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

template<typename T> T lcm(const T a, const T b) {
    return a / gcd(a, b) * b;
}

template<typename T> bool chmin(T& a, const T& b) {
    if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
    if (a < b) return a = b, true; else return false;
}

// End of template.

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cin.read(buf, sizeof buf); // 注意: ./a.out < in か pbp | ./a.out で入力すること

    int n, buka[200200] = {};
    cin >> n;
    rep(i, n - 1) {
        int a;
        cin >> a;
        buka[a - 1] += 1;
    }

    rep(i, n) print(buka[i]);

    return 0;
}



Measured memory_bytes: 4396
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
MOD = 10**9+7

s = input()
t = input()

sl = len(s)
tl = len(t)
dp = [[0 for _ in range(tl+1)] for _ in range(sl+1)]

for i in range(sl):
    for j in range(tl):
        if s[i] == t[j]: dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])

ans = ''
while sl > 0 and tl > 0:
    if dp[sl][tl-1] == dp[sl][tl]:
        tl -= 1
    elif dp[sl-1][tl] == dp[sl][tl]:
        sl -= 1
    else:
        ans = s[sl-1] + ans
        sl -= 1
        tl -= 1
print(ans)




Measured memory_bytes: 126572
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    string S;
    cin >>S;
    if(S=="SAT"){
        cout <<1<<endl;
    }
    if(S=="FRI"){
        cout <<2<<endl;
    }
    if(S=="THU"){
        cout <<3<<endl;
    }
    if(S=="WED"){
        cout <<4<<endl;
    }
    if(S=="TUE"){
        cout <<5<<endl;
    }
    if(S=="MON"){
        cout <<6<<endl;
    }
    if(S=="SUN"){
        cout <<7<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define drep2(j,n) for(int j = (n)-1; j >= 0; --j)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define srep2(j,s,t) for (int j = s; j < t; ++j)
#define srep3(k,s,t) for (int k = s; j < t; ++k)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  ll N,A,B;
  cin >> N >> A >> B;
  if(N == 1 && A != B ) {
    cout << 0 << endl;
    return 0;
  } 
  B = B - A;
  A = 0;
  cout << max((ll)0,A + B * (N-1) - B - A * (N - 1) + 1) << endl;
  return 0;
}

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

int main() {
    int n; std::cin >> n;
    std::vector<int> l(n*2+1, -1);

    int d = n;
    int u = 1; int s = 1 - 2*(1-(n%2));
    for (int i = 0; i < n; i++) {
        std::cin >> l[d];
        d = d + s * u;
        u++;
        s *= -1;
    }

    bool f = true;
    for (int i = 0; i < n*2+1; i++) {
        if (l[i] < 0) {
            continue;
        }
        std::cout << ((f)?"":" ") << l[i];
        f = false;
    }
    std::cout << std::endl;

    return 0;
}

Measured memory_bytes: 3712
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;

int main (){
	int A,B;
	cin >> A >>B;
	if(A>8 || B>8){
		cout << ":(" ;
	}
	else {
		cout << "Yay!";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int partition(int *, int, int);
 
int main(){
    int n, i, p;
    int A[100000];
   
    scanf("%d", &n);
 
    for(i = 0; i < n; i++){
        scanf("%d", &A[i]);
    }

    p = partition(A, 0, n-1);
 
    for(i = 0; i < n; i++){
        printf("%d", A[i]);
        if(i==p) printf("]");
        if(i<n-1) printf(" ");
        if(i==p-1) printf("[");
    }
  
    printf("\n");
 
    return 0;
}
 
int partition(int A[],int p,int r){
    int i, j, x, tmp;
   
    x = A[r];
    i = p - 1;
    for(j = p; j < r; j++){
        if(A[j] <= x){
            i = i + 1;
            tmp = A[i];
            A[i] = A[j];
            A[j] = tmp;
        }
    }
 
    tmp = A[i+1];
    A[i+1] = A[r];
    A[r] = tmp;
 
    return i+1;
}

Measured memory_bytes: 992
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  
  if(A + B > C + D){
    cout << "Left" << endl;
  }
  else if(A+B < C+D){
    cout << "Right" << endl;
  }
  else{
    cout << "Balanced" << endl;
  } 
}

Measured memory_bytes: 256
a, b, k = map(int, input().split())

def gcd(x, y):
    while y > 0:
        x, y = y, x % y
    return x

A = []
x = gcd(a, b)
for i in range(1, x + 1):
    if x % i == 0:
        A.append(i)
        
A.reverse()

print(A[k - 1])

Measured memory_bytes: 3064
N = int(input())


def dfs(x, s, f, t):
    if x > N:
        return 0
    else:
        x = str(x)
        return s * f * t + dfs(int(x + '7'), 1, f, t) + dfs(
            int(x + '5'), s, 1, t) + dfs(int(x + '3'), s, f, 1)


print(dfs(0, 0, 0, 0))


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

#define mod 1000000007

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

using namespace std;
typedef long long ll; 
 
int main(void){
	
	ll N, M;
	
	cin >> N >> M;
	
	vector<pair<ll, ll>> A(N);
	
	rep(i, N)
		cin >> A[i].first >> A[i].second;
		
	sort(A.begin(), A.end());
	
	ll ans = 0;
	rep(i, N){
		if(M - A[i].second >= 0){
			M -= A[i].second;
			ans += A[i].first * A[i].second;
		}
		else{
			while(M > 0){
				M--;
				ans += A[i].first;
			}
			break;
		}
	}
	
	cout << ans;
	
	return 0;
}


Measured memory_bytes: 1792
//BUGSBUNNY
//IIT ROORKEE
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define vl vector<long long>
#define vpii vector<pii>
#define vpipii vector<pipii>
#define vb vector<bool>
#define pb push_back
#define pob pop_back
#define mp make_pair
#define pii pair<int,int>
#define pipii pair<int,pii>
#define piipi pair<pii,int>
#define pld pair<long double,long double>
#define mod 1000000007
// #define mod 163577857 
// #define mod 998244353
#define rep(i,n) for (ll i = 0; i < n; i++)
#define repp(i,a,b) for(ll i = a ; i<b ; i++)
#define reppr(i,a,b) for(ll i = a-1 ; i>=b ; i--)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define ff first
#define ss second
#define pc putchar_unlocked
#define gc getchar_unlocked
#define inf 9223372036854775807
#define infn -9223372036854775807
#define pi 3.14159265358979323846
#define eps 0.0000000001
#define sp << " " <<
#define setprec(x) cout << fixed << setprecision(x);
#define REVERSE(a) reverse(all(a));
#define SORT(a) sort(all(a));
#define all(n) n.begin(),n.end()
 
//GCD and LCM
    int gcd (int a, int b) { return b ? gcd (b, a % b) : a; }
    int lcm (int a, int b) { return a / gcd(a, b) * b; }
 
//Modular Exponentiation
    int powmod(int x,int y) 
    { 
        if (y == 0) return 1; 
        int p = powmod(x, y/2) % mod; 
        p = (p * p) % mod;   
        return (y%2 == 0)? p : (x * p) % mod; 
    }
 
//Modular Inverse
    int inverse(int a) 
    { 
       return powmod(a,mod-2); 
    }


void solve();
signed main()
{
    //-------------------------------------------------------------------------------   
        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
        clock_t clk = clock();
    //-------------------------------------------------------------------------------   
    //-------------------------------------------------------------------------------
        int t = 1;
        // cin >> t;       
        rep(i,t)
        {
            // cout << "Case #" << i+1 << ": ";
            solve();
        }
    //-------------------------------------------------------------------------------
        clk = clock() - clk;
        cerr << fixed << setprecision(12) << "Time: " << ((double)clk)/CLOCKS_PER_SEC;
    //-------------------------------------------------------------------------------
}

void solve()
{
    int k , a , b;
    cin >> k >> a >> b;
    cout << (  b/k - (a-1)/k == 0 ? "NG":"OK" );
}   

Measured memory_bytes: 3808
n = int(input())
nin = []

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

# print(nin)
ans = 0

for i in range(2**n):
    f = True
    for j in range(n):
        if (i >> j) & 1:
            for x,y in nin[j]:
                if ((i >> (x-1)) & 1) == y:
                    pass
                else:
                    f = False
                    break
    else:
        if f:
            tmp = bin(i).count('1')
            ans = max(ans, tmp)
            # print(i)

print(ans)

Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr ll INF = 1LL << 40;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// ----------------------------------------------------------------------------

int main(){
  int N;
  cin >> N;
  int sx=0,sy=0,T=0;
  bool can = true;
  for(int i=0; i<N; i++){
    int t,x,y;
    cin >> t >> x >> y;
    int c;
    c = abs(x-sx) + abs(y-sy);
    if(t-T < c){
      can = false;
    }else{
      if((t-T-c)%2){
        can = false;
      }
    }
  }
  if(can){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


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

int res[105][105];
int main() {
	int h, w, n;
	scanf("%d%d%d", &h, &w, &n);
	int x = 0, y = 0;
	for(int c = 1; c <= n; c++) {
		int k; scanf("%d", &k);
		for(int i = 0; i < k; i++) {
			if(x & 1) {
				res[x][y--] = c;
				if(y < 0) y = 0, x++;
			}
			else {
				res[x][y++] = c;
				if(y == w) y = w - 1, x++;
			}
		}
	}
	for(int i = 0; i < h; i++)
		for(int j = 0; j < w; j++) printf("%d%c", res[i][j], j == w - 1 ? '\n' : ' ');
	return 0;
}


Measured memory_bytes: 384
/*
     Author:Raghav Bansal
     IIIT Una
                  */
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define BOLT ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define X first
#define Y second
#define endl "\n"
using namespace std;
const int N = 1e5 + 10;
vector<int> v[N];
int pwr(int x) {
    return x * x * x * x * x;
}
int check(int x) {
    int ans = x * x;
    if (ans > 1e15) {
        return 0;
    }
    ans *= x;
    if (ans > 1e15) {
        return 0;
    }
    ans *= x;
    if (ans > 1e15) {
        return 0;
    }
    ans *= x;
    if (ans > 1e15) {
        return 0;
    }
    return 1;
}
void solve() {
    set<int> s;
    int cur = 0;
    unordered_map<int, int> hash;
    while (check(cur)) {
        s.insert(pwr(cur));
        hash[pwr(cur)] = cur;
        cur++;
    }
    int x;
    cin >> x;
    for (auto &it : s) {
        int flag = x - it;
        if (s.count(abs(flag))) {
            if (flag < 0) {
                cout << -hash[abs(flag)] << " " << -hash[it] << endl;
                return;
            } else {
                cout << hash[flag] << " " << -hash[it] << endl;
                return;
            }
        }
        flag = x + it;
        if (s.count(flag)) {
            cout << hash[flag] << " " << hash[it] << endl;
            return;
        }
    }
}
int32_t main() {
    BOLT;
    solve();
}


Measured memory_bytes: 6096
#include<iostream>
#include<vector>

int main(){
    int W, H, N;
    std::cin >> W >> H >> N;
    std::vector<std::vector<bool>> rectangle(H, std::vector<bool>(W, true));
    for(int i = 0; i < N; i++){
        int x, y, a;
        std::cin >> x >> y >> a;
        if(a == 1){
            for(int i = 0; i < H; i++){
                for(int j = 0; j < x; j++){
                    rectangle[i][j] = false;
                }
            }
        }else if(a == 2){
            for(int i = 0; i < H; i++){
                for(int j = x; j < W; j++){
                    rectangle[i][j] = false;
                }
            }
        }else if(a == 3){
            for(int i = 0; i < y; i++){
                for(int j = 0; j < W; j++){
                    rectangle[i][j] = false;
                }
            }
        }else if(a == 4){
            for(int i = y; i < H; i++){
                for(int j = 0; j < W; j++){
                    rectangle[i][j] = false;
                }
            }
        }
    }

    int sum = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            sum += rectangle[i][j];
        }
    }


    std::cout << sum << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
ll n,k[2000005],fix[2000005],d[2000005],raod[2000005],wx,ans;
vector<ll>v[2000005],g[2000005];
set<pair<ll,ll> >st;
void go(ll x){
    fix[x] = 1;
    for(int i=0; i<v[x].size(); i++){
        if(fix[v[x][i]] == 1){
            cout << -1;
            exit(0);
        }
        if(fix[v[x][i]] == 2)continue;
        go(v[x][i]);
    }
    fix[x] = 2;
}
int main(){
    ios::sync_with_stdio(false);
    cin >> n;
    
    for(int i=1; i<=n; i++){
        for(int j=1; j<n; j++){
            int x;
            cin >> x;
            if(j > 1){
                v[wx].pb(min(i , x) * n + max(i , x));
                k[min(i , x) * n + max(i , x)]++;
                g[min(i , x) * n + max(i , x)].pb(wx);
                raod[min(i , x) * n + max(i , x)]++;
            }
            wx = min(i , x) * n + max(i , x);
        }
    }
    
    for(int i=1; i<=2000000; i++){
        if(fix[i] == 0){
            go(i);
        }
    }
    
    for(int i=1; i<=n; i++){
        for(int j=i+1; j<=n; j++)
            st.insert(make_pair(raod[i * n + j] , i * n + j));
    }
    
    
    while(st.size()){
        int x = (*st.begin()).s;
        st.erase(st.begin());
        for(int i=0; i<v[x].size(); i++){
            st.erase(st.find(make_pair(raod[v[x][i]] , v[x][i])));
            raod[v[x][i]]--;
            st.insert((make_pair(raod[v[x][i]] , v[x][i])));
        }
        for(int i=0; i<g[x].size(); i++){
            d[x] = max(d[x] , d[g[x][i]] + 1);
            ans = max(ans , d[x]);
        }
    }
    
    cout << ans + 1;
    
    
    
    return 0;
}


Measured memory_bytes: 199936
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<int>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  int d;
  cin >> d;
  ll k[26];
  ll c[26];
  rep(i,26)cin >> c[i];
  rep(i,26)k[i]=0;
  ll ans=0;
  ll s[d][26];
  rep(i,d)rep(j,26)cin >> s[i][j];
  int t[d];
  rep(i,d)cin >> t[i];
  rep(i,d)t[i]--;
  rep(i,d){
    ans+=s[i][t[i]];
    k[t[i]]=i+1;
    rep(j,26)ans-=(i+1-k[j])*c[j];
    cout << ans << endl;
  }
}


Measured memory_bytes: 3700
#include<iostream>
#include<string.h>
#include<vector>
#include <algorithm>
using namespace std;

int main()
{

  int N,K;
  cin >> N >> K;

  vector<int> p(N);
  for(int i=0;i<N;i++)
    cin >> p[i];
  
  sort(p.begin(), p.end());

//  for(int i=0;i<N;i++)
//    cout << p[i] << " ";
  
  int sum=0;
  for(int i=0;i<K;i++)
    sum += p[i];
  
  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 3600