akhauriyash/Code-Regression huggingface dataset:
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define MOD 998244353
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
#define ar array
#define ld long double
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};
char c[4]={'D' , 'R' , 'U' , 'L'};
const ll maxN=2e5+5;
ll n , k , a[maxN] , dp[maxN];
void solve(){
	cin>> n >> k ;
	for(ll i=0;i<n;i++)cin>>a[i];
	dp[0]=0;
	for(ll i=1;i<=k ;i++){
		for(ll j=0;j<n ; j++){
			if(i-a[j]>=0 && dp[i-a[j]]==0){
				dp[i]=1;
				break;
			}
		}
	}
	if(dp[k])cout<<"First"<<endl;
	else cout<<"Second"<<endl;
}

int main(){
	//mahakal();
	fast;
	ll t =1 ;
	//cin>> t ; 
	while(t--)solve();
	//cerr << "\ntime taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; 
	return 0;
}

Measured memory_bytes: 4368
#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int a[100001],i;
  for(i=0;i<100001;i++)
    a[i]=0;
  for(i=0;i<n;i++){
    int b;
    scanf("%d",&b);
    a[b]++;
  }
  int max=0;
  for(i=1;i<100000;i++)
    if(max<a[i-1]+a[i]+a[i+1])
      max=a[i-1]+a[i]+a[i+1];
  printf("%d\n",max);
  return 0;
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000],arr1[1000000];
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);   
    string s;
    long long i,j,k,x,y,z,a,b,n,aa,bb;
    cin>>n;
    cin>>s;
    a=0;b=0;
    if (s[0]=='R')
    {
    	arr[0]=1;
	}
	else
	{
		arr1[0]=1;
	}
    for (i=1;i<n;i++)
    {
    	arr[i]=arr[i-1];
    	arr1[i]=arr1[i-1];
    	if (s[i]=='R')
    	{
    		arr[i]+=1;
		}
		else
		{
			arr1[i]+=1;
		}
	}
	a=0;b=0;
    for (i=0;i<n;i++)
    {
    	if (s[i]=='W' )
    	{
    		a++;
		}
		else
		{
			b++;
		}
	}
	aa=a;bb=b;
	for (i=(n-1);i>=0;i--)
	{
		if (s[i]=='W')
		{
			if ((arr1[i]-1)>=(bb-arr[i]))
			{
				a--;
			}
		}
	}
	cout<<a<<endl;
}

Measured memory_bytes: 6884
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <stdio.h>
//end of libraries ;
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
// ll lmax(ll o , ll w) {if(o>w)return o; return w;}
// ll lmin(ll o , ll w) {if(o<w)return o; return w;}
#define INF 3999999999999999999
#define N 3000003
#define PI 3.14159265359
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
int main(){
fcin;
int s , w;
cin>>s>>w;
if(w>=s) cout<<"unsafe";
else cout<<"safe";
}

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

#define LL long long
typedef pair<int, int> pii;

template< typename T > inline void read(T &x)
{
    static char _c;
    static bool _f;

    x = 0;
    _f = 0;
    _c = getchar();

    while(_c < '0' || '9' < _c) {if(_c == '-') _f = true; _c = getchar();}
    while('0' <= _c && _c <= '9') {x = (x << 1) + (x << 3) + (_c & 15); _c = getchar();}
    if(_f) x = -x;
}

template < typename T > inline void Min(T &x, T y) {if(y < x) x = y;}
template < typename T > inline void Max(T &x, T y) {if(x < y) x = y;}


#define lowbit(x) ((x) & -(x))
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(l,r) ((l)+(((r)-(l))>>1))
#define fi first
#define se second
#define mk make_pair
#define pb push_back

const int INF = 0x3f3f3f3f;
const double pi = (double) acos(-1.0);
const double eps = (double) 1e-8;
const int MOD = (int) 1e9 + 7;
//const int MOD = (int) 998244353;
//int MOD = 998244353;
const int maxn = (int) 1e5 + 20;
const int maxm = (int) 1e6 + 20;

inline int sig(double x) {return x < -eps ? -1 : eps < x;}
LL fp(LL a, LL n, LL mod = MOD)
{
    if(n < 0) a = fp(a, mod - 2, mod), n = -n;
    LL res = 1; for(; n; n >>= 1, a = a * a % mod) if(n & 1) res = res * a % mod; return res;
}

