akhauriyash/Code-Regression huggingface dataset:
#include <string.h>
#include <iostream>
#include <algorithm>

using namespace std;
// Sol 3A
// forward dp
// enumerating items from beginning (z = 0..N)
// inner loop is looping
// "weights >= the current item weight"
// in descending order
long long dp[100005][105];
long long solve(int N, int W, int *v, int *w) {
  // items are 0 indexed, 0..N-1'th items
  // dp[a][b] = solution for a knapsack of weight a,
  // only can use items until and including b'th item
  // long long dp[W + 1][N + 1];
  // memset(dp, 0, sizeof(long long) * (W + 1) * (N + 1));

  for (int z = 0; z < N; ++z) {
    for (int q = W - w[z]; q >= 0; --q) {
      dp[q + w[z]][z] = max(dp[q + w[z]][z], v[z] + dp[q][z]);
    }
    for (int q = 0; q < W + 1; ++q) {
      dp[q][z + 1] = dp[q][z];
    }
  }

  // for (int q = 0; q < W + 1; ++q) {
  //   for (int z = 0; z < N; ++z) {
  //     cout << dp[q][z] << ' ';
  //   }
  //   cout << '\n';
  // }
  return dp[W][N - 1];
}


int main() {
  int N, W;
  cin >> N >> W;
  int v[N], w[N];
  for (int q = 0; q < N; ++q)
    cin >> w[q] >> v[q];

  long long ans = solve(N, W, v, w);
  cout << ans << '\n';
}


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

main(){
	string s; cin>>s;
	int sum = 0;
	for(int i=0; i<s.length(); i++) sum += s[i]-'0';
	if(sum%9==0) cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 3680
N, A, B = map(int, input().split())
if A == 0 or (A+B == 0):
    print(0)
elif B == 0:
    print(N)
else:
    s = A*(N // (A+B))
    rem  = N % (A+B)
    if rem > A:
        rem = A
    print(s+rem)

Measured memory_bytes: 3064
#pragma GCC optimize ("-O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<cmath>
#include<cstdio>
#include<algorithm>
#include<bitset>
#include<complex>
#include<deque>
#include<fstream>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<utility>
#include<valarray>
#include<vector>
#include<array>
#include<forward_list>
#include<random>
#include<ratio>
#include<tuple>
#include<unordered_map>
#include<unordered_set>
#include<cstring>

using namespace std;
using Int = long long; using uint = unsigned int; using uInt = unsigned long long;
typedef pair<int,int> Pi; typedef pair<Int,Int> Pl;
constexpr int mod = 1e9+7;
constexpr int INF32 = numeric_limits<int>::max();
constexpr Int INF64 = numeric_limits<Int>::max();
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define mp make_pair
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rer(i,l,r) for(int i=(l); i<=(r); ++i)
#define gnr(i,l,r) for(int i=(r); i>=(l); --i)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(i,n-1)cout<<a[i]<<' '; if(n)cout<<a[n-1]<<'\n';}
#define prip(p) cout<<p.fi<<' '<<p.se<<'\n'
#define priend(a) {cout<<(a)<<'\n'; return 0;}
#define fil(a,v) memset((a),v,sizeof(a))
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n,m,_,x,y,q;
string s,sb;
bool ok;
char ch;

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

  cin>>n; if(n%2)priend("No"); cin>>s;
  rep(i,n/2)sb+=s[i];
  ok=1;
  rer(i,n/2,n-1)if(s[i]!=sb[i-n/2]){ok=0; break;}
  pri1(ok?"Yes":"No");
}

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

int main()
{
    int N;
    cin >> N;
    int d[N];
    for (int i = 0; i < N; i++)
    {
        cin >> d[i];
    }
    sort(d, d + N);
    int dan = 1;
    for (int i = 0; i < N - 1; i++)
    {
        if (d[i] < d[i + 1])
        {
            dan++;
        }
    }
    cout << dan << endl;
}

Measured memory_bytes: 256
// TO KAISE HAI AAP LOG!! //

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

#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define F first
#define S second
#define all(v) v.begin(),v.end()
ll mod=1e9+7;
 
/*/----------------------------- Code begins -----------------------------/*/
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll t=1,tc;
    //cin>>t;
    for(tc=1;tc<=t;tc++){
      ll x;
      cin>>x;
      if(x>=1800 && x<2000)
       cout<<"1";
      else if(x>=1600 && x<1800)
       cout<<"2";
      else if(x>=1400 && x<1600)
       cout<<"3";
      else if(x>=1200 && x<1400)
       cout<<"4";
      else if(x>=1000 && x<1200)
       cout<<"5";
      else if(x>=800 && x<1000)
       cout<<"6";
      else if(x>=600 && x<800)
       cout<<"7"; 
      else
       cout<<"8";
    }
	return 0;
}

