akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func main() {
	var x, y int
	fmt.Scan(&x, &y)

	// a = (1,2), b = (2,1)
	// x = a + 2b, y = 2a + b
	for a := 0; a <= x; a++ {
		b := y - 2*a
		if a+2*b == x {
			comInit()
			fmt.Println(com(a+b, b))
			return
		}
	}

	fmt.Println(0)
}

// https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a#5-二項係数-ncr

const max int = 1e6
const mod int = 1e9 + 7

var fac [max]int
var finv [max]int
var inv [max]int

// テーブルを作る前処理
func comInit() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1
	for i := 2; i < max; i++ {
		fac[i] = fac[i-1] * i % mod
		inv[i] = mod - inv[mod%i]*(mod/i)%mod
		finv[i] = finv[i-1] * inv[i] % mod
	}
}

// 二項係数計算
func com(n, k int) int {
	if n < k {
		return 0
	}
	if n < 0 || k < 0 {
		return 0
	}
	return fac[n] * (finv[k] * finv[n-k] % mod) % mod
}


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

#define INF (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define N 100005
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795

ll no_of_div(ll a)
{
  ll cnt=0,i;
  if (a==2)return 1;
  for(i=2;i*i<a;i++)
  {
if(a%i==0)cnt+=2;
  }
  if(i*i==a)cnt++;
  return cnt;
}

//vl a(1001);

ll powM(ll a,ll b)
{ 
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }

return ans;
}







int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);

string s;cin>>s;
//s.erase(s.end()-1);
auto it=s.end()-1;

while(it!=s.begin())
{
  ll x=distance(s.begin(),it);
 // cout<<x<<"\n";
if(x&1)it--;
else 
{
  string s1=s.substr(0,x/2);
  string s2=s.substr(x/2,x/2);
  if(s1==s2)
  {
    cout<<x<<"\n";
    return 0;
  }
  it--;
}
}

  return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair 
#define mt make_tuple
#define fi first
#define se second
#define gcd __gcd
#define maxe *max_element
#define mine *min_element
#define deb debug
 
#define forz(i,n) for(long long int i=0;i<n;i++)
#define rep(i,k,n) for (lli i = k; i <= n; i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0)
 
typedef pair <lli,lli> pll;
 
 
lli countGreater(lli arr[], lli n, lli k) 
{ 
    lli l = 0; 
    lli r = n - 1; 
  
    lli leftGreater = n; 
  
    while (l <= r) { 
        lli m = l + (r - l) / 2; 
  

        if (arr[m] > k) { 
            leftGreater = m; 
            r = m - 1; 
        } 

        else
            l = m + 1; 
    } 
  
    return (n - leftGreater); 
}
 
bool is_palin(string input)
{
    if (input == string(input.rbegin(), input.rend())) 
        return true;
    return false;
}
void solve()
{
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])
    {
        cout<<"Yes";
        return ;
    }
    cout<<"No";
        return ;
}
 
int main()
{
    kira; 
 
    lli t=1; //cin>>t;
    while(t--)
    {
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 256
#ABC121

n,m,c = list(map(int,input().split()))
b = list(map(int,input().split()))
count = 0
for i in range(n):
    a = list(map(int,input().split()))
    d = [a[j] * b[j] for j in range(m)]
    if sum(d) + c > 0:
        count += 1
        
print(count)

Measured memory_bytes: 3060
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))
def plis(a): return " ".join(list(map(str, a)))

import fractions


def lcm(a, b):
  return (a * b) // fractions.gcd(a, b)

N = ri()
t = ri()
for i in range(N-1):
  t = lcm(t, ri())
print(t)


Measured memory_bytes: 5716
#include <iostream>
#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
#include <utility>
//#include <set>
#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 10000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; if(b<0) b *= -1 ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll n ; cin >> n ;
	vll x(n),y(n) ;
	for(int i=0;i<n;i++) cin >> x.at(i) >> y.at(i) ;
	map<pll,ll> m ;
	pll ins ;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i==j) continue ;
			ins.first = x.at(i)-x.at(j) ;
			ins.second = y.at(i)-y.at(j) ;
			m[ins]++ ;
		}
	}
	ll ans = 0 ;
	for(auto p:m){
		ans = max(ans,p.second) ;
	}
	cout << n-ans << endl ;
}