struct Mint
{
    LL x;
    Mint() {x = 0;}
    Mint(int _x): x(_x) {}
    Mint(LL _x): x(_x) {}
    Mint operator - () const{
        return Mint(MOD - x);
    }
    Mint operator + (const Mint &rhs) const{
        LL res = x + rhs.x; if(res >= MOD) res -= MOD; return Mint(res);
    }
    Mint operator - (const Mint &rhs) const{
        LL res = x - rhs.x; if(res < 0) res += MOD; return Mint(res);
    }
    Mint operator * (const Mint &rhs) const{
        return Mint(x * rhs.x % MOD);
    }
    Mint operator / (const Mint &rhs) const{
        return Mint(x * fp(rhs.x, -1) % MOD);
    }
    bool operator == (const Mint &rhs) const{
        return x == rhs.x;
    }
    bool operator != (const Mint &rhs) const{
        return x != rhs.x;
    }
    friend ostream& operator << (ostream &out, const Mint &rhs){
        return out << rhs.x;
    }
    friend istream& operator >> (istream &in, Mint &rhs){
        return in >> rhs.x;
    }
};

void work()
{
    LL n, a, b;
    cin >>n >>a >>b;
    if(a > b) swap(a, b);

    if((b - a) & 1)
        cout <<min(min(a, b) - 1, n - max(a, b)) + (b - a + 1) / 2 <<endl;
    else
        cout <<(b - a) / 2 <<endl;
}


int main(int argc, char **argv)
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
//    get_prime();
//    pre();
    int tc = 1;
//    read(tc);
    for(int ca = 1; ca <= tc; ca++)
    {
//        printf("Case #%d: ", ca);
        work();
    }
    return 0;
}


Measured memory_bytes: 256
fun main() {
    val (a, b, c, d) = readInts().map { it.toLong() }
    val poss = listOf(a * c, a * d, b * c, b * d)
    println(poss.max())
}

// Input Reader
private fun readLn() = readLine()!!

private fun readStrings() = readLn().trim().split(" ")
private fun readInts() = readStrings().map { it.toInt() }


Measured memory_bytes: 38980
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( [ $ t : ty ] ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( [ $ t : ty ] ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( [ $ t ] ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let (n, k) = get!(usize, usize);

    let mut hs = get!(u64; n);
    hs.sort();

    let ans = hs
        .windows(k)
        .map(|w| w.last().unwrap() - w.first().unwrap())
        .min()
        .unwrap();

    println!("{}", ans);
}


Measured memory_bytes: 8572
#include<iostream>
#include<vector>
using namespace std;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  cin>>a;
  
  int allxor = 0;
  for(auto& ai:a)allxor ^= ai;
  
  for(auto& ai:a)cout<< (allxor^ai) <<endl;
}


Measured memory_bytes: 3996
import java.util.*;

public class Main {
    static final int MOD = 1000000007;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] arr = sc.next().toCharArray();
        int length = arr.length;
        int[][] dp = new int[length + 1][13];
        dp[0][0] = 1;
        for (int i = 1; i <= length; i++) {
            for (int j = 0; j < 13; j++) {
                for (int k = 0; k < 10; k++) {
                    if (arr[i - 1] == '?' || arr[i - 1] - '0' == k) {
                        dp[i][(j * 10 + k) % 13] += dp[i - 1][j];
                        dp[i][(j * 10 + k) % 13] %= MOD;
                    }
                }
            }
        }
        System.out.println(dp[length][5]);
        
    }
}

Measured memory_bytes: 46636
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cctype>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<string>
#define mem(a, b) memset((a), (b), sizeof (a));
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5+10;
template<class T>inline T read(T&x){char c;while((c = getchar()) <= 32);bool flag = false;if(c == '-')flag = true, c = getchar();for(x = 0; c > 32; c = getchar())x = x*10+c-'0';if(flag)x = -x;return x;}
template<class T>inline T write(T x){if(x < 0)putchar('-'), x = -x;if(x < 10)putchar(x+'0');else write(x/10),putchar(x%10+'0');}
//------------------- Main ------------------------

int main()
{
    string str;
    int ans = 0;
    cin >> str;
    int len = str.size();
    for(int i = 0; i < len; i++)
    {
        ans += str[i]-'0';
    }
    if(ans == 1)cout << 10 << endl;
    else cout << ans << endl;
    return 0;
}


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

