akhauriyash/Code-Regression huggingface dataset:
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int n;
    R(n);
    int an=0;
    REP(i,n){
        int x;
        R(x);
        while(x%2==0)x/=2,an++;
    }
    W(an);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  int H,W;
  cin >> H >> W;
  vector<string>a(H);
  for(int i=0;i<H;i++){
    cin >> a[i];
  }

  vector<bool>row(H,false);
  vector<bool>col(W,false);

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(a[i][j]=='#'){
	row[i] = true;
	col[j] = true;
      }
    }
  }

    for(int i=0;i<H;i++){
      if(row[i]){
	for(int j=0;j<W;j++){
	  if(col[j]){
	    cout << a[i][j];
	  }
	}
	cout << endl;
      }
    }
}


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


int main() {

	int A;
	int B;
	int C;	
	cin >> A >> B >> C;

	if ((A == B && B != C) || (B == C && C != A) || (C == A && A != B)) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
from collections import Counter


n = int(input())
vs = list(map(int, input().split()))
a = vs[::2]
b = vs[1::2]

ca = Counter(a)
cb = Counter(b)
ca[0] = 0
cb[0] = 0
if ca.most_common(1)[0][0] != cb.most_common(1)[0][0]:
    print(n - ca.most_common(1)[0][1] - cb.most_common(1)[0][1])
else:
    print(min(
        n - ca.most_common(1)[0][1] - cb.most_common(2)[1][1],
        n - ca.most_common(2)[1][1] - cb.most_common(1)[0][1]
    ))
    # if len(set(vs)) == 1:
    #     print(n // 2)
    # else:
    #     print(min(
    #         n - ca.most_common(1)[0][1] - cb.most_common(2)[1][1],
    #         n - ca.most_common(2)[1][1] - cb.most_common(1)[0][1]
    #     ))


Measured memory_bytes: 19040
import java.util.*;

public class Main {

    static final int MOD=1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] count = new int[n];
        Boolean[] hasRed = new Boolean[n];

        for(int i=0;i<n;i++){
            count[i]=1;
            hasRed[i]=false;
        }
        hasRed[0]=true;

        for(int i=0;i<m;i++){
            int x = sc.nextInt()-1;
            int y=sc.nextInt()-1;
            if(count[x]==1&&hasRed[x]){
                hasRed[x]=false;
                hasRed[y]=true;
            }else if(hasRed[x]){
                hasRed[y]=true;
            }
            count[x]--;
            count[y]++;

        }

        int ans =0;
        for(int i=0;i<n;i++)if(hasRed[i])ans++;
        System.out.println(ans);


    }
}




Measured memory_bytes: 77788
program main
   implicit none
   integer ::n
   integer i,j,ma
   integer,allocatable,dimension(:)::l,summ
   read(*,*)n
   allocate(l(n))
read(*,*)l
   ma=maxval(l)
   if(ma<sum(l)-ma)then
      write(*,"(a3)")"Yes"
   else
      write(*,"(a2)")"No"
   endif
end program main


Measured memory_bytes: 640
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string.h>
#include<queue>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

ll Pow_mod(ll a, ll b, ll c){
    ll ans = 1;
    a %= c;
    while (b){
        if (b & 1) ans = (ans * a) % c;
        a = (a * a) % c;
        b >>= 1;
    }
    return (ans % c);
}

int a[200010];

int main(){
    int n;
    scanf("%d", &n);
    int max_ = 0, pos = 0;;
    for (int i = 1; i <= n; i ++ ){
        scanf("%d", &a[i]);
        if (a[i] > max_){
            max_ = a[i];
            pos = i;
        }
    }
    for (int i = 1; i <= n; i ++ ){
        if (i == pos){
            int max__ = 0;
            for (int j = 1; j <= n; j ++ ){
                if (j == pos) continue;
                if (a[j] > max__) max__ = a[j];
            }
            printf("%d\n", max__);
        }
        else printf("%d\n", max_);
    }
    return 0;
}


Measured memory_bytes: 2432
import Data.List
import Data.Char
import Data.Maybe
import Control.Monad
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.ByteString.Char8 as BS8

cntfw :: [T.Text] -> Int
cntfw s
    | null$drop 1 s = 1
    | hs /= ss      = 1
    | otherwise     = 1 + (cntfw $ tail s)
    where
        hs = head s
        ss = s !! 1

