akhauriyash/Code-Regression huggingface dataset:
function main()
    N,M = reads(Int,Int)
    fris = Set{Int}[]
    np = zeros(Int, N)
    for i in 1:M
        a,b = reads(Int,Int)
        if np[a] != 0 && np[a] == np[b]
        elseif np[a] != 0 && np[b] != 0
            bi,si = length(fris[np[a]]) > length(fris[np[b]]) ? (np[a], np[b]) : (np[b], np[a])
            union!(fris[bi], fris[si])
            for j in fris[si]
                np[j] = bi
            end
        elseif np[a] != 0
            push!(fris[np[a]], b)
            np[b] = np[a]
        elseif np[b] != 0
            push!(fris[np[b]], a)
            np[a] = np[b]
        else
            push!(fris, Set([a,b]))
            np[a] = length(fris)
            np[b] = length(fris)
        end
    end
    if M == 0
        println(1)
    else
        println(maximum(map(x -> length(x), fris)))
    end
end

import Base.parse
import Base.StringVector

parse(::Type{String},  str::AbstractString) = str
isdelim(x::UInt8, xs::Set{UInt8}) = x in xs
const delimset = Set([0x0a, 0x20])

function myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}
    out = StringVector(0)
    c::UInt8 = 0x00
    while !eof(s)
        c = read(s, UInt8)
        !isdelim(c, delims) && break
    end
    push!(out, c)
    eof(s) && return out
    while !eof(s)
        c = read(s, UInt8)
        isdelim(c, delims) && break
        push!(out, c)
    end
    return out
end

function readword(io::IO = stdin, delims = delimset)::String
    word = myreaduntil(io, delims)
    i = length(word)
    if i == 0 || word[i] != 0x0a
        return String(word)
    elseif i < 2 || word[i-1] != 0x0d
        return String(resize!(word,i-1))
    else
        return String(resize!(word,i-2))
    end
end

pread(ty) = parse(ty, readword())

reads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)

function readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}
    rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)
    for i in 1:len
        for j in 1:length(tys)
            @inbounds rv[j][i] = pread(tys[j])
        end
    end
    rv
end

readvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]

function readmat(ty::Type, s...)::Matrix{ty}
    v = Matrix{ty}(undef, s...)
    @inbounds for i in 1:s[1]
        v[i,:] = readvec(ty, s[2])
    end
    v
end

main()


Measured memory_bytes: 256304
#coding:utf-8
from scipy.misc import comb

n, k = map(int, input().split())
m = pow(10,9) + 7

for i in range(k):
    # 赤と赤の間に青を配置する場所の組み合わせ
    blue = comb(n-k+1, i+1, exact=True)
    # 青をいくつずつ配置するかの組み合わせ
    blue_num = comb(k-1, i, exact=True)
    print(blue * blue_num % m)

Measured memory_bytes: 13488
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 1010101010101010;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
  ll n; cin>>n;
  cout<<(n-1)*n/2<<endl;
}


Measured memory_bytes: 3592
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct Node {
    int key;
    struct Node *prev, *next;
};

struct Node *nil;

void init() {
    nil = (struct Node *)malloc(sizeof(struct Node));
    nil->prev = nil;
    nil->next = nil;
}

void insertNode(int x) {
    struct Node *n = (struct Node *)malloc(sizeof(struct Node));
    n->key = x;
    n->prev = nil;
    n->next = nil->next;
    nil->next->prev = n;
    nil->next = n;
}

//删除第1个含有键值x的结点并返回
int deleteNode(int x) {
    struct Node *s = nil;  //从头节点开始搜索
    while (s->next->key != x && s->next != nil) {
        s = s->next;
    }
    if (s->next == nil) {
        return -1;
    }
    struct Node *tmp = s->next;
    int v = tmp->key;
    s->next = tmp->next;
    tmp->next->prev = s;
    free(tmp);
    return v;
}

//删除链表的表头结点
int deleteFirst() {
    struct Node *tmp = nil->next;
    int v = tmp->key;
    nil->next = tmp->next;
    tmp->next->prev = nil;
    free(tmp);
    return v;
} 

//删除俩表表尾结点
int deleteLast() {
    struct Node *tmp = nil->prev;
    int v = tmp->key;
    nil->prev = tmp->prev;
    tmp->prev->next = nil;
    free(tmp);
    return v;
}

void showList() {
    if (nil->next == nil) {
        return;
    }
    struct Node *p = nil->next;
    while (p != nil) {
        if (p != nil->next) {
            printf(" ");
        }
        printf("%d", p->key);
        p = p->next;
    }
    printf("\n");
}

