akhauriyash/Code-Regression huggingface dataset:
import math
N = int(input())
X = []
for _ in range(N):
    x, y = map(int, input().split())
    X.append((math.atan2(y, x), x, y))

X = sorted(X) * 2
ma = 0
for i in range(N):
    sx = sy = 0
    for j in range(i, i + N):
        sx += X[j][1]; sy += X[j][2]
        d = sx ** 2 + sy ** 2
        ma = max(ma, d)

print(ma**0.5)


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

int main(){
  char c;
  cin >>c;
  if(c=='a' || c=='i' || c=='u' || c=='o' || c=='e') cout << "vowel" << endl;
  else cout << "consonant" << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define repbit(bit, n)  for(int bit = 0; (bit) < (1 << (n)); ++(bit))
#define ifbit(bit, i)   if((bit) & (1 << (i)))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
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); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n, k; cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h[i];

    int ans = 0;
    for(auto &x : h){
        if(x >= k) ++ans;
    }

    cout << ans << endl;

return 0;
}

Measured memory_bytes: 3668
N, M = map(int, input().split())

def divisor(n: int) -> list:
    list_of_divisor = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            list_of_divisor.append(i)
            if i != n//i:
                list_of_divisor.append(n//i)
    list_of_divisor.sort()
    return list_of_divisor

div = divisor(M)
for i in div[::-1]:
    if i <= M/N:
        print(i)
        exit()

Measured memory_bytes: 38640
#include<iostream>
#include<cstring>

using namespace std;

int H, A[2000001];

void maxHeapify(int i) {
	int l, r, largest;
	l = 2 * i;
	r = 2 * i + 1;

	if (l <= H && A[l] > A[i]) {
		largest = l;
	}
	else {
		largest = i;
	}
	if (r <= H && A[r] > A[largest]) {
		largest = r;
	}
	if (largest != i) {
		int x;
		x = A[i];
		A[i] = A[largest];
		A[largest] = x;

		maxHeapify(largest);
	}
}


int extract() {
	int maxv;
	if (H < 1) {
		return 0;
	}
	maxv = A[1];
	A[1] = A[H--];
	maxHeapify(1);
	return maxv;
}

void increaseKey(int i,int key) {
	if (key < A[i]) {
		return;
	}
	A[i] = key;
	while (i > 1 && A[i / 2] < A[i]) {
		int maxv;
		maxv = A[i];
		A[i] = A[i / 2];
		A[i / 2] = maxv;
		i = i / 2;
	}
}

void insert(int key) {
	H++;
	A[H] = 0;
	increaseKey(H, key);
}

int main() {
	int key;
	char com[10];

	while (1) {
		cin >> com;
		if (com[0] == 'e' && com[1] =='n') {
			break;
		}
		if (com[0] == 'i') {
			cin >> key;
			insert(key);
		}
		else{
			cout << extract() << endl;
		}
	}
}


Measured memory_bytes: 6884
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  int N, K;
  cin >> N >> K;
  vector<ll> A(N);
  rep(i, N) {
    cin >> A[i];
  }

  ll S = 0;
  rep(i, N) {
    S += A[i];
  }
  // For Debug
  // cout << "sum: " << S << endl;

  set<ll> candidates;
  for (ll i = 2; i * i <= S; ++i) { // i is the divisor
    if (S % i == 0) {
      candidates.insert(i);
      candidates.insert(S / i);
    }
  }
  candidates.insert(S);
  // For Debug
  // for (auto x : candidates) {
  //   cout << x << " ";
  // }
  // cout << endl;

  ll ans = 0;

  for (auto it = candidates.rbegin(); it != candidates.rend(); ++it) { // Try x in decreasing order.
    ll x = *it;

    // a[i]: (A[i] % x) = d (-d). increasing order.
    // b[i]: x - a[i]   = x-d (+ x-d). decreasing order.
    vector<ll> a(N);
    rep(i, N) {
      a[i] = A[i] % x;
    }
    sort(all(a));
    vector<ll> b(N);
    rep(i, N) {
      b[i] = x - (a[i]);
    }

    // For Debug
    // cout << "a: ";
    // rep(i, N) {
    //   cout << a[i] << " ";
    // }
    // cout << endl;
    // cout << "b: ";
    // rep(i, N) {
    //   cout << b[i] << " ";
    // }
    // cout << endl;

    // sumA[i]: summention of a from 0 to i.
    // sumB[i]: summention of b from i to N-1.
    vector<ll> sumA = a;
    vector<ll> sumB = b;
    for (int i = 0; i < N-1; ++i) {
      sumA[i+1] += sumA[i];
    }
    for (int i = N-1; i > 0; --i) {
      sumB[i-1] += sumB[i];
    }

    // Find the k in which sumA[k] = sumB[k+1]
    int k;
    for (k = 0; k < N-1; ++k) {
      if (sumA[k] == sumB[k+1]) { break; }
    }
    int summed = 0;
    for (int i = 0; i <= k; ++i) {
      summed += a[i];
    }
    if (summed <= K) { // OK.
      ans = x;
      break;
    }
  }

  if (ans > 0) {
    cout << ans << endl;
  } else {
    cout << 1 << endl;
  }
}


