akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;
using PP = std::pair<P, P>;

constexpr ll INF = 1ll<<60;

constexpr ll dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll H, W;
std::vector<P> ps;
ll a[510][510];
bool used[510][510];
std::vector<PP> ans;

int main()
{
  std::cin >> H >> W;

  std::vector<P> ps;

  rep( i, H ) rep( j, W )
    std::cin >> a[i][j];

  ll dir = 1;
  ll ci = 0, cj = 0;

  while( true ) {
    ll ni, nj;
    
    if( (dir==1 && cj == W-1) || (dir==-1 && !cj) ) {
      dir *= -1;
      ni = ci+1, nj = cj;
    } else {
      ni = ci, nj = cj+dir;
    }

    if( used[ni][nj] || ci >= H )
      break;

    if( (a[ci][cj]&1) && ni < H ) {
      --a[ci][cj];
      ++a[ni][nj];

      ans.emplace_back( P( ci+1, cj+1 ), P( ni+1, nj+1 ) );
    }

    ci = ni;
    cj = nj;
  }

  std::cout << ans.size() << std::endl;

  for( auto pp : ans )
    printf( "%lld %lld %lld %lld\n", pp.first.first, pp.first.second, pp.second.first, pp.second.second );

  return 0;
}

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

public class Main {
	
	public static int check(int n , Set<Integer> set) {
		for(int i = 2; i*i <= n; i++) {
			if(n%i == 0) {
				if(n/i == i) {
					if(set.contains(i)) return 0; 
				}
				else {
					if(set.contains(i) || set.contains(n/i)) return 0; 
				}
			}
		}
		return 1; 
	}
	public static void solve(InputReader in) {
		int n = in.readInt(); 
		int a[] = new int[n]; 
		
		for(int i = 0; i<n; i++)
			a[i] = in.readInt(); 
		
		Set<Integer> set = new HashSet<>(); 
		HashMap<Integer, Integer> map = new HashMap<>(); 
		
		for(int i : a) {
			set.add(i); 
			map.put(i, map.getOrDefault(i, 0) + 1); 
		}
		if(map.get(1) != null) {
			int k = map.get(1); 
			if(k == 1) {
				System.out.println(1); 
				return; 
			}
			else {
				System.out.println(0); 
				return; 
			}
		}
		
		int count = 0; 
		
		for(int j = 0; j<n; j++) {
			if(check(a[j] , set) == 1 && map.get(a[j]) == 1) count++; 
		}
		
		System.out.println(count); 
	}
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in); 
		int t = 1; 
		while(t-- > 0) {
			solve(in); 
		}
	}
}

class InputReader{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	 public InputReader(InputStream stream) {
		this.stream = stream;
	}

     public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

     public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

     public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

     public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
     public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
     
     public String next() {
		return readString();
	}
    