Measured memory_bytes: 764
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let h: usize = sc.read();
    let n: usize = sc.read();
    let a: Vec<usize> = sc.vec(n);
    let sum = a.into_iter().sum::<usize>();
    if h <= sum {
        println!("Yes");
    } else {
        println!("No");
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

using namespace std;

int main(void)
{
    int N;
    cin >> N;
    long L[N];
    for (int i = 0; i < N; i++) {
        cin >> L[i];
    }

    sort(L, L+N);

    int validCount = 0;
    for (int i = 0; i < N-2; i++) {
        for (int j = i+1; j < N-1; j++) {
            for (int k = j+1; k < N; k++) {
                // all the three are unique
                if (L[i] != L[j] && L[j] != L[k]) {
                    if (L[k] < (L[i] + L[j])) {
                        validCount++;
                    }
                }
            }
        }
    }
    cout << validCount << endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++) 
#define rrep(i,n) for(int i = 1; i <= (int)(n); i++) 
#define pb push_back
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

//const ll mod = 1000000007;
//const ll INF = mod * mod;
//const double pi = 3.14159265358979;

int main() {
    int n;
    cin >> n;
    vi v(n);
    rep(i,n) cin >> v[i];
    int element_even,element_odd;
    if(n % 2 == 0) {
        element_even = n / 2;
        element_odd = n /2;
    }
    else {
        element_even = (n - 1) /2;
        element_odd = (n + 1) / 2;
    }
    vi even(100010),odd(100010);
    rep(i,n) {
        if(i % 2 == 0) odd[v[i]]++;
        else even[v[i]]++;
    }
    int max_even = 0,max_odd = 0;
    int e,o;
    rep(i,even.size()) {
        if(even[i] > max_even) {
            max_even = even[i];
            e = i;
        }
    }
    rep(i,odd.size()) {
        if(odd[i] > max_odd) {
            max_odd = odd[i];
            o = i;
        }
    }
    if(e != o) {
        //cout << max_odd << " " << max_even << endl;
        int ans = 0;
        ans += (element_even - max_even);
        ans += (element_odd - max_odd);
        cout << ans << endl;
    }
    else {
        int second_maxeven = 0;
        rep(i,even.size()) {
            if(even[i] > second_maxeven) {
                if(i == e) continue;
                else second_maxeven = even[i];
            }
        }
        int ans1 = 0;
        ans1 += (element_even - second_maxeven);
        ans1 += (element_odd - max_odd);
        int second_maxodd = 0;
        rep(i,odd.size()) {
            if(odd[i] > second_maxodd) {
                if(i == o) continue;
                else second_maxodd = odd[i];
            }
        }
        int ans2 = 0;
        ans2 += (element_odd - second_maxodd);
        ans2 += (element_even - max_even);
        cout << min(ans1,ans2) << endl;
    }
    /*
    rep(i,10) cout << odd[i] << " ";
    cout << endl;
    rep(i,10) cout << even[i] << " ";
    cout << endl;
    */
}


Measured memory_bytes: 1408
package main

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

func main() {
	var L = float64(irLine(1)[0][0])

	fmt.Printf("%f", (L/3)*(L/3)*(L/3))
}

//Print Print string data to standard output
func Print(data interface{}) {
	switch data.(type) {
	case string:
		os.Stdout.Write([]byte(data.(string)))
	case int:
		os.Stdout.Write([]byte(strconv.Itoa(data.(int))))
	}
}

//StrStdin Read standard input data
func StrStdin(line int) [][]string {
	var stringInput [][]string
	scanner := bufio.NewScanner(os.Stdin)

	for i := 0; i < line; i++ {
		scanner.Scan()
		if s := scanner.Text(); s != "" {
			stringInput = append(stringInput, strings.Split(strings.TrimSpace((scanner.Text())), " "))
		} else {
			break
		}
	}

	return stringInput
}

//rLine Read standard input data
func rLine(line int) [][]string {
	var rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	var buf = make([]byte, 0, 1000000)
	var stringInput [][]string

	for i := 0; i < line; {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			stringInput = append(stringInput, strings.Split(strings.TrimSpace((string(buf))), " "))
			buf = []byte{}
			i++
		}
	}
	return stringInput
}

func irLine(i int) [][]int {
	return alitoas(rLine(i))
}

//itoa converts string to integer
func itoa(s string) int {
	var i, _ = strconv.Atoi(s)
	return i
}

func itoas(S []string) []int {
	var result = make([]int, len(S))
	for i, s := range S {
		result[i] = itoa(s)
	}
	return result
}

func alitoas(S [][]string) [][]int {
	var result = make([][]int, len(S))
	for i, s := range S {
		result[i] = itoas(s)
	}
	return result
}

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

func gcd3(a, b, c int) int {
	return gcd(gcd(a, b), c)
}