Measured memory_bytes: 384
// ConsoleApplication6.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。


//sortは初期で昇順 greater<hoge>()で降順

#include <iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<string>
#include <set>
#include <cassert>
#include<cmath>
#include<climits>
using namespace std;
#define MOD 1000000007
class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};


int find(vector<long long> &arr, long long obj) {
	if (arr[arr.size() - 1] < obj)return arr.size()-1;
	if (arr[0] > obj)return -1;

	int min = 0; int max = arr.size() - 1;
	for (int i = 0; i < arr.size(); i++) {
		if (arr[min+(max-min) / 2] > obj) {
			max = min + (max - min) / 2;
		}
		else {
			min = min + (max - min) / 2;
		}
		if (max - min == 1) {
			return min;
		}
	}


}

int num[101];
int three[3];
int total;


void count(int j,int n,int deep) {
	for (int i = j + 1; i <= n-deep; i++) {
		three[deep] = num[i];
		
		if (deep != 0) {
			count(i, n, deep - 1);
		}
		else {
			int flag = 0;
			for (int k = 0; k < 3; k++) {
				if (three[k] >= 2) {
					flag++;
				}

			}
			if (flag == 3) {
				flag = 0;
				for (int k = 0; k < 3; k++) {
					if (three[k] >= 4) {
						flag++;
					}

				}
				if (flag == 2) {
					total++;
				}
				else if(flag == 3) {
					total += 3;
				}
			}
		}


	}


}
int two[2];
void count2(int j, int n, int deep) {
	for (int i = j + 1; i <= n - deep; i++) {
		two[deep] = num[i];
		if (deep != 0) {
			count2(i, n, deep - 1);
		}
		else {
			int flag = 0;
			for (int k = 0; k < 2; k++) {
				if (two[k] >= 2) {
					flag++;
				}

			}
			if (flag == 2) {
				flag = 0;
				for (int k = 0; k < 2; k++) {
					if (two[k] >= 24) {
						flag++;
					}

				}
				if (flag == 2) {
					total += 2;
				}
				else if (flag == 1) {
					total++;
				}
			}
			flag = 0;
			for (int k = 0; k < 2; k++) {
				if (two[k] >= 4) {
					flag++;
				}

			}
			if (flag == 2) {
				flag = 0;
				for (int k = 0; k < 2; k++) {
					if (two[k] >= 14) {
						flag++;
					}

				}
				if (flag == 2) {
					total += 2;
				}
				else if (flag == 1) {
					total++;
				}
			}
		}


	}


}




int main() {
	long long n;
	cin >> n;
	for (int i = 2; i <= n; i++) {
		int temp = i;
		for (int j = 2; j <= i; j++) {
			while (1) {
				if (temp%j == 0) {
					temp /= j;
					num[j]++;
				}
				else {
					break;
				}
			}
			if (temp== 1)break;
		}
	}
	
	for (int i = 2; i <= n; i++) {
		if (num[i] >= 74)total++;
//		cout << num[i] <<' '<<i<< endl;
	}
	count(1, n, 2);
	count2(1, n, 1);
	
	cout << total;



	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ans = 0
tmp = 0
B.append(0)
for i in range(N + 1):
    if B[i] + tmp >= A[i]:
        ans += A[i]
        if tmp >= A[i]:
            tmp = B[i]
        else:
            tmp = B[i] - A[i] + tmp
    else:
        ans += tmp + B[i]
        tmp = 0
print(ans)


Measured memory_bytes: 19116
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-9, PI = acos(-1);
const int N = 1e5 + 9, M = 5e2 + 9, OO = 1e9 + 7, MOD = 1e9 + 9;
const ll inf = 1e18;

int arr[N], mem[N][2], n;

int solve(int rem, int player) {
  if(!rem)
    return !player;
  int& ret = mem[rem][player];
  if(~ret)
    return ret;
  ret = !player;
  for (int i = 0; i < n; ++i) {
    if(arr[i] > rem) continue;
    if(solve(rem - arr[i], player ^ 1) == player)
      return ret = player;
  }
  return ret;
}

int main() {
  fastIO;
#ifdef LOCAL
  freopen("input.in", "rt", stdin);
#endif
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i)
    cin >> arr[i];
  memset(mem, -1, sizeof mem);
  if(solve(k, 0) == 0)
    cout << "First";
  else
    cout << "Second";
  return 0;
}


Measured memory_bytes: 8832
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <numeric>
#include <map>
#include <sstream>
#include <bitset>
using namespace std;




int main()
{
    int A,P;
    cin>>A>>P;
    
    cout<<(3*A+P)/2<<endl;
    
    }




Measured memory_bytes: 256
// Best practice

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <functional> // for less 

#define int         long long
#define pb          emplace_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; 

#define fbo find_by_order
#define ook order_of_key

signed main() {
   tezz
   
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    int mx=a[0],ans=1;
    for(int i=1; i<n; i++){
        if(a[i]>=mx){
            // cout << i << " " << a[i] << endl;
            mx=a[i];
            ans++;
        }
    }
    cout << ans;
   
   return 0;
}