Measured memory_bytes: 3648
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
//Roling Hash
//RollingHash RH(s,base) base:[2,MOD)?????±??°
//RH.set(s,base): vector???????§???????????????????????????§????????????????????????????????????
//RH.get(l,r): [l,r)??????????????\ O(1)
//1000000007, 1000000009, 1000000021
template<long long MOD>
class RollingHash {
public:
	int n;
	long long base;
	vector<long long> pow, hash;
	RollingHash() {}
	RollingHash(const string &s, long long base_ = 10007) { init(s, base_); }
	void init(const string &s, long long base_ = 10007) {
		n = s.size();
		base = base_;
		calc(s.c_str());
	}
	long long get(int x)const { return hash[x]; }
	long long get(int l, int r)const { return (get(r) - get(l)*pow[r - l] % MOD + MOD) % MOD; }
	void calc(const char *s) {
		pow.resize(n + 1);
		pow[0] = 1;
		hash.resize(n + 1);
		hash[0] = 0;
		for (int i = 0; i < n; i++) {
			pow[i + 1] = pow[i] * base % MOD;
			hash[i + 1] = (s[i] + hash[i] * base) % MOD;
		}
	}
};
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m; cin >> n >> m;
	string s; cin >> s;
	int l = 0, r = 1;
	RollingHash<MOD> RH(s);
	RollingHash<MOD + 2> RH2(s);
	unordered_set<string> st;
	rep(i, 0, m) {
		string q; cin >> q;
		if (q == "R++")r++;
		else if (q == "R--")r--;
		else if (q == "L++")l++;
		else if (q == "L--")l--;
		st.insert(to_string(RH.get(l, r)) + to_string(RH2.get(l, r)));
	}
	cout << st.size() << endl;
	return 0;
}

Measured memory_bytes: 44828
#import <stdio.h>
#import <string.h>
int main() {
	char s[200002];
	scanf("%s",s);
	int ans = strlen(s);
	int cs=0;
	for(int i=0;i<strlen(s);i++){
		if(s[i]=='S'){
			cs++;
		}else{
			if(cs>0){
				cs--;
				ans-=2;
			}
		}
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 2292
x, n = map(int, input().split())

if n!=0:
  p_list = list(map(int, input().split()))

  res = set(range(102)) - set(p_list)
  res = [(abs(r-x), r) if r<=x else (abs(r-x)+0.5, r)
         for r in res]
  res = sorted(res, key=lambda r: r[0])

  print(res[0][1])
else:
  print(x)

Measured memory_bytes: 9236
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        Sieve sieve = new Sieve(n);
        
        long ans = 0;
        for (int i = 1; i <= n; i++) {
            ans += (long)sieve.factorCount[i] * i;
        }
        System.out.println(ans);
    }
}
class Sieve {
    int[] minFactor;    // 最小の素因数
    int[] factorCount;  // 約数の個数
    
    Sieve(int n) {      // (N <= 10^7)
        factorCount = new int[n + 1];
        
        Arrays.fill(factorCount, 1);
        
        for (int i = 2; i <= n; i++) {
            factorCount[i]++;
            
            for (int j = 2; i * j <= n; j++) {
                factorCount[i*j]++;
            }
        }
    }
    
    boolean isPrime(int x) {
        if (minFactor[x] == x) {
            return true;
        }
        
        return false;
    }
    
    // nの素因数のリスト (60 => [2, 2, 3, 5])
    List<Integer> factorList(int x) {
        List<Integer> res = new ArrayList<Integer>();
        
        while (x != 1) {
            res.add(minFactor[x]);
            x /= minFactor[x];
        }
        
        return res;
    }
    
    // nの素因数の頻度 (60 => (2 => 2, 3 => 1, 5 => 1)
    Map<Integer, Integer> factorMap(int x) {
        Map<Integer, Integer> res = new HashMap<Integer, Integer>();
        
        List<Integer> factorList = factorList(x);
        
        for (Integer f : factorList) {
            int count = res.getOrDefault(f, 0);
            res.put(f, ++count);
        }
        
        // for (int i = 1; i <= x; i++) {
        //     if (!res.containsKey(i)) {
        //         res.put(i, 0);
        //     }
        // }
        
        return res;
    }
}

Measured memory_bytes: 75076
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

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