typedef long long ll;
using namespace std;
int main()
{

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


Measured memory_bytes: 3628
if __name__ == '__main__':
    n, m = map(int, input().split())
    ab = []
    for i in range(m):
        ab_i = tuple(map(int, input().split()))
        ab.append(ab_i)

    ab.sort(key=lambda pair: pair[1])

    ans = 0
    left = 0
    for i in range(m):
        if left <= ab[i][0]:
            left = ab[i][1]
            ans += 1

    print(ans)


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

int main(){
  int s, a=0,b,c,d;
  
  cin >> s;
  a += s / 100;
  d = s / 100;
  b = s - a*100;
  a += b / 10;
  c = b / 10;
  a += s - d*100 - c*10;
  
  cout << a << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long int;
using ULL = unsigned long long;

int main() {
    int n, d;
    cin >> n >> d;

    if (n % (2 * d + 1) == 0) {
        cout << n / (2 * d + 1) << endl;
    } else {
        cout << n / (2 * d + 1) + 1 << endl;
    }
    return 0;
}


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

#define rep3(i, s, n ,a) for (int i = (s); i < (int)(n); i+=a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

int main(){
    double r;
    cin >> r;
    cout << 2 * r * M_PI << endl;
    return 0;
}

Measured memory_bytes: 3812
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <list>
#include <set>
using namespace  std;

constexpr int INF = std::numeric_limits<int>::max();

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int ans = 0;
    int a = 0;
    string s;
    cin >> s;

    for (char c: s) {
        if (c == 'A' || c == 'T' || c == 'G' || c == 'C') {
            a++;
        } else {
            ans = max(ans, a);
            a = 0;
        }
    }
    ans = max(ans, a);
    cout << ans << endl;
}

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

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  int n = r * 100 + g * 10 + b;
  if (n % 4 == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
/*
g++ -std=c++11 -o2 -Wall ABC099B.cpp -o ./out/ABC099B.out
./out/ABC099B.out
*/

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

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define tr(c, i) for (iter(c) != (c).begin(); i != (c).end(); ++i)
#define pb push_back
#define mp make_pair

typedef long long ll;

int s[1000];

int main(){
//    freopen("./input/input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    s[1] = 1;
    for (int i = 2; i <= 999; ++i) {
      s[i] += s[i - 1] + i;
    }
    int ans = s[b - a] - b;
    cout << ans << "\n";
}


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

int N;
string S;

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

    int x = 0;
    int max_x = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'I') {
            x++;
            max_x = max(max_x, x); 
        }
        else {
            x--;
        }
    } 

    cout << max_x << endl;

    return 0;
}