Measured memory_bytes: 256
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let s = read!(i64);

    let mut h = HashMap::new();

    let mut a = s;
    let mut m = 1;
    loop {
        if h.contains_key(&a) {
            break;
        }

        h.insert(a, m);
        a = if a % 2 == 0 { a / 2 } else { 3 * a + 1 };
        m += 1;
    }

    println!("{}", m)
}


Measured memory_bytes: 4352
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define SIZE 2000010
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define ll long long
#define mp make_pair
#define pi acos(-1.0)
#define eps 1e-6
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
const ll mod = 1e9 + 7;
ll n, m;
string s;
ll a[SIZE];
int main() {
	io(); rep(i, 1, 3) cin >> a[i];
	sort(a + 1, a + 1 + 3);
	if (a[1] == a[2] && a[2] != a[3]) cout << "Yes";
	else if (a[1] != a[2] && a[2] == a[3]) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define END getchar();getchar();return 0

signed main() {
	int n;
	string s, t;
	cin >> n >> s >> t;
	for (int i = n; i >= 0; i--) {
		string x = s.substr(n - i, i), y = t.substr(0, i);
		if (x == y) {
			cout << n * 2 - i << endl;
			END;
		}
	}

	END;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int box[3];
	int flg;
	int i;
	for(i=0;i<3;i++)	cin>>box[i];
	flg=1;
	if(box[0]==box[1]&&box[1]!=box[2])	flg=0;
	cout<<((flg)?"Close":"Open")<<endl;
	return 0;
}


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

vector<int> ans(200000);
vector<vector<int>> nodes(200000);
 
void dfs(int node, int child) {
	ans[child] += ans[node];
	for (int c:nodes[child]) {
        if (c != node) {
            dfs(child, c);
        }
    }
}
 
int main(){
    int N; cin >> N;
    int Q; cin >> Q;
 
	for (int i = 0; i < N - 1; i++) {
        int a; cin >> a; a = a - 1;
        int b; cin >> b; b = b - 1;
		nodes[a].push_back(b);
		nodes[b].push_back(a);
	}
 
	for (int i = 0; i < Q; i++) {
        int p; cin >> p; p = p - 1;
        int x; cin >> x;
		ans[p] += x;
	}
 
	for(int c:nodes[0]) if(c) dfs(0, c);
	for(int i = 0; i < N; i++) {
        cout << ans[i] << (i < N-1?" ":"\n");
    }
}


Measured memory_bytes: 23424
#include<bits/stdc++.h>
using namespace std;
 
const int S=(1<<20)+5;
char buf[S],*H,*T;
inline char Get()
{
    if(H==T) T=(H=buf)+fread(buf,1,S,stdin);
    if(H==T) return -1;return *H++;
}
inline int read()
{
    int x=0;char c=Get();
    while(!isdigit(c)) c=Get();
    while(isdigit(c)) x=x*10+c-'0',c=Get();
    return x;
}
 
const int N=200010;
const int ha=1e9+7;
struct Edge{int to,next;} e[N<<1],et[N<<1];
int h[N],ht[N],esum=0,tsum=0,n,cmt=0;
int gay[N],out[N],sz[N];
bool done[N],inc[N],flag;
vector<int> crl,vertix;
stack<int> s;
int fac[N];
 
int Pow(int a,int b)
{
    int ans=1;
    for(;b;b>>=1,a=1ll*a*a%ha)
        if(b&1) ans=1ll*ans*a%ha;
    return ans;
}
 
void add_edge(int u,int v)
{
    e[++esum]={v,h[u]};h[u]=esum;
    e[++esum]={u,h[v]};h[v]=esum;
}
 
void add_topo_edge(int u,int v)
{
    out[v]++;
    et[++tsum].to=v;
    et[tsum].next=ht[u];
    ht[u]=tsum;
}
 
void findcrl(int u,int fa)
{
    vertix.push_back(u);
    done[u]=1;s.push(u);
    for(int t=h[u];t;t=e[t].next)
    {
        int v=e[t].to;
        if(v==fa||inc[v]) continue;
        cmt++;
        if(!flag&&done[v])
        {
            while(s.top()!=v) crl.push_back(s.top()),inc[s.top()]=1,s.pop();
            crl.push_back(v);inc[v]=1;s.pop();
            flag=1;
        }
        else if(!done[v]) findcrl(v,u);
    }
    if(!s.empty()&&s.top()==u) s.pop();
}
 
void findgay(int u,int fa)
{
    for(int t=h[u];t;t=e[t].next)
    {
        int v=e[t].to;
        if(v==fa||inc[v]) continue;
        gay[v]=u;findgay(v,u);
    }
}
 
void build_topo()
{
    for(int u : vertix)
        for(int t=h[u];t;t=e[t].next)
        {
            int v=e[t].to;
            if(v>=gay[u]) continue;
            add_topo_edge(u,v);
        }
    for(int u : vertix)
        if(!out[u]) add_topo_edge(0,u);
    for(int u : vertix) out[u]=0;
}
 
void getsize(int u)
{
    sz[u]=1;
    for(int t=ht[u];~t;t=et[t].next)
    {
        int v=et[t].to;
        getsize(v);
        sz[u]+=sz[v];
    }
    ht[u]=-1;
}
 
int getans()
{
    int prodsz=1;getsize(0);
    for(int u : vertix)
        prodsz=1ll*prodsz*sz[u]%ha;
    return Pow(prodsz,ha-2);
}
 
int xi_jin_ping_is_good(int u)
{
    flag=0;cmt=0;findcrl(u,0);
    if(vertix.size()!=cmt) return 0;
    for(int u : crl) if(inc[u]) findgay(u,0);
    for(int i=0;i<crl.size()-1;i++) gay[crl[i]]=crl[i+1];
    gay[crl.back()]=crl[0];
    tsum=-1;build_topo();
    int res=getans();
    for(int i=1;i<crl.size();i++) gay[crl[i]]=crl[i-1];
    gay[crl[0]]=crl.back();
    tsum=-1;build_topo();
    res=(res+getans())%ha;
    vertix.clear();crl.clear();
    return res;
}
 
int main()
{
    memset(ht,-1,sizeof(ht));
    int x,y,ans=1;
    n=read()<<1;fac[0]=1;
    for(int i=1;i<=n;i++)
        fac[i]=1ll*fac[i-1]*i%ha;
    for(int i=1;i<=n;i++)
    {
        x=read();y=read();
        add_edge(x,y+n/2);
    }
    for(int i=1;i<=n;i++)
    {
        if(done[i]) continue;
        x=xi_jin_ping_is_good(i);
        if(x==0) return puts("0"),0;
        ans=1ll*ans*x%ha;
    }
    ans=1ll*fac[n]*ans%ha;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 17268
#include <iostream>
#include <vector>
#include <sstream>
#include <cstdio>
using namespace std;
string tostr(int n){
	stringstream ss;
	ss<<n;
	string ret;
	ss>>ret;
	return ret;
}
int main(){
	int n;
	while(cin>>n,n){
		int lunch=0,dinner=0,midnight=0;
		int lc=0,dc=0,mc=0;
		for(int i=0,h,m,mm;i<n;++i){
			scanf("%d:%d %d",&h,&m,&mm);
			int time = (mm-m>0)?mm-m:mm+60-m;
			if(11*60<=h*60+m&&h*60+m<15*60){
				lc++;
				if(time<=8)lunch++;
			}else if(18*60<=h*60+m&&h*60+m<21*60){
				dc++;
				if(time<=8)dinner++;
			}else if((21*60<=h*60+m&&h*60+m<24*60)||(0*60<=h*60+m&&h*60+m<2*60)){
				mc++;
				if(time<=8)midnight++;
			}
		}
		cout<<"lunch "<<((lc!=0)?tostr(lunch*100/lc):"no guest")<<"\n";
		cout<<"dinner "<<((dc!=0)?tostr(dinner*100/dc):"no guest")<<"\n";
		cout<<"midnight "<<((mc!=0)?tostr(midnight*100/mc):"no guest")<<"\n";
	}
	return 0;
}

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

using namespace std;

#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF (1 << 30)

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;

const int MOD = 1e9 + 7;
const int dy[] = {0, 0, 1, -1};
const int dx[] = {1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

int n, m, r;
int dist[210][210];
int R[210];
int res = INF;

void Warshall_Floyd() {
    for(int k = 1; k < n; ++k) for(int i = 0; i < n; ++i) for(int j = 0; j < n; ++j) {
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
    }
}

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

    cin >> n >> m >> r;
    rep(i, r) {
        cin >> R[i];
        --R[i];
    }
    sort(R, R + r);
    rep(i, 210) rep(j, 210) {
        if(i == j) dist[i][j] = 0;
        else dist[i][j] = INF;
    }
    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        dist[a][b] = dist[b][a] = c;
    }
    Warshall_Floyd();
    do {
        int cost = 0;
        rep(i, r - 1) {
            cost += dist[R[i]][R[i + 1]];
        }
        chmin(res, cost);
    }while(next_permutation(R, R + r));
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
 
#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 sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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 long long ll;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {

  int N; std::cin >> N;

  std::vector<ll> A(N), B(N), C(N);
  rep(i,N) std::cin >> A[i];
  rep(i,N) std::cin >> B[i];
  rep(i,N) std::cin >> C[i];

  std::sort( all(A) );
  std::sort( all(B) );
  std::sort( all(C) );

  ll ans = 0;
  rep(i,N) {
    auto a = std::lower_bound( all(A), B[i] );
    auto c = std::upper_bound( all(C), B[i] );
    ans += std::distance(A.begin(), a) * std::distance(c, C.end());
  }

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


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

int main()
{
  int n,k;
  cin>>n>>k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i)
  {
    cin>>a[i];
  }
  int sum=0;
  for(auto &e: a) {
    sum+=e;
  }
  std::vector<int> div;
  for (int i = 1; i <= sqrt(sum); ++i)
  {
    if(sum%i==0) {
      div.push_back(i);
      div.push_back(sum/i);
    }
  }
  sort(div.begin(),div.end());
  int ans;
  for(auto &e: div) {
    std::vector<int> tmp;
    for(auto &f: a) {
      tmp.push_back(f%e);
    }
    int tmp_sum=0;
    for(auto &g: tmp) {
      tmp_sum+=g;
    }
    if(tmp_sum%e!=0) continue;
    sort(tmp.begin(), tmp.end(),greater<int>());
  
    tmp.erase(tmp.begin(),tmp.begin()+tmp_sum/e);
    int sum2=0;
    for(auto &h: tmp) {
      sum2+=h;
    }
    if(sum2<=k) ans=e;
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
int n , x , a;
bool flag;
vector<int>v , s;
bool cek(){
	while(s.size() > 0){
		flag = false;
		for(int i = s.size() - 1 ; i >= 0 ; i--){
			if(s[i] == i + 1){
				v.pb(s[i]);	
				s.erase(s.begin()+i);
				flag = true;
        break;
			}
		}
		if(!flag){
			v.clear();
			v.pb(-1);
			return false;
		}
	}
	return true;
}
int main(){
	cin >> n;
	for(int i = 0 ; i < n ; i++){
        cin >> x;
        s.pb(x);
	}
	if(!cek()){
		cout << -1 << endl;
		return 0;
	}
	for(int i = v.size() - 1 ; i >= 0 ; i--){
		cout << v[i] << endl;
	}
}
// soal I analysis 1

Measured memory_bytes: 3636
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


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

    N, Q = il()
    S = iss()
    ret = [0] * N
    for n in range(N - 1):
        if S[n] == 'A' and S[n + 1] == 'C':
            ret[n] += ret[n - 1] + 1
        else:
            ret[n] += ret[n - 1]

    for _ in range(Q):
        l, r = il()
        print(ret[r - 2] - ret[l - 2])


if __name__ == '__main__':
    main()


Measured memory_bytes: 7964
#include<cstdio>
#include<cstring>
int main(){
  char s[100000];
  scanf("%s", s);
  
  int n = 0;
  for(int i=1; i<strlen(s); i++){
    if(s[i] != s[i-1])
      n++;
  }
  printf("%d", n);
  
  return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (n, m, x) = listOfInt()
    val aa = listOfInt()
    val left = aa.filter { it < x }.count()
    val right = aa.filter {it > x}.count()

    println(Math.min(left, right))
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 38016
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
  #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl "\n"
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
   int n,x;
   cin>>n>>x;
   vector<int> v(n);
   for(auto &it:v){
	    cin>>it;
	    it=abs(it-x); 
	  }
   int ans;
   for(auto it:v)ans=__gcd(ans,it);
   cout<<ans<<endl;
}
int32_t main(){
   IOS;
   solve();
   //debug();
  #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
  #endif	
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll a, b, n;
	cin >> a >> b >> n;
	ll x = min(n, b - 1);
	cout << floor(1.0 * a * x / b) - a * floor(1.0 * x / b) << endl;
}


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

const ll INF = 1LL << 60;

const int mod = 1e9 + 7;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

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

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

combination comb(3000);

// K個をnグループに分ける
// グループに0個のものがあっても良い
mint f2(int k, int n) {
    return comb(k + n, n);
}

// k個をnグループに分ける
// 各グループは1個以上ある
mint f(int k, int n) {
    if (k < n) return 0;
    if (k == 0 && n == 0) return 1;
    // if (n - 1 == 0) return 1;
    // if (n - k == 0) return 1;

    return f2(k - n, n - 1);
}

ll N, K;
int main() {
    cin >> N >> K;

    mint ans = 0;
    for (int i = 1; i <= K; i++) {
        mint blue = f(K, i);
        mint red = 0;
        red += f(N - K, i + 1);
        red += f(N - K, i);
        red += f(N - K, i);
        red += f(N - K, i - 1);
        // cout << blue << " " << red << endl;

        ans = blue * red;
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append(b)
    G[b].append(a)

def dfs(cur, cost):
    dist[cur] = cost
    for to in G[cur]:
        if dist[to] == -1:
            dfs(to, cost+1)
dist = [-1]*n
dfs(0, 0)
m = max(dist)
for i in range(n):
    if dist[i] == m:
        start = i
        break
dist = [-1]*n
dfs(start, 0)
m = max(dist)

if m%3==1:
    print("Second")
else:
    print("First")

Measured memory_bytes: 223892
#include <iostream>
using namespace std;
 
    
    
int main(){
     
  long int n,a,b,c;
  cin>>n>>a>>b;

  c=n/(a+b)*a;
  if (n%(a+b)>a)
  {
    c=c+a;
  }
  else
  {
    c=c+n%(a+b);
  }
  cout<<c<<endl;
  
    return 0;
}

Measured memory_bytes: 256
x,n = gets.split(' ').map(&:to_i)
pa = gets.split(' ').map(&:to_i)
a = 0
hoge = nil
plus = nil
minus = nil
while true do
  hoge = pa.length == 0
  plus = pa.include?(x+a)
  minus = pa.include?(x-a)
  if plus && minus
    a+=1
  else
    break
  end
end

if !minus
  puts x - a
elsif !plus
  puts x + a
else
  puts x
end

Measured memory_bytes: 14264
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)

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

    string n;
    cin >> n;
    int m = n.length();

    ll dp[m + 1][8][2] = {0};
    vector<int> y = {0, 1, 1, 2, 1, 2, 2, 3};
    dp[0][0][0] = 1;

    rep(i, 0, m)
    {
        int x = n[i] - '0';
        dp[i + 1][0][1] = 1;

        rep(j, 0, 8)
        {
            dp[i + 1][j][1] += y[j] * dp[i][j][1];
            rep(k, 0, 8)
            {
                if (y[k] == y[j] - 1)
                {
                    if (j == 5 && k == 2)
                        continue;
                    if (j == 3 && k == 4)
                        continue;
                    if (j == 6 && k == 1)
                        continue;
                    dp[i + 1][j][1] += dp[i][k][1];
                }
            }
        }
        if (x == 3 || x == 5 || x == 7)
        {
            int s = (x + 1) / 2 - 2;
            int t = 1 << s;

            rep(j, 0, 8)
            {
                if (!(j & t))
                {
                    dp[i + 1][j + t][0] += dp[i][j][0];
                }
                else
                {
                    dp[i + 1][j][0] += dp[i][j][0];
                }
            }
        }

        if (x > 3)
        {
            rep(j, 0, 8)
            {
                if (!(j & 1))
                    dp[i + 1][j + 1][1] += dp[i][j][0];
                else
                    dp[i + 1][j][1] += dp[i][j][0];
            }
            if (x > 5)
            {
                rep(j, 0, 8)
                {
                    if (!(j & 2))
                        dp[i + 1][j + 2][1] += dp[i][j][0];
                    else
                        dp[i + 1][j][1] += dp[i][j][0];
                }
            }
            if (x > 7)
            {
                rep(j, 0, 8)
                {
                    if (!(j & 4))
                        dp[i + 1][j + 4][1] += dp[i][j][0];
                    else
                        dp[i + 1][j][1] += dp[i][j][0];
                }
            }
        }
    }

    cout << dp[m][7][1] + dp[m][7][0] << endl;
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const double pi=acos(-1);




int main() 
{
  ll N; cin>>N;
  rep(i,N+1)
  {
    if(i*(i+1)/2>=N)
    {
      //cout<<i<<endl;
      for(ll j=1;j<=i;j++)
      {
        if(j==i*(i+1)/2-N) {continue;}
        cout<<j<<endl;
      }
      return 0;
    }
  }  
    
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		try {
			int t=scan.nextInt();
			while(t--!=0){
				int x,y,z;
				x=scan.nextInt();
				y=scan.nextInt();
				z=scan.nextInt();
				int a=x*x;
				int b=y*y;
				int c=z*z;
				if(a+b==c)
					System.out.println("YES");
				else if(b+c==a)
					System.out.println("YES");
				else if(c+a==b)
					System.out.println("YES");
				else
					System.out.println("NO");

			}
		} catch (Exception e) {
			// TODO: handle exception
		}
	}

}

Measured memory_bytes: 23464
package main

import (
	"fmt"
	"bufio"
	"os"
	"strings"
	"strconv"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	input :=  splitAndAtoi(nextLine(stdin))
	n, m := input[0], input[1]

	if(n == m){
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

func splitAndAtoi(s string) []int {
	ss := strings.Split(s, " ")
	var r []int
	for _, s := range ss {
		i, _ := strconv.Atoi(s)
		r = append(r, i)
	}

	return r
}

func nextNumber(s *bufio.Scanner) int {
	i, _ := strconv.Atoi(nextLine(s))
	return i
}

func nextLine(s *bufio.Scanner) string {
	s.Scan()
	return s.Text()
}

func debug(s string) {
	fmt.Println(s)
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

ll bit = 21;
V sum[21];

void solve_abc_d() {
	ll n, m, x, k;
	ll ans = 0;
	cin >> n;

	V a(n);
	rep(i, n) {
		cin >> a[i];
	}
	rep(j, bit) {
		sum[j] = V(n + 1, 0);
	}

	ll d;
	rep(i, n) {
		rep(j, bit) {
			d = (a[i] >> j) & 1;
			sum[j][i + 1] = sum[j][i] + d;
		}
	}

	ll len;
	ll tmp;
	V now;
	rep(i, n) {
		len = INF;
		rep(j, bit) {
			d = (a[i] >> j) & 1;
			tmp = sum[j][i];
			auto itr = upper_bound(ALL(sum[j]), tmp + 1);
			if (itr != sum[j].end()) {
				tmp = itr - sum[j].begin();
				len = min(len, tmp - i - 1);
			}
			else {
				len = min(len, n - i);
			}

		}
		ans += len;
	}

	cout << ans << "\n";

}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed;
	//cout << setprecision(7);

	solve_abc_d();

	return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x, y) CPP_CAT_I(x, y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x, y) x##y

#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;
// }}}

constexpr i64 INF = 1'010'000'000'000'000'017LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

#define M5 100007
#define M9 1000000000

// util {{{
#define FOR(i, start, end) for (i64 i = (start), CPP_CAT(i, xxxx_end) = (end); i < CPP_CAT(i, xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f, c, ...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ##__VA_ARGS__); })(c))
#define ll long long int
#define VI vector<int>
template <typename C>
i64 SIZE(const C &c)
{
    return static_cast<i64>(c.size());
}

template <typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }

template <typename T, typename U, typename Comp = less<>>
bool chmax(T &xmax, const U &x, Comp comp = {})
{
    if (comp(xmax, x))
    {
        xmax = x;
        return true;
    }
    return false;
}

template <typename T, typename U, typename Comp = less<>>
bool chmin(T &xmin, const U &x, Comp comp = {})
{
    if (comp(x, xmin))
    {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit
{
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit()
    {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if (AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

bool isOK(int mid, double key)
{
}

int binary_search(double key)
{
    int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int right = 2000000000;
    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1)
    {
        int mid = left + (right - left) / 2;

        if (isOK(mid, key))
            right = mid;
        else
            left = mid;
    }

    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return right;
}

bool isKaibun(string st)
{
    bool ans = true;
    int n = st.length();
    REP(i, n / 2)
    {
        if (st[i] != st[n - i - 1])
        {
            return false;
        }
    }
    return true;
}

int toInt(char a)
{
    return a - '0';
}

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

int lcm(int a, int b)
{
    return a * b / gcd(a, b);
}

void solve()
{
    int K;
    cin >> K;
    int x = 7;
    int ans = 1;
    REP(i, 1000000)
    {
        if (x % K == 0)
        {
            cout << ans;
            return;
        }
        ans++;
        x = (x * 10 + 7) % K;
    }
    cout << "-1";
}

signed main()
{

    solve();

    return 0;
}


Measured memory_bytes: 3632
import sys
input = sys.stdin.buffer.readline
N,Q = map(int,input().split())

BIT = [0]*(N+1)  # BITを使う

def BIT_query(idx):  # idxまでの合計を返す
    res_sum = 0
    while idx > 0:
        res_sum += BIT[idx]
        idx -= idx&(-idx)
    return res_sum

def BIT_update(idx,x):  # idxにxを足す
    while idx <= N:
        BIT[idx] += x
        idx += idx&(-idx)
    return

c = [0]+list(map(int,input().split()))  # 1-indexedで扱う
lastAppeared = [-1]*(N+1)  # その色が最後に現れた位置
ans = [0]*Q
queries = []
for q in range(Q):
    l,r = map(int,input().split())
    queries.append(r*10**12+l*10**6+q)  # tupleのソートは遅いので6桁区切りでintにする
queries.sort()  # rでソートされる

curR = 0  # 右端の位置
for i in range(Q):
    query = queries[i]
    r = query//10**12
    l = (query//10**6)%(10**6)
    q = query % 10**6
    while curR < r:
        curR += 1
        color = c[curR]
        last = lastAppeared[color]
        if last != -1:
            BIT_update(last,-1)  # すでに現れているなら前に現れた位置から-1
        lastAppeared[color] = curR
        BIT_update(curR,1)
    ans[q] = BIT_query(r)-BIT_query(l-1)  # クエリを先読みしているのでansに格納
for i in range(Q):
    print(ans[i])


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a < b)
    swap(a, b);
  if (a == 2 && b == 1)
  	cout << 3 << '\n';
  else if (a == 3 && b == 1)
  	cout << 2 << '\n';
  else
    cout << 1 << '\n';
 	return 0; 
}

Measured memory_bytes: 256
// Aizu Vol-2 0276: Temperature Difference
// 2017.8.6

#include <stdio.h>

int main()
{
	int i = 7, a, b;;

	while (i--) {
		scanf("%d%d", &a, &b);
		printf("%d\n", a - b);
	}
	return 0;
}

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

ll n;
vector<ll> a;

main(){
    cin >> n;
    a.resize(n);
    for(int i=0;i<n;++i){
        cin >> a[i];
    }

    ll ans = 0;

    ll i =0;
    ll j = 0;
    ll teks = 0;
    ll tekx = 0;
    while(i<n){
        while(j<n && teks+a[j] == (tekx^a[j]) ){
            teks+=a[j];
            tekx^=a[j];
            j++;
        }
        ans += j-i;
        teks -= a[i];
        tekx = (tekx^a[i]);
        i++;
        j = max(j,i);
    }
    cout << ans;

}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		
	}
	int max=arr[0];
	int count=1;
	for(int i=1;i<n;i++)
	{
		if(max>arr[i])
		{
			count++;
			max=arr[i];
		}
	}
 
	
	cout<<count<<endl;
	
	return 0;
}

Measured memory_bytes: 1024
/*******以下はMAX_NUM_INPUTが大きい場合用のコード．ALDS1_6_A-Counting Sort.cppが小さい場合用のコード****/

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <stack>
#define MAX_NUM_INPUT 20000
#define MAX 10000
#define INFTY 20000//>MAX
using namespace std;
//常に心してかかれ
//簡単なことを簡単にできるように練習する
//びっくりするくらいつまらないことで詰まってることも多い
//それでも不具合の可能性は常にある


int n;

void countingSort(/*int A[],int B[],*/int k){//後々使えるように最大値は定数MAXではなく変数で与えといた
	int C[INFTY];//Cの添え字は0?kまで使える必要がある
	int tmp;//++

	scanf("%d",&n);

	for(int i=0;i<k+1;i++){//iの範囲に注意
		C[i] = 0;
	}

	//C[i]にはAにおけるiの出現回数を記録(上ですべての要素を0で初期化しているのでない要素があってもいい)
	for(int i=0;i<n;i++){//iの範囲に注意
		scanf("%d",&tmp);
		C[tmp]++;
	}

	//C[i]にAにおけるi以下の数の出現回数を記録
	for(int i=0;i<k+1;i++){//iの範囲に注意
		C[i+1] = C[i] + C[i+1];
	}

	//CをもとにB(出力)を決定
	/*
	for(int i=0;i<C[0];i++){
		B[i] = 0;
	}
	*/
	bool first_output = true;//++ 表示が一回以上行われたかどうか判定する変数
	for(int i=0;i<C[0];i++){
		if(first_output){
			printf("0");
			first_output = false;
		}else{
			printf(" 0");
		}
	}
	for(int i=1;i<k+1;i++){
		if(C[i-1] < C[i]){
			for(int j = C[i-1];j < C[i];j++){
				//B[j] = i;
				if(first_output){
					printf("%d",i);
					first_output = false;
				}else{
					printf(" %d",i);
				}
			}
		}
	}

	printf("\n");
}

int main(){
	int k = MAX;
	//int A[MAX_NUM_INPUT+1];//before sort
	//int B[MAX_NUM_INPUT+1];//after sort

	//scanf("%d",&n);

	//確認用
	//printf("%d\n",n);
	
	/*
	for(int i=0;i<n;i++){
		scanf("%d",&A[i]);

		//確認用
		//printf("%d ",S[i]);
	}
	*/

	countingSort(/*A,B,*/k);
	
	/*
	//結果出力
	printf("%d",B[0]);
	for(int i=1;i<n;i++){
		printf(" %d",B[i]);
	}
	printf("\n");
	//
	*/

	return 0;
}

Measured memory_bytes: 1236
import java.util.Collections

fun main(args: Array<String>) {
    val n = readInputLine().toInt()
    
    val topList = mutableListOf<Int>()
    val middleList = mutableListOf<Int>()
    val bottomList = mutableListOf<Int>()
    
    for (a in readInputLine().split(" ").map { it.toInt() }) {
        topList.add(a)
    }
    topList.sort()
    for (b in readInputLine().split(" ").map { it.toInt() }) {
        middleList.add(b)
    }
    for (c in readInputLine().split(" ").map { it.toInt() }) {
        bottomList.add(c)
    }
    bottomList.sort()

    var ans = 0L
    
    for (middle in middleList) {
        ans += (lowerBound(topList, middle)).toLong() * (n - upperBound(bottomList, middle)).toLong()
    }

    println(ans)
}
 
fun readInputLine(): String {
    return readLine()!!
}

// value以上の数値が現れる最初のインデックスを返す
fun <T: Comparable<T>> lowerBound(list: List<T>, value: T): Int {
    return Collections.binarySearch(list, value, {x, y -> if (x >= y) 1 else -1}).inv()
}

// valueより大きい数値が現れる最初のインデックスを返す
fun <T: Comparable<T>> upperBound(list: List<T>, value: T): Int {
    return Collections.binarySearch(list, value, {x, y -> if (x > y) 1 else -1}).inv()
}


Measured memory_bytes: 106484
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp(a, b) make_pair(a, b)
#define pb(t) push_back(t)
#define ft first
#define sc second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;




int main(void) {
    string s;
    cin >> s;
    string a[]={
        "AKIHABARA",
        
        "AKIHABAR",
        "AKIHABRA",
        "AKIHBARA",
        "KIHABARA",
        
        "AKIHABR",
        "AKIHBAR",
        "AKIHBRA",
        "KIHABAR",
        "KIHABRA",
        "KIHBARA",
        
        "AKIHBR",
        "KIHABR",
        "KIHBAR",
        "KIHBRA",
        
        "KIHBR"
    };
    
    for(ll i=0; i<16; i++) {
        if(s==a[i]) {
            pt("YES");
            return 0;
        }
    }
    pt("NO");
    
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000009
const long long INF = 1LL<<60;

int N,A,B,C,L[10];
int ans=1LL<<30;
int flag[8];

void dfs(int cu){
    if(cu==N){
        int a=0,b=0,c=0;
        int ca=0,cb=0,cc=0;
        rep(i,N){
            if(flag[i]==0) a+=L[i],ca++;
            else if(flag[i]==1) b+=L[i],cb++;
            else if(flag[i]==2) c+=L[i],cc++;
        }
        if (0 == ca or 0 == cb or 0 == cc) return;
        int cand=(ca-1)*10+(cb-1)*10+(cc-1)*10;
        cand+=abs(A-a)+abs(B-b)+abs(C-c);
        ans=min(ans,cand);
        return;
    }

    rep(i,4){
        flag[cu]=i;
        dfs(cu+1);
    }
}


int main() {
    cin>>N>>A>>B>>C;
    rep(i,N) cin>>L[i];

    dfs(0);
    cout<<ans<<endl;
}

Measured memory_bytes: 256