Measured memory_bytes: 640
#include<iostream>
#define AMARI 1000000000+7
using namespace std;
long long int power(long long int a){
  long long int sum=1;
  for(long long int i=1;i<=a;i++){
    sum*= i;
    sum%= AMARI;
  }
  return sum;
}
int main(){
  int diff;
  long long int sum=1,d,m;
  cin >> d >> m;
  if((diff=abs(d-m))>=2){
    cout << 0<<endl;
  }else{
    sum= (power(d)*power(m));
    sum%=AMARI;
    if(diff==0){
      sum*=2;
      sum%=AMARI;
    }
    cout << sum << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
#define IOS ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define AfterDecimal(n) cout << fixed << setprecision(n);
#define pb push_back
#define pp(a, b) pair <a, b>
#define ll long long int
#define ld long double
#define all(a) a.begin(), a.end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
#define itr iterator
#define bits(x) __builtin_popcount(x)
#define fori(n)  for (ll i = 0; i < n; i++)
#define forj(n)  for (ll j = 0; j < n; j++)
#define fork(n)  for (ll k = 0; k < n; k++)
#define vll vector <ll>
#define mll map <ll, ll>
#define vpll vector <pll>
 
 
using namespace __gnu_pbds;
using namespace std;
 
template <class T> T printr(T p){ cout << p << '\n'; return 0; }
template <class T> T printe(T p){ cout << p << '\n'; exit(0); }
template <class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template <class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
 
 
//template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update>  
    ordered_set;  
 
#ifdef LOCAL
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << "# "<< name << " = " << arg1 << '\n';
}
template<typename Arg1, typename... Args>
void __f(const char* names, Arg1 && arg1, Args &&... args){
        const char* comma = strchr(names + 1 ,',');
        cout << "# ";
        cout.write(names, comma - names)<< " = " << arg1 << " | ";
        __f(comma + 1, args...);
}
#else
#define debug(...) 36
#endif
 
ll power(ll x, ll y, ll p){ 
   ll res = 1;
   x = x % p;  
   while (y > 0) {
      if (y & 1) 
         res = (res * x) % p; 
      y = y >> 1;
      x = (x * x) % p; 
   }
   return res;
}
 
const ll INF = (ll)(8e18);
const ll MOD = (ll)(1e9 + 7);
const ll HMOD = (ll)4222234727;
const ll hashprime = (ll)31;
 
const int maxn = 200010;


int32_t main(){
    IOS;
    #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    ll h,n; cin >> h >> n;
    ll val = 0;
    for(int i = 1; i <= n; i++){
        ll x; cin >> x;
        val += x;
    }
    cout << ((val >= h) ? "Yes" : "No") << '\n';
    #ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}


Measured memory_bytes: 256
#include <stdio.h>

#define N 20

int main(void) {
    int n, m, c, sum, num, cnt = 0;
    int a[N];

    scanf("%d %d %d", &n, &m, &c);
    
    for (int i = 0; i < m; i++) {
        scanf("%d", &a[i]);
    }

    for (int i = 0; i < n; i++) {
        sum = 0;
        for (int j = 0; j < m; j++) {
            scanf("%d", &num);
            sum = sum + num * a[j];
        }
        sum = sum + c;
        if (sum > 0) {
            cnt++;
        }
    }

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


Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0
for i in range(n):
    ans+=b[a[i]-1]
    if(i!=0 and a[i]-1==a[i-1]):
        ans+=c[a[i-1]-1]
print(ans)


Measured memory_bytes: 3064
import numpy
N,K = map(int,input().split())
H = list(map(int,input().split()))

H = numpy.sort(H)
sum = 0
#print(H)
if N-K > 0:
  for i in range(N-K):
    sum = sum + H[i]
else:
    sum = 0
    
print(sum)

Measured memory_bytes: 43092
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

//3-2 挿入ソート
public class Main {
	 public static void main(String args[]) throws IOException {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int A[] = new int[n];
		for(int i = 0; i < n; i++) {
			A[i] = scanner.nextInt();
		}
		scanner.close();

		//昇順に並べる挿入ソート
		for(int i = 0; i < A.length; i++) {
			int tmp = A[i];
			int j = i - 1;
			while(j >= 0 && A[j] > tmp) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = tmp;
			System.out.println(Arrays.toString(A).replaceAll("[,\\[\\]]", ""));
		}

	 }
}


Measured memory_bytes: 31604
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

typedef long long ll;

const int N=405,Mo=998244353;

int pwr(int x,int y) {
	int z=1;
	for(;y;y>>=1,x=(ll)x*x%Mo)
		if (y&1) z=(ll)z*x%Mo;
	return z;
}

void inc(int &x,int y) {x=x+y>=Mo?x+y-Mo:x+y;}

int n,a[N],b[N],fac[N],pw[N][N],inv[N],iv,sa,sb;
int f[N][N],g[N][N],c[N][N];

int main() {
	scanf("%d",&n);
	fo(i,1,n) scanf("%d%d",&a[i],&b[i]),sa+=a[i],sb+=b[i];

	fac[0]=1;fo(i,1,sb) fac[i]=(ll)fac[i-1]*i%Mo;
	inv[sb]=pwr(fac[sb],Mo-2);fd(i,sb-1,0) inv[i]=(ll)inv[i+1]*(i+1)%Mo;

	iv=pwr(sa,Mo-2);

	fo(i,1,n) {
		pw[i][0]=1;pw[i][1]=(ll)a[i]*iv%Mo;
		fo(j,2,b[i]) pw[i][j]=(ll)pw[i][j-1]*pw[i][1]%Mo;
	}

	f[0][0]=1;sa=sb=0;
	fo(i,1,n) {
		sb+=b[i]-1;sa+=a[i];
		fd(s,sa,0)
			fd(t,sb,0) {
				f[s][t]=Mo-f[s][t];
				fo(k,1,b[i]-1) if (t>=k) inc(f[s][t],Mo-(ll)f[s][t-k]*pw[i][k]%Mo*inv[k]%Mo);
				if (s>=a[i]) inc(f[s][t],f[s-a[i]][t]);
			}
	}
	fo(s,0,sa) fo(t,0,sb) c[s][t]=pwr((ll)sa*pwr(sa-s,Mo-2)%Mo,t+2);
	int ans=0;
	fo(i,1,n) {
		fo(s,0,sa-a[i]) fo(t,0,sb-b[i]+1) g[s][t]=f[s][t];
		fo(s,0,sa-a[i])
			fo(t,0,sb-b[i]+1) {
				if (s>=a[i]) inc(g[s][t],Mo-g[s-a[i]][t]);
				fo(k,1,b[i]-1) if (t>=k) inc(g[s][t],(ll)g[s][t-k]*pw[i][k]%Mo*inv[k]%Mo);
				g[s][t]=Mo-g[s][t];
			}
		int ret=0;
		fo(s,0,sa-a[i])
			fo(t,0,sb-b[i]+1) 
				(ret+=(ll)g[s][t]*c[s][t+b[i]-1]%Mo*fac[t+b[i]]%Mo)%=Mo;
		(ans+=(ll)ret*pw[i][b[i]]%Mo*inv[b[i]-1]%Mo)%=Mo;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 2816
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))


happy_sum = 0
for n in range(N):
    
    happy_sum += B[A[n] - 1]
    
    if n != 0 and A[n] == A[n-1] + 1:
        happy_sum += C[A[n-1] - 1]

print(happy_sum)

Measured memory_bytes: 3064
A = input()
B = input()
C = input()
list_A=[]
list_B=[]
list_C=[]

def cardA():
    if(not list_A):
       print("A")
    else:
        tmp = list_A.pop(0)
        if(tmp=="a"):
            cardA()
        elif(tmp=="b"):
            cardB()
        else:
            cardC()
        
def cardB():
    if(not list_B):
       print("B")
    else:
        tmp = list_B.pop(0)
        if(tmp=="a"):
            cardA()
        elif(tmp=="b"):
            cardB()
        else:
            cardC()

def cardC():
    if(not list_C):
       print("C")
    else:
        tmp=list_C.pop(0)
        if(tmp=="a"):
            cardA()
        elif(tmp=="b"):
            cardB()
        else:
            cardC()

for i in range (len(A)):
    list_A.append(A[i])

for i in range (len(B)):
    list_B.append(B[i])

for i in range (len(C)):
    list_C.append(C[i])

atmp = list_A.pop(0)
if(atmp=="a"):
    cardA()
elif(atmp=="b"):
    cardB()
else:
    cardC()


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) {
    cin >> a[i];
  }

  sort(a.begin(), a.end(), greater<int>());
  int a_sum, b_sum;
  a_sum = 0;
  b_sum = 0;
  rep(i,n) {
    if (i%2 == 0) a_sum+= a[i];
    else b_sum += a[i];
  }

  cout << a_sum-b_sum << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
ans = ['' for _ in range(n)]


def dfs(i, mx):
    if i == n:
        print(''.join(ans))
        return
    for j in range(mx+1):
        ans[i] = chr(ord('a') + j)
        dfs(i+1, max(j+1, mx))


dfs(0, 0)


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

typedef long long ll;

int main() {
	int n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; ++i) cin >> a[i];

	ll ans = 0, h = 0;
	for (int i = 0; i < n; ++i) {
		if (a[i] < h) ans += h - a[i];
		else  h = a[i];
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4468
#python3
from collections import deque
def main():
    n = int(input()) 
    #隣接リスト表現でグラフを管理する
    #v-uのcostはto[v]においてuが格納されている位置と同じcost[v]リスト位置に保存するような対応関係をとる
    to = [[] for _ in range(n)]
    cost = [[] for _ in range(n)]
    for _ in range(n-1):
        v, u, w  = map(int, input().split())
        v -= 1
        u -= 1
        to[v].append(u)
        cost[v].append(w)
        to[u].append(v)
        cost[u].append(w)

    
    #根からの距離を偶奇をBFSで求める    
    dist = [-1 for _ in range(n)]
    dist[0] = 0
    q = deque()
    q.append(0)
    while len(q) != 0:
        #訪問予定の頂点を取り出す
        val = q.popleft()
        #頂点vに連結している頂点を探索すして訪問予定に追加する
        for i in range(len(to[val])):
            wal = to[val][i]
            cos = cost[val][i]
            if dist[wal] != -1:
                continue
            dist[wal] = (dist[val] + cos)%2 
            q.append(wal)
    
    for i in range(n):
        print(dist[i])
main()

Measured memory_bytes: 38292
n=int(input())
t=0
x=0
y=0
for i in range(n):
  g,h,j=map(int,input().split())
  if (g-t)%2==(abs(h-x)+abs(j-y))%2 and (abs(h-x)+abs(j-y))<=(g-t):
    t=g
    x=h
    y=j
  else:
    print("No")
    exit()

print("Yes")


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

int main() {
    long long int n, k;
    cin >> n >> k;
    vector<long long int> h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }

    sort(h.begin(), h.end());

    long long int ans = 10000000000;
    for (int i = 0; i < n; ++i) {
        if (i + k - 1 >= n) {
            break;
        } else {
            ans = min(ans, h[i+k-1] - h[i]);
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main()
{
   long long n,q;
   cin>>n>>q;
   long long sum=0;
   long long s=0;
   for(int i=0; i<n; i++)
   {
        long long x;
        cin>>x;
        sum+=x+q-max(s,x);
        s=q+x;
   }
   cout<<sum<<endl;

	return 0;
}


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

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define REP(i, n) for(ll i = n-1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << x << endl
#define mp make_pair
#define pb push_back

const long long MOD = 1000000007;
const long long INF = 1LL<<60;


int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cout << fixed << setprecision(12);
    ll a, b;
    cin >> a >> b;
    ll out = a * b / __gcd(a, b);
    cout << out << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define INFTY (1 << 21)
#define WHITE 0
#define GRAY 1
#define BLACK 2

int h,ray[100][100];

void dijkstra();

int main(){
  int i, j, u, k, v, w;

  scanf("%d",&h);

  for(i = 0 ; i < h ; i++){
    for(j = 0 ; j < h ; j++){
      ray[i][j] = INFTY;
    }
  }

  for(i = 0 ; i < h ; i++){
    scanf("%d%d",&u,&k);

    for(j = 0 ; j < k ; j++){
      scanf("%d%d",&v,&w);
      ray[u][v] = w;
    }
  }

  dijkstra();

  return 0;
}

void dijkstra(){
  int i,minx,u,v;
  int d[100], color[100];

  for(i = 0 ; i < h ; i++){
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  color[0] = GRAY;

  while(1){
    minx = INFTY;
    
    u = -1;
    
    for(i = 0 ; i < h ; i++){
      if(minx > d[i] && color[i] != BLACK){
	u = i;
	minx = d[i];
      }
    }

    if(u == -1) break;

    color[u] = BLACK;
    
    for(v = 0 ; v < h ; v++){
      if(color[v] != BLACK && ray[u][v] != INFTY){
	if(d[v] > d[u] + ray[u][v]){
	  d[v] = d[u] + ray[u][v];
	  color[v] = GRAY;
	}
      }
    }
  }

  for(i = 0 ; i < h ; i++){
    printf("%d ",i);

    if(d[i] == INFTY) printf("-1\n");
    else printf("%d\n",d[i]);
  }
}
    



Measured memory_bytes: 2052
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
int main(){
  int n;
  cin>>n;
  map<ll,ll>M;
  rep(i,n){
    string s;
    cin>>s;
    M[s[0]]++;
  }
  vl vec;
  for(auto p:M){
    if(p.first=='M'||p.first=='A'||p.first=='R'||p.first=='C'||p.first=='H'){
      vec.push_back(p.second);
    }
  }
  ll ans=0;
  if(vec.size()<3){
    cout<<0<<endl;
    return 0;
  }
  for(int i=0;i<vec.size()-2;i++){
    for(int j=i+1;j<vec.size()-1;j++){
      for(int k=j+1;k<vec.size();k++){
        ans+=vec[i]*vec[j]*vec[k];
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
#define trav(x,c) for(auto &x:c)
using namespace std;

int toint(string s) {
  int ans = 0;
  for(char x: s) ans = ans*10 + (x - '0');
  return ans;
}

int sum(int x) {
  int s = 0;
  while(x) {
    s += x%10;
    x /= 10;
  }
  return s;
} 

int main() {
  int n;
  cin>>n;
  int ans = 0;
  while(n--) {
    int l,r;
    cin>>l>>r;
    ans += r-l+1;
  }
  cout<<ans;
}

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

int main(){
    int p, q, r;
    int maior = 0;
    cin >> p >> q >> r;
    int horas[3] = {p, q, r};
    int index = 0;
    for(int i = 0;i < 3;i++){
        if(horas[i] > maior){
            maior = horas[i];
            index = i;
        }
    }
    horas[index] = NULL;
    int total = 0;
    for(int i = 0; i< 3;i++){
        if(horas[i] != NULL){
            total+= horas[i];
        }
    }
    cout <<total <<endl;

}

Measured memory_bytes: 256
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<iomanip>
#include<sstream>
#include<cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
typedef long long int ll;
const ll INF = 1LL << 60;
const int MOD = 1000000007;
ll n, k, ans = 0, o; vector<ll> a;
int main() {
    cin >> n >> k;
    vector<int> h(n),dp(n+5,MOD);
    rep(i, n) {
        cin >> h[i];
    }dp[0] = 0;
    rep(i, n) {
        for (int j = 1;i + j < n && j <= k; j++) {
            dp[i + j] = min(abs(h[i] - h[i + j])+dp[i], dp[i + j]);
        }
    }cout << dp[n -1] << endl;
}

Measured memory_bytes: 1024
PROGRAM WW3
  implicit none
  INTEGER::a,b,n
  INTRINSIC MOD
  character(len=100) w
  b=0
  read(*,*) w
  a = len_trim(w)
  
   DO n=1,a/2
    IF(w(n:n) == w(a+1-n:a+1-n))THEN
     b=b
    ELSE
     b=b+1
    END IF
   END DO
   
  WRITE(*,*) b

END PROGRAM WW3

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

using namespace std;

void solve()
{
	int n, k;
	string s;
	cin >> n >> k >> s;
	vector<pair<int, int>> ps;
	for (int i = 0; i < n; i++)
	{
		if (ps.empty() || ps.back().first != s[i]-'0')
		{
			ps.emplace_back(s[i]-'0', 1);
		}
		else
		{
			ps.back().second++;
		}
	}
	int cnt = 0, ans = 0, now = 0, ptr = 0;
	for (const auto &p : ps)
	{
		while (ptr < (int)ps.size() && cnt + (ps[ptr].first == 0) <= k)
		{
			now += ps[ptr].second;
			cnt += 1 - ps[ptr].first;
			ptr++;
		}
		ans = max(ans, now);
		cnt -= 1 - p.first;
		now -= p.second;
	}
	cout << ans << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 1528
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vii vector<vi>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	 //cin.tie(0);
	//ios::sync_with_stdio(false);
	//std::cout << std::fixed;
	//std::cout << std::setprecision(12);
	//std::cout << std::defaultfloat;
	int n;
	cin>>n;
	vector<vector<int>> g(n+1,vector<int>(n+1,0));
	if(n%2){
		FOR(i,1,n/2){
			g[i][i+1]=1;
			g[i][n-(i+1)]=1;
			g[n-i][i+1]=1;
			g[n-i][n-(i+1)]=1;
		}
		g[n][1]=1;
		g[n][n-1]=1;
		g[n][n-n/2]=1;
		g[n][n/2]=1;
	}else{
		FOR(i,1,n/2){
			g[i][n-i]=1;
			g[i][i+1]=1;
			g[n-i+1][i+1]=1;
			g[n-i+1][n-i]=1;
		}
		g[1][n/2]=1;
		g[1][n/2+1]=1;
		g[n][n/2]=1;
		g[n][n/2+1]=1;
	}
	int c=0;
	FORQ(i,1,n){
		FORQ(j,i+1,n){
			if(g[i][j]||g[j][i]){
				c++;
			}
		}
	}
	cout<<c<<endl;
	FORQ(i,1,n){
		FORQ(j,i+1,n){
			if(g[i][j]||g[j][i]){
				cout<<i<<" "<<j<<endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 384
// AtCoder.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <math.h>
#include <cmath>

using namespace std;

int main() {
    int n;
    cin >> n;
    set<string> s;
    for(int i = 0; i < n; i++){
        string str;
        cin >> str;
        s.insert(str);
    }
    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 19244
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

typedef long long ll;
typedef pair< int, int > pii;

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

  int a[3];
  cin >> a[0] >> a[1] >> a[2];

  int ans = INF_INT;
  int p[3] = {0, 1, 2};
  do{
    ans = min(ans,
        abs(a[p[0]] - a[p[1]]) + abs(a[p[1]] - a[p[2]]));
  }while(next_permutation(p, p + 3));

  cout << ans << endl;

  return 0;
}


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

#define f first
#define s second
#define ins insert
#define pb push_back
#define endl '\n'
#define ll long long
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define ii pair<int,int>
#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define tc ll t; cin >> t; while (t--)
#define sz(c) (int) (c).size()
#define trav(x,c) for (auto &x : c)
#define all(c) (c).begin(), (c).end()
#define rll(c) (c).rbegin(), (c).rend()
#define db(x) cout << #x << ": " << x << endl;
#define _db(c) trav(x,c) cout << x << " "; cout << endl;
#define godspeed ios_base::sync_with_stdio(0); cin.tie(0);

int a[100005];
int main() { 
    godspeed;
    
    ll n, sum = 0; cin >> n;
    vl v(n);
    for (ll i = 0 ; i < n ; ++i) {cin >> v[i]; sum += v[i]; a[v[i]]++;}
    sort(all(v));
	
    ll k; cin >> k;
    ll lsum = sum;
	while (k--) {
		ll x, y; cin >> x >> y;
		lsum += (y-x)*a[x];
		cout << lsum << endl;
		a[y] += a[x];
		a[x] = 0;
	}
}

Measured memory_bytes: 4460
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int n;
  long height[100001];
  int i;
  long old=0;

  scanf("%d", &n);
  for(i=0;i<n;i++)scanf("%ld",&height[i]);

  old = height[n-1];

  for(i=n-2;i >= 0;i--){
    if(old < height[i]){
      height[i]--;

      if(height[i] > old){
        puts("No");
        return 0;
      }
    }
    old = height[i];
  }

  puts("Yes");
  return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define Sheryang main
typedef long long ll;
#pragma GCC optimize(3)
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > >
template<class T> inline T min(T &x,const T &y){return x>y?y:x;}
template<class T> inline T max(T &x,const T &y){return x<y?y:x;}
struct ios {
inline char gc(){
static const int IN_LEN=1<<18|1;
static char buf[IN_LEN],*s,*t;
return (s==t)&&(t=(s=buf)+fread(buf,1,IN_LEN,stdin)),s==t?-1:*s++;
}
template <typename _Tp> inline ios & operator >> (_Tp&x){
static char ch,sgn; ch = gc(), sgn = 0;
for(;!isdigit(ch);ch=gc()){if(ch==-1)return *this;sgn|=ch=='-';}
for(x=0;isdigit(ch);ch=gc())x=(((x<<2)+x)<<1)+(ch^'0');
sgn&&(x=-x); return *this;
}
}io;
const int maxn = 5e5 + 7;
const int mod = 1e9 + 7;
/** keep hungry and keep calm! **/

/**
递归
第一、二条光线之和等于等边三角形的边长
去掉这两条边
剩下的边长之间是有关系的
每次都是满足(x,y)->(y,x%y)的关系
x = 5 y = 3
x = 3 y = 2
x = 2 y = 1
每次增加的长度是2*(x-x%y)
即每次都在x的基础上减少x%y，而且会反射两次 
当x%y == 0时，光线不再反射
增加的长度是2*x-y
**/
ll n,m;
ll ans;
void dfs(ll x,ll y)
{
	if(x % y == 0)
	//递归一定存在结束条件，先写结束条件
	{
		ans += 2*x-y;
		return ;
	}
	else
	{
		ans += 2*(x-x%y);
		dfs(y,x%y);
	}
}

int main()
{
	cin >> n >> m;
	ans = n;//第一二条光线的和为边长
	n = n-m;
	dfs(max(n,m),min(n,m));
	cout << ans << endl; 
	return 0;
}

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

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;


//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

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

#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)


struct Edge {
    int to, from;
    ll cost;
    Edge(int from, int to, ll cost): from(from), to(to), cost(cost) {}
};

typedef vector<vector<Edge>> AdjList;
AdjList graph;

typedef vector<ll> vec;
typedef vector<vec> mat;

mat mul(mat &A, mat &B) {
    mat C(A.size(), vec((int)B[0].size()));
    for(int i=0; i<A.size(); ++i){
        for(int k=0; k<B.size(); ++k){
            for(int j=0; j<B[0].size(); ++j){
                C[i][j] = (C[i][j] + A[i][k] * B[k][j] %MOD) % MOD;
            }
        }
    }
    return C;
}
mat mat_pow(mat A, ll n) {
    mat B(A.size(), vec((int)A.size()));

    for(int i=0; i<A.size(); ++i){
        B[i][i] = 1;
    }

    while(n > 0) {
        if(n & 1) B = mul(B, A);
        A = mul(A, A);
        n >>= 1;
    }
    return B;
}


int main() {
    //cin.tie(0);
    //ios::sync_with_stdio(false);
    //cout << fixed << setprecision(10);
    
    ll N; cin >> N;
    cout << (N-1)*N /2 << endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int K,N;
  int max_ind,max_val;

  cin >> K >> N;
  
  vector<int> A(N);

  for(int i=0;i < N;i++) cin >> A.at(i);

  vector<int> kaisa(N-1);

  for(int i = 0;i < N - 1; i++) {
    kaisa.at(i) = A.at(i+1) - A.at(i);
  }

  max_ind = 0;
  max_val = A.at(0) + (K - A.at(N-1));

  for(int i = 0;i < N - 1; i++) {
    if(max_val < kaisa.at(i)) {
      max_val = kaisa.at(i);
      max_ind = i;
    }
  }

  //max_indが始点

  int result = K - max_val;

  cout << result << endl;

  
}

Measured memory_bytes: 1920
import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')

#2234
#import numpy as np

def main():
	m=II()
	di=0
	su=0
	for _ in range(m):
		d,c=MI()
		di+=c
		su+=d*c

	print((su-1)//9+di-1)

if __name__ == "__main__":
	main()

Measured memory_bytes: 3064
#include <cstdio>
using namespace std;

int main() {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  
  if(a==b) {
    if(a!=c) printf("Yes"); 
    else printf("No");
  } else {
    if(b==c) printf("Yes");
    else if(a==c) printf("Yes");
    else printf("No");
  }
  
  return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
	int n,k;	scanf("%d%d",&n,&k);
	while(k--){
		int x,y;	scanf("%d%d",&x,&y);
		x--,y--;
		x=min(x,n-x-1);
		y=min(y,n-y-1);
		if(x>y)	swap(x,y);
		printf("%d\n",x%3+1);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int N;
	cin >> N;
	
	vector<int> X(N), Y(N), P(N);
	REP(i, N) scanf("%d %d %d", &X[i], &Y[i], &P[i]);
	
	auto compress = [](auto &&v, auto &&cv, auto &z) -> void {
		for (auto &&u : v) cv.emplace_back(u);
		cv.emplace_back(INF);
		cv.emplace_back(-INF);
		cv.emplace_back(0);
		sort(ALL(cv));
		cv.erase(unique(ALL(cv)), cv.end());
		for (auto &&u : v) u = lower_bound(ALL(cv), u) - cv.begin();
		z = lower_bound(ALL(cv), 0) - cv.begin();
	};
	
	vector<int> cx, cy;
	int zx, zy;
	compress(X, cx, zx);
	compress(Y, cy, zy);

	vector<vector<int>> distx(1<<N, vector<int>(cx.size(), INF));
	vector<vector<int>> disty(1<<N, vector<int>(cy.size(), INF));
	
	auto solve = [N](auto &&v, auto &&z, auto &&cv, auto&& distv) -> void {
		REP(s, 1 << N) {
			REP(i, N) if (s >> i & 1) distv[s][v[i]] = 0;
			distv[s][z] = 0;
			
			REP(i, cv.size()) REP(j, cv.size()) if (i != j && distv[s][j] == 0) {
				chmin(distv[s][i], abs(cv[i] - cv[j]));
			}
		}
	};
	
	solve(X, zx, cx, distx);
	solve(Y, zy, cy, disty);
	
	vector<ll> ans(N + 1, longINF);
	REP(s1, 1 << N) { // 鉄道が通る集落
		int cnt = 0;
		REP(i, N) if (s1 >> i & 1) ++cnt;
		for (int s2 = s1;; s2 = (s2 - 1) & s1) { // s1 の内、左右に伸びる鉄道の集合
			int s3 = s2 ^ s1; // 上下
			
			ll cur = 0;
			REP(i, N) cur += (ll)min(distx[s2][X[i]], disty[s3][Y[i]]) * P[i];
			chmin(ans[cnt], cur);
			if (s2 == 0) break;
		}
	}
	
	REP(i, N + 1) cout << ans[i] << endl;
	return 0;
}


Measured memory_bytes: 9912
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
//#include <function>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i < (int)(n); i++)


int main() {

  int N, K;
  string ss;
  cin >> N;
  cin >> ss;
  cin >> K;

  char target = ss[K - 1];

  REP(i, N) if (ss[i] != target) ss[i] = '*';

  cout << ss << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int x=abs(a-c),y=abs(b-d);
    cout<<((x/gcd(x,y))+(y/gcd(x,y))-1)*gcd(x,y)<<endl;
    return 0;
}


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

using namespace std;

int a[222222];
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int p;
		scanf("%d", &p);
		a[p] = i;
	}
	int m = 0, c = 0;
	for (int i = 2; i <= n; i++) {
		if (a[i - 1] > a[i]) {
			c = 0;
			continue;
		}
		c++;
		m = max(m, c);
	}
	cout << n - m - 1 << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int solve(ll x){
    ll left = 0, right = 1000000000;
    ll mid;

    while(right-left > 1){
        mid = (left+right)/2;
        if(2*x <= mid*(mid+1)) right = mid;
        else left = mid;
    }

    return right;
}

int main(){
    ll x; cin >> x;

    cout << solve(x) << endl;
}

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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

int main() {
    int N, K;
    cin >> N >> K;
    if ((N + 1) / 2 >= K) cout << "YES" << endl;
    else cout << "NO" << endl;
}


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

N = int(input())
ans = 0
if N < 10:
  ans = N
elif N < 100:
  ans = 9
elif N < 1000:
  ans = 9 + (N - 100 + 1)
elif N < 10000:
  ans = 909
elif N < 100000:
  ans = 909 + (N - 10000 + 1)
else:
  ans = 90909

print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int aa[15][15],vv[15],ss[15];
int main()
{
	int n,m,x,zx,ans=99999999;
	cin>>n>>m>>x;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=m;j++)
		{
			cin>>zx;
			if(!j) vv[i]=zx;
			aa[i][j]=zx;
		}
	}
	for(int i=1;i<(1<<n);i++)
	{
		for(int d=0;d<=m;d++) ss[d]=0;
		int j=i,tatal=0,f=1;
		for(int k=0;k<n;k++)
		{
			if((j>>k)&1) 
			{
				tatal+=vv[k+1];
				//cout<<(j>>k)<<endl;
				for(int b=1;b<=m;b++) ss[b]+=aa[k+1][b];
				//cout<<tatal<<endl; 
			}
		//	for(int h=1;h<=m;h++) cout<<ss[h]<<"   ";
		}
		for(int c=1;c<=m;c++) if(ss[c]<x) f=0;
		if(f&&tatal<ans) ans=tatal;
	}
	if(ans==99999999) cout<<"-1"<<endl;
	else cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3168
V,E,r = map(int,input().split())
# adj_list = [ [] for _ in range(V)]
INF = float('inf')
edges = []

for _ in range(E):
  s,d,c = map(int, input().split())
  edges.append([s,d,c])


dist = [INF] * V
dist[r] = 0
for _ in range(V-1):
  for s,d,c in edges:
    # import pdb; pdb.set_trace()
    if dist[d] > dist[s] + c:
      dist[d] = dist[s] + c

for s,d,c in edges:
  if dist[d] > dist[s] + c:
    print("NEGATIVE CYCLE")
    exit()

for d in dist:
  print(d if d!=INF else "INF")



Measured memory_bytes: 6132
#include <stdio.h>

int main(void){
    int n;
    scanf("%d", &n);
    int a[n],b[n],c[n-1];
    int i;
    for(i=0;i<n;i++){
        scanf("%d", &a[i]);
    }
    for(i=0;i<n;i++){
        scanf("%d", &b[i]);
    }for(i=0;i<n-1;i++){
        scanf("%d", &c[i]);
    }

    int sum=0;
    for(i=0;i<n;i++){
        sum += b[a[i]-1];
        if(i<n){
          if(a[i+1]-a[i]==1){
              sum += c[a[i]-1];
          }
        }

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


Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{

   string s;
   cin>>s;
   int r;
   if(s=="SAT") r=1;
   else if(s=="SUN") r=7;
   else if(s=="MON") r=6;
   else if(s=="TUE") r=5;
   else if(s=="WED") r=4;
   else if(s=="THU") r=3;
   else if(s=="FRI") r=2;

   cout<<r<<endl;

	return 0;
}

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

int findSumOfDisits(int n) {
    int sum = 0;
    while (n) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

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

    string ans = "No";
    if (n % findSumOfDisits(n) == 0) {
        ans = "Yes";
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)
 
# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]
 
# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]
 
# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())
 
def log(*args):
    print("DEBUG:", *args, file=sys.stderr)
 
def count_bit_one(bits, n):
    ret = 0
    for keta in range(n):
        if bits & 2**keta:
            ret += 1
    return ret
 
n = int(input())
aaa = [None] * n
for i in range(n):
    a = int(input())
    aaa[i] = [ get_nums_l() for _ in range(a)]
 
ans = -1
for bits in range(2**n):
    ng = False
    for keta in range(n):
        if bits & 2**keta != 0:
            for a in aaa[keta]:
                if (bits & 2**(a[0]-1) != 0) != (a[1]==1):
                    ng = True
                    break
        if ng:
            break
    if not ng:
        ans = max(ans, count_bit_one(bits, n))
 
print(ans)

Measured memory_bytes: 44144
#46 未提出者は誰だ

list_1 = [int(input()) for i in range(28)]
list_1.sort()

list_2 = []
for i in range(1,31):
        list_2.append(i)

result = list(set(list_2) - set(list_1))
print(min(result))
print(max(result))


Measured memory_bytes: 5600