int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    int ctr = 0;
    for(int i = 0; i < 1000; i++){
        if(a <= i * c && i * c <= b){
            ctr++;
        }
    }

    cout << ctr << endl;
    
    return 0;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <cstdlib>
#include <numeric>
#include <vector>
using namespace std;

vector<int> sieve(int n) {
	vector<int> res(1, 2);
	vector<bool> prime(n, true);
	for(int i = 3; i < n; i += 2) {
		if(prime[i]) {
			res.push_back(i);
			for(int j = i * 3; j < n; j += i * 2)
				prime[j] = false;
		}
	}

	return res;
}

int main() {
	vector<int> prime = sieve(110000);

	for(int n; scanf("%d", &n), n;)
		printf("%d\n", accumulate(prime.begin(), prime.begin() + n, 0));

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
#include <utility>

using namespace std;

int e_gcd(int a, int b)
{
    if (a < b) swap(a, b);

    if (a % b == 0)
    {
        return b;
    }else
    {
        return e_gcd(b, a % b);
    }

}

int vgcd(vector<int> a)
{
    vector<int>::iterator itr = a.begin();
    int ans = *itr;
    int bef = *itr;
    itr++;
    while (itr != a.end())
    {
        ans = e_gcd(bef, *itr);
        bef = ans;
        itr++;
    }

    return ans;
    
}

int main(int argc, char const *argv[])
{
    int N, X;
    cin >> N >> X;
    vector<int> d;
    int in;
    for (int i = 0; i < N; i++)
    {
        cin >> in;
        d.emplace_back(abs(X - in));
    }

    int ans = vgcd(d);

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

Measured memory_bytes: 1144
using System;
using System.Linq;

namespace ABC117A
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            int[] TX = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
            int T = TX[0];
            int X = TX[1];
            
            Console.WriteLine(Convert.ToDouble(T)/ Convert.ToDouble(X));
        }
    }
}

Measured memory_bytes: 13268
from sys import stdin
import numpy as np
from numba import njit

@njit("i8(i8[:,:],i8,i8)",cache=True)
def search(grid,h,w):
    q=np.zeros(2*10**6+4,dtype=np.int64)
    now=0
    for i in range(h):
        for j in range(w):
            if grid[i][j]==1:
                q[now]=i
                q[now+1]=j
                now+=2

    now,nex=0,now
    cnt=0
    while now!=nex:
        tmp=nex
        for i in range(now,nex,2):
            y=q[i]
            x=q[i+1]
            for dy,dx in (-1,0),(1,0),(0,-1),(0,1):
                ny=y+dy
                nx=x+dx
                if 0<=ny<h and 0<=nx<w:
                    if grid[ny][nx]==0:
                        grid[ny][nx]=1
                        q[tmp]=ny
                        q[tmp+1]=nx
                        tmp+=2

        now,nex=nex,tmp
        cnt+=1

    return cnt-1

def main():
    #入力
    readline=stdin.readline
    h,w=map(int,readline().split())
    grid=[readline().strip() for _ in range(h)]
    grid=np.array([[1 if grid[i][j]=="#" else 0 for j in range(w)] for i in range(h)],dtype=np.int64)
    print(search(grid,h,w))

if __name__=="__main__":
    main()

Measured memory_bytes: 131728
int a[1<<18],v[1<<18][3],n,m,q,c,i,j;
#define rep(i,n) for(i=0;i<n;++i)
main(){scanf("%d%d%d",&n,&m,&q);rep(i,n)rep(j,2)v[i][j]=(i+n+1-2*j)%n;rep(i,m){scanf("%d",a+i);rep(j,a[i])c=v[c][a[i]&1];v[c][2]=1;rep(j,2)v[v[c][j^1]][j]=v[c][j];c=v[c][0];}rep(i,q)scanf("%d",&c),printf("%d\n",1-v[c][2]);exit(0);}

Measured memory_bytes: 4696
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
typedef pair<int, int> P;

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[100010];
    rep(i, N) cin >> A[i];
    int ans = A[0] - 1;
    int k = 1;
    rep(i, N - 1) {
        //cerr << k << " " << A[i + 1] << " " << (A[i + 1] - 1) / k << " " << ans + (A[i + 1] - 1) / k << endl;
        ans += (A[i + 1] - 1) / (k + 1);
        if(A[i + 1] + 1 - k <= 2) {
            k = max(k, A[i + 1]);
        }
    }
    cout << ans << endl;
    return 0;
}
// 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9
// 2 0 1 0 2 4 0 1 1 0 1 1 2 1 2 
// 

