akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
using namespace std;
int a[180000], b[180000], c[180000];
int main() {
	int n; cin >> n; int t = 0;
	for (int i = 0; i < n; i++) {
		int a, b; cin >> a >> b;
		t += a; c[t % 86400]++; t += b; t %= 86400;
	}
	for (int i = 0; i < 86400; i++)c[i + 86400] = c[i];
	int ret = 0, maxn = 0;
	for (int i = 0; i < 10801; i++)ret += c[i]; maxn = ret;
	for (int i = 0; i < 160000; i++) {
		ret -= c[i]; ret += c[i + 10801]; maxn = max(maxn, ret);
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;
class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    int sum=0;
    for(int x=0;x<m;x++)
    {
      int a=sc.nextInt();
      sum+=a;
    }
    if(sum<=n)
    {
      System.out.println(n-sum);
    }
    else
    {
      System.out.println(-1);
    }
  }
}

Measured memory_bytes: 46288
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);

  ll lb = 9999999999LL, ub = 99999999999LL;
  // ll lb = 99, ub = 999;
  while (ub - lb > 1) {
    const ll mid = (lb + ub) / 2;
    cout << "? " << mid << endl;
    string resp;
    cin >> resp;
    if (resp == "Y") ub = mid;
    else lb = mid;
  }
  while (ub % 10 == 0) ub /= 10;
  // cout << ub << endl;
  if (ub == 1) {
    for (;;) {
      cout << "? " << (ub * 10) - 1 << endl;
      string resp;
      cin >> resp;
      if (resp == "N") {
        ub *= 10;
      }
      else {
        cout << "! " << ub << endl;
        return 0;
      }
    }
  }
  for (;;) {
    cout << "? " << (ub * 10) - 1 << endl;
    string resp;
    cin >> resp;
    if (resp == "Y") {
      ub *= 10;
    }
    else {
      cout << "! " << ub << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 596
### SNIPPET
  # n = gets.split.map(&:to_i)
  # array = n.times.map { gets.split.map(&:to_i) }
  # [].all?(&:even?)
  # a = [*1..m].repeated_combination(n).to_a
  # [1,2,3,4,5].select { |num| num.even? }  # => [2, 4]
  # ["a","a","b"].group_by(&:itself).map{|k,v| [k, v.count]}.to_h #=> {"a"=>2, "b"=>1}
  # 切り捨て: .floor(2).to_f ,切り上げ： .ceil(2).to_f,四捨五入: round(2)
  # 3.upto(6) do |i|, 6.downto(3) do |i|
  # 公約数125.gcd(100)、公倍数125.lcm(100)
  # PI = Math::PI
  # 高さ = a * Math.sin(w / 180.0 * Math::PI), 底辺 = a * Math.cos(w / 180.0 * Math::PI)
  # def chmax(a, b) a > b ? a : b end
  # INF = Float::INFINITY
  # def chmin(a, b) a < b ? a : b end

a,b,c,d = gets.split.map(&:to_i)

# if a >= 0 && b >= 0
#   xmax = b
#   if c >= 0 && d >= 0
#     ymax = d
#   else
#     xmax = a
#     ymax = d
#   end
# else
# end
ary = []
ary << a * c
ary << a * d
ary << b * c
ary << b * d
puts ary.max

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

using namespace std;

int main(void) {
	int num, x, a, n = 0, ans = 0, i;
	cin  >> num >> x;
	for (i = 0; i < num; i++) {
		scanf("%d", &a);
		n += a;
		ans++;
		if (n > x)
			break;
	}
	if (n <= x)
		ans++;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n, y] <- getIntList
    putStrLn . head $ [show i ++ " " ++ show j ++ " " ++ show k| i <- [0..n], j <- [0..(n-i)], let k = n-i-j, i * 10000 + j * 5000 + k * 1000 == y] ++ ["-1 -1 -1"]

Measured memory_bytes: 380
import java.util.*;

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

	int w = sc.nextInt();
	int n = sc.nextInt();

	int[][] change = new int[n][2];
	for(int i=0; i<n; i++){
	    String[] s = (sc.next()).split(",");
	    change[i][0] = Integer.parseInt(s[0]);
	    change[i][1] = Integer.parseInt(s[1]);
	}

	int[] num = new int[w+1];
	for(int i=1; i<=w; i++){
	    num[i] = i;
	}

	for(int i=0; i<n; i++){
	    int temp = num[change[i][0]];
	    num[change[i][0]] = num[change[i][1]];
	    num[change[i][1]] = temp;
	}

	for(int i=1; i<=w; i++){
	    System.out.println(num[i]);
	}
    }
}

Measured memory_bytes: 0
//Subhash Suman
//Description :

#include <bits/stdc++.h>
#define ll long long int
#define pll pair<ll, ll>
#define pii pair<int, int>