Measured memory_bytes: 256
(defun prime-array (n)
  (let ((arr (make-array (1+ n) :element-type 'bit :initial-element 1)))
    (setf (aref arr 0) 0)
    (setf (aref arr 1) 0)
    (loop :for q :from 1 :upto n :do(if (= 1 (aref arr q))
                                        (loop :for a :from (* 2 q) :upto n :by q :do(setf (aref arr a) 0))))
    arr))

(let* ((prime (prime-array (expt 10 5)))
       (arr-l (make-array (1+ (expt 10 5)) :element-type 'bit :initial-element 0)))
  (loop :for k :from 3 :upto (expt 10 5)
        :do (if (and (= 1 (aref prime k))
                     (= 1 (aref prime (/ (1+ k) 2))))
                (setf (aref arr-l k) 1)))
  (loop :repeat (read) :do (print (count 1 (subseq arr-l (read) (1+ (read)))))))


Measured memory_bytes: 74084
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
  double a,b,x,l,ans;
  cin >> a >> b >> x;
  l=x/a*2/b;
  if (l>a){
    b=b*2-x/a*2/a;
    l=a;
  }
  ans=atan(b/l)*180/M_PI;
  printf("%.12lf\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <vector>
#include<algorithm>
using namespace std;
typedef long long int l;
long long int N;
int num[20];
long long int ans=1;

int main(){
	int n,d,i,j,x,sum=0,z;
	cin>>n;
	vector<int> a(n+1,0);
	for(i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
		}
	cin>>d;
	vector<int> ans;
	for(i=0;i<d;i++){
		cin>>j>>x;
		z=sum-a[j]+x;
		ans.push_back(z);
		}
	for(i=0;i<ans.size();i++){
		cout<<ans[i]<<'\n';
		}
	
}


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


int main() {
	
	string S;

	cin >> S;

	int N = S.size();

	string K;

	for (int i = 0; i<N; i+=2)  {
			K += S.at(i);
	}

	cout <<K << endl;


	return 0;
}

Measured memory_bytes: 512
<?php
$p='';
while(1){
  list($h,$w)=explode(' ',trim(fgets(STDIN)));
  if($h||$w){
    $l='';
    for($i=0;$i<$w;$i++){$l.='#';}
    $m='#';
    for($i=2;$i<$w;$i++){$m.='.';}
    $m.='#';

    $p.=$l.PHP_EOL;
    for($i=2;$i<$h;$i++){$p.=$m.PHP_EOL;}
    $p.=$l.PHP_EOL;

    $p.=PHP_EOL;
  }
  else break;
}
print $p;

Measured memory_bytes: 15368
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

ll f(ll n) {
    ll sum = 0, cur = 1;
    while(sum < n) {
        sum += cur;
        cur++;
    }
    return (sum == n) ? (cur - 1) : -1;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    ll cnt = f(n);
    if (cnt == -1) {
        cout << "No" << endl;
        return 0;
    }
    vector<vector<ll>> ans(cnt + 1);
    reps(x, 1, cnt + 1) {
        ll ofs = x * (x - 1) / 2;
        rep(i, x) {
            ans[x - 1].push_back(ofs + i + 1);
        }
        ll cur = ofs + x;
        rep(i, cnt - x) {
            cur += x + i;
            ans[x - 1].push_back(cur);
        }
    }
    rep(i, cnt) {
        ans[cnt].push_back((i + 2) * (i + 1) / 2);
    }
    printf("Yes\n%lld\n", cnt + 1);
    rep(i, sz(ans)) {
        printf("%lld ", sz(ans[i]));
        ll l = sz(ans[i]);
        rep(j, l) {
            printf("%lld%s", ans[i][j], (j == (l - 1)) ? "\n" : " ");
        }
    }
    return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
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; }

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) do{}while(0)
#endif



ll test(ll k){
	ll d = 0;
	rep(i,k+10) {
		d = d*10+7;
		d = d % k;
		if ( d == 0 ){
			return i+1;
		}
	}
	return -1;
}

int main(){
	ll k;
	cin >> k;
	
	cout << test(k) << endl;

	return 0;
}




Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int n, m;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		int val;
		cin >> val;
		n -= val;
	}
	cout << max(-1, n) << "\n";
	return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define MOD 1000000007
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=0;lli w=0ll,weight=0ll,value=0ll,x=0ll,res=0ll;
    cin>>n>>w;
    vector<lli> a[4];
    for(int i=0;i<4;++i)
		a[i].pb(0);
    for(int i=0;i<n;++i)
    {
		cin>>weight>>value;
		if(i==0)
			x=weight;
		a[weight-x].pb(value);
	}
	for(int i=0;i<4;++i)
	{
		sort(a[i].begin()+1,a[i].end(),greater<lli>());
		for(int j=1;j<(int)a[i].size();++j)
			a[i][j]+=a[i][j-1];
	}
	for(int i=0;i<(int)a[0].size();++i)
	{
		for(int j=0;j<(int)a[1].size();++j)
		{
			for(int k=0;k<(int)a[2].size();++k)
			{
				for(int l=0;l<(int)a[3].size();++l)
				{
					if(x*i+(x+1)*j+(x+2)*k+(x+3)*l<=w)
						res=max(res,a[0][i]+a[1][j]+a[2][k]+a[3][l]);
				}
			}
		}
	}
	cout<<res<<endl;
}


Measured memory_bytes: 256
A = [list(map(int,input().split())) for i in range(3)]
N = int(input())
B = [int(input()) for n in range(N)]
C = [[0,0,0],[0,0,0],[0,0,0]]
F = "No"

for i in range(3):
  for j in range(3):
    if A[i][j] in B:
      C[i][j] = 1

for i in range(3):
  if C[i][0]+C[i][1]+C[i][2]==3:
    F = "Yes"

for i in range(3):
  if C[0][i]+C[1][i]+C[2][i]==3:
    F = "Yes"

for i in range(3):
  if C[0][0]+C[1][1]+C[2][2]==3 or C[0][2]+C[1][1]+C[2][0]==3:
    F = "Yes"

print(F)

Measured memory_bytes: 3188
using System;
class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());

        int cnt = 0;
        for (int i = 1; i <= n; i++)
        {
            if (i % 2 == 1)
            {
                cnt++;
            }
        }
        Console.WriteLine((double)cnt / n);
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> X(m, 0);
    REP(i,m) cin >> X[i];
    sort(X.begin(), X.end());

    vector<int> dist(m-1,0);
    REP(i,m-1) dist[i]=X[i+1]-X[i];
    sort(ALL(dist));
    int ans = 0;
    for(int i=0; i<=m-2-(n-1); i++)
        ans+=dist[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<cstdlib>
using namespace std;
int gcd(int a,int b){
  if(a==0){
    return b;
  }
  if(b==0){
    return a;
  }
  else if(a%b==0){
    return b;
  }
else{
  return gcd(b,a%b);
}
}
  int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
      cin>>a[i];
    }
    int r[n+1],l[n+1];
    l[0]=0;
    r[n-1]=0;
    for(int i=0;i<n;i++){
      l[i+1]=gcd(l[i],a[i]);
    }
    for(int i=n-1;i>0;i--){
      r[i-1]=gcd(r[i],a[i]);
    }
    int ans=0;
    for(int i=0;i<n;i++){
      ans=max(ans,gcd(r[i],l[i]));
    }
    cout<<ans;
  }


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    int n,m;
    cin>>n>>m;
    int edges[m][2]={};
    int dist[n][n];
    int inf=1<<25;
    rep(i,m){
        cin>>edges[i][0]>>edges[i][1];
        edges[i][0]--;
        edges[i][1]--;
    }
    int res=0;
    rep(i,m){
        rep(j,n)rep(k,n)dist[j][k]=inf;
        rep(j,n)dist[j][j]=0;
        rep(j,m){
            if(i==j)continue;
            dist[edges[j][0]][edges[j][1]]=1;
            dist[edges[j][1]][edges[j][0]]=1;
        }
        rep(j,n)rep(k,n)rep(l,n){
            dist[k][l]=min(dist[k][l],dist[k][j]+dist[j][l]);
        }
        bool flg=false;
        rep(j,n)rep(k,n){
            if(dist[j][k]==inf)flg=true;
        }
        res+=int(flg);
    }
    cout << res << endl;
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma warning(disable:4996)
using namespace std;
using ll = long long;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int INF = 1e9;
int main() {	
	int N, K;
	cin >> N >> K;
	vector<int>A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int ans = INF;
	for (int i = 0; i <= N - K; i++) {
		int a = A[i];
		int b = A[i + K - 1];
		int result = 0;
		if (b <= 0) {
			result = abs(a);
		}
		else if (a >= 0) {
			result = abs(b);
		}
		else {
			result = abs(a) + abs(b) + min(abs(a), abs(b));
		}
		ans = min(ans, result);
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;
//========================================================================



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

	int A, B;
	cin >> A >> B;

	cout << 6 - A-B;




}



Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define REP(i, n) for(int i = 0;i < (n);i++)
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=998244353;
const llint inf=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	int i,j,n;cin>>n;
	llint S=1000000000000000000LL%mod;
	
	
	vector<llint>kei(n);
	kei[0]=S;
	for(i=0;i<n-1;i++){kei[i+1]=kei[i]*S%mod;}
	llint L=512;
	//cerr<<"L="<<L<<endl;
	vector<llint>ans(L);ans[0]=1;
	for(int kai=0;kai<3;kai++){
		int m;cin>>m;
		vector<vector<int>>go(n);
		while(m--){
			int a,b;cin>>a>>b;a--;b--;
			if(a<b){swap(a,b);}
			go[b].pub(a);
		}
		vector<int>gru(n);
		vector<int>hyo(L,mod);
		vector<llint>gen(L,0);
		for(i=n-1;i>=0;i--){
			for(auto it:go[i]){hyo[gru[it]]=i;}
			int g=0;
			while(hyo[g]==i){g++;}
			gru[i]=g;
			gen[g]+=kei[i];gen[g]%=mod;
		}
		vector<llint>dp(L,0);
		for(i=0;i<L;i++){
			//cerr<<gen[i]<<endl;
			for(j=0;j<L;j++){
				dp[i^j]+=ans[i]*gen[j];
				dp[i^j]%=mod;
			}
		}
		ans=dp;
	}
	cout<<ans[0]<<endl;
}


Measured memory_bytes: 5584
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define sh short int
#define pb push_back
#define mid (l+r)/2
#define S second
#define F first
using namespace std;
const ll inf = 1e18;
const ll mod = 1e9+7;
int h,n;
pii a[1009];
ll dp[10009];
ll bt(ll val){
    if(val <= 0) return 0;
    ll &ret = dp[val];
    if(ret != -1) return ret;
    ret = inf;
    for(int i=0;i<n;i++){
        ret = min(ret,bt(val-a[i].F)+a[i].S);
    }
    return ret;
}
int main(){
    fast,cin>>h>>n;
    for(int i=0;i<n;i++) cin>>a[i].F>>a[i].S;
    memset(dp,-1,sizeof(dp)); cout<<bt(h)<<endl;
}


Measured memory_bytes: 640
n = gets.chomp.to_i
s = gets.chomp.split("")
a = []
b = s
ans = 0
# hash = Hash.new(0)
# arr = [*"a".."z"]
# arr.each do |i|
#     hash[i] += 0
# end
(n-1).times do 
    hash = Hash.new(0)
    arr = [*"a".."z"]
    arr.each do |i|
    hash[i] += 0
    end
    # hash_a = Hash.new(*"a".."z",1)
    # hash_b = Hash.new(*"a".."z",1)
    a << b.shift
    aa = a.uniq
    bb = b.uniq
    aa.each do |i|
        hash[i] += 1
    end
    bb.each do |i|
        hash[i] += 1
    end
    count = 0
    hash.each do |i|
        if i[1] == 2
            count += 1
        end
    end
    # max = [hash_b.size,hash_a.size].max
    # min = [hash_b.size,hash_a.size].min
    # if max == hash_b.size
    #     big = hash_b
    #     small = hash_a
    # elsif max == hash_a
    #     big = hash_a
    #     small = hash_b
    # end
    # if big == nil || small == nil
    #     break
    # end
    #  p big
    #  p small
    # small.each do |i|
    #     # p big[i[0]]
    #     if big.include?(i[0]) 
    #         count += 1
    #        # [i[1],big[i[0]]].min
    #     end
    # end
    ans = [ans,count].max
end
puts ans

Measured memory_bytes: 14184
#include <stdio.h>
#include <math.h>

int isprime(int);
  
int main(){
  int i, n, *p, count = 0;

  scanf("%d",&n);

  p = malloc(sizeof(int)*n);

  for(i = 0; i < n; i++) scanf("%d",&p[i]);

  for(i = 0; i < n; i++){
    if(isprime(p[i]) == 1) count++;
  }

  printf("%d\n",count);

  return 0;
}

int isprime(int x){
  int i = 3;
  
  if(x == 2) return 1;

  if(x < 2 || x%2 == 0) return 0;

  while(i <= sqrt(x)){
    if(x%i == 0) return 0;
    i = i + 2;
  }
  
  return 1;
}


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

int main (){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    for(int i = 0; i < 100000;i++){
        C = C - B;
        A = A - D;
        if(C <= 0){
            cout << "Yes" << endl;
            break;
        }
        else if(A <= 0){
            cout << "No" << endl;
            break;
        }
    }
}

Measured memory_bytes: 3636
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))