Measured memory_bytes: 4432
#include <iostream>
#include <algorithm>
#include <vector>

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

    std::vector<int> xs(n), ys(n);
    for (auto& x : xs) std::cin >> x;
    for (auto& y : ys) std::cin >> y;

    if (xs > ys) std::swap(xs, ys);
    int ans = 0;
    while (xs != ys) {
        std::next_permutation(xs.begin(), xs.end());
        ++ans;
    }

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


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

int main() {
	int X, A, B;
	cin >> X >> A >> B;
	int p=X-A;
	while(p>0){
		p -= B;
		if (p - B < 0) {
			break;
		}
	}
	cout << p << endl;
	}

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

int main(int argc, char *argv[])
{
    int H, W;
    std::cin >> H >> W;

    char S[H+2][W+2];
    char ans[H+2][W+2];

    for (int i = 0; i < H+2; i++) {
        for (int j = 0; j < W+2; j++) {
            S[i][j] = '0';
        }
    }

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            std::cin >> S[i][j];
        }
    }

    int count = 0;

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            count = 0;
            if (S[i][j] == '.') {
                if (S[i-1][j-1] == '#') {
                    count++;
                }
                if (S[i-1][j] == '#') {
                    count++;
                }
                if (S[i-1][j+1] == '#') {
                    count++;
                }
                if (S[i][j-1] == '#') {
                    count++;
                }
                if (S[i][j+1] == '#') {
                    count++;
                }
                if (S[i+1][j-1] == '#') {
                    count++;
                }
                if (S[i+1][j] == '#') {
                    count++;
                }
                if (S[i+1][j+1] == '#') {
                    count++;
                }
                ans[i][j] = count + '0';
            } else {
                ans[i][j] = '#';
            }
        }
    }

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            std::cout << ans[i][j];
        }
        std::cout << "" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int x,i,I; 
    for(i=1;i>0;i++){
      scanf("%d",&x);      
      if(x==0)  break;
      
      else{      
	printf("Case %d: %d\n",i,x);
      }
    }
  
  return 0;
}

Measured memory_bytes: 1028
#!usr/bim/python
#! -*- coding: utf-8 -*-

hw = raw_input()
hw = hw.split()
hw = map(int,hw)

h = max(hw)
w = min(hw)

ans = 0

if h % 3 == 0 or w % 3 == 0:
    ans = 0
elif w % 2 == 0:
    ans = w/2
elif h % 2 == 0:
    ans = h/2
elif h == w:
    ans = (h/3+1)**2
else:
    ans = (h/3)*2+1

if ans >= w:
    ans = w

print ans


Measured memory_bytes: 2568
N = int(input())
S = input()
dp = [[0] * 5005 for _ in range(5005)]
for i in range(N - 1, -1, -1):
    for j in range(N - 1, -1, -1):
        if S[i] != S[j]:
            dp[i][j] = 0
        else:
            dp[i][j] = dp[i + 1][j + 1] + 1
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        now = min(dp[i][j], j - i)
        ans = max(ans, now)
print(ans)

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

int main () {
    int N, M;
    cin >> N >> M;
    int city[51] = {0};
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        city[a - 1] += 1;
        city[b - 1] += 1;
    }
    for (int i = 0; i < N; i++) {
        cout << city[i] << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

bool is_number(string c) { return (c != "+" && c != "-" && c != "*"); }
int cal (int a, int b, string c) {
    if (c == "+") return a+b;
    if (c == "-") return a-b;
    if (c == "*") return a*b;
}

int main() {
    stack<int> sta;
    string c;
    while (cin >> c) {
        if (!is_number(c)) {
            int b = sta.top(); sta.pop();
            int a = sta.top(); sta.pop();
            sta.emplace(cal(a, b, c));
        } else {
            sta.emplace(stoi(c));
        }
    }
    cout << sta.top() << endl;
    return 0;
}


Measured memory_bytes: 3176
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.print(maxAnswer(a, b));
    }

    private static Integer maxAnswer(Integer a, Integer b){
        int plus = a + b;
        int minus = a - b;
        int multiply = a * b;
        return Math.max(plus, Math.max(minus, multiply));
    }
}


Measured memory_bytes: 25172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
ll ans[5];

int get(ll a, ll b) {
	int l = 0, r = 3500;
	while(l < r) {
		int mid = (l + r) / 2;
		if(double(a * mid - b) / double(b * mid) >= 0.0) r = mid;
		else l = mid + 1;
	}
	return r;
}