using namespace std;
const int N = 105, V = 1e5 + 5;
ll INF = 1e10;
ll n, w, dp[N][V], arr1[N], arr2[N];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> w;
    for (int i = 1; i <= n; i++)
    {
        cin >> arr1[i] >> arr2[i];
    }
    for (int i = 0; i < N - 2; i++)
    {
        for (int j = 1; j < V - 2; j++)
        {
            dp[i][j] = INF;
        }
    }
    for (int i = 1; i <= n; i++)
    {
        for (int vi = 1; vi <= V - 3; vi++)
        {
            if (vi - arr2[i] >= 0)
            {
                dp[i][vi] = min(dp[i][vi], dp[i - 1][vi - arr2[i]] + arr1[i]);
            }
            dp[i][vi] = min(dp[i][vi], dp[i - 1][vi]);
        }
    }
    ll ans = 0;
    for (int i = 0; i < V - 2; i++)
    {
        if (dp[n][i] <= w)
        {
            ans = i;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 82176
main :: IO ()
main = do
    [n, x] <- fmap read . words <$> getLine
    as     <- fmap read . words <$> getLine
    answer $ solve x as

type Answer = Int
answer :: Answer -> IO ()
answer = print

solve :: Int -> [Int] -> Answer
solve x = inner 0 x
  where
    inner n k aas
      | null as   = n + m
      | otherwise = inner (n + m) (x + m - a) as
      where
        (a : as) = aas
        m = max 0 (a - k)


Measured memory_bytes: 36220
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
int main(){
	int a,b;
	cin>>a>>b;
	cout<<(a+b)%24<<endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n = gets.chomp.to_i

a = Array.new(n)

str = gets.chomp
a = str.split.map(&:to_i)

count = 0
for i in 0..(n-1) do
  minj = i
  for j in i..(n-1) do
    minj = j if a[j] < a[minj]
  end
  if a[i] != a[minj] then
    change = a[i]
    a[i] = a[minj]
    a[minj] = change
    count += 1
  end
end

for i in 0..n-1 do
  print a[i]
  print " " if i != n-1
end

print "\n", count, "\n"

Measured memory_bytes: 8712
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	if(n>0&&m>0) cout<<"Positive";
	else if(n<=0&&m>=0) cout<<"Zero";
	else if(n<0&&m<0) 
		if((m-n+1)%2==0) cout<<"Positive";
		else cout<<"Negative";
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <algorithm>
  
typedef long long int ll;
using   namespace std;
#define ALL(a) ((a).begin(),(a).end())
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
const ll MOD = 1000000007;
const ll INF = 100000000;
    ll N,M;
    ll C[30];
    ll dp[21][100000];
  
    int DP(int n,int v){
      if(n<0||v<0){return INF;}
      if(dp[n][v]!=-1)return dp[n][v];
      else{
        return dp[n][v] = min(DP(n-1,v),DP(n,v-C[n])+1);
      }
    }
  
  
int main() {
    cin>>N>>M;
    REP(i,M)cin>>C[i];
    memset(dp,-1,sizeof(dp));
    //REP(i,100000)dp[0][i]=INF;
    REP(i,21)dp[i][0]=0;
    cout<<DP(M - 1,N)<<endl;
  
  
}

Measured memory_bytes: 19612
from functools import reduce


def do_code():
    rot = int(input())
    str = input()
    table = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    ans = reduce(lambda red, s: red + table[(table.index(s) + rot) % 26], str[:], "")
    print(ans)


if __name__ == '__main__':
    do_code()


Measured memory_bytes: 3572
package main

import (
  "fmt"
)

func absInt(x int) int {if x < 0 {x *= -1}; return x}

func main() {
  var n, l int 
  fmt.Scan(&n, &l)
  s := (n - 1) * n / 2 + l * n
  m := 1001
  var res int 
  for i := 0; i < n; i++ {
    a := absInt(l + i)
    if a < m {
      m = a
      res = l + i
    }
  }
  fmt.Println(s - res)

}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<stack>
using namespace std;

int main() {
	int n;
	string s;
	cin >> n >> s;
	stack<char>st;
	string front = "", back = "";
	for (int i = 0;i < n;++i) {
		if (s[i] == ')') {
			if (st.empty() || st.top() == ')')front = front + "(";
			else if (st.top() == '(')st.pop();
		}
		else st.push(s[i]);
	}
	while (st.size()) {
		back = back + ")";
		st.pop();
	}
	cout << front << s << back << endl;
}

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

using namespace std;

int main()
{
	for(int n;cin>>n,~n;){
		stack<int> st;
		if(n==0)			st.push(0);
		for(;n>0;n/=4)		st.push(n%4);
		while(!st.empty())	cout<<st.top(),st.pop();
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 100009;
struct node{
	int a, b;
}s[MAXN];
int n, m;
long long ans;
bool operator<(node x, node y){
	return x.b < y.b;
}
int main(){
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; i++)
		scanf("%d%d", &s[i].b, &s[i].a);
	sort(s + 1, s + n + 1);
	for(int i = 1; i <= n; i++){
		ans += (long long)min(m, s[i].a) * s[i].b;
		m -= min(m, s[i].a);
		if(!m)
			break;
	}
	cout<<ans;
	return 0;
}


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

using namespace std;

int main() {
	long long h, k;
	cin >> h >> k;
	if(h == 1 || k == 1) {
		cout << 1 << endl;
		return 0;
	}
	long long ans = h * (k / 2);
	if(k & 1) ans += (h + 1) / 2;
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main()
{
    //freopen("input.txt", "r", stdin);



    int n, a, b, c = 0;
    bool f = false;

    cin >> n;

    for(int i = 1; i <= n; i++)
    {
        cin >> a >> b;

        if(a == b)
        {
            c++;

            if(c > 2)
            {
                f = true;
                break;
            }
        }
        else if(c > 2)
        {
            f = true;
            break;
        }
        else
        {
            c = 0;
            f = false;
        }

    }

    cout << (f ? "Yes" : "No") << endl;



    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define y_n(ans) cout<<(ans?"Yes":"No")<<endl;

const int MAX = 1e6 + 10;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    vector<bool> exist(MAX, false);
    bool pairwise = true;
    rep(i, n) {
        cin >> a[i];
        if (exist[a[i]] && a[i] != 1) pairwise = false;
        exist[a[i]] = true;
    }

    vector<bool> is_prime(MAX, true);
    is_prime[0] = false;
    is_prime[1] = false;
    for (int i=2; i<MAX; ++i) {
        if (!is_prime[i]) continue;
        int cnt = 0;
        if (exist[i]) cnt++;
        for (int j=2*i; j<MAX; j+=i) {
            is_prime[j] = false;
            if (exist[j]) cnt++;
        }
        if (cnt > 1) {
            pairwise = false;
            break;
        }
    }

    if (pairwise) {
        cout << "pairwise coprime" << endl;
    }
    else {
        int GCD = a[0];
        for (int i = 1; i < n; ++i) {
            GCD = __gcd(GCD, a[i]);
        }

        if (GCD == 1) {
            cout << "setwise coprime" << endl;
        } else {
            cout << "not coprime" << endl;
        }
    }
}

Measured memory_bytes: 7476
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

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

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    
    int N, K;
    cin >> N >> K;
    cout << N-K+1 << endl;

    return 0;
}


Measured memory_bytes: 256
H,W,D = map(int,input().split())
A = [list(map(int,input().split())) for i in range(H)]
Q = int(input())
S = [list(map(int,input().split())) for i in range(Q)]
P = [None]*(H*W+1)
for i in range(H):
    for j in range(W):
        P[A[i][j]] = [i,j]

Accum = [0]*(H*W+1)
accum = 0

for i in range(D+1,H*W+1):
    Accum[i] = Accum[i-D]+abs(P[i][0]-P[i-D][0])+abs(P[i][1]-P[i-D][1])

for s in S:
    print(Accum[s[1]]-Accum[s[0]])

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

int main() {
    int N;
    long long W;
    cin >> N >> W;
    vector<vector<int>> A(4, vector<int>(0));
    int w0, v0;
    cin >> w0 >> v0;
    A[0].push_back(v0);
    for(int i=1; i<N; ++i) {
        int w,v;
        cin >> w >> v;
        A[w-w0].push_back(v);
    }
    for(int i=0; i<4; ++i) sort(A[i].begin(), A[i].end(), greater<int>());

    int ans = 0;
    for(int i=0; i<=A[0].size(); ++i) {
        for(int j=0; j<=A[1].size(); ++j) {
            for(int k=0; k<=A[2].size(); ++k) {
                for(int l=0; l<=A[3].size(); ++l){
                    if(j + 2*k + 3*l > W - w0*(i+j+k+l)) continue;
                    int tmp = 0;
                    for(int p=0; p<i; ++p) tmp += A[0][p];
                    for(int p=0; p<j; ++p) tmp += A[1][p];
                    for(int p=0; p<k; ++p) tmp += A[2][p];
                    for(int p=0; p<l; ++p) tmp += A[3][p];
                    ans = max(ans, tmp);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    if (N&1) N*=2;
    cout << N << ln;
}


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

int main() {

    int r;
    int D;
    int x2000 = 0;

    std::cin >> r >> D >> x2000;

    int xi = x2000;
    int xi_1 = 0;

    for(int i=0;i<10;++i){
        xi_1 = r * xi - D;
        std::cout << xi_1 << std::endl;
        xi = xi_1;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main(){
  int k;
  cin >> k;
  vector<int> r(k), c(k);
  vector< vector<bool> > board(8, vector<bool>(8, false));
  vector<int> x(8);
  vector<int> perm(8);
  rep(i, 8){
    x[i] = i;
    perm[i] = i;
  }
  rep(i, k){
    cin >> r[i] >> c[i];
    board[r[i]][c[i]] = true;
    x.erase(find(x.begin(), x.end(), r[i]));
    perm.erase(find(perm.begin(), perm.end(), c[i]));
  }
  do {
    vector<bool> check1(15, false);
    vector<bool> check2(15, false);
    rep(i, k){
      check1[r[i]+7-c[i]] = true;
      check2[r[i]+c[i]] = true;
    }
    bool flag = true;
    rep(i, 8-k){
      if (check1[x[i]+7-perm[i]] || check2[x[i]+perm[i]]){
        flag = false;
        break;
      }
      check1[x[i]+7-perm[i]] = true;
      check2[x[i]+perm[i]] = true;
    }
    if (flag){
      rep(i, 8-k){
        board[x[i]][perm[i]] = true;
      }
      break;
    }
  }while(next_permutation(perm.begin(), perm.end()));
  
  rep(i, 8){
    rep(j, 8){
      if (board[i][j])
        cout << 'Q';
      else
        cout << '.';
    }
    cout << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3156
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

N, K = map(int, input().split())

v1 = N+K
v2 = N-K
v3 = N*K
print(max(v1, v2, v3))


Measured memory_bytes: 3316
# AGC003B - Simplified mahjong
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int, [input() for _ in range(N)]))
    ans = 0
    for i in range(N - 1):  # make pairs greedily
        ans += A[i] // 2  # pairs with same cards
        if A[i] % 2 and A[i + 1]:  # pairs with a neighbor
            ans += 1
            A[i + 1] -= 1
    ans += A[-1] // 2  # pairs with the same cards in the last one
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 14240
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
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; }
template<class T, class U>T rem(T a, U b) { return a - b*floor(a/b); }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N, Q;
        string S;
        cin >> N >> Q;
        cin >> S;
        vll L(Q), R(Q);
        rep(i, 0, Q) {
                cin >> L[i] >> R[i];
        }

        vll counts(N+1, 0);
        rep(i, 1, N) {
                //cout << S[i-1] << S[i] << endl;
                if (S[i-1] == 'A' and S[i] == 'C') {
                        counts[i+1]++;
                }
        }
        rep(i, 0, N) {
                counts[i+1] += counts[i];
        }
        //print1d(counts);

        rep(i, 0, Q) {
                cout << counts[R[i]] - counts[L[i]] << endl;
        }
}

Measured memory_bytes: 3456
#include<iostream>
#include<cstdio>
using namespace std;
long long f0=2,f1,t,n;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		f1=f0*2+2;
		t=f0;
		f0=f1;
		f1=t;
	}
	cout<<f0<<'\n';
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace D
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var answer = new bool[1000001];
            var tmp = new bool[1000001];
            Array.Sort(A);
            foreach (var n in A)
            {
                if (answer[n]) answer[n] = false;
                if (tmp[n]) continue;
                answer[n] = true;
                for (var i = n; i < tmp.Length; i += n)
                {
                    tmp[i] = true;
                }
            }
            Console.WriteLine(answer.Count(x => x));
        }
    }
}


Measured memory_bytes: 45268
n = int(input())
d = list(map(int,input().split()))
nc = [0]*(max(d)+1)
for i in range(0,n):
    nc[d[i]]+=1
if d[0]==0 and nc[0]==1 and nc.count(0)==0:
    ans = 1
    for i in range(1,len(nc)):
        ans *= nc[i-1]**nc[i]
        ans = ans%998244353
    print(ans)
else:
    print(0)


Measured memory_bytes: 14396
#include <iostream>

using namespace std;

const int INF = 1<<29;
const int N = 10;

int main(){
    int n;
    while(true){
        cin >> n;
        if(!n) break;

        int dp[N][N];
        for(int i=0;i<N;i++)
        for(int j=0;j<N;j++) dp[i][j] = INF;

        int a,b,c;
        while(n--){
            cin >> a >> b >> c;
            dp[a][b] = c;
            dp[b][a] = c;
        }

        for(int k=0;k<N;++k){
            for(int i=0;i<N;++i){
                for(int j=0;j<N;++j){
                    if(dp[i][j] > dp[i][k] + dp[k][j])
                        dp[i][j] = dp[i][k] + dp[k][j];
                }
            }
        }

    int sum[N];
    for(int i=0;i<N;i++){
        sum[i] = 0;
        for(int j=0;j<N;j++){
            if(i != j && dp[i][j]!=INF){
                sum[i] += dp[i][j];
            }
        }
    }

    int ans_i = 0;
    for(int i=0;i<N;i++){
        if(sum[i] < sum[ans_i] && sum[i] != 0){
            ans_i = i;
        }
    }

    cout << ans_i << " " << sum[ans_i] << endl;

    }

}


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

using namespace std;

#define pb push_back
#define ll long long
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define bug cout << "ok" << endl

const ll INF = 1e9 + 5, N = 3e5 + 5, mod = 1e9 + 7, M = 1e6 + 5;

int main(){
	string s;
	cin >> s;
	if(s[s.size() - 1] == 's') s += "es";
	else s += "s";
	cout << s << endl;	
}

Measured memory_bytes: 3592
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, S, E) for (int(X) = (S); (X) < (E); ++(X))
#define rrep(X, S, E) for (int(X) = (E)-1; (X) >= (S); --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll INF = 9 * 1e18;
const ll MOD = 1e9 + 7;

void solve(long long N, std::vector<long long> A) {
  ll l = 0;
  ll r = 0;

  ll cnt = 0;
  ll aXor = A[l];
  ll aSum = A[l];

  while (l <= N - 1) {
    if (aXor == aSum) {
      while (r < N && aXor == aSum) {
        r++;

        if (r == N) {
          break;
        }

        aXor ^= A[r];
        aSum += A[r];
      }

      if (r == N && aXor == aSum) {
        r--;
      } else {
        aXor ^= A[r];
        aSum -= A[r];
        r--;
      }

      cnt += r - l + 1;
    }
    aXor ^= A[l];
    aSum -= A[l];
    l++;
  }

  print(cnt);
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}


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

const int maxn = 100005;

int n, dep[maxn], siz[maxn];
int head[maxn], adj[maxn * 2], nxt[maxn * 2], total;
bool hav[maxn];

inline void addedge(int u, int v){
	++total, adj[total] = v, nxt[total] = head[u], head[u] = total;
}

void dfs(int u, int f){
	siz[u] = 1, hav[u] |= (u == n);
	for(int i = head[u]; i; i = nxt[i])
		if(adj[i] != f){
			dep[ adj[i] ] = dep[u] + 1;
			dfs(adj[i], u);
			hav[u] |= hav[ adj[i] ];
			siz[u] += siz[ adj[i] ];
		}
}

int main(){
	scanf("%d", &n);
	for(int u, v, i = 1; i <= n - 1; i++){
		scanf("%d%d", &u, &v);
		addedge(u, v), addedge(v, u);
	}
	
	dep[1] = 1, dfs(1, 0);
	int last_d = ((1 + dep[n]) >> 1) + 1, siz1 = n, siz2;
	for(int i = 1; i <= n; i++)
		if(hav[i] && (dep[i] == last_d)){
			siz1 -= siz[i], siz2 = siz[i];
			break;
		}
	
	puts(siz1 > siz2 ? "Fennec" : "Snuke");
	
	return 0;
}

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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);
    
    char a; cin >> a;
    if(a == 'A') cout << "T" << endl;
    if(a == 'T') cout << "A" << endl;
    if(a == 'C') cout << "G" << endl;
    if(a == 'G') cout << "C" << endl;
    

    return 0;
}

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

using namespace std;

typedef pair<int,int> Pa;

int main(){
    int N; cin>>N;
  vector<int> A(N);
  vector<int> B(N);
  vector<Pa> P(N);
  long long Asum=0;
  bool ans=true;
  
  for(int i=0;i<N;i++){
    cin>>A[i]>>B[i];
  	P[i]=make_pair(B[i],A[i]);
  }
  sort(P.begin(),P.end());
  for(int i=0;i<N;i++){
    Asum+=P[i].second;
    if(Asum>P[i].first){
    	ans=false;
      break;
    }
  }
  
  if(ans) printf("Yes");
  else printf("No");
    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100005

enum Which{
	Hanako,
	Jiro,
};

int N,A,B;
int table[NUM];

int calc_xor(int mod){

	int ret = 0;

	for(int i = 0; i < N; i++){
		ret ^= (table[i]%mod);
	}

	return ret;
}

int main(){

	scanf("%d %d %d",&N,&A,&B);

	for(int i = 0; i < N; i++){
		scanf("%d",&table[i]);
	}

	Which winner;
	bool FLG;

	if(A == B){

		if(calc_xor(A+1) != 0){

			winner = Hanako;

		}else{
			winner = Jiro;
		}
	}else if(A > B){

		FLG = false;

		for(int i = 0; i < N; i++){
			if(table[i] >= B+1){
				FLG = true;
				break;
			}
		}

		if(FLG){

			winner = Hanako;

		}else{

			if(calc_xor(B+1) != 0){

				winner = Hanako;

			}else{

				winner = Jiro;
			}
		}

	}else{ //A < B

		int tmp_count = 0;
		int tmp_index,other_xor;

		for(int i = 0; i < N; i++){
			if(table[i] >= A+1){
				tmp_count++;
				tmp_index = i;
			}
		}

		if(tmp_count >= 2){

			winner = Jiro;

		}else{

			if(tmp_count == 0){

				if(calc_xor(A+1) != 0){

					winner = Hanako;

				}else{

					winner = Jiro;
				}
			}else{ //tmp_count == 1

				FLG = false;

				other_xor = 0;

				for(int i = 0; i < N; i++){
					if(i == tmp_index)continue;
					other_xor ^= (table[i]%(A+1));
				}

				for(int i = 1; i <= A; i++){

					if(table[tmp_index]-i >= A+1)continue;

					if((other_xor^(table[tmp_index]-i)%(A+1)) == 0){

						FLG = true;
						break;
					}
				}

				if(FLG){

					winner = Hanako;

				}else{

					winner = Jiro;
				}
			}
		}
	}

	if(winner == Hanako){

		printf("Hanako\n");

	}else{

		printf("Jiro\n");
	}

	return 0;
}



Measured memory_bytes: 3556
import java.util.Scanner;

/*
 * AtCoder Beginner Contest 100 A
 */
public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();

		if (A <= 8 && B <= 8) {
			System.out.println("Yay!");
		} else {
			System.out.println(":(");
		}

	}

}