sol s
    | null$drop 1 s  = 0
    | otherwise = ((cnt * (cnt-1)) `div` 2) + sol ds
    where
        hs  = head s
        cnt = cntfw s
        ds  = drop cnt s

main :: IO ()
main = do
    n <- fst . fromJust . BS8.readInt <$> BS8.getLine
    s <- sort <$> (replicateM n $ (T.pack).sort <$> getLine :: IO [T.Text])
    
    print $ sol s


Measured memory_bytes: 73084
import std.stdio, std.algorithm, std.range, std.conv, std.string, std.math, std.container, std.typecons;
import core.stdc.stdio;
// foreach, foreach_reverse, writeln
alias P = Tuple!(int,int);

void main() {
	const int MOD = 1_000_000_007;
	int n, m;
	scanf("%d%d", &n, &m);
	int[] x = new int[n];
	int[] raw = new int[m];
	foreach (i; 0..n) scanf("%d", &x[i]);
	foreach (i; 0..m) scanf("%d", &raw[i]);
	auto y = raw.assumeSorted;

	P[] p;
	foreach (i; 0..n) {
		int r = y.lowerBound(x[i]).length.to!int;
		if (r == m || r == 0) continue;
		p ~= P(x[i]-y[r-1], x[i]-y[r]);
	}
	p = p.sort.uniq.array;
	n = p.length.to!int;
	int[] a;
	foreach (i; 0..n) {
		a ~= p[i][1]*-1;
	}
	int[] ca = a.dup;
	ca = ca.sort.uniq.array;
	foreach (i; 0..n) {
		a[i] = ca.assumeSorted.lowerBound(a[i]).length.to!int+1;
	}

	class BIT {
		int[] data;
		this(int n) {
			data = new int[n+1];
		}
		BIT dup() {
			BIT ret = new BIT(to!int(data.length));
			ret.data = data.dup;
			return ret;
		}
		void add(int i, int x=1) {
			i++;
			while (i < data.length) {
				(data[i] += x) %= MOD;
				i += i&-i;
			}
		}
		int sum(int i) {
			int ret = 0;
			i++;
			while (i) {
				(ret += data[i]) %= MOD;
				i -= i&-i;
			}
			return ret;
		}
	}

	int ans = 1;
	BIT b = new BIT(n+1);
	b.add(0,1);
	foreach (i; 0..n) {
		int cur = b.sum(a[i]-1);
		(ans += cur) %= MOD;
		b.add(a[i], cur);
	}
	writeln(ans);
}

Measured memory_bytes: 4596
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll,ll> pll;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define MOD 1000000007
#define ARRAY_MAX 200005

const int INF = 1e9+7;