void dfs(int dep, int from, ll a, ll b) {
	if(a < 0 || b < 0) return;
	// printf("dfs(%d, %d, %lld, %lld)\n", dep, from, a, b);
	if(dep == 3) {
		if(!a) return;
		if(b % a) return;
		ans[dep] = b / a;
		for(int i = 1; i <= dep; i++) printf("%lld ", ans[i]);
		exit(0);
	}
	from = max(from, get(a, b));
	// printf("GOT FROM : %d\n", from);
	for(int i = from; i <= 3500; i++) {
		// printf("CUR i %d\n", i);
		// printf("L : %lld  R : %lld\n a = %lld  b = %lld\n", b * (3 - dep), i * a, a, b);
		if(b * (4 - dep) < i * a) break;
		ans[dep] = i;
		ll a2 = a * i - b;
		ll b2 = b * i;
		// printf("\ta2 %lld b2 %lld\n", a2, b2);
		ll g = __gcd(a2, b2);
		a2 /= g;
		b2 /= g;
		dfs(dep + 1, i, a2, b2);
	}
	// puts("RETURNING");
}

int main() {
	scanf("%lld", &n);
	dfs(1, get(4, n), 4, n);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <climits>
#include <string.h>
#include <cctype>
#include <set>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using namespace std;

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

// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
	mint operator+(const mint a) const { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= a; }
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

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

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(2000005);

mint g(int r, int c) {
	return comb(r + c + 2, r + 1) - 1;
}

bool comp(int i, int j) {
	return i > j;
}

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(n * a, b);
}



Measured memory_bytes: 31488
#include <bits/stdc++.h>
#define R register
#define mp make_pair
#define ll long long
#define pii pair<int, int>
using namespace std;

template <class T>
inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
    while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}

int main() {
    int x, y, ans = 0;
    read(x), read(y);
    if (x <= 3) ans += (4 - x) * 100000;
    if (y <= 3) ans += (4 - y) * 100000;
    if (x == 1 && y == 1) ans += 400000;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            string Inputnum = Console.ReadLine();

            string[] comparisonNum = Inputnum.Split(' ');

            SetNum(comparisonNum);
        }

        /// <summary>
        /// ??\??????????????°???????????°??????????????????????????????
        /// </summary>
        /// <param name="numList"></param>
        private static void SetNum(string[] numList)
        {
            int? a = null;
            int? b = null;
            int? c = null;

            //??\?????????????????????????????????
            foreach(var result in numList)
            {
                //string??§???????????£????????????int????????£??????
                int resultint = int.Parse(result);


                if(a == null)
                {
                    a = resultint;
                    continue;
                }

                if(b == null)
                {
                    b = resultint;
                    continue;
                }

                c = resultint;
            }

            //??\??????????????°????????????????????¨?????????
            NumReplace(a, b, c);
           
        }

        /// <summary>
        /// ??°????????\?????????????????????
        /// </summary>
        /// <param name="a">1???????????\??????????????°???</param>
        /// <param name="b">2???????????\??????????????°???</param>
        /// <param name="c">3???????????\??????????????°???</param>
        private static void NumReplace(int? a, int? b, int? c)
        {
            int? temp;

            //a??¨b????????\?????????
            if (a > b)
            {
                temp = a;
                a = b;
                b = temp;
            }


            //c?????????a??¨b??????????????´???
            if (a <= c && b >= c)
            {
                temp = b;
                b = c;
                c = temp;
            }

            //c?????????a??????????°?????????´???
            else if (a > c)
            {
                temp = a;
                a = c;
                c = b;
                b = temp;

            }

            Console.WriteLine("{0} {1} {2}", a, b, c);
        }


    }

}

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

int main() {
    int h, a;
    cin>>h>>a;
    int r= h%a;
    int x= h/a;
    if (r==0)
    {
        cout<<x;
    }
    else 
    {
        cout<<x + 1;
    }
	return 0;
	
}

Measured memory_bytes: 3608
import math

a, b, h, m = map(int, input().split())
hh = 30*h
if m != 0:
  hh += (m/60)*30
mm = 6*m
xh = a * math.cos(math.radians(hh))
yh = a * math.sin(math.radians(hh))
xm = b * math.cos(math.radians(mm))
ym = b * math.sin(math.radians(mm))

disX = pow(xh-xm, 2)
disY = pow(yh-ym, 2)
print(math.sqrt(disX+disY))