Measured memory_bytes: 21844
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;


 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
    int[] dp = new int[1000001];
    for(int i = 0; i < 1000001; i++){
      dp[i] = 0;
    }
    dp[1] = 1;
    for(int i = 1; i * 2 <= 1000000; i++){
      dp[i * 2] |= dp[i];
    }
    for(int i = 1; i * 3 <= 1000000; i++){
      dp[i * 3] |= dp[i];
    }
    for(int i = 1; i * 5 <= 1000000; i++){
      dp[i * 5] |= dp[i];
    }

    while(true){
      int m = sc.nextInt();
      if(m == 0){break;}
      int n = sc.nextInt();

      int answer = 0;
      for(int i = m; i <= n; i++){
        answer += dp[i];
      }
      System.out.println(answer);
    }

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

      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }

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

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

typedef long long int llint;

struct Opr
{
  int x, y, xx, yy;

  Opr() {}
  Opr(int x, int y, int xx, int yy) : x(x), y(y), xx(xx), yy(yy) {}
};

int h, w;
int  mas[501][501];

vector<Opr> opr;

int main()
{
  cin>> h >> w;
  for(int i = 0; i < h; i++)
    for(int j = 0; j < w; j++) cin>> mas[i][j];

  int cnt = 0;
  
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {

      if(i == h - 1 && j == w - 1) continue;
      
      if(mas[i][j] % 2 == 1) {

	if(j + 1 < w && mas[i][j + 1] % 2 == 1) {
	  mas[i][j]--;
	  mas[i][j + 1]++;
	  opr.push_back(Opr(i, j, i, j + 1));
	} else if(i + 1 < h) {
	  mas[i][j]--;
	  mas[i + 1][j]++;
	  opr.push_back(Opr(i, j, i + 1, j));
	} else {
	  mas[i][j]--;
	  mas[i][j + 1]++;
	  opr.push_back(Opr(i, j, i, j + 1));
	}

	cnt++;
      }
      
    }
  }

  cout<< cnt <<endl;
  for(int i = 0; i < opr.size(); i++) {
    cout<< opr[i].x + 1 << ' ' << opr[i].y + 1 << ' '
	<< opr[i].xx + 1 << ' ' << opr[i].yy + 1 <<endl;
  }
  

  return 0;
}