int main() {
    init();
    int n, key = 0;
    char com[15];
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%s", com);
        //insert x || delete x
        if (strlen(com) == 6) {
            scanf("%d", &key);
            if (com[0] == 'i') {
                insertNode(key);
            }
            else if(com[0] == 'd') {
                deleteNode(key);
            }
            else {
                printf("unknown command");
            }
        }
        //deleteFirst || deleteLast
        else if (strlen(com) > 6) {
            if (com[6] == 'F') {
                deleteFirst();
            }
            else if (com[6] == 'L') {
                deleteLast();
            }
            else {
                printf("unknown command");
            }
        }
        else {
            printf("unknown command");
        }
    }
    showList();
    return 0;
}


Measured memory_bytes: 32940
N = int(input())
v = list(map(int,input().split()))
v = sorted(v,reverse = True)
ans = 0
for i in range(N-1):
  len_v = len(v)
  a = v[len_v-1]
  b = v[len_v-2]
  next_ = (a + b)/2
  ans += next_
  v.pop()
  v.pop()
  v.append(next_)
print(v[0])

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

signed main()
{
	int N;
	cin >> N;
	int tmp;
	set<int> d;
	for (int i = 0; i < N; i++) {
		cin >> tmp;
		d.insert(tmp);
	}

	cout << d.size() << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
using namespace std;

void trace(int A[], int N){
    int i;
    for ( i = 0; i < N; i++ ){
        if( i > 0 ){
            printf(" ");
        }
        printf("%d", A[i]);
    }
    printf("\n");
}

void sort(int A[], int N){
    int j,i, v;
    for ( i = 1; i < N; i++ ){
        v = A[i];
        j = i - 1;
        while ( j >= 0 && A[j] > v){
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A, N);
    }
}

int main() {
    int N, i, j;
    int A[100];
    
    scanf("%d", &N);
    for (i = 0;i < N;i++) scanf("%d", &A[i]);
    trace(A, N);
    sort(A, N);
    return 0;
}


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

typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N,M;
    cin >> N >> M;
    if (N%2==0){
        for (int i=1;i<=M;i++){
            if (N>4*i){
                cout << i << " " << N - i << "\n";
            } else {
                cout << i << " " << N - i - 1 << "\n";
            }
        }
        return 0;
    } else {
        for (int i=1;i<=M;i++){
            cout << i << " " << N - i << "\n";
        }
        return 0;
    }
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
const int MOD = 1e9+7;
#define PI 3.14159265359
typedef long long ll;
using namespace std;

vector<int> graph[100001];
int distmod[100001][3];
int reached[100001][3];


void bfs(int s){
	queue<pair<int, int> > que;
	que.push(make_pair(s, 0));
	reached[s][0] = 1;
	distmod[s][0] = 0; 
	while (!que.empty()){
		auto now = que.front();
		que.pop();
		for (auto x : graph[now.first]){
			if (reached[x][(now.second+1)%3] != 3){
				reached[x][(now.second+1)%3]++;
				que.push(make_pair(x, (now.second+1)%3));
				if (distmod[now.first][now.second] != MOD) distmod[x][(now.second+1)%3] = min(distmod[x][(now.second+1)%3], distmod[now.first][now.second] + 1);
			}
		}
	}
	return;
}

int main(){
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++){
		int u, v;
		cin >> u >> v;
		graph[u].push_back(v);
	}
	int s, t;
	cin >> s >> t;
	for (int i = 0; i <= n; i++){
		for (int j = 0; j < 3; j++){
			distmod[i][j] = MOD;
		}
	}
	bfs(s);
	if (distmod[t][0] == MOD) cout << -1 << endl;
	else cout << distmod[t][0]/3 << endl;
}



Measured memory_bytes: 11404
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)
N,M=map(int,input().split())
a=UnionFind(N)
for i in range(M):
    X,Y,Z=map(int,input().split())
    if a.same_check(X,Y):
        pass
    else:
        a.union(X,Y)
answer=set()
for i in range(1,N+1):
    answer.add(a.find(i))
print(len(answer))


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