N = int(input())
B = [int(input()) for _ in range(N)]

for b in B:
    for i in range(3):
        if b == A1[i]:
            A1[i] = 0
        if b == A2[i]:
            A2[i] = 0
        if b == A3[i]:
            A3[i] = 0


if ((A1[0] == 0 and A2[0] == 0 and A3[0] == 0) or
    (A1[1] == 0 and A2[1] == 0  and A3[1] == 0) or
    (A1[2] == 0 and A2[2] == 0  and A3[2] == 0) or
    (A1[0] == 0 and A1[1] == 0  and A1[2] == 0) or
    (A2[0] == 0 and A2[1] == 0  and A2[2] == 0) or
    (A3[0] == 0 and A3[1] == 0  and A3[2] == 0) or
    (A1[0] == 0 and A2[1] == 0  and A3[2] == 0) or
    (A1[2] == 0 and A2[1] == 0  and A3[0] == 0)):
    print('Yes')
else:
    print('No')


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

ll mod = 998244353;

//a^n (mod m)
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//mod mでの a の逆元を求める
long long modinv(long long a) {
    long long b = mod, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod; 
    if (u < 0) u += mod;
    return u;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    
    ll n;
    cin>>n;
    ll a[n];
    ll cnt[n+1]={};
    for(int i=0;i<n;i++){
        cin>>a[i];
        cnt[a[i]]++;
    }
    if(a[0]!=0 || cnt[0]>1){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1;
    for(int i=1;i<n;i++){
        if(cnt[i]) ans *= modpow(cnt[i-1],cnt[i]);
        ans %= mod;
    }
    cout << ans << endl;

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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; }



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

  string s;
  int w;
  cin >> s >> w;

  int n = s.length();
  rep(i, n) {
    if (i * w >= n) break;
    cout << s[i * w];
  }
  cout << '\n';
  

  
  return 0;
}

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

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

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = 1e9 + 7;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> p(n);
    REP(i, n) cin >> p[i];

    vector<int> check(n+1, -1);

    int sum = 0;
    REP(i, n){
        if(check[p[i] - 1] > 0){
            check[p[i]] = check[p[i] - 1] + 1;
        }else{
            check[p[i]] = 1;
        }
        sum = max(check[p[i]], sum);
    }
    cout << n - sum << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