Measured memory_bytes: 5104
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include <limits>
#include <iomanip>

using namespace std;

int main(){
	int ans=0;
	int n,k;
	int r,s,p;
	string t;
	
	cin >> n >> k;
	
	cin >> r >> s >> p;
	
	cin >> t;
	
	for(int i=0;i<n-k;i++){
		if(t[i] == t[i+k])t[i+k] = 'w';
	}
	
	for(int i=0;i<n;i++){
		if(t[i]=='r'){
			ans += p;
		}else if(t[i] == 's'){
			ans += r;
		}else if(t[i] == 'p'){
			ans += s;
		}

	}
	
	cout << ans << endl;

	
	return 0;
}

Measured memory_bytes: 512
n, k = map(int, input().split())
a = list(map(int, input().split()))
a_below = []
count2 = 0
for i in range(n):
    count1 = 0
    for j in range(n):
        if a[j] < a[i]:
            count1 += 1
        if j > i and a[j] < a[i]:
            count2 += 1
    a_below.append(count1)
a_slip = count2

print(((sum(a_below)*k*(k-1))//2 + a_slip*k)%1000000007)

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

int main(){
    int A[3][3];
    bool check[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>A[i][j];
            check[i][j]=false;
        }
    }
    int N;
    cin>>N;
    for(int b=0;b<N;b++){
        int temp;
        cin>>temp;
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(temp==A[i][j]){
                    check[i][j]=true;
                }
            }
        }
    }
    if(check[0][0]&&check[0][1]&&check[0][2]){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check[1][0]&&check[1][1]&&check[1][2]){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check[2][0]&&check[2][1]&&check[2][2]){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check[0][0]&&check[1][0]&&check[2][0]){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check[0][1]&&check[1][1]&&check[2][1]){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check[0][2]&&check[1][2]&&check[2][2]){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check[0][0]&&check[1][1]&&check[2][2]){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check[0][2]&&check[1][1]&&check[2][0]){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}

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