     public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

int N;
int M = 55555;
vector<int> a(M+3, 0), prime;


int main(){
  cin >> N;
  FOR(i, 2, M+1){
    if(a[i] == 0 && i % 5 == 1){
      prime.push_back(i);
    }
    for(int j = 2; i*j <= M; j++){
      a[i*j] = 1;
    }
  }
  REP(i, N){
    cout << prime[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 512
N,K=map(int,input().split())
A=list(map(int,input().split()))
idx=A.index(1)
cnt=0
if idx:
    if idx+1<=K:
        cnt=1
        A[:K]=[1]*K
    else:
        cnt=(idx-1)//(K-1)+1
        num=cnt*(K-1)+1
        A[:num]=[1]*num
A=A[::-1]
idx=A.index(1)
if idx:
    if idx+1<=K:
        cnt+=1
        A[:K]=[1]*K
    else:
        cnt+=(idx-1)//(K-1)+1
        num=cnt*(K-1)+1
        A[:num]=[1]*num
print(cnt)

Measured memory_bytes: 14004
# 参考URL https://note.nkmk.me/python-union-find/
class UnionFind():
    # parents
    # 各要素の親要素の番号を格納するリスト
    # 要素が根（ルート）の場合は-(そのグループの要素数)を格納する
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    # find(x)
    # 要素xが属するグループの根を返す
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    # union(x, y)
    # 要素xが属するグループと要素yが属するグループとを併合する
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    # same(x, y)
    # 要素x, yが同じグループに属するかどうかを返す
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # size(x)
    # 要素xが属するグループのサイズ（要素数）を返す
    def size(self, x):
        return -self.parents[self.find(x)]

import sys
def input():
    return sys.stdin.readline().strip()

n, m, k = map(int, input().split())
ans = [-1 for _ in range(n)]
uf = UnionFind(n)

for _ in range(m):
    a, b = map(int, input().split())
    uf.union(a-1, b-1)
    ans[a-1] -= 1
    ans[b-1] -= 1

for _ in range(k):
    c, d = map(int, input().split())
    if uf.same(c-1, d-1):
        ans[c-1] -= 1
        ans[d-1] -= 1

for i in range(n):
    ans[i] += uf.size(i)

print(' '.join(map(str, ans)))

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

int main(){
  int L, R;
  cin >> L >> R;
  int A = L % 2019;
  int a = L / 2019;
  int B = R - (2019*a);
  int min = 2019*2019;
  if(2019 - A <= B - A){
    min = 0;
    cout << min << endl;
  } else {
    for(int i = A; i < B; i++){
      for(int j = i + 1; j <= B; j++){
        if(min > (i*j) % 2019){
          min = (i*j) % 2019;
        }
      }
    }
    cout << min << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	unsigned long long n;
	cin >> n;
	
	unsigned long long result = n / 11 * 2;
	unsigned long long m = n % 11;
	if (m) {
		if (m > 6) {
			++result;
		}
		++result;
	}
	
	cout << result << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x,ans=0,f=0;
  string s;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s>>x;
    if(s=="(")ans+=x;
    else ans-=x;
    if(ans<0)f++;
  }
  cout<<(f||ans?"NO":"YES")<<endl;
}

Measured memory_bytes: 3160
import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List
import Data.List.Split
import Data.Char

readInt = read :: String -> Int
getInt = readLn :: IO Int
getInts = map read . words <$> getLine :: IO [Int]
cond t f c = if c then t else f
-- end of templete

swap s p = lp ++ rv : mp ++ lv : rp
  where
    lp = take (i-1) s
    lv = s !! (i-1)
    mp = drop i . take (j-1) $ s
    rv = s !! (j-1)
    rp = drop (j) s
    i = minimum p
    j = maximum p

main = do
    w <- getInt
    n <- getInt
    bs <- map (map readInt . wordsBy (==',')) <$> replicateM n getLine
    mapM_ print $ foldl swap [1..w] bs

Measured memory_bytes: 4116
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main(){
	int n,h,w;
	cin>>n>>h>>w;
	vi a(h+1),b(w+1);
	for(int i=0;i<n;i++){
		int x,y,d;
		cin>>x>>y>>d;
		a[max(x-d,0)]++;
		a[min(x+d,h)]--;
		b[max(y-d,0)]++;
		b[min(y+d,w)]--;
	}
	bool B1=1,B2=1;
	for(int i=1;i<=h;i++) a[i]+=a[i-1];
	for(int i=1;i<=w;i++) b[i]+=b[i-1];
	for(int i=0;i<h;i++) if(!a[i]) B1=0;
	for(int i=0;i<w;i++) if(!b[i]) B2=0;
	cout<<(B1||B2?"Yes":"No")<<endl;
}


Measured memory_bytes: 3636
#![allow(non_snake_case)]

#[allow(unused_macros)]
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

fn main() {
    input!{
        N: [usize; 6],
    }
    let mut check_cnt = 0;
    let mut ignore_figure = 0;
    for i in 0..6 {
        for j in (i + 1)..6 {
            if N[i] == N[j] && N[i] != ignore_figure {
                check_cnt += 1;
                ignore_figure = N[i]
            }
        }
    }
    println!("{}", if check_cnt >= 2 { "YES" } else { "NO" })
}

Measured memory_bytes: 4352
package main

import (
	"bufio"
	"math"
	"os"
	"strconv"
)

const (
	initialBufSize = 1024
	maxBufSize     = 1e6
)

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriterSize(os.Stdout, 1000000)
)

func main() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer writer.Flush()

	n := scanInt()
	s := scanStrings(n)
	count := make([]int, 26)
	for i := 0; i < 26; i++ {
		count[i] = math.MaxInt16
	}

	for i := 0; i < n; i++ {
		r := []rune(s[i])

		for k := 'a'; k <= 'z'; k++ {
			if count[k-'a'] == -1 {
				continue
			}

			ok := false
			c := 0
			for j := 0; j < len(r); j++ {
				if r[j] == k {
					ok = true
					c++
				}
			}

			if ok {
				count[k-'a'] = min(count[k-'a'], c)
			} else {
				count[k-0x61] = -1
			}
		}
	}

	for i := 0; i < 26; i++ {
		r := count[i]
		if r != -1 {
			c := rune(i + 'a')
			for i := 0; i < r; i++ {
				writer.WriteRune(c)
			}
		}
	}
}

func scanInt() int {
	i, _ := strconv.Atoi(scanString())
	return i
}

func scanInts(size int) []int {
	ints := make([]int, size)
	for i := 0; i < size; i++ {
		ints[i] = scanInt()
	}
	return ints
}

func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanString(), 64)
	return f
}

func scanFloat64s(size int) []float64 {
	f := make([]float64, size)
	for i := 0; i < size; i++ {
		f[i] = scanFloat64()
	}
	return f
}

func scanString() string {
	scanner.Scan()
	return scanner.Text()
}