using namespace std;
#define MAX 1000
int n,x,a[MAX],b[MAX],t[10001];

int solve(){
	int ans=0;
	bool v[MAX];
	for(int i=0;i<n;i++){
		b[i]=a[i];	v[i]=false;
	}
	sort(b,b+n);
	for(int i=0;i<n;i++)	t[b[i]]=i;//ソート後の位置を記録
	for(int i=0;i<n;i++){
		if(v[i])	continue;
		int current=i;
		int s=0;
		int m=10000;
		int count=0;
		while(1){
			v[current]=true;
			count++;
			m=min(m,a[current]);
			s+=a[current];
			current=t[a[current]];
			if(v[current])	break;
		}
		ans+=min(s+(count-2)*m,s+m+(count+1)*x);
	}
	return ans;
}
		

int main(){
	cin>>n;
	x=10000;
	for(int i=0;i<n;i++){
		cin>>a[i];
		x=min(x,a[i]);
	}
	cout<<solve()<<endl;
	return 0;
}

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

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


int main() {
	int k;
	cin>>k;

	string s="";

	for(int i=0;i<k;i++)
	{
		s+="A";
		s+="C";
		s+="L";
	}
	cout<<s;
}


Measured memory_bytes: 3596
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
import sys
### stdin
def input(): return sys.stdin.readline()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
OutV = lambda x: print(*x, sep='\n')
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