using namespace std;

int n;
const int N=200;
vector<int> v[N];

int ab(int a)
{
    if(a>=0) return a;
    else return -a;
}

int solve(int src)
{
    vector<int> t(n,0);
    t[src]=1;
    queue<int> q;
    q.push(src);
    while(!q.empty())
    {
        int a=q.front();
        q.pop();
        for(int to:v[a])
        {
            if(t[to]==0)
            {
                t[to]=t[a]+1;
                q.push(to);
            }
            else if(ab(t[a]-t[to])!=1) return -1;
        }
    }
    int res=0;
    for(int i=0;i<n;i++) res=max(res,t[i]);
    return res;
}

int main()
{
    scanf("%d",&n);
    char s[n][n+1];
    for(int o=0;o<n;o++) scanf("%s",s[o]);
    for(int o=0;o<n;o++) for(int i=0;i<n;i++) if(s[o][i]=='1') v[o].push_back(i);
    int res=-1;
    for(int i=0;i<n;i++) res=max(res,solve(i));
    printf("%d\n",res);
    return 0;
}


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

namespace AizuOnLine
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] data = Console.ReadLine().Split(' ');
            int num1 = Convert.ToInt32(data[0]);
            int num2 = Convert.ToInt32(data[1]);
            int num3 = Convert.ToInt32(data[2]);

            int ans = Enumerable.Range(num1, num2 - num1 + 1).Where(e => e <= num3 && num3 % e == 0).Count();
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 9616
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]