func scanStrings(size int) []string {
	s := make([]string, size)
	for i := 0; i < size; i++ {
		s[i] = scanString()
	}
	return s
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func pow(x, y int) int {
	return int(math.Pow(float64(x), float64(y)))
}

// greatest common divisor(最大公約数)
func gcd(a, b int) int {
	for {
		mod := a % b
		if mod == 0 {
			return b
		}
		a, b = b, mod
	}
}

// latest common multiple(最小公倍数)
func lcm(a, b int) int {
	return (a / gcd(a, b)) * b
}

func fact(n int) int {
	ret := 1
	for i := 1; i <= n; i++ {
		ret *= i
	}
	return ret
}

func perm(n, r int) int {
	ret := 1
	for i := 0; i < r; i++ {
		ret *= n
		n--
	}
	return ret
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func isPrimeNum(n int) bool {

	if n <= 1 {
		return false
	}

	l := int(math.Sqrt(float64(n)) + 1.)
	for i := 2; i < l; i++ {
		if n%i == 0 {
			return false
		}
	}

	return true
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
int main() {
	char a, b, c, d;
	cin >> a >> b >> c >> d;
	int A = a - '0', B = b - '0', C = c - '0', D = d - '0';
	if (A + B + C + D == 7) {
		cout << A << "+" << B << "+" << C << "+" << D << "=" << "7" << endl;
		getchar();
		getchar();
		return 0;
	}
	if (A + B + C - D == 7) {
		cout << A << "+" << B << "+" << C << "-" << D << "=" << "7" << endl;
		getchar();
		getchar();
		return 0;
	}
	if (A + B - C + D == 7) {
		cout << A << "+" << B << "-" << C << "+" << D << "=" << "7" << endl;
		getchar();
		getchar();
		return 0;
	}
	if (A + B - C - D == 7) {
		cout << A << "+" << B << "-" << C << "-" << D << "=" << "7" << endl;
		getchar();
		getchar();
		return 0;
	}
	if (A - B + C + D == 7) {
		cout << A << "-" << B << "+" << C << "+" << D << "=" << "7" << endl;
		getchar();
		getchar();
		return 0;
	}
	if (A - B + C - D == 7) {
		cout << A << "-" << B << "+" << C << "-" << D << "=" << "7" << endl;
		getchar();
		getchar();
		return 0;
	}
	if (A - B - C + D == 7) {
		cout << A << "-" << B << "-" << C << "+" << D << "=" << "7" << endl;
		getchar();
		getchar();
		return 0;
	}
	else {
		cout << A << "-" << B << "-" << C << "-" << D << "=" << "7" << endl;
		getchar();
		getchar();
		return 0;
	}
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
A = []
for _ in range(3):
    A += list(map(int, input().split()))
B = [False]*9
N = int(input())
for _ in range(N):
    n = int(input())
    if n in A:
        B[A.index(n)] = True

def check():
    if all(B[:3]) or all(B[3:6]) or all(B[6:9]):
        return True
    for i in range(3):
        if B[0+i] and B[3+i] and B[6+i]:
            return True
    if B[0] and B[4] and B[8]:
        return True
    if B[2] and B[4] and B[6]:
        return True
    return False

if check():
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
a = int(input())
b = list(map(int,input().split()))
b = [0] + b + [0]
s = [0]*(a+1)
for i in range(a+1):
    s[0] += abs(b[i] - b[i+1])
for j in range(1,a+1):
    s[j] = s[0] - abs(b[j] - b[j+1]) - abs(b[j-1] - b[j]) + abs(b[j-1] - b[j+1])
for k in range(1,a+1):
    print(s[k])

Measured memory_bytes: 14048
#include "bits/stdc++.h"
using namespace std;
int h,w;
int p[8][8];
int cp[8][8];
int cnt[4];//最後の1回は色固定
void cppanel()
{
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
			cp[i][j]=p[i][j];
	}
}

bool f[8][8];
int dx[4]={1,0,-1,0};
int dy[4]={0,-1,0,1};
void dfs(int nowh,int noww,int nowcolor,int nuru)
{
	f[nowh][noww]=true;
	for(int i=0;i<4;i++)
	{
		int nh=nowh+dx[i];
		int nw=noww+dy[i];
		if(nh>=0 && nh<h && nw>=0 && nw<w)
		{
			if(cp[nh][nw]==nowcolor && !f[nh][nw])
				dfs(nh,nw,nowcolor,nuru);
		}
	}
	cp[nowh][noww]=nuru;
	return;
}

int main()
{
	int c;
	int ans=0;
	while(1)
	{
		cin>>h>>w>>c;
		if(h==0)
			break;
		c--;
		for(int i=0;i<h;i++)
		{
			for(int j=0;j<w;j++)
			{
				cin>>p[i][j];
				p[i][j]--;
			}
		}
		fill(cnt,cnt+4,0);
		ans=0;
		for(int bit=0;bit<1296;bit++)
		{
			cnt[0]++;
			for(int i=0;i<4;i++)
			{
				if(cnt[i]==6)
				{
					cnt[i+1]++;
					cnt[i]=0;
				}
			}
			//順番に塗りつぶして調べる
			cppanel();
			for(int i=0;i<4;i++)
			{
				//dfsで帰るがけ順に塗りつぶし
				fill(f[0],f[8],false);
				dfs(0,0,cp[0][0],cnt[i]);
			}
			fill(f[0],f[8],false);
			dfs(0,0,cp[0][0],c);
			fill(f[0],f[8],false);
			dfs(0,0,c,c);//これでついでに連結成分を調べる
			int tmp=0;
			for(int i=0;i<h;i++)
			{
				for(int j=0;j<w;j++)
				{
					if(f[i][j])
						tmp++;
				}
			}
			ans=max(ans,tmp);
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3088
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
#include<complex>
using namespace std;

typedef complex<double> P;

struct L : public vector<P>{
    L(const P &a, const P &b){
        push_back(a), push_back(b);
    }
};

struct C {
    P p; double r;
    C(const P &p, double r) : p(p), r(r) { }
};

const double EPS = 1e-8;

namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

void crossPointsOfCircles(double c1x, double c1y, double c1r, double c2x, double c2y, double c2r){
    double x = c2x - c1x;
    double y = c2y - c1y;
    double K = (1.0/2)*(c1r*c1r + x*x + y*y - c2r*c2r);
    P cross1((K*x + y*sqrt(c1r*c1r*(x*x + y*y) - K*K))/(x*x + y*y), (K*y - x*sqrt(c1r*c1r*(x*x + y*y) - K*K))/(x*x + y*y));
    P cross2((K*x - y*sqrt(c1r*c1r*(x*x + y*y) - K*K))/(x*x + y*y), (K*y + x*sqrt(c1r*c1r*(x*x + y*y) - K*K))/(x*x + y*y));
    if(cross2 < cross1){
        swap(cross1, cross2);
    }
    printf("%.10f %.10f ", cross1.real() + c1x, cross1.imag() + c1y);
    printf("%.10f %.10f\n", cross2.real() + c1x, cross2.imag() + c1y);
}

int main(){
    double c1x, c1y, c1r, c2x, c2y, c2r;
    cin >> c1x >> c1y >> c1r >> c2x >> c2y >> c2r;

    crossPointsOfCircles(c1x, c1y, c1r, c2x, c2y, c2r);
    return 0;
}

Measured memory_bytes: 3268
#include <bits/stdc++.h>
    using namespace std;
    
    typedef pair<long , long> pair_t;

    bool comp(const pair_t &a , const pair_t &b){
        if(a.first == b.first){
            return a.second < b.second;
        }
        return a.first < b.first;
    }

        
    int main(){
        long n;
        cin >> n;
        long a;
        long ans;
        vector<long> v ,vminus ,vplus ;
        long minus = 0;
        long plus = 0;
        long t = 0;
        for(int i = 0 ; i < n ; i++){
            cin >> a;
            v.push_back(a);
            if(a <= 0){
                minus += 1;
                vminus.push_back(a);
            }else{
                plus += 1;
                vplus.push_back(a);
            }
            t += abs(a);
        }
        sort(v.begin(), v.end());
        sort(vminus.begin(), vminus.end());
        sort(vplus.begin(), vplus.end());
        long vpair;
        vpair = min(minus , plus );
        ans = t;
        if(minus > 0 && plus > 0){
            // plusminus
        }else if(plus == 0 ){
            // all minus or zero
            ans += v[n-1] * 2;
        }else{
            // all plus
            ans -= v[0] * 2 ;
        }
        cout << ans << endl;
        if(minus > 0 && plus > 0){
            for(long i = 0; i < plus - 1; i++){
                cout << vminus[0] << " " << vplus[i] << endl;
                vminus[0] = vminus[0] - vplus[i];
            }
            for(long i = 0; i < minus; i++){
                cout << vplus[plus - 1] << " " << vminus[i] << endl;
                vplus[plus - 1] = vplus[plus - 1] - vminus[i];
            }
        }else if(plus == 0){
            for(long i = 0; i < minus - 1; i++){
                cout << vminus[minus - 1] << " " << vminus[i] << endl;
                vminus[minus - 1] = vminus[minus - 1] - vminus[i];
            }
        }else{
            for(long i = 1; i < plus - 1; i++){
                cout << vplus[0] << " " << vplus[i] << endl;
                vplus[0] = vplus[0] - vplus[i];
            }
            cout << vplus[plus-1] << " " << vplus[0] << endl;
        }
        
        return 0;
    }

Measured memory_bytes: 3820
N,K = map(int,input().split())
p = list(map(int,input().split()))

l = []
for i in range(N):
    l.append(((1+p[i])*(p[i]/2))/p[i])

que = [0]*(N+1)
for i in range(1,N+1):
    que[i] = l[i-1]+que[i-1]

ans = 0
for i in range(K,len(l)):
    ans = max(ans,que[i+1]-que[i+1-K])

if N == K:
    print(max(que))
else:
    print(ans)

Measured memory_bytes: 32520
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 10;
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 998244353;
char s[N], t[N];
int main() {
	scanf("%s%s", s, t);
	for (int i = 0; i < (int)strlen(s); i++) {
		if (s[i] != t[i]) {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 3692
#include "bits/stdc++.h"
using namespace std;
const int N = 2e3 + 3;
const long long inf = 1e15;
int n , x;
int arr[N];
int dist[N][N];
int main(){
    scanf("%d %d" , &n , &x);
    for(int i = 0 ; i < n ; ++i){
        scanf("%d" , arr + i);
    }
    long long ans = inf;
    for(int i = 0 ; i < n ; ++i){
        dist[0][i] = arr[i];
    }
    for(int i = 1 ; i < n ; ++i){
        for(int j = 0 ; j < n ; ++j){
            dist[i][j] = min(dist[i - 1][j] , dist[i - 1][(j + n - 1) % n]);
        }
    }
    for(int i = 0 ; i < n ; ++i){
        long long cost = 0;
        for(int j = 0 ; j < n ; ++j){
            cost += dist[i][j];
        }
        cost += 1LL * i * x;
        ans = min(ans , cost);
    }
    printf("%lld\n" , ans);
}

Measured memory_bytes: 15872
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

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

ans = A * (N // (A + B))
if N % (A + B) >= A:
    ans += A
else:
    ans += N % (A + B)
print(ans)


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  string S;
  cin >> S;
  int N;
  cin >> N;

  int ans = 0;
  REP(i,N){
	string T;
	cin >> T;
	T += T;
	if(T.find(S) != string::npos)
	  ++ans;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3156
// Math = ♥️

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
#define pq priority_queue
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define sz(c) ((ll)c.size())
#define ordered_set                            \
    tree<ll, null_type, less<ll>, rb_tree_tag, \
         tree_order_statistics_node_update>
#define MAX (ll)(1e5 + 5)
#define MOD (ll)(1e9 + 7)

ll dp[MAX][105][2];
ll D;
string num;

ll solve(ll d, ll cnt, ll f) {
    if (d == -1) {
        if (cnt == 0) {
            return 1;
        } else {
            return 0;
        }
    }

    if (dp[d][cnt][f] == -1) {
        ll ans = 0;
        if (f == 0) {
            for (int i = 0; i <= 9; i++) {
                ans += solve(d - 1, (cnt + i) % D, 0);
                ans %= MOD;
            }
        } else {
            for (int i = 0; i < (num[d] - '0'); i++) {
                ans += solve(d - 1, (cnt + i) % D, 0);
                ans %= MOD;
            }
            ans += solve(d - 1, (cnt + (num[d] - '0')) % D, 1);
            ans %= MOD;
        }
        dp[d][cnt][f] = ans;
    }
    return dp[d][cnt][f];
}

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

    memset(dp, -1, sizeof(dp));

    cin >> num >> D;
    reverse(all(num));
    cout << (((solve(num.size() - 1, 0, 1) - 1) + MOD) % MOD) << "\n";
}


Measured memory_bytes: 165120
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> A, B;
int memo[1<<18][51];
bool visited[1<<18][51];
const int INF = 1<<29;
vector<int> aa;
int f(int p, int n, int m) {
	if (p == N) {
		return 0;
	}
	if (visited[n][m]) return memo[n][m];
	visited[n][m] = true;
	int r = INF;
	for (int i = 0; i < N; ++ i) if (((n>>i)&1)==0) {
		int qq = abs(p-i) % 2;
		int x = (qq == 0) ? A[i] : B[i];
		if (x < m) continue;
		int k = 0;
		for (int j = i+1; j < N; ++ j) if ((n>>j)&1) ++ k;
		aa.push_back(i);
		r = min(r, f(p+1, n | (1<<i), x) + k);
		aa.pop_back();
	}
	return memo[n][m] = r;
}
int main() {
	cin >> N;
	A.resize(N);
	B.resize(N);
	for (auto& x : A) cin >> x;
	for (auto& x : B) cin >> x;
	int r = f(0, 0, 0);
	if (r >= INF) cout << -1 << endl;
	else cout << r << endl;
}


Measured memory_bytes: 65664
#include <cstdio>

int totSat=0;

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



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


int main()
{
    int N;
    cin >> N;
    vector<double> t(N+2, 0.0), v(N+2, 0.0);
    for(int i = 1; i <= N; i++) cin >> t[i];
    for(int i = 1; i <= N; i++) cin >> v[i];
 
 
    vector<double> l(N+2, 0.0), r(N+2, 0.0);
    for(int i = 2; i < N+2; i++) l[i] = l[i-1] + t[i-1];
    for(int i = 1; i < N+2; i++) r[i] = r[i-1] + t[i];
 
    vector<double> sv;
    for(double x = 0; x <= r[N+1]; x += 0.5) {
        double mn = 1e9+1;
        for(int i = 0; i < N+2; i++) {
            if( x < l[i] ) mn = min(mn, v[i] + (l[i] - x));
            if( l[i] <= x && x <= r[i]) mn = min(mn, v[i]);
            if( r[i] < x ) mn = min(mn, v[i] + (x - r[i]));
        }
        sv.push_back(mn);
    }
 
    double ans = 0;
    for(int i = 1; i < sv.size(); i++) {
        ans += 0.25 * (sv[i] + sv[i-1]);
    }
 
    cout << fixed << setprecision(3) << ans << endl;
 
    return 0;
}

Measured memory_bytes: 896
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
mod = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

def inverse(N, mod):
	return (pow(N, mod - 2, mod))

class Graph(object):
	def __init__(self):
		self.graph = defaultdict(list)

	def __len__(self):
		return len(self.graph)

	def add_edge(self, a, b):
		self.graph[a].append(b)

#強連結成分の個数と、それぞれの頂点がどの成分に属すかを返す
def scc(N, G, Grev):
	order = []
	visit = [0] * N
	group = [None] * N #あるノードが強連結の何番目のグループに含まれるか
	def dfs(node):
		visit[node] = 1
		for i in G.graph[node]:
			if not visit[i]:
				dfs(i)
		order.append(node)

	def dfs_rev(node, num):
		group[node] = num
		visit[node] = 1
		for i in Grev.graph[node]:
			if not visit[i]:
				dfs_rev(i, num)

	#順方向のグラフ上でDFSを行い、帰りがけ順に頂点を記録
	for i in range(N):
		if not visit[i]:
			dfs(i)

	#逆方向のグラフ上で帰りが遅かった頂点から順にDFSを行い分解
	visit = [0] * N
	num = 0
	for i in reversed(order):
		if not visit[i]:
			dfs_rev(i, num)
			num += 1

	return num, group

#scc後のDAGを構築
def construct(N, G, num, group):
	DAG = [[] for i in range(num)]
	for i in range(N):
		itr = group[i]
		DAG[itr].append(i)

	return DAG

def getlist():
	return list(map(int, input().split()))


def main():
	N, M = getlist()
	G = Graph()
	Grev = Graph()
	for i in range(M):
		a, b = getlist()
		G.add_edge(a, b)
		Grev.add_edge(b, a)

	num, group = scc(N, G, Grev)

	DAG = construct(N, G, num, group)
	x = len(DAG)
	print(x)
	for i in range(x):
		print(len(DAG[i]), *DAG[i])




if __name__ == '__main__':
	main()

Measured memory_bytes: 311828
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int time = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		a = a*time;
		if(a < b)System.out.print(a);
		else System.out.print(b);
	}
}

Measured memory_bytes: 21844
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
string f="";
string s="";
string df=".#.#";
string ds="..##";

int main(void){
	scanf("%d",&n);
	int i=0;
	while(i<n){
		bool flag=false;
		for(int j=0;j<4;j++){
			string ff=f+df[j];
			string ss=s+ds[j];
			cout << ff << endl;
			cout << ss << endl;
			string b;
			cin >> b;
			if(b=="T" || b=="end"){
				f=ff;
				s=ss;
				i++;
				flag=true;
				break;
			}
		}
		if(!flag)break;
	}
	while(i<n){
		for(int j=0;j<4;j++){
			string ff=df[j]+f;
			string ss=ds[j]+s;
			cout << ff << endl;
			cout << ss << endl;
			string b;
			cin >> b;
			if(b=="T" || b=="end"){
				f=ff;
				s=ss;
				i++;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 596
let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let rec f i b =
  if i >= n then if b then 1 else 0
  else if a_s.(i) mod 2 = 0 then f (i + 1) true + f (i + 1) b + f (i + 1) b
  else f (i + 1) b + f (i + 1) true + f (i + 1) true
let _ = Printf.printf "%d\n" @@ f 0 false

Measured memory_bytes: 384
def update(a, n):
    ret = [0] * (n+1)
    for i in range(n):
        l = max(0, i - a[i])
        r = min(i + a[i] + 1, n)
        ret[l] += 1
        ret[r] -= 1
    data = [0] * (n+1)
    data[0] = ret[0]
    for i in range(1, n+1):
        data[i] = data[i-1] + ret[i]
    return data[:-1]


n, k = map(int, input().split())
ret = list(map(int, input().split()))

k = min(k, 120)

for i in range(k):
    ret = update(ret, n)

print(' '.join(list(map(str, ret))))


Measured memory_bytes: 174736
n = int(input())
p = list(map(int,input().split()))

ps = [i for i in p]
p.sort()
cnt = 0

for i in range(n):
    if p[i] == ps[i]:
        pass
    else:
        cnt += 1

if cnt > 2:
    print('NO')
else:
    print('YES')

Measured memory_bytes: 3060
from itertools import combinations

N = int(input())
a = list(map(int, input().split()))
count = 0
for i in combinations(a,3):
    b = list(i)
    b.sort()
    if b[2] > b[1] and b[1] > b[0]:
        if b[2] < (b[1] + b[0]):
            count += 1

print(count)

Measured memory_bytes: 9192
from collections import Counter

n = int(input())
v = input().split()

v1 = v[::2]
v2 = v[1::2]
c1 = Counter(v1).most_common(2)
c2 = Counter(v2).most_common(2)

if len(set(v)) == 1:
    print(len(v) // 2)
elif c1[0][0] != c2[0][0]:
    print(n - c1[0][1] - c2[0][1])
else:
    print(min(n - c1[0][1] - c2[1][1], n - c1[1][1] - c2[0][1]))

Measured memory_bytes: 20712
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header
int main() {
	vector<string> s(10000);
	cin >> s[int('a')] >> s[int('b')] >> s[int('c')];
	int dex = int('a');
	while(1){
		if(s[dex] == ""){
			cout << char((dex)-('a'-'A')) << endl;
			break;
		}
		int dex1 = dex;
		dex = int(s[dex][0]);
		s[dex1].erase(0, 1);
	}
 	return 0;
}

Measured memory_bytes: 3604
import math
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

S = int(sys.stdin.readline())
a = math.ceil(math.sqrt(S))
x1 = a
y2 = math.ceil(S / a)
x2 = abs(x1 * y2 - S)
y1 = 1
print(x1, x2, y1, y2, 0, 0)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i=1,i##_len=(n); i<=i##_len; ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for(int i=(s);i<(t);++i)
#define rng(obj) (obj).begin(), (obj).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 uni(x) x.erase(unique(rng(x)),x.end())
#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) vector<vector<T>>
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vp = vector<P>;
template <class T> inline istream& operator>>(istream&i,v(T)&v)
{ rep(j,sz(v))i>>v[j];return i;}
template <class T> string join(const v(T)&v)
{ stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template <class T> inline ostream& operator<<(ostream&o,const v(T)&v)
{ if(sz(v))o<<join(v); return o;}
template <class T1,class T2> inline istream& operator>>(istream&i ,pair<T1,T2>&v)
{ return i>>v.fi>>v.se;}
template <class T1,class T2> inline ostream& operator<<(ostream&o ,pair<T1,T2>&v)
{ return o<<v.fi<<","<<v.se;}
template <class T> inline ll suma(const v(T)& a) 
{ ll res(0); for(auto&& x:a) res += x; return res;}
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double eps = 1e-10;
const int MX = 200005;
//----------------------------------------------------------------

#define fileio ifstream fio; if(argc>=2){fio.open(argv[1]); std::cin.rdbuf(fio.rdbuf());}
#define fastio ios_base::sync_with_stdio(false);
#define MOD 1000000007
//----------------------------------------------------------------

void Main(){
  ll n;
  cin>>n;
  vl a(n);
  vl b(n);
  vl c(n);
  cin>>a>>b>>c;
  sort(rng(a));
  sort(rng(c));
  ll ans = 0;
  rep(j,n){
    ll bj = b[j];
    ll ka = distance(a.begin(), lower_bound(rng(a),bj) );
    ll kc = distance( lower_bound(rng(c),bj+1)  ,c.end() );
    ans += ka * kc;
  }
  cout<<ans<<endl;  
} int main(int argc,char* argv[]){ 
    fastio; fileio; Main();}

Measured memory_bytes: 2560
#include<iostream>
using namespace std;
#include<cmath>
typedef long long ll;
ll prime[1000001];
ll length = 0;
bool isprime[1000000] = {};
void insert(ll p) { prime[length] = p; length++; isprime[p] = true; return; }
void makeprime() {
	insert(2);
	for (ll i = 3; i < 1000000; i += 2) {
		for (ll j = 0; j < length; j++)
			if (i%prime[j] == 0)goto cont;
			else if (prime[j] > sqrt(i))break;
			insert(i);
		cont:;
	}
}
int main() {
	makeprime();
	int a, d, n;
	while (cin >> a >> d >> n, a, d, n) {
		int cnt = 0;
		for (int i = a;; i += d) {
			if (isprime[i]) { cnt++; if (cnt == n) { cout << i << endl; goto end; } }
		}
	end:;
	}
}

Measured memory_bytes: 4656
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] array = new int[N];
		for (int i=0 ; i < N ; i++) {
			array[i] = sc.nextInt();
		}
		int max = array[0];
		int min = array[0];
		for (int i = 0 ; i<N ; i++) {
			if (array[i]>max) {
				max=array[i];
			}
			if(array[i]<min) {
				min = array[i];
			}
		}
		System.out.println(max-min);

//------------------------------------------------------------
	}
}

Measured memory_bytes: 21972
from fractions import gcd
def lcm(x,y):
    return x*y//gcd(x,y)

A, B, C, D = map(int, input().split())

lcmn = lcm(C, D)

candivnum = (B//C + B//D - B//lcmn) - ((A-1)//C + (A-1)//D - (A-1)//lcmn)
print(B-A+1-candivnum)

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

for i in range(K):
    if i%2 == 0:
        if A%2 == 1:
            A = A-1
        A = A // 2
        B = B + A
    else:
        if B%2 == 1:
            B = B-1
        B = B // 2
        A = A + B
        
ans = [str(A), str(B)]

print(' '.join(ans))

Measured memory_bytes: 3316
import java.io.PrintWriter

val br = System.`in`.bufferedReader()
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val n = readInteger()
    out.println((1000 - (n % 1000)) % 1000)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 34168
N, K = [int(x) for x in input().split()]
d = []
Snuke = [0] * N#最終的に0をもつインデックスがいたずらされる．
for k in range(K):
    d.append(input())
    A = [int(a) for a in input().split()]
    for a in A:
        Snuke[a - 1] += 1
count = 0
for i in Snuke:
    if i == 0:
        count += 1
print(count)

Measured memory_bytes: 9196
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int n = (int)sc.nextInt();
		int a[] = new int[n];

		for(int i=0;i<n;i++) {
			a[i] = (int)sc.nextInt();
		}

		Arrays.sort(a);

		for(int j =0 ;j<n-1;j++) {
			if(a[j] == a[j+1]) {
				System.out.println("NO");
				return;
			}
		}

		System.out.println("YES");

	}

	static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public long nextInt() {
            return Integer.parseInt(next());
        }

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

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = (int) nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }

}

Measured memory_bytes: 49416
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

const ll N=10;
mat G(N);
ll n,m;

ll dfs(ll f,set<ll> al) {
  al.insert(f);
  ll res=0;
  if(al.size()==n) res=1;
  for(ll t:G[f]) {
    if(al.count(t)) continue;
    res+=dfs(t,al);
  }
  return res;
}

int main() {
  cin >> n >> m;
  for(ll i=0;i<m;i++) {
    ll a,b;
    cin >> a >> b;
    a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  set<ll> al;
  ll ans=dfs(0,al);
  cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
/*
template<class... T>
ostream& operator<<(ostream& os, tuple<T...>& t) {
	for (size_t i = 0; i < tuple_size< tuple<T...> >::value; ++i) {
		if (i) os << " ";
		os << get<0>(t);
	}
	return os;
}
*/
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

const int dx[] = {0, 1, 0, -1};
const int dy[] = {-1, 0, 1, 0};

struct Node {
	int x, y, dir, cost;
};
bool operator>(const Node& n1, const Node& n2) {
	return n1.cost > n2.cost;
}

int C[4];
int W, H;
vector< vector<int> > op;
bool inRange(int x, int y) {
	return 0 <= x && x < W && 0 <= y && y < H;
}
void f(int x, int y, int dir, int dc, int o, priority_queue<Node, vector<Node>, greater<Node> >& Q, vector< vector< vector<int> > >& dp) {
	int nx = x, ny = y, nd = dir;
	if (o == 4) {
		if (x != W-1 || y != H-1) {
			return;
		}
	}
	else {
		nd = (nd + o) % 4;
		nx += dx[nd];
		ny += dy[nd];
		if ( !inRange(nx, ny) ) return;
	}
	if (dp[y][x][dir]+dc < dp[ny][nx][nd]) {
		dp[ny][nx][nd] = dp[y][x][dir]+dc;
		Q.push({nx, ny, nd, dp[ny][nx][nd]});
	}
}
int solve() {
//	cout << "!" << C[0] << " " << C[1] << " " << C[2] << " " << C[3] << endl;
	vector< vector< vector<int> > > dp(H, vector< vector<int> >(W, vector<int>(4, inf))); dp[0][0][1] = 0;
	priority_queue<Node, vector<Node>, greater<Node> > Q; Q.push({0, 0, 1, 0});
	while ( !Q.empty() ) {
		Node node = Q.top(); Q.pop();
		int x = node.x, y = node.y, dir = node.dir, cost = node.cost;
		if (cost < dp[y][x][dir]) continue;
		f(x, y, dir, 0, op[y][x], Q, dp);
		for (int i = 0; i < 4; ++i) {
			f(x, y, dir, C[i], i, Q, dp);
		}
	}
	int res = inf;
	for (int i = 0; i < 4; ++i) {
		res = min(res, dp[H-1][W-1][i]);
	}
	return res;
}
int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	while ( cin >> W >> H, W || H ) {
		op = vector< vector<int> >(H, vector<int>(W, 0));
		for (int y = 0; y < H; ++y) {
			for (int x = 0; x < W; ++x) {
				cin >> op[y][x];
			}
		}
		for (int i = 0; i < 4; ++i) {
			cin >> C[i];
		}
		cout << solve() << endl;
	}
}

Measured memory_bytes: 3328
def checkStr(str):
  n = len(str)
  if n % 2 == 0:
    for i in range(int(n/2)):
      if str[i] != str[n-i-1]:
        return False
  else:
    for i in range(int((n-1)/2)):
      if str[i] != str[n-i-1]:
        return False
  return True


s = input()
if checkStr(s[0:int((len(s)-1)/2)]) and checkStr(s) and checkStr(s[int((len(s)+3)/2)-1:]):
  print('Yes')
else:
  print('No')

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

x = [1]
for i in range(1,2001):
    x.append(x[i-1]*i)


res = 0
mod = 10**9 + 7
for i in range(1, s):
    if i*3 > s:
        break
    
    y = s - i*3
    res += x[y+i-1]//x[y]//x[i-1]%mod
    res %= mod
print(res)

Measured memory_bytes: 69784
#include <iostream>

#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::vector;

static int
solve(int N, vector<int> &A)
{
  int ret = 0;
  int n = 0;
  while (n < N)
  {
    ret++;
    int dir = 0;
    int cur = A[n];
    while (++n < N)
    {
      int prev = cur;
      cur = A[n];
      if (dir == -1)
      {
        if (prev < cur)
        {
          break;
        }
      }
      else if (dir == 1)
      {
        if (cur < prev)
        {
          break;
        }
      }
      else
      {
        if (prev < cur)
        {
          dir = 1;
        }
        else if (cur < prev)
        {
          dir = -1;
        }
      }
    }
  }
  return ret;
}

int
main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  for (int n = 0; n < N; n++)
  {
    cin >> A[n];
  }
  cout << solve(N, A) << endl;
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    map<int, int> a;
    for(int i=0; i<n; i++){
        int aa;
        cin >> aa;
        a[aa] += 1; 
    }
    int count = n - (n-a.size());
    if((n-a.size())%2==1){
        count--;
    }
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 4992
N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]

ans_count = 0
for i in range(N):
  for j in range(i):
    total = sum((X[i][k] - X[j][k]) ** 2 for k in range(D))
    distance = int(total ** 0.5)
    if (total == (distance ** 2)):
      ans_count += 1

print(ans_count)

Measured memory_bytes: 3188