Measured memory_bytes: 9588
import Foundation
// 第一引数に、素数かどうかを判定したい自然数を渡す
func check_primes(n:Int)->Bool{
    // 計算するのは√nまでで十分
    for i in 2...Int(sqrt(Double(n)))+1{
        // コーナーケースになりうるものは除いておく
        if i > n || n == 2{
            continue
        }
        if n%i == 0{
            return false
        }
    }
    return true
}

// 標準入力の受け取り
var x = Int(readLine()!)!

// 素数に当たるまでループを回す
while !check_primes(n:x){
    x+=1
}

// 答えを出力
print(x)

Measured memory_bytes: 13188
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, n) for(int i = 1; i <= (int)(n); i++)
#define MOD 998244353
int D[100000];
int C[100001];

long myPow(long x, long n, long m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

int main(){
  int N;
  cin >>N;
  int M = 0;
  rep(i, N){
    cin >> D[i];
    C[D[i]]++;
    M = max(M, D[i]);
  }
  if(D[0] != 0){
    cout << 0 << endl;
    return 0;
  }
  rep(i, N){
    if(i != 0 and D[i] == 0){
      cout << 0 << endl;
      return 0;
    }
  }
  long long int ans = 1;
  reps(i, M){
    ans *= myPow(C[i - 1] , C[i], MOD);
    ans %= MOD;
  }
  cout << ans << endl;
}

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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;

int main(){
    int N, A[100000];

    cin >> N;
    for(int i = 1; i < N + 1; i++) cin >> A[i];

    A[0] = A[N+1] = 0;

    int res = 0;
    for(int i = 0; i < N + 1; i++) res += abs(A[i] - A[i+1]);


    for(int i = 1; i < N + 1; i++){
        cout << res + abs(A[i-1] - A[i+1]) - ( abs(A[i-1] - A[i]) + abs(A[i] - A[i+1]) ) << endl;
    }

    return 0;
}

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

ll val(string s){
    ll res = 0;
    string tmp = "";
    for(int i=0; i<s.size(); i++){
        if(s[i] == '+'){
            res += stoll(tmp);
            tmp = "";
        }
        else{
            tmp += s[i];
        }
    }
    if(tmp != "") res += stoll(tmp);

    return res;
}

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

    ll ans = 0;
    for(int bit=0; bit<1<<(s.size()-1); bit++){
        string v = ""; v += s[0];
        for(int i=0; i<s.size()-1; i++){
            if(bit&(1<<i)) v += '+';
            v += s[i+1];
        }
        ans += val(v);
    }

    cout << ans << endl;
}

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

int main(){
  string s;
  cin >> s;
  vector<int>cnt(2,0);
  rep(i,s.size()){
    if(s[i]=='0') cnt[0]++;
    else cnt[1]++;
  }
  int ans = min(cnt[0], cnt[1]);
  ans = ans*2;
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
// B - RGB Boxes
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, n, r, g, R, G, B, w, ans = 0, count = 0;
  string s, t;
  vector<pair<string, pair<lli, lli>>> pr;
  cin >> r >> g >> b >> n;
  repe(i, 0, 3000)
  {
    R = i;
    repe(j, 0, 3000)
    {
      G = j;
      B = (n - (R * r + G * g)) / b;
      if (R * r + G * g + B * b == n && B >= 0)
      {
        count++;
      }
    }
  }
  cout << count << endl;
}

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

typedef long long ll;

using namespace std;

int main(void) {
	// For fast IO
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);

	long double a, b;
	cin >> a >> b;
	
	cout << (ll)(a * b);

	return 0;
}

Measured memory_bytes: 3744
N, M = map(int, input().split())
H = [int(h) for h in input().split()]
Max = [h-1 for h in H]

for _ in range(M):
    ab = [int(_ab)-1 for _ab in input().split()]
    Max[ab[0]] = max(Max[ab[0]], H[ab[1]])
    Max[ab[1]] = max(H[ab[0]], Max[ab[1]])

cnt = 0
for n in range(N):
    if H[n] > Max[n]:
        cnt += 1
print(cnt)


Measured memory_bytes: 19988
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))

    A.sort()
    B.sort()
    C.sort()

    cntB = [0 for _ in range(N)]
    for i, b in enumerate(B):
        cntB[i] = N - bisect.bisect_right(C, b)

    cumsumB = [0 for _ in range(N)]
    cumsumB[-1] = cntB[-1]
    for i in range(N - 2, -1, -1):
        cumsumB[i] = cumsumB[i + 1] + cntB[i]

    res = 0
    for i, a in enumerate(A):
        idx = bisect.bisect_right(B, a)
        if idx < N:
            res += cumsumB[idx]

    print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 98196