s = input()

if s == s.upper():
    ans = 'A'
else:
    ans = 'a'

print(ans)

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

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.second == b.second) {
        return a.first.compare(b.first) < 0;
    }
    return a.second > b.second;
}

int main() {
    int N;
    cin >> N;
    map<string, int> m;
    string S;
    for (int i = 0; i < N; i++) {
        cin >> S;
        if (m.count(S)) {
            m[S]++;
        } else {
            m[S] = 1;
        }
    }
    vector<pair<string, int>> v;
    for (auto it = m.begin(); it != m.end(); it++) {
        v.push_back(make_pair(it->first, it->second));
    }
    sort(v.begin(), v.end(), my_compare);
    int t = v[0].second;
    for (int i = 0; i < v.size(); i++) {
        if (v[i].second == t) {
            cout << v[i].first << "\n";
        }
    }
    return 0;
}

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

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

    std::vector<long long> l{2, 1};
    for(int i = 2; i <= n; ++i){
        l.push_back(l.at(i - 1) + l.at(i - 2));
    }

    std::cout << l.at(n) << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    int N, M;
    cin >> N >> M;
    int tot = 0;
    rep(i, M) {
        int A;
        cin >> A;
        tot += A;
    }

    LL ans = -1;
    if (tot <= N) {
        ans = N-tot;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3656
#include<stdio.h>
struct P{int x,y;}p[100][100];
int F(int x,int y)
{
	P&r=p[y][x];
	if(r.x<0)return r.x+2;
	x=r.x;
	r.x=-1;
	y=F(x,r.y);
	r.x=-2;
	return y;
}
int main()
{
	int N,i,j,s;
	while(scanf("%d",&N),N)
	{
		for(i=0;i<N;++i)for(j=0;j<N;++j)scanf("%d%d",&p[i][j].x,&p[i][j].y);
		for(s=i=0;i<N;++i)for(j=0;j<N;++j)s+=F(j,i);
		printf("%d\n",s);
	}
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
     
 int main(void) {
   char c;
   scanf("%c",&c);
  	
  	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {  	
     printf("vowel\n");
    } 
    
   	else {
     printf("consonant\n");
    } 
    	return 0;
 }

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,mx,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    int dp[n+1];
    dp[0]=0;

    for(int i=1;i<n;i++)
    {
        mx=INT_MAX;
           for(int j=1;j<=k;j++)
                if(i>=j)
                 mx=min(dp[i-j]+abs(a[i]-a[i-j]),mx);
                 
           dp[i]=mx;
    }
    cout<<dp[n-1]<<"\n";
    return 0;
}

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

int main(){
    int n, m, a, b;
    bool flag = false;
    cin >> n >> m;
    vector<vector<int> > board(200020);
    // board.resize(200020);
    // for (int i = 0; i < 200020; i++) {
    //     board[i].resize(200020);
    // }
    vector<int> vec, A(m), B(m);
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        if(a==1)vec.push_back(b);
        if(b==1)vec.push_back(a);
        board[a].push_back(b);
        board[b].push_back(a);
    }
    // for (auto x: vec){
    //     cout << x << " ";
    // }
    // for (int i = 0; i < vec.size(); i++) {
    //     cout << vec[i] << " ";
    // }
    // cout << endl;
    for (auto x: vec) {
        if(find(board[x].begin(), board[x].end(), n) != board[x].end()) flag = true;
    }
    if(flag) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}


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