int main() {
  int n;
  cin>>n;
  long long a[n], b[n];
  for (int i=0; i<n; i++) {
    cin>>a[i]>>b[i];
  }
  long long cnt = 0;
  for (int i=n-1; i>=0; i--) {
    long long val = cnt + a[i];
    if (val % b[i] == 0) {
      continue;
    }
    cnt += b[i] - (val % b[i]);
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>

using namespace std;

int main()
{
	ostringstream os;

	while (true)
	{
		int n;
		cin >> n;

		if (n == 0)
			break;

		double sum = 0, squ = 0;
		for (int i = 0; i < n; ++i)
		{
			double num;
			cin >> num;
			sum += num;
			squ += pow(num, 2);
		}

		squ -= (pow(sum, 2) / n);
		double sd = sqrt(squ / n);

		os << setprecision(16) << sd << "\n";
	}

	cout << os.str() << endl;

	return 0;
}

Measured memory_bytes: 1316
n = int(input())
MAXN = 110000

f_inf = float('inf')
dp = [f_inf] * (MAXN+n)

dp[0] = 0

for i in range(1, n+2):
    for j in range(7):
        dp[i] = min(dp[i], dp[i-pow(6, j)]+1)
    for k in range(6):
        dp[i] = min(dp[i], dp[i-pow(9, k)]+1)

print(dp[n])

Measured memory_bytes: 48772
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
//using Graph = vector<vector<pair<ll,ll>>>;
const int mod =1e+9+7;

const int dy[4]={0,1,0,-1};
const int dx[4]={1,0,-1,0};
const ll INF=1e10;

int main(){
    string s;
    ll k; cin>>s>>k;
    map<string,ll>mp;
    ll num=s.size();
    ll cnt=0;
    for(char c='a';c<='z';c++){
        for(int i=0;i<num;i++){
            if(s[i]==c){
                for(int j=1;j<=min(k,num-i);j++){
                    
                    mp[s.substr(i,j)]++;
                    if(mp[s.substr(i,j)]>1)continue;
                    else cnt++;
                }
            }
        }
        if(cnt>=k)break;
    }
    ll CNT=1;
    for(auto p:mp){
        if(CNT==k){
            cout<<p.first<<endl;
            return 0;
        }
        else CNT++;
    }
}











Measured memory_bytes: 3668
import numpy as np
N = int(input())
s = np.array([int(input()) for _ in range(N)])
s = np.sort(s)

sm = np.sum(s)
if sm % 10 == 0:
    for n in s:
        if n % 10 != 0:
            sm -= n
            break
    else:
        sm = 0
print(sm)


Measured memory_bytes: 14008
import 'dart:convert';
import 'dart:io';
import 'dart:async';

main() async {
  var N = int.parse(stdin.readLineSync());
  var lines = stdin.transform(utf8.decoder).transform(LineSplitter());

  List<int> txy = [];
  bool flag = true;
  int count = 1;
  List<int> prev = [0, 0, 0];
  int diff = 0;
  int dis = 0;
  await for (var line in lines) {
    txy = line.split(" ").map((x) => int.parse(x)).toList();
    diff = (txy[0] - prev[0]);
    dis = ((txy[1] - prev[1]).abs() + (txy[2] - prev[2]).abs());
    if (diff >= dis && diff % 2 == dis % 2) {
      count++;
      prev[0] = txy[0];
      prev[1] = txy[1];
      prev[2] = txy[2];
      if (count > N) break;
    } else {
      flag = false;
      break;
    }
  }
  if (flag) {
    print("Yes");
  } else {
    print("No");
  }
}


Measured memory_bytes: 20388
#include <bits/stdc++.h>
// #include "../cxx-prettyprint/prettyprint.hpp" // vecの内容をきれいに表示

using namespace std;
typedef long long ll;

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

// 今回は関数でdpテーブルをいじるのでグローバル
vector<int> dp(100010, 0);
vector<bool> flag(100010, false);
vector<vector<int>> A(100010, vector<int>(0));


int f(int x)
{
    if (flag[x])
        return dp[x];
    flag[x] = true;
    int fans = 0;
    for (const auto y : A[x])
    {
        // cout << y;
        fans = max(fans, f(y) + 1);
    }
    // cout << "\n";
    return dp[x] = fans;
}

int main()
{
    // ここに処理を記述

    int N, M;
    cin >> N >> M;

    int x, y;
    for (int i = 0; i < M; i++)
    {
        cin >> x >> y;
        A[x].push_back(y);
    }

    // DAG(閉路なし有向グラフ)はトポロジカルソートでDP可能性あり
    // 今回はそうじゃなくてメモ化再帰で記述
    // f(x) : xを始点とする最長経路
    // f(x) = 0(xの行先なし) or max(f(y)+1|x->yが存在するy)
    // この時答えはmax(f(x))

    int ans = 0;
    FOR(i, 1, N + 1)
    {
        // flag.assign(N,false);
        // cout << i << ":";
        if (dp[i] == 0)
            ans = max(ans, f(i));
        // cout << "end" << endl;
    }
    // cout << dp << "\n";

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 8192
<?php
fscanf(STDIN,'%d', $a);
$bef_arr = fgets(STDIN);
$arr = explode(" ", $bef_arr);

$echo_cnt = 0;

for($i = 0; $i < $a; $i++){
    if($arr[$i] % 2 !== 0 && ($i +1) % 2 !== 0){
        $echo_cnt++;
    }
}

echo $echo_cnt;

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

int main() {
	int n;
	cin >> n;
	vector<long long> x, y;
	long long a, b, i, j,k,l;
	for (i = 0; i < n; i++) {
		cin >> a >> b;
		x.push_back(a);
		y.push_back(b);
	}
	/*	for (int i = 0; i < n; i++) {
			cout << x[i] << y[i] << endl;
		}
	*/	
	long long p, q;
	int point = 0, maxpoint = 0;
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			if (i == j) continue;
			else{
				p = x[i] - x[j];
				q = y[i] - y[j];
			}
			for (k = 0; k < n; k++) {
				for (l = 0; l < n; l++) {
					if (k == l) continue;
					else if ((x[k] + p) == x[l] && (y[k] + q) == y[l]) {
						point++;
					}
				}
			}		
			if (point > maxpoint) {
				maxpoint = point;
			}
			point = 0;
		}
	}

	cout << n - maxpoint;
	return 0;
}

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

typedef long long int ll;
typedef vector<int> vi;
typedef set<int> si;
typedef vector<ll> vll;

#define pvec(v) for(auto e: v) cout << e << " ";
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define forn(s, e) for(int i=s; i<e; ++i)
#define pb push_back
#define INF 1000000000
#define PI 3.14159265359

int main(){
	IO
	double r;
	cin >> r;

	cout << setprecision(11) << fixed << 2*PI*r << endl;
	return 0;
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        if (i % 2 == 1 && x % 2 == 1) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int W,H,N; cin >> W >> H >> N;
    int out=0;
    vector<vector<int> > s(H,vector<int>(W,0));
    for(int i=0;i<N;i++){
        int x,y,a; cin >> x >> y >> a;
        if(a==1){
            for(int j=0;j<x;j++){
                for(int k=0;k<H;k++){
                    s[k][j]=1;
                }
            }
        }
        if(a==2){
            for(int j=W-1;j>=x;j--){
                for(int k=0;k<H;k++){
                    s[k][j]=1;
                }
            }
        }
        if(a==3){
            for(int j=0;j<y;j++){
                for(int k=0;k<W;k++){
                    s[j][k]=1;
                }
            }
        }
        if(a==4){
            for(int j=H-1;j>=y;j--){
                for(int k=0;k<W;k++){
                    s[j][k]=1;
                }
            }
        }
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(s[i][j]==0){
                out++;
                cerr << "-";
            }else{
                cerr << "+";
            }
        }
        cerr << "\n";
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int x,mini,maxi;
bool yes=true;

int main(){
    string S;
    cin >> S;
    for(int i=0;i<S.size();i++)
    {
        if(S[i]=='A')
        {
            mini=i;
            break;
        }
    }
    for(int i=S.size()-1;i>=0;i--)
    {
        if(S[i]=='Z')
        {
            maxi=i;
            break;
        }
    }
    cout << maxi-mini+1;;
}
    
    
    

  

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
int dp[100001];

class Graph{
	int v;
	list<int>*l;
public :
	Graph(int v){
		this->v=v;
		l = new list<int>[v];
	}
	void addedge(int x,int y){
		l[x].push_back(y);
	}
	void printgraph(){
	for(int i=0;i<v;i++){
		cout<<i<<" --- ";
		for(auto it:l[i]){
			cout<<it<<", ";
		}
		cout<<endl;
	}
	}
	
	int longestpath(int src){
	bool leaf=true;
	int bestchild=0;
	if(dp[src]!=-1){
		return dp[src];
	}
	for(auto child: l[src]){
		leaf=false;
		bestchild=max(bestchild,longestpath(child));
	}
	return dp[src]=leaf?0:1+bestchild;
	}
};

signed main(){
	
	int n,e;
	cin>>n>>e;
	Graph g(n+1);
	memset(dp,-1,sizeof dp);
	for(int i=0;i<e;i++){
		int x,y;
		cin>>x>>y;
		g.addedge(x,y);
	}
	//g.printgraph();
	int ans=0;
	for(int i=1;i<=n;i++)
		ans = max(ans,g.longestpath(i));
	cout<<ans<<endl;

	return 0;
}

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

using namespace std ;

const int MAX = 1e5 + 10 ;

int arr[MAX] ;
int r , g , b , n ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>r>>g>>b>>n ;
	int ans = 0 ;
	for(int i = 0 ; i <= n ; ++i)
	{
		for(int j = 0 ; j <= n ; ++j)
		{
			if(r*i + g*j > n)
				break ;
			int rem = n - r*i - g*j ;
			if(rem % b == 0)
				ans++ ;
		}
	}
	return cout<<ans<<"\n" , 0 ;
}		

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll a, b;
    cin >> a >> b;
    if(a > 0) {
        cout << "Positive" << endl;
    } else {
        if(b >= 0) {
            cout << "Zero" << endl;
        } else {
            ll temp = b - a;
            cout << (temp % 2 == 0 ? "Negative" : "Positive") << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
int main() {
    int n;
    cin >> n;
    
    int x[n];
    rep(i, n) cin >> x[i];
    
    int minj ,tmp = 0, cnt = 0;
    for(int i = 0; i < n; i++) {
        minj = i;
        for(int j = i; j < n; j++) {
            if(x[minj] > x[j]) {
                minj = j;
            }
        }
        if(minj != i)
        {
            tmp = x[i];
            x[i] = x[minj];
            x[minj] = tmp;
            cnt++;
        }
    }
    
    
    rep(i, n) cout << x[i] << ((i == n-1) ? "\n" : " ");
    cout << cnt << endl;
    
    
    
}
    



Measured memory_bytes: 3104
#include <iostream>
#include <string>


std::string sortStr(std::string str, bool grt = true){

	char tmp;
	for(int i = 0; i < (int)(str.size()) - 1; i++){
		for(int j = i + 1; j < (int)(str.size()); j++){

			if( (grt && str[i] < str[j]) ||
				(!grt && str[i] > str[j])){
				tmp = str[i];
				str[i] = str[j];
				str[j] = tmp;
			}
			
		}
	}

	return str;
}


int main(void){

	std::string s, t;
	std::cin >> s >> t;

	s = sortStr(s, false);
	t = sortStr(t);

	std::cout << ((s < t) ? "Yes" : "No") << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

long long int gcd(long long int x, long long int y)
{
	if (y == 0) { return x; }
	return gcd(y, x % y);
}

int main(void)
{
	string s, t;
	cin >> s >> t;
	cout << t + s << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    //#include "testlib.h"
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007
    #define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
    #define GCD(m,n) __gcd(m,n)
    #define LCM(m,n) m*(n/GCD(m,n))
    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    #define pii pair<int,int>
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
        int n,d;
        cin>>n>>d;
        int a[n][d];
        rep0(n){
            repi(j,0,d) cin>>a[i][j];
        }
        int ans=0;
        rep0(n){
            repi(j,i+1,n){
                int sum=0;
                repi(k,0,d){
                    sum+=pow((a[i][k]-a[j][k]),2);

                }
                int sq=sqrt(sum);
                if(sq*sq==sum) ans++;
            }
        }
        cout<<ans;


        }
    signed main()
    {   
        asdf
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

Measured memory_bytes: 512
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
import math
#li=input().split()
#S=input()
#lis=list(map(int,input().split()))

n=int(input())

A=[0]
i=1
while i<=math.sqrt(n):
    if n%i==0:
        A.append(i)
    i+=1
B=[0]
s=[]
for i in range(len(A)-1):
    j=int(n/A[i+1])
    B.append(j)
    a=len(str(A[i+1]))
    b=len(str(B[i+1]))
    s.append(max(a,b))
ans=min(s)
print(ans)


Measured memory_bytes: 3064
import scala.io.Source

object Main extends App {
  val lines = Source.stdin.getLines()
  val n     = lines.next().toInt

  val result: (Int, Int) =
    lines.toStream
      .take(n)
      .map(_.toInt)
      .foldLeft((Integer.MIN_VALUE, Integer.MAX_VALUE)) { (s, a) =>
        (Math.max(s._1, a - s._2), Math.min(s._2, a))
      }

  println(result._1)
}



Measured memory_bytes: 106644
n,k=map(int,input().split())
point=list(map(int,input().split()))
t=input()
t+="x"*k
l=[[t[i],1] for i in range(k)]
ans=0
for i in range(k,n+k):
    if l[i%k][0]==t[i]:
        l[i%k][1]+=1
    else:
        ans+=point["spr".index(l[i%k][0])]*((l[i%k][1]+1)//2)
        l[i%k][0]=t[i]
        l[i%k][1]=1
print(ans)

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

typedef long long ll;

int n;
ll del;
char s[4005];
ll dp[4005][1<<3];

int main(){

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

    cin>>n;
    cin>>s+1;
    for(int i=1;i<=n;i++){
        if(s[i]=='R')s[i]=0;
        if(s[i]=='G')s[i]=1;
        if(s[i]=='B')s[i]=2;
    }
    for(int l=1;l+l<n;l++){
        for(int i=1;i+l+l<=n;i++){
            if(s[i]!=s[i+l]&&s[i+l]!=s[i+l+l]&&s[i]!=s[i+l+l])del++;
        }
    }
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        memcpy(dp[i],dp[i-1],sizeof(dp[0]));
        for(int j=0;j<8;j++){
            if(j>>s[i]&1){
                dp[i][j]+=dp[i-1][j^(1<<s[i])];
            }
        }
    }
    cout<<dp[n][7]-del<<endl;

    return 0;
}

Measured memory_bytes: 3864
using System;
using System.Collections.Generic;


namespace ConsoleApplication10
{
    class Program
    {
        static void Main(string[] args)
        {    
            int i = 1;
            while (true)
            {
                string str = Console.ReadLine();
                int x = int.Parse(str);
               
                if (x == 0)
                {
                    break;
                }
                Console.WriteLine("Case {0}: {1}",i,x);
                i++;

                }
            }
          }
          
            
        }

Measured memory_bytes: 9244
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
  int N,K;
  cin>>N>>K;
  long long int h[N+1],dp[N+1];
  for(int i=1;i<=N; ++i){
    cin>>h[i];
    dp[i]=10000000000;
  }
  dp[1]=0;
  for(int i=2; i<=N; ++i){
    for(int j=1; j<=K; ++j){
      if(i-j>0) dp[i]=min(dp[i-j]+abs(h[i]-h[i-j]),dp[i]);
    }
  }
  cout<<dp[N]<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
 
 
using namespace std;
 
#if DEBUG && !ONLINE_JUDGE
    #include "debug.h"
#else
    #define debug(...)
#endif
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<vector<int> > vvi;
typedef vector<vector<ii> > vvii;
 
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define ff first
#define ss second
#define trav(a, x) for(auto& a : x) 
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
const ll INF = 1e18;
const int mod = 1e9+9;
ll gcd(ll a,ll b){if (a==0) return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return a*(b/gcd(a,b));}
ll Abs(ll a){if(a>0)return a;return -a;}
ll Ceil(ll a,ll b){if(a%b==0)return a/b;else return a/b+1;}
double Abs(double a){if(a>0)return a;return -a;}
 
//*X.find_by_order(2) element at index=2
//X.order_of_key(1) how many elements strictly less than 1
 
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
inline int pow_(ll x, ll y,ll p){
  int r = 1; while(y){if(y & 1) r = r * x % p; y >>= 1; x = x * x % p;} return r;
}
inline int inv_(int x){return pow_(x, mod - 2, mod);}
inline int add(int a, int b){a += b; if(a >= mod) a -= mod; return a;}
inline int mul(int a, int b){return a * 1LL * b % mod;}
inline int sub(int a, int b){a -= b; if(a < 0) a += mod; return a;}

int main(){

	#ifdef LOCAL_TEST
    freopen("in.txt","r",stdin);
    //freopen("out.txt", "w", stdout);
    #else
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    #endif
    ll n;
    cin>>n;
    double a[n+5] = {0};
    for(int i=1;i<=n;i++)cin>>a[i];
    sort(a+1,a+n+1);
	double ans = 0;
	double p = pow(2,n-1);
	for(int i=1;i<=n;i++){
		ans = ans + a[i]/p;
		if(i!=1)p = p/2;
	}

	printf("%0.10f\n", ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;

const int N=100005;

int n;
int a[N];

int gcd(int x,int y){
	if (!y) return x;
	else return gcd(y,x%y);
}

bool solve(){
	int yi=0,er=0;
	for (int i=1;i<=n;i++){
		if (a[i]==1) yi++;
		if (!(a[i]&1)) er++;
	}
	if (er&1) return 1;
	if (er<n-1) return 0;
	if (yi>0) return 0;
	int g=0;
	for (int i=1;i<=n;i++){
		if (a[i]&1) a[i]--;
		g=gcd(a[i],g);
	}
	for (int i=1;i<=n;i++) a[i]/=g;
	return solve()^1;
}

int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	if (solve()) printf("First\n");
	else printf("Second\n");
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(void){
	int a,b,c,d,i,t,n;
	int s[10];
	c=0;
	while(scanf("%d",&n)!=EOF){
		if(n==0){
			printf("%d\n",s[c-1]);
			c--;
		}else{
			s[c]=n;
			c++;
		}
	}
	return 0;
}


Measured memory_bytes: 2040
#include<stdio.h>
int main()
{
	int n, k, i, a[100] = { 0 }, j,sum=0;
	int useless;
	scanf("%d%d", &n, &k);
	for (i = 0;i < k;i++)
	{
		scanf("%d", &useless);
		getchar();
		do
		{
			scanf("%d", &j);
			a[j - 1] = 1;
		} while (getchar() != '\n');
	}
	for (i = 0;i < n;i++)
	{
		if (a[i] == 0) sum++;
	}
	printf("%d", sum);
	return 0;
}

Measured memory_bytes: 1724
#include "bits/stdc++.h"
#include <numeric>

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define vi vector<int>

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cerr << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define debug(...) CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) (__VA_ARGS__)

using namespace std;
using ll = long long;
using P = pair<int, int>;

void Main() {
  int n;
  cin >> n;
  ll ans = 0;
  REP(i, 1, n+1) if (i%3!=0 && i%5!=0) ans += i;
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 3648
n=int(input())
c=list(input())
w=[i for i, x in enumerate(c) if x == 'W']
r=[i for i, x in enumerate(c) if x == 'R']
wc=len(w)
rc=len(r)
wt=list(range(rc,wc+rc))
tand = set(w) & set(wt)
print(wc-len(tand))


Measured memory_bytes: 57412
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include<stack>
using namespace std;
#define PI 3.14159265358979
typedef  long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
int main(void)
{
    int n;
    cin>>n;

    vector<int> a(n+3);
    int ans =0;
    rep(i,n)
    {
        cin>>a[i];
        if(i%2==0&&a[i]%2==1) ans ++;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3156
$mod = 10**9+7

def pow(a,b)
  if b == 1
    a
  elsif b%2 == 0
    (pow(a,b/2)**2)%$mod
  else
    (a*pow(a,b/2)**2)%$mod
  end
end

def create_fact(n)
  for i in 2..n
    $fact[i] = ($fact[i-1]*i)%$mod
  end
end

def create_fact_inv(n)
  $fact_inv[n] = pow($fact[n],$mod-2)
  n.downto(1) do |i|
    $fact_inv[i-1] = ($fact_inv[i]*i)%$mod
  end
end

def create_inv(n)
  for i in 1..n
    $inv[i] = ($fact[i-1]*$fact_inv[i])%$mod
  end
end

def init(n)
  $fact = Array.new(n+1,1)
  $fact_inv = Array.new(n+1,1)
  $inv = Array.new(n+1,0)
  create_fact(n)
  create_fact_inv(n)
  create_inv(n)
end

def combi(a,b)
  (($fact[a]*$fact_inv[b])%$mod)*$fact_inv[a-b]%$mod
end

init(1000010)
n = gets.to_i
a = gets.split.map(&:to_i)
ans = 1
a.each do |i|
    ans = ans.lcm(i)
end
ans %= $mod
c = 0
a.each do |i|
    c += $inv[i]
    c %= $mod
end
puts ans*c%$mod

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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pc = tuple<int, int, int>;
const int INF = 1e9;

void Main() {
  string N;
  cin >> N;
  int n = N.size();
  vector<vector<int>> dp(n+1, vector<int>(2, INF));
  dp[0][0] =  0; dp[0][1] = 1;
  rep(i, n) {
    int x = N[i] - '0';
    dp[i+1][0] = min(dp[i][0] + x, dp[i][1] + 10 - x);
    dp[i+1][1] = min(dp[i][0] + x + 1, dp[i][1] + 10 - x - 1);
  }
  cout << dp[n][0] << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


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

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


  for (int i = 0, s_len = S.size(); i < s_len; i += 2) {
    cout << S[i];
  }

  return 0;
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
#define PB push_back
#define MP make_pair
#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<long long>;
using ld = long double;

#define unordered_map __fast_unordered_map
template<class Key, class Value, class Hash = std::hash<Key>>
using unordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif


int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);

  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;

  char min_ch = *min_element(ALL(s));

  if (k > 15) {
    cout << string(n, min_ch) << "\n";
    return 0;
  }

  string t = s;
  reverse(ALL(t));
  s += t;
  s += "$";
  string best = string(1, 'z' + 1);
  debug(s);

  int L = 0;
  while (L <= n) {
    if (s[L] != min_ch) { ++L; continue; }
    int R = L;
    while (s[R] == min_ch) { ++R; }
    debug(L, R);
    const int len = R - L;
    int mult_len = min<ll>((ll)len * (1 << (k - 1)), n);

    string cand(mult_len, min_ch);
    int ptr = R;
    while (SZ(cand) < n) {
      cand += s[ptr++];
    }
    mini(best, cand);
    L = R;
  }

  cout << best << "\n";
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int>h(n);
    rep(i,n) cin >> h[i];
    int ans=0;
    int cnt=0;
    for(int i=1;i<n;++i) {
      if(h[i-1]>=h[i]) {
        cnt++;}
      else cnt=0;
      ans=max(ans,cnt);}
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int i, o, t;
  cin >> i >> o >> t;
  int j, l, s, z;
  cin >> j >> l >> s >> z;
  ll ans = 0;
  ans += o;
  vector<int> v = {i, j, l};
  int co = 0;
  bool f = false;
  for(int x : v){
    if(x % 2 == 1) co++;
    if(x == 0) f = true;
  }
  if(co >= 2 && f == false){
    if(co == 2){
      rep(m, 3){
        if(v.at(m) % 2 == 0){
          v.at(m)--;
        }
      }
    }
    ans += 3;
  }
  for(int x : v){
    ans += x/2*2;
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

const int N = 2e5;

int n;
int a[N];

int main(){
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; ++i)
        cin >> a[i];
    int mx = -1, mx2 = -1;
    for(int i = 0; i < n; ++i){
        if(a[i] >= mx){
            mx2 = mx;
            mx = a[i];
        }
        else if(a[i] > mx2)
            mx2 = a[i];
    }
    for(int i = 0; i < n; ++i){
        cout << (a[i] == mx ? mx2 : mx) << '\n';
    }
}


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

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

using ll = long long;
using P = pair<int,int>;
using graph = vector<vector<int>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

int main() {
    int N,M,K;
    cin>>N>>M>>K;
    bool can = false;
    rep(i,N+1){
        rep(j,M+1){
            int cnt = (N-i)*j+(M-j)*i;
            if(cnt==K)can = true;
        }
    }
    if(can)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <map>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> nums;
  int as[200000];
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (nums.find(a) == nums.end())
      nums.emplace(a, 1);
    else
      nums[a]++;
    as[i] = a;
  }
  long long count = 0;
  for (auto it : nums) {
    if (it.second > 1)
      count += (long long)it.second * (it.second - 1) / 2;
  }
  for (int i = 0; i < n; i++)
    cout << count - (nums[as[i]] > 1 ? nums[as[i]] - 1 : 0) << endl;
  return 0;
}


Measured memory_bytes: 8320
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod (ll)1000000007
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n, k, q, a, b[100010];
signed main() {
	cin >> n >> k >> q;
	rep(i, q) {
		cin >> a;
		b[a]++;
	}
	REP(i, n) {
		if (k - (q - b[i]) > 0)puts("Yes");
		else puts("No");
	}
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,n) for(int i = (a); i < (n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define debug_v(v,N) for(int i=0;i<N;i++) { cout << v[i] << " "; } cout << endl;
#define debug_vv(v,H,W) for(int i=0;i<H;i++) { for(int j=0;j<W;j++) { cout << v[i][j] << " "; } cout << endl; }

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	string S; cin >> S;
	S += "A";
	rep(i, S.length() - 2) {
		if (S[i] == S[i + 1]) {
			cout << i + 1 << " " << i + 2 << endl;
			return;
		}
		if (S[i] == S[i + 2]) {
			cout << i + 1 << " " << i + 3 << endl;
			return;
		}
	}
	cout << "-1 -1" << endl;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using VLL = std::vector<llint>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


int N;
int a[60];
VPII ans;


void solve(){
	if(all_of(RNG(a, 0, N), [](int x){ return x >= 0; }))
		rep(i, 1, N) ans.pb({ i, i+1 });
	else if(all_of(RNG(a, 0, N), [](int x){ return x <= 0; }))
		reper(i, N, 2) ans.pb({ i, i-1 });
	else {
		int Mi = max_element(RNG(a, 0, N))-&a[0];
		int mi = min_element(RNG(a, 0, N))-&a[0];
		if(abs(a[Mi]) > abs(a[mi])){
			Mi++;
			repe(i, 1, N) ans.pb({ Mi, i });
			rep(i, 1, N) ans.pb({ i, i+1 });
		}
		else {
			mi++;
			repe(i, 1, N) ans.pb({ mi, i });
			reper(i, N, 2) ans.pb({ i, i-1 });
		}
	}
	cout << SIZE(ans) << endl;
	for(PII p : ans) cout << p.fi << ' ' << p.se << endl;
}


signed main(){
	cin >> N;
	rep(i, 0, N) cin >> a[i];

	solve();

	return 0;
}

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

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);

	int n;	cin >> n;
	V a(n);	VECCIN(a);
	V right(n), left(n);

	left[0] = 0;
	for(int i = 1 ; i < n ; i++)
		left[i] = max(left[i - 1] , a[i - 1]);

	right[n - 1] = 0;
	for(int i = n - 2 ; 0 <= i ; i--)
	 	right[i] = max(right[i + 1] , a[i + 1]);

	REP(i , n){
	 	int ans = max(right[i],  left[i]);
		SCOUT(ans) << endl;
	}

	return 0;
}

Measured memory_bytes: 4224
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main() {
    input!{
        n: u32,
        y: u32,
    };
    for i in 0..n+1{
        for j in 0..n+1-i{
            let k = n - i - j;
            if i * 10000 + j * 5000 + k * 1000 == y{
                println!("{} {} {}", i, j, k);
                return;
            }
        }
    }
    println!("-1 -1 -1");
}


Measured memory_bytes: 4352
n = int(input())
r = sorted([list(map(int, input().split())) for i in range(n)], reverse=True)
b = sorted([list(map(int, input().split())) for i in range(n)])

rd = set()

for i in range(n):
    p = []
    for j in range(n):
        if j in rd:
            continue
        if b[i][0] > r[j][0] and b[i][1] > r[j][1]:
            p.append(r[j] + [j])
    if len(p) > 0:
        p.sort(key=lambda x: x[1], reverse=True)
        rd.add(p[0][2])
print(len(rd))

Measured memory_bytes: 3064
#include<iostream>
#include<cstring>
#include<math.h>
#include<algorithm>

using namespace std;



int main(){

    long long n;
    cin >> n;

    int c[n], v[n];

    for(int i=0;i<n;i++)cin >> v[i];
    for(int i=0;i<n;i++)cin >> c[i];

    long long ans = 0;
    for(int i=0;i<n;i++){
        if(v[i]>c[i])ans += v[i]-c[i];
    }

    cout << ans << endl;

}


Measured memory_bytes: 256