#include<iostream>
int main()
{
	int appear[100];
	for (int i = 0; i < 100; i++)
	{
		appear[i] = 0;
	}
	int max = 0;
	for (int num; std::cin >> num;)
	{
		appear[num - 1]++;
		if (max < appear[num - 1])
		{
			max = appear[num - 1];
		}
	}
	for (int i = 0; i < 100; i++)
	{
		if (appear[i] == max)
		{
			std::cout << i + 1 << std::endl;
		}
	}
	return 0;
}


Measured memory_bytes: 2996
using System;
using System.Linq;

namespace atc
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = 0;
            string input = Console.ReadLine();
            foreach(char c in input)
            {
                num += Convert.ToInt32(c.ToString());
            }
            //long p = long.Parse(Console.ReadLine());
            //int[] p = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            if (num % 9 == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


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

using namespace std;

bool is_prime(int n){
    if (n == 1) return false;
    
    bool check = true;
    
    for(int i = 2; i * i <= n; i++){
        if (n % i == 0) check = false;
    }
    return check;
}

int main(void){
    int x;
    cin >> x;
    
    for (int i = x; i <= 100003; i++){
        if (is_prime(i)){
            cout << i << endl;
            return 0;
        }
    }
    
    
}


Measured memory_bytes: 256
use std::io;
use std::collections::LinkedList;

fn main() {
    let mut buf: String = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.trim().split_whitespace();
    let h = iter.next().unwrap().parse::<usize>().unwrap();
    let w = iter.next().unwrap().parse::<usize>().unwrap();
    let mut grid: Vec<Vec<bool>> = Vec::new();
    let mut white_num: usize = 0;
    for _ in 0..h {
        let mut buf: String = String::new();
        io::stdin().read_line(&mut buf).unwrap();
        grid.push(buf.trim().chars().map(|c| match c {
            '.' => {
                white_num += 1;
                true
            },
            '#' => false,
            _ => false
        }).collect::<Vec<bool>>());
    }
    let mut queue: LinkedList<(usize, usize, usize)> = LinkedList::new();
    queue.push_back((0, 0, 1));
    loop {
        match queue.pop_front() {
            Some(pos) => {
                if pos.0 == w - 1 && pos.1 == h - 1 {
                    println!("{}", white_num - pos.2);
                    return;
                } else {
                    if pos.0 < w - 1 && grid[pos.1][pos.0 + 1] {
                        grid[pos.1][pos.0 + 1] = false;
                        queue.push_back((pos.0 + 1, pos.1, pos.2 + 1));
                    }
                    if pos.1 < h - 1 && grid[pos.1 + 1][pos.0] {
                        grid[pos.1 + 1][pos.0] = false;
                        queue.push_back((pos.0, pos.1 + 1, pos.2 + 1));
                    }
                    if pos.0 > 0 && grid[pos.1][pos.0 - 1] {
                        grid[pos.1][pos.0 - 1] = false;
                        queue.push_back((pos.0 - 1, pos.1, pos.2 + 1));
                    }
                    if pos.1 > 0 && grid[pos.1 - 1][pos.0] {
                        grid[pos.1 - 1][pos.0] = false;
                        queue.push_back((pos.0, pos.1 - 1, pos.2 + 1));
                    }
                }
            },
            None => {
                println!("-1");
                return;
            }
        }
    }
}