int main() {
	int n;
	while (cin >> n) {
		for (int i = 0; n; i++) {
			if (n & 1)cout << pow(2, i) << (n >> 1 ? ' ' : '\n');
			n >>= 1;
		}
	}
	return 0;
}

Measured memory_bytes: 3404
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N;
    cin >> N;
    vector<ll> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    vector<ll> sum(N);
    sum[0] = a[0];
    for (int i = 1; i < N; i++) sum[i] = sum[i-1] + a[i];

    // - + - + ...
    // + - + - ...
    vector<ll> cum(2), cnt(2);
    for (int i = 0; i < N; i++) {
        int i1 = i % 2, i2 = (i + 1) % 2;
        if (sum[i] + cum[i1] <= 0) {
            ll d = abs(sum[i] + cum[i1]) + 1;
            cnt[i1] += d;
            cum[i1] += d;
        }
        if (sum[i] + cum[i2] >= 0) {
            ll d = abs(sum[i] + cum[i2]) + 1;
            cnt[i2] += d;
            cum[i2] -= d;
        }
        /*
        if (i % 2 == 0) {
            if (a[i] + cum1 < 0) {
                int d1 = abs(a[i] + cum1) + 1;
                cnt1 += d1;
                cum1 += d1;
            }
            if (a[i] + cum2 > 0) {
                int d2 = abs(a[i] + cum2) + 1;
                cnt2 += d2;
                cum2 -= d2;
            }
        }
        else {
            if (a[i] + cum1 > 0) {
                int d1 = abs(a[i] + cum1) + 1;
                cnt1 += d1;
                cum1 -= d1;
            }
            if (a[i] + cum2 < 0) {
                int d2 = abs(a[i] + cum2) + 1;
                cnt2 += d2;
                cum2 += d2;
            }
        }
        */
    }
    cout << min(cnt[0], cnt[1]) << '\n';
}


Measured memory_bytes: 4848
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()

vector<int> enum_div(int n) {
  vector<int> ret;
  for (int i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i != 1 && i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  return ret;
}

int main() {
  //
  int n, m;
  cin >> n >> m;
  if (n == 1) {
    cout << m << endl;
    return 0;
  }

  vector<int> d = enum_div(m);
  // sort(ALL(d));
  // reverse(ALL(d));
  int ret = 0;
  rep(i, d.size()) {
    if (m / d[i] >= n) {
      ret = max(ret, d[i]);
    }
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
struct Dice{
  int s[6];
  void roll(char c){
    int b;
    if(c=='E'){
      b=s[0];
      s[0]=s[3];
      s[3]=s[5];
      s[5]=s[2];
      s[2]=b;
    }
    if(c=='W'){
      b=s[0];
      s[0]=s[2];
      s[2]=s[5];
      s[5]=s[3];
      s[3]=b;
    }
    if(c=='N'){
      b=s[0];
      s[0]=s[1];
      s[1]=s[5];
      s[5]=s[4];
      s[4]=b;
    }
    if(c=='S'){
      b=s[0];
      s[0]=s[4];
      s[4]=s[5];
      s[5]=s[1];
      s[1]=b;
    }
    if(c=='R'){
      b=s[1];
      s[1]=s[2];
      s[2]=s[4];
      s[4]=s[3];
      s[3]=b;
    }    
  }
  int top() {
    return s[0];
  }
  int right(){
    return s[2];
  }
  int left(){
    return s[3];
  }
  int front(){
    return s[1];
  }
};
int main(){
  Dice d;
  for(int i=0;i<6;i++) cin >> d.s[i];
  int n;
  cin >> n;
  
  while(n--){
    int a,b;
    cin >> a >> b;
    if(d.left()==a) d.roll('E');
    if(d.right()==a) d.roll('W');
    while(d.top()!=a) d.roll('N');
    while(d.front()!=b) d.roll('R');
    cout << d.right() << endl;
  }
  return 0;
}



Measured memory_bytes: 3100