int main(){

    string s;
    cin >> s;
    int n;
    cin >> n;
    int len = s.length();

    string str = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";

    for(int i = 0;i < len && n > 0;i++){

        if(s[i] == 'a'){
            continue;
        }
        if(i != len-1){//末尾以外
            if(26-(s[i]-'a') > n){
                //aにできないならそのままのほうがいい
                continue;
            }else{
                n -= (26 - (s[i]-'a'));
                s[i] = 'a';
            }
        }
    }
    if(n > 0){
        n %= 26;
        s[len-1] = str[s[len-1]-'a'+ n];
        n = 0;
    }
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 512
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int N;
int L,R;
int main() {
	cin>>N;

	int ans=0;
	for(int i=0;i<N;i++){
		cin>>L>>R;
		ans+=R-L+1;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
A = rl()

class SegTree:
	def __init__(self, n, f=min, v=float('inf')):
		self.n = n
		self.f = f
		self.v = v
		self.nums = [v] * (2*n)
		
	def init(self, seq):
		n, f, nums = self.n, self.f, self.nums
		assert len(seq) == n, 'seq size error'
		for i, x in enumerate(seq):
			nums[i+n] = x
		for i in range(n-1, 0, -1):
			nums[i] = f(nums[i<<1], nums[i<<1|1])

	def update(self, i, x):
		n, f, nums = self.n, self.f, self.nums
		i += n
		nums[i] = x
		while i > 1:
			i >>= 1
			nums[i] = f(nums[i<<1], nums[i<<1|1]) # f(nums[i//2], nums[i//2+1])
	
	def query(self, l, r): # f([l, r))
		n, f, v, nums = self.n, self.f, self.v, self.nums
		l, r = l+n, r+n
		vl, vr = v, v
		while l < r:
			if l & 1:
				vl = f(vl, nums[l])
				l += 1
			if r & 1:
				r -= 1
				vr = f(nums[r], vr)
			l, r = l>>1, r>>1
		return f(vl, vr)

def gcd(a, b):
	return gcd(b, a%b) if b else a

st = SegTree(N, f=gcd, v=0)
st.init(A)

ans = -1
for i in range(N):
	g = gcd(st.query(0, i), st.query(i+1, N))
	ans = max(g, ans)
print(ans)



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

int main(){
	int n, in;
	cin >> n;
	vector<int> a(100002);
	rep(i, n){
		cin >> in;
		a.at(in)++;
		a.at(in+1)++;
		a.at(in+2)++;
	}
	int ma = 0;
	rep(i, 100002){
		if(ma < a.at(i)) ma = a.at(i);
	}
	cout << ma << endl;
	return 0;
}

Measured memory_bytes: 640
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>*/
#define PII pair<int,int>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
//using namespace __gnu_pbds;
const double PI=acos(-1.0);
const double eps=1e-6;
inline ll read()
{
    ll x=0,f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int main()
{
	//ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
	ll a=read(),b=read(),c=read(),k=read();
	if(k<=a) cout<<k<<endl;
	else if(k<=a+b) cout<<a<<endl;
	else cout<<a-(k-(a+b))<<endl;
	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
void trace(int A[], int N) {
	int i;
	for (i = 0; i < N; i++) {
		if (i > 0)  cout << " ";
		cout << A[i];
	}
	cout << endl;
}
void insertSort(int A[], int N) {
	int j, i, v;
	for (i = 1; i < N; i++) {
		v = A[i];
		j = i - 1;
		while (j >= 0 && A[j] > v) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		trace(A, N);
	}
}
int main() {
	int N, i, j;
	int A[100];
	cin >> N;
	for (i = 0; i < N; i++)
		cin >> A[i];
	trace(A, N);
	insertSort(A, N);
	return 0;
}

Measured memory_bytes: 3096
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>

int main()
{
    int N, A, B;
    std::cin >> N >> A >> B;

    std::vector<int> p;
    for (int i = 0; i < N; ++i) {
        int buf;
        std::cin >> buf;
        p.push_back(buf);
    }
    std::sort(p.begin(), p.end());

    int cnt = 0;

    while (true) {
        std::vector<int>::iterator itr = p.begin();
        while (itr != p.end()) {
            if (*itr <= A) {
                p.erase(itr);
                break;
            }

            ++itr;
        }

        if (itr == p.end()) {
            break;
        }

        while (itr != p.end()) {
            if ((A +1) <= *itr && *itr <= B) {
                p.erase(itr);
                break;
            }

            ++itr;
        }

        if (itr == p.end()) {
            break;
        }

        while (itr != p.end()) {
            if ((B + 1) <= *itr) {
                p.erase(itr);
                cnt++;
                break;
            }

            ++itr;
        }

        if (itr == p.end()) {
            break;
        }
    }

    std::cout << cnt << std::endl;

    return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(M)]
AB.sort(key=lambda x: x[1])
ans = 0
x = 0
for a,b in AB:
    if a <= x:
        continue
    x = b-1
    ans += 1
print(ans)


Measured memory_bytes: 29084
while True:
	try:
		stack = []
		for s in raw_input().split():
			if s in ('+', '-', '*', '/'):
				stack.append(eval('{2}{1}{0}'.format(stack.pop(), s, stack.pop())))
			else:
				stack.append(float(s))
		print '%.6f' % stack.pop()
	except EOFError:
		break

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "First" << '\n'; exit(0); }
inline void no() { cout << "Second" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { cout << p.first << ' ' << p.second; return os; }

void solve() {
  string s; cin >> s;
  int n = s.size();
  if ((n % 2 == 0) ^ (s[0] == s[n - 1])) no(); yes();
}


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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

ll a,b;
ll h=100,w=100;
char res[101][101];

int main(){
  cin>>a>>b;
  a--;b--;
  rep(i,100)rep(j,100){
    res[i][j]='.';
  }
  repl(i,49,100)repl(j,49,100)res[i][j]='#';
  res[49][49]='.';
  for(ll i=0;i<50;i+=2){
    for(ll j=0;j<50;j+=2){
      if(b==0)break;
      res[i][j]='#';
      b--;
    }
    if(b==0)break;
  }
  for(ll i=50;i<100;i+=2){
    for(ll j=50;j<100;j+=2){
      if(a==0)break;
      res[i][j]='.';
      a--;
    }
    if(a==0)break;
  }
  cout<<100<<" "<<100<<endl;
  rep(i,100){
    rep(j,100)cout<<res[i][j];
    cout<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
#define re return
#define all(a) a.begin(),a.end()
using namespace std;
signed main()
{
	int l;
	cin>>l;
	long double m=l;
	long double y=m/3;
	int zs=y*y*y;
	y=y*y*y-zs;
	cout<<zs;
	if (!y)  re 0;
	cout<<'.';
	while (true){
		if (!y)  break;
		y*=10;
		int xs=y;
		cout<<xs;
		y-=xs;
	}
	re 0;
}

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

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define     SPEED       ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	hell        1000000007
#define 	rep(i,n)    for(ll i=0;i<n;i++)
#define 	repe(i,a,b) for(ll i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search

ll power(ll a,ll b)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2);
	if(b%2==0)
		return((c%hell)*(c%hell))%hell;
	return ((((c%hell)*(c%hell))%hell)*(a%hell))%hell;
}

/********************************************************/
//	d.erase(unique(all(d)), d.end());




int main()
{
	SPEED;
	ll n,k,m,i,j,c=0,cs=0,t;
	t=1;

	// cin>>t;
	string s,p="",l="";
	while(t--)
	{
		// cs++;
		cin>>s;
		n=s.length();
		// ll a[n];
		rep(i,n)
		{
			p+=to_string(i%2);
			l+=to_string((i+1)%2);
		}
		rep(i,n)
		{
			if(p[i]!=s[i]) c++;
			if(l[i]!=s[i]) cs++;
		}
		
		cout<<min(c,cs);
		if(t!=0)
	   		cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 720
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <set>
#include <sstream>
#include <cmath>
#include <deque>
#include <list>
#include <bitset>
using namespace  std;
typedef pair<long long , long long> P;
typedef long long int64;
typedef long long lint;
#define REP(i, n) for(long long (i)=0; (i)<(n); ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define FST first
#define SND second

signed main(){
    int N, K;
    string s;
    cin >> N >> s >> K;
    char a = s[K-1];
    string res = "";
    REP(i, N){
        if(a==s[i]) res = res + a;
        else res = res + '*';
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    cin>>s>>t;
    cout << t + s << endl;
}


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

using namespace std;
using ll = long long;

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 ll INF = 1LL << 60;

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

    ll dp[100010];
    for (int i = 0; i <= n; i++) dp[i] = INF;
    dp[0] = 0;

    for (int i = 0; i < n; i++) {
        for (int j = 1; j <= k; j++) {
            if (i + j < n) chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }

    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 4396
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(i64 i = 0; i < N; i++)
#define Rep(i, k, N) for(i64 i = k; i < N; i++)
#define all(v) v.begin(), v.end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}

int main(){
    int N;
    cin >> N;
    string S;
    map<string, int> mp;
    string state[4] = {"AC", "WA", "TLE", "RE"};
    for(auto& s : state) mp[s] = 0;
    rep(i, N) { 
        cin >> S;
        mp[S]++;
    }
    
    for(auto& s : state){
        cout << s << " x " << mp[s] << endl;
    }
}


Measured memory_bytes: 3632
#include<iostream>

using namespace std;

int main(){

  double ina, inb;

  while(cin >> ina >>inb){

    if(ina < 35.5 && inb < 71) cout << "AAA" << endl;
    else if(ina < 37.5 && inb < 77) cout << "AA" << endl;
    else if(ina < 40 && inb < 83) cout << "A" << endl;
    else if(ina < 43 && inb < 89) cout << "B" << endl;
    else if(ina < 50 && inb < 105) cout << "C" << endl;
    else if(ina < 55 && inb < 116) cout << "D" << endl;
    else if(ina < 70 && inb < 148) cout << "E" << endl;
    else  cout << "NA" << endl;

  }
  return 0;

}

Measured memory_bytes: 0
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    n, m = LI()
    d = [0] * n
    wa = [0] * n
    for _ in range(m):
        p, s = input().rstrip().split()
        p = int(p) - 1
        if d[p]:
            continue
        if s == "AC":
            d[p] = 1
        else:
            wa[p] += 1
    ans = 0
    for i in range(n):
        if d[i]:
            ans += wa[i]
    print(sum(d), ans)

    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 42332
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

a,b = map(int,ipt().split())
print(a*b)


Measured memory_bytes: 68724
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 100000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
ll lcm(ll a,ll b){
    return (a*b)/__gcd(a,b);
}
int main(void){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll p,q;
    ll ans=b-(a-1);
    p=(b/c)+(b/d)-(b/lcm(c,d));
    q=((a-1)/c)+((a-1)/d)-((a-1)/lcm(c,d));
    ans-=(p-q);
    cout<<ans<<endl;
   return 0;
}


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

int main(int argc, char *argv[]) {
	vector<float> mountain;
	float rcv;
	while (EOF != fscanf(stdin, "%f", &rcv)) {
		mountain.push_back(rcv);
	}
	sort(mountain.begin(), mountain.end());
	const int list_size = static_cast<int>(mountain.size());
	printf("%.1f\n", mountain[list_size-1]-mountain[0]);
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937_64 mt64(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt64);
}
/*--------Library Zone!--------*/

int n, ans;
signed main() {
	cin >> n;
	int cnt = 0;
	rep(i, n) {
		int a; cin >> a;
		if (a)cnt += a;
		else {
			ans += cnt / 2; cnt = 0;
		}
	}
	ans += cnt / 2;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
 
#define rep(i, a, b) for (long long(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

using ll = long long;
using P = std::pair<ll, ll>;
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

ll d[51][51];

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

  ll n;
  std::cin>>n;

  std::vector<ll> a(n),b(n);
  rep(i,0,n)std::cin>>a[i];
  rep(i,0,n)std::cin>>b[i];

  ll ans=0;

  std::set<ll> used;

  for(ll i=51;i>=1;i--){
    rep(j,0,51)rep(k,0,51)d[j][k]=MOD;
    rep(j,0,51)d[j][j]=0;

    rep(j,0,51){
      for(ll div:used){
        d[j][j%div]=0;
      }
      for(ll div=i-1;div>=1;div--){
        d[j][j%div]=0;
      }
    }

    rep(mid,0,51)rep(j,0,51)rep(k,0,51)chmin(d[j][k],d[j][mid]+d[mid][k]);

    bool isok=true;
    rep(j,0,n)if(d[a[j]][b[j]]!=0)isok=false;

    if(!isok){
      if(i==51){
        std::cout<<-1;
        return 0;
      }
      used.insert(i);
      ans+=(1ll<<i);
    }
  }

  std::cout<<ans<<"\n";

  return 0;
}



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


namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            int[] array = sc.intarr;

            int a = array[0];
            int b = array[1];
            int c = array[2];
            int d = array[3];

            int dif_ab = Math.Abs(a - b);
            int dif_bc = Math.Abs(b - c);
            int dif_ca = Math.Abs(c - a);

            if(dif_ca <= d || (dif_ab <= d && dif_bc <= d))
            {
                wr.wri("Yes");
            }
            else
            {
                wr.wri("No");
            }

        }
    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


Measured memory_bytes: 13268
#include<stdio.h>
#include<string.h>

int main(void)
{
	char ch;
	int sum;
	scanf("%c", &ch);

	while(ch != '0')			//判断首数字
	{
		sum = 0;
		sum += ch - '0';
		scanf("%c", &ch);
		while(ch != '\n')
		{
			sum += ch - '0';
			scanf("%c", &ch);
		}
		printf("%d\n", sum);
		scanf("%c", &ch);
		
	}
	return 0;
}


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

int main() {
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> A(Q);
  for (int i = 0; i < Q; ++i)
    cin >> A[i];
  vector<int> B(N);
  for (int i = 0; i < Q; ++i)
    ++B[A[i] - 1];
  for (int i = 0; i < N; ++i)
    if (K - Q + B[i] > 0)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
}

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

int main(void) {
  unsigned int N, H, W;
  cin >> N >> H >> W;
  int count = 0;
  for (int i = 0; i < N; i++) {
    int h, w;
    cin >> h >> w;
    if (H <= h && W <= w)
      count++;
  }
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
n=int(input())
for i in range(n):
    a,b,c = input().split()
    x = int(a)
    y = int(b)
    z = int(c)
    p = [x,y,z]
    p.sort()
    if pow(p[0],2) + pow(p[1],2) == pow(p[2],2):
        print('YES')
    else:
        print('NO')


Measured memory_bytes: 5600
//Night's template
//orzakyrt
#include <bits/stdc++.h>
#define R register
#define LL long long
#ifdef __DEBUG__
	#define Debug (fprintf(stderr,"orzyrt\n"),fflush(stderr))
	#define debug(__a...) (fprintf(stderr,__a),fflush(stderr))
	#define setfile(__a) ('orzyrt')
	#define Compile(__a) system("g++ "__a".cpp -lm -o "__a)
#else
	#define Debug ('orzyrt')
	#define debug(__a...) ('orzyrt')
	#define setfile(__a) freopen(__a".in","r",stdin);freopen(__a".out","w",stdout)
	#define Compile(__a) ('orzyrt')
#endif
template<class TT>inline TT Max(R TT a,R TT b){return a<b?b:a;}
template<class TT>inline TT Min(R TT a,R TT b){return a<b?a:b;}
template<class TT>inline TT Abs(R TT a){return a<0?-a:a;}
template<class TT>inline TT cmin(R TT &a,R TT b){(b<a)&&(a=b);}
template<class TT>inline TT cmax(R TT &a,R TT b){(a<b)&&(a=b);}
using namespace std;
template<class TT>inline void read(R TT &x){
	x=0;R bool f=false;R char c=getchar();
	for(;c<48||c>57;c=getchar())f|=(c=='-');
	for(;c>47&&c<58;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	(f)&&(x=-x);
}
//end template

namespace Night{
	const int maxn = 1010;
	int n;
	int a[maxn];
	int k;
	vector<LL>v;
	bool vis[1000000];
	int main(){
		read(n);read(k);
		for(R int i=1;i<=n;++i)read(a[i]);
		for(R int i=1;i<=n;++i){
			R LL sum=0;
			for(R int j=i;j<=n;++j){
				sum+=a[j];
				v.push_back(sum);
			}
		}
		R LL ans=0;
		for(R int i=50;~i;i--){
			R int cnt=0;
			for(R int j=0;j<v.size();++j){
				if(!vis[j] && v[j]&(1ll<<i)){
					cnt++;
				}
			}
			if(cnt>=k){
				for(R int j=0;j<v.size();++j){
					if(!vis[j] && !(v[j]&(1ll<<i))){
						vis[j]=1;
					}
				}
				ans+=1ll<<i;
			}
		}
		cout<<ans;
		return 0;
	}
}
int main(){
	return Night::main();
}

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

int N;
vector<int> w;
int solve(){
    vector<vector<int>> dp(N+1, vector<int>(N+1, -1));
    for (int i = 0; i <= N; i++)
    {
        dp[i][i] = 0;
        if(i < N) dp[i][i+1] = 0;
    }

    for (int bet = 2; bet <= N; bet++)
    {
        for (int l = 0; l + bet <= N; l++)
        {
            int r = l + bet;
            if(dp[l+1][r-1] == bet - 2){
                if(abs(w[l] - w[r-1]) <= 1) dp[l][r] = bet;
                else dp[l][r] = bet - 2;
            }
            for (int mid = l+1; mid < r-1; mid++)
            {
                dp[l][r] = max(dp[l][r], dp[l][mid] + dp[mid][r]);
            }
        }
    }
    return dp[0][N];
}

int main() {
    while (cin >> N, N)
    {
        w.resize(N);
        for (int i = 0; i < N; i++) cin >> w[i];
        cout << solve() << endl;
    }
}


Measured memory_bytes: 3232
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <tuple>
#include <cmath>
#include <map>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n,m) for(int i=n;i<m;i++)
int main()
{
    string S; cin >> S;
    int x, y; cin >> x >> y;
    int A[16001]{}, B[16001]{}, C[16001]{}, D[16001]{};
    int *X1 = A, *X2 = B, *Y1 = C, *Y2 = D;
    X1[8000] = true;
    Y1[8000] = true;
    auto debug = [&]() {
        vector<int*> L = {X1, Y1};
        cout << "----\n";
        for (auto p : L) {
            for (int i = -5; i <= 5; i++) { cout << p[8000+i] << ' '; }
            cout << endl;
        }
    };
    int axis = 0;
    int first = 1;
    REP(i, S.size()) {
        int cnt = 0;
        while (i < S.size() && S[i] == 'F') i++, cnt++;
        if (first && axis == 0) {
            REP(j, 16001) {
                X2[j] = 0 <= j-cnt ? X1[j-cnt] : 0;
            }
            swap(X1, X2);
        } else if (axis == 0) {
            REP(j, 16001) {
                X2[j] = (0 <= j-cnt ? X1[j-cnt] : 0) | (j+cnt < 16001 ? X1[j+cnt] : 0);
            }
            swap(X1, X2);
        } else {
            REP(j, 16001) {
                Y2[j] = (0 <= j-cnt ? Y1[j-cnt] : 0) | (j+cnt < 16001 ? Y1[j+cnt] : 0);
            }
            swap(Y1, Y2);
        }
        axis = !axis;
        first = 0;
    }
    cout << (X1[8000+x] && Y1[8000+y] ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 512
N = int(input())
W = str(input())
gobi = W[-1]
List = []
List.append(W)
a = True
for i in range(N-1):
  W = str(input())
  if gobi == W[0] and not(W in List):
    List.append(W)
    gobi = W[-1]
    continue
  else:
    a = False
    break
if a == True:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=500010;

ll power(ll x,ll n)
{
    if(n==0){return 1;}
    if(n==1){return x;}
    if(n%2==0){
        return power((x*x)%M,n/2);
    }
    if(n%2==1){
        return (power((x*x)%M,n/2)*x)%M;
    }
}

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

    ll n;
    cin>>n;
    ll ar[n];
    for(ll i=0;i<n;++i)
    {
        cin>>ar[i];
    }

    ll fac[n+1];
    fac[0]=1;
    for(ll i=1;i<=n;++i)
    {
        fac[i]=(i*fac[i-1])%M;
    }

    ll maths[n-1];
    for(ll i=0;i<n-1;++i)
    {
        maths[i]=(fac[n-1]*power(i+1,M-2))%M;
    }
    ll ans=0;
    for(ll i=0;i<n-1;++i)
    {
        ll ch=((ar[n-1]-ar[i])*maths[i])%M;
        ans=(ans+ch)%M;
    }
    cout<<ans;

    return (0);
}


Measured memory_bytes: 2560
import sys
def Ii():return int(sys.stdin.readline())
def Mi():return map(int,sys.stdin.readline().split())
def Li():return list(map(int,sys.stdin.readline().split()))

k = Ii()
if k%2 == 0 or k%5 == 0:
  print(-1)
  exit(0)
elif k%7 == 0:
  k = k//7
ans = 1
a = 10
mod = a%(9*k)
while mod != 1:
  mod *= 10
  mod = mod%(9*k)
  ans += 1
  
print(ans)

Measured memory_bytes: 9204
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
ll dp[3005][3005][4];
ll val[3005][3005];
int main(){
    ll h,w,n;
    cin>>h>>w>>n;
    map<P,ll> mp;
    for(int i=0;i<n;i++){
        ll a,b,c;
        cin>>a>>b>>c;
        a--;b--;
       val[a][b]=c;
    }
    for(int i=0;i<=3000;i++){
        for(int j=0;j<=3000;j++){
            for(int k=0;k<3;k++){
                if(val[i][j]>0){
                    if(k<2){
                        chmax(dp[i][j+1][k+1],dp[i][j][k]+val[i][j]);
                    }
                    chmax(dp[i+1][j][0],dp[i][j][k]+val[i][j]);
                }
                chmax(dp[i+1][j][0],dp[i][j][k]);
                chmax(dp[i][j+1][k],dp[i][j][k]);
            }
        }
    }
    ll ans=0;
    for(int i=0;i<=3;i++){
        chmax(ans,dp[h][w][i]);
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 355800
let () = Scanf.scanf "%d %d %d\n" @@ fun n m l ->
  let dp = Array.make_matrix n n 1145141919810 in
  for i = 1 to m do
    Scanf.scanf "%d %d %d\n" @@ fun a b c ->
      dp.(a - 1).(b - 1) <- c;
      dp.(b - 1).(a - 1) <- c;
  done;
  for i = 0 to n - 1 do
    dp.(i).(i) <- 0;
  done;
  for k = 0 to n - 1 do
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
        dp.(i).(j) <- min dp.(i).(j) (dp.(i).(k) + dp.(k).(j))
      done
    done
  done;
  for i = 0 to n - 1 do
    for j = 0 to n - 1 do
      dp.(i).(j) <-
        if i = j then 0
        else if dp.(i).(j) <= l then 1
        else 1145141919810
    done
  done;
  for k = 0 to n - 1 do
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
        dp.(i).(j) <- min dp.(i).(j) (dp.(i).(k) + dp.(k).(j))
      done
    done
  done;
  Scanf.scanf "%d\n" @@ fun q ->
    for i = 1 to q do
      Printf.printf "%d\n" @@
      Scanf.scanf "%d %d\n" @@ fun s t ->
        if dp.(s - 1).(t - 1) = 1145141919810 then -1
        else dp.(s - 1).(t - 1) - 1
    done



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

#define int long long

const int N = 2e5 + 10;
int n;

struct TMP {
	int x, indx, ans;
	
	TMP() {
		x = indx = ans = 0;
	}
} ar[N];

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> ar[i].x, ar[i].indx = i;
	sort(ar, ar + n, [&] (TMP a, TMP b) { return a.x < b.x; });
	
	for (int i = 0; i < n; i++)
		if (i < n / 2)
			ar[i].ans = ar[n / 2].x;
		else
			ar[i].ans = ar[n / 2 - 1].x;
	sort(ar, ar + n, [&] (TMP a, TMP b) { return a.indx < b.indx; });
	
	for (int i = 0; i < n; i++)
		cout << ar[i].ans << '\n';
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fr(i, n) for (ll i = 0; i < n; i++)
#define Fr(i, k, n) for (ll i = k; i <= n; i++)
void solve();

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // Single Test Case?cin>>t;
    while (t--) {
        solve();
        cout << "\n";
    }
    //	cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs"<<
    //"\n";
}
void solve() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(max(b * d, a * c), max(b * c, a * d));
}

Measured memory_bytes: 3632
#include<stdio.h>

int main(void)
{
   int a, b ;
   
   scanf("%d" , &a);
   scanf("%d" , &b);
 
   if(a<b){
   printf("a < b\n");
   }
   else if(a>b){
   printf("a > b\n");
   }
   else if(a==b){
   printf("a == b\n");
   }

   return 0;
}

Measured memory_bytes: 580
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<long long>A(N);
    for (int i = 1; i <= N; i++) {
        cin >> A[i - 1];
        A[i - 1] -= i;
    }
    sort(A.begin(), A.end());
    long long med;
    if (N % 2 == 0)med = (A[N / 2] + A[N / 2 - 1]) / 2;
    else med = A[N / 2];
    long long ans = 0;
    for (int i = 0; i < N; i++) {
        ans += abs(A[i] - med);
    }

    cout << ans << endl;

    return 0;
}

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

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

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

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

int main(){
    int a[20];
    int n,p,q;
    int ans = 0;

    cin >> n;
    FOR(i,0,n)cin >> a[i];

    FOR(i,1,n-1){
        p = a[i] - a[i-1];
        q = a[i+1] - a[i];
        if(p * q > 0)ans++;
    }

    cout << ans;

    return 0;
}


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

using namespace std; 
#define ll long long 
#define ull unsigned long long 
#define tezz std::ios::sync_with_stdio(false);std::cin.tie(NULL);std::cout.tie(NULL);
#define INT_BITS 32
#define MOD 999983

ll indexi=0;
vector<ll> a(16);
ll NCR(ll n,ll k){
    if(k>n) return 0;
    ll res=1;
    for(ll i=1;i<=k;i++){
        res*=n-i+1;
        res/=i;
    }
    return res;
}
void solvexXx(){
    ll a,b;
    cin>>a>>b;
    ll n=a+b;
    ll res=NCR(n,a)+NCR(n,b);
    if(b>a) cout<<(res%MOD)<<endl;
    else cout<<0<<endl;

}
int main(){
    string s,t;
    cin>>s>>t;
    long long n=s.length();
    string g=t.substr(0,n);
    if(s==g) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

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

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int n,ans=0;
    double t,a;
    cin >> n>>t>>a;
    double diff = 1e9;
    
    
    for(int i = 0; i < n; i++)
    {
        double h;
        cin >> h;
        double temp = t - h * 0.006;
        if(abs(a - temp) < diff)
        {
            ans = i+1;
            diff = abs(a-temp);
        }
    }
    

    cout << ans<<endl;

    return 0;
}

Measured memory_bytes: 256