Measured memory_bytes: 4352
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class BAToZString {
public:
    void solve(std::istream &in, std::ostream &out) {
        string str;
        in >> str;
        int pa = str.find('A'), pz = str.find_last_of('Z'), res = pz - pa + 1;
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    BAToZString solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3796
#include<stdio.h>

int main(){
int i=0,ans=0;
char s[100001],tmp;
scanf("%s",s);
tmp=s[0];
while(s[i]!=0){
if(s[i]!=tmp){
ans++;
tmp=s[i];
}
i++;
}
printf("%d\n",ans);
return 0;
}

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

int main(void){
    int n;
    cin>>n;
    int t[n],ans=0;
    for(int i=0;i<n;i++){
        cin>>t[i];
        ans += t[i];
    }
    int m;
    cin>>m;
    for(int i=0;i<m;i++){
        int p,x;
        cin>>p>>x;
        cout<<(ans+x-t[p-1])<<endl;
    }
}

Measured memory_bytes: 256
import sys

input=sys.stdin.readline

H,W=map(int,input().split())
A=[0 for i in range(0,H)]
B=[0 for i in range(0,H)]
for i in range(0,H):
    A[i]=list(map(int,input().split()))
for i in range(0,H):
    B[i]=list(map(int,input().split()))

C=[[0 for i in range(0,W)] for j in range(0,H)]
for i in range(0,H):
    for j in range(0,W):
        C[i][j]=abs(A[i][j]-B[i][j])

dp=[[0 for i in range(0,W)] for i in range(0,H)]
if C[0][0]!=0:
    dp[0][0]=pow(2,6400+C[0][0])+pow(2,6400-C[0][0])
else:
    dp[0][0]=pow(2,6400)
for i in range(0,H):
    for j in range(0,W):
        ans1=0
        ans2=0
        if i!=0:
            ans1=(dp[i-1][j]<<C[i][j])|(dp[i-1][j]>>C[i][j])
        if j!=0:
            ans2=(dp[i][j-1]<<C[i][j])|(dp[i][j-1]>>C[i][j])
        if (i,j)!=(0,0):
            dp[i][j]=ans1|ans2

ans=100
for i in range(0,80+1):
    test=100
    if dp[H-1][W-1]>>(6400+i) &1 ==1:
        test=i
    if ans>test:
        ans=test

print(ans)

Measured memory_bytes: 52060
N, M = map(int, input().split())
D = [[] for i in range(N)]
for i in range(M):
    a = [int(j) for j in input().split()]
    for v in a[1:]:
        D[v - 1].append(i)

P = [int(i) for i in input().split()]
ans = 0
for i in range(1 << N):
    S = [0] * M #各電球が何回スイッチ入ってるか
    for k in range(N):
        if ((i >> k) & 1) == 1:
            for d in D[k]:
                S[d] ^= 1

    if all([s == p for  s,p in zip(S, P)]):
        ans += 1

print(ans)



Measured memory_bytes: 43484
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

int n;
double xa,ya,xb,yb,xc,yc,xd,yd;

int main(){
	while(cin>>xa>>ya>>xb>>yb>>xc>>yc>>xd>>yd){
		if((xb-xa)*(xd-xc)+(yb-ya)*(yd-yc)==0)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a, b;
    bool flag = false;
  cin >> a >> b;
  
  for(int i = 1; i <= 3; i++){
  	if(a * b * i % 2){
  		cout << "Yes" << endl;
      flag = true;
      break;
   	}
	}
  if(flag == false){
  	cout << "No" << endl;
  }
}

Measured memory_bytes: 256
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:i32,
    }
    println!("{}", (n + 1) / 2);
}


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

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a;
  cin >> b;
  if(b == 1) {
    cout << 0 << '\n';
    return 0;
  }
  int result = 1;
  int count = 0;
  while(1) {
    result += a-1;
    count++;
    if(result >= b) break;
  }
  cout << count << '\n';
}




Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,all,w[10000005],v[10000005];
long long dp[50010005];
int main()
{
	memset(dp,0x3f,sizeof(dp));dp[0]=0;
	scanf("%d%d",&n,&all);for(int i=1;i<=n;++i) scanf("%d%d",&w[i],&v[i]);
	for(int i=1;i<=n;++i) {
		for(int j=100000;j!=-1;--j) dp[j+v[i]]=min(dp[j+v[i]],dp[j]+(long long)w[i]);
	}
	for(int i=100000;i!=-1;--i) if(dp[i]<=all) {printf("%d",i);break;}
	return 0;
}

Measured memory_bytes: 393344
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int num (char * init) {
	int ret = 0;
	for (int i=0; i<3; i++) {
		ret = ret*10 + (int)(*(init+i)-'0');
	}
	return ret;
}

int main () {
	char S[11];
	int min = 1000;
	scanf ("%s", S);
	int n = strlen (S);

	for (int i=0; i<n-2; i++) {
		int tmp = abs (num (S+i) - 753);
		if (tmp < min)
			min = tmp;
	}

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



Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
 int N,c=0;
 cin >>N; 
 vector<int> num(N);
 for(long long int i=0;i<N;i++){
     cin >> num[i];
 }
 for(long long int i=0;i<N;i++){
     c+=num[i];
 }
 cout << c-num.size();
 }



Measured memory_bytes: 256
#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 int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}
int lcm(int a, int b)
{
    return a / __gcd(a, b) * b;
} 
void solve()
{
    int n,k;
    cin >> n>>k;
    int a[n];
    for (int i = 0; i < n;i++){
        cin >> a[i];
    }
    for (int i = k; i < n;i++){
        if(a[i]>a[i-k]){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tc;
    tc = 1;
    //cin >> tc;
    while (tc--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 5224