n = int(input())
w = list(map(int, input().split()))

total = sum(w)
sa = []
for i in range(n):
    #print(w[0:i+1])
    #print(w[i+1:n+1])
    s1 = sum(w[0:i+1])
    s2 = total - s1
    sa.append(abs(s1-s2))
#print(sa)
print(min(sa))


Measured memory_bytes: 9004
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef double db;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=100005;
ll ceil(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?(x+y-1)/y:-x/y;}
ll floor(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?x/y:-(x+y-1)/y;}
char str[max_n];
void rs(string& s){scanf(" %s",str);s=str;}
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
int n,m,a[20][20];
int x,c[20];
int t[20];
int main(){
    scanf("%d%d%d",&n,&m,&x);
    for(int i=0;i<n;i++){
        scanf("%d",c+i);
        for(int j=0;j<m;j++)scanf("%d",&a[i][j]);
    }
    int ans=inf;
    for(int s=0;s<(1<<n);s++){
        int cost=0;
        for(int i=0;i<m;i++)t[i]=0;
        for(int i=0;i<n;i++){
            if(s>>i&1){
                cost+=c[i];
                for(int j=0;j<m;j++)t[j]+=a[i][j];
            }
        }
        bool f=true;
        for(int i=0;i<m;i++)if(t[i]<x)f=false;
        if(f)ans=min(ans,cost);
    }
    if(ans!=inf)printf("%d\n",ans);
    else printf("-1\n");
    return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-6;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair

int A, B;

void solve()
{
	for(int c=1;c<=3;++c){
		int prod = A*B*c;
		if(prod&1){
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}

int main()
{
	cin >> A >> B;
	solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll isPrime(int n) 
{ 
	// Corner cases 
	if (n <= 1) 
		return 1; 
	if (n <= 3) 
		return 2; 

	// This is checked so that we can skip 
	// middle five numbers in below loop 
	if (n % 2 == 0 || n % 3 == 0) 
		return 1; 

	for (int i = 5; i * i <= n; i = i + 6) 
		if (n % i == 0 || n % (i + 2) == 0) 
			return 1; 

	return 2; 
} 

ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i,res%=1000000007; 
    return res; } 
 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll h,w,k=0,d=0,sum=0;
        cin>>h>>w;
        ll n;
        cin>>n;
        ll A[n];
        for(ll i=0;i<n;i++)
        {
            cin>>A[i];
            sum=sum+A[i];
            
        }
        ll C[sum];
         for(ll i=0;i<n;i++)
         {
             for(ll j=0;j<A[i];j++)
             {
                 C[d]=i+1;
                 //cout<<C[d]<<" "<<endl;
                 d++;
             }
         }
        ll B[h][w];
        for(ll i=0;i<h;i++)
        {
            for(ll j=0;j<w;j++)
            {
                if(i%2==0)
                {
                B[i][j]=C[k];
                k++;
                }
                else
                {
                    B[i][w-j-1]=C[k];
                    k++;
                }
            }
        }
        for(ll i=0;i<h;i++)
        {
           for(ll j=0;j<w;j++)
           {
               cout<<B[i][j]<<" ";
           }
           cout<<endl;
        }
    } 
    return 0;
}


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

#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;


void solve(){
	int n, k;
	cin>>n>>k;
	cout<<std::setprecision(10)<<1.0 *n/k<< endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
     t =1;
 //    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int X;cin>>X;
    if(X==3||X==5||X==7)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <cmath>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int mod=1e9+7;

int main() {
 int N;
 cin>>N;
 int x=N;
 int sum=0;
 while(x){
   sum+=x%10;
   x/=10;
 }
 if(N%sum==0){cout<<"Yes"<<endl;}
 else{cout<<"No"<<endl;}
 return 0;  
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main() {
  string s;
  cin >> s;
  int N = s.size();
  int K; cin >> K;
  vector<string> S;
  for(int k = 1; k <= 5; k++) {
    for(int i = 0; i < N - k + 1; i++) {
      S.push_back(s.substr(i, k));
    }
  }
  sort(S.begin(), S.end());
  S.erase(unique(S.begin(), S.end()), S.end());

  cout << S[K - 1] << endl;
  return 0;
}

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

int main(void){
  int N, K, M;
  while(cin >> N >> K >> M, N | K | M){
    vector<int> v;
    for(int i = 0; i < N; i++) v.push_back(i+1);
    int idx = M-1;
    int size = N;
    //for(int i = 0; i < N - 1; i++){
    while(N > 1){
      v.erase(v.begin() + idx);
      --N;
      idx = (idx + K - 1) % N;
    }
    cout << v[0] << endl;
  }
  return 0;
}

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

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

  ll N; cin >> N;
  ll K; cin >> K;
  vector<ll> A(N); for (ll i = 0; i < N; i++) cin >> A[i];
  for (ll i = K; i < N; i++) {
    if (A[i - K] < A[i]) cout << "Yes" << '\n';
    else cout << "No" << '\n';
  }
  return 0;
}

Measured memory_bytes: 4780
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> mpll;
typedef unordered_map<char, ll> mpcl;
typedef unordered_map<string, ll> mpsl;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        ll n, t;
        cin >> n >> t;
        vl v(n);
        rep(i, n) cin >> v[i];

        ll ans = 0;
        rep(i, n - 1) {
            ans += min(t, v[i + 1] - v[i]);
        }
        ans+=t;
        cout << ans << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

int main() {
  int n;

  while (true) {
    cin >> n;
    int score_a = 0;
    int score_b = 0;

    if (n == 0) break;

    for (int i = 0; i < n; ++i) {
      int a, b;
      cin >> a;
      cin >> b;

      if (a == b) {
        score_a += a;
        score_b += b;
      } else if (a > b) {
        score_a += a + b;
      } else {
        score_b += a + b;
      }
    }

    cout << score_a << " " << score_b << endl;
  }
  
  return 0;
}



Measured memory_bytes: 2964
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int m = sc.nextInt();
			int n = sc.nextInt();
			if(m==0 && n==0) break;
			boolean [] year = new boolean[7368793];
			int a = m;
			for(int j=0;j<n;j++) {
				loop:for(int i=a;i<=7368792;i++) {
					if(!year[i]) {
						a = i;
						break loop;
					}
				}
				for(int i=a;i<=7368792;i+=a) {
					year[i] = true;
				}
			}
			long ans = 0;
			loop2:for(int i=m;i<=7368792;i++) {
				if(!year[i]) {
					ans = i;
					break loop2;
				}
			}
			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 87620
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;

int a, b, c;

int main(){
  ios_base::sync_with_stdio(false);
  
  string ans = "NO";

  cin >> a >> b >> c;
  
  for(int i=0;i*a < a*b;i++){
    if((a*i)%b == c){
      ans = "YES";
      break;
    }
  } 

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
n, y = map(int, input().split())

for i in range(n + 1):
    for j in range(n + 1 - i):
        k = (y - i * 10000 - j * 5000) // 1000
        if i + j + k == n:
            print(i, j, k)
            exit()

print(-1, -1, -1)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    char c;
    cin >> c;
    c++;
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 256