akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}



int main(){
  ll n, k;
  cin>>n>>k;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  ll now = 1;
  set<ll> s;
  vector<ll> vv;
  ll len = v.size();
  ll cnt = 0;
  s.insert(now);
  vv.push_back(now);

  rep(i,n) {
    now = v[now-1];
    vv.push_back(now);
    if(s.find(now) == s.end()) {
      s.insert(now);
    } else {
      len = vv.size();
      rep(j,len) {
	if(vv[j]==now) {
	  cnt = j;
	  break;
	}
      }
      break;
    }
  }
  if(k<len) {
    std::cout << vv[k] << std::endl;
  } else {
    k-=cnt;
    std::cout << vv[k%(len-(cnt+1)) + cnt] << std::endl;
  }
  return 0;
}



Measured memory_bytes: 15012
#include <iostream>

using namespace std;

long long fact(long long n);

int main(){
	long long n; cin >> n;
	cout << fact(n) << endl;

	return 0;
}

long long fact(long long n){
	if (n < 2) {
		return 1;
	} else {
		return n * fact(n-1);
	}
}

Measured memory_bytes: 1156
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

const ll MOD = 1000000007;

ll powmod(ll x, ll n){
    ll ret=1;
    while(n>0){
        if(n&1){
            ret*=x;
            ret%=MOD;
            n-=1;
        }
        else{
            x*=x;
            x%=MOD;
            n>>=1;
        }
    }
    return ret;
}

signed main(){
    int n; cin >> n;
    ll num0[66],num1[66];
    rep(i,66) num0[i]=num1[i]=0;
    
    rep(i,n){
        ll a; cin >> a;
        for(ll j=0;j<66;j++){
            if(a&(1ull<<j)) num1[j]++;
            else num0[j]++;
        }
    }
    //rep(i,10) cout<< num0[i]<<" "<<num1[i]<<endl;
    ll ans=0;
    rep(i,63){
        ll x=num0[i]*num1[i];
        x%=MOD;
        ans+=(powmod(2,i)*x)%MOD;
        ans%=MOD;
    }
    cout << ans%MOD << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll a,b;
  	ci(a>>b);
  if(b-a>=2018||a%2019==0||b%2019==0){
    co(0)
  }
  else{
    a%=2019;
    b%=2019;
    ll ans=2018;
     FOR(i,min(a,b),max(a,b)+1){
       FOR(j,min(a,b),max(a,b)+1){
         if(i!=j){
           chmin(ans,i*j%2019);
         }
       }
     }
    co(ans)
  }
}

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

// 8:31 ~ 10:21

vector<string> split(const string &str, char delim){
  vector<string> res;
  size_t current = 0, found;
  while((found = str.find_first_of(delim, current)) != string::npos){
    res.push_back(string(str, current, found - current));
    current = found + 1;
  }
  res.push_back(string(str, current, str.size() - current));
  return res;
}

int  main()
{
	string str;
	
	getline(cin, str);
	int N = stoi(str);
	
	int *Num = new int[N];
	getline(cin, str);
	vector<string> str_v;
	str_v = split(str, ' ');
	
	int count_o = 0;
	for(int n = 0; n<N; n++){
		Num[n] = stoi(str_v[n]);
		if(Num[n]%2 == 1)	count_o++;
	}
	
	
	if(count_o%2 == 1){
		cout << "NO" << endl;
	}else{
		cout << "YES" << endl;
	}
	
	
	return 0 ;
}

Measured memory_bytes: 7168
"use strict";

var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.split(/ |\n/),
    cid = 0;

function next() {
    return +cin[cid++];
} // number一個取得
function nextstr() {
    return cin[cid++];
} // 文字列一個取得
function nextbig() {
    return BigInt(cin[cid++]);
} // BigInteger一個取得
// 長さnの配列として取得。aは文字列フラグ
function nexts(n, a) {
    return a ? cin.slice(cid, cid += n) : cin.slice(cid, cid += n).map(a => +a);
}
// 長さnのBigInt配列として取得。
function nextsbig(n) {
    return cin.slice(cid, cid += n).map(a => BigInt(a));
}
// w個ずつを組にして長さhの配列。aは文字列フラグ。
function nextm(h, w, a) {
    var r = [],
        i = 0;
    if (a)
        for (; i < h; i++) r.push(cin.slice(cid, cid += w));
    else
        for (; i < h; i++) r.push(cin.slice(cid, cid += w).map(a => +a));
    return r;
}
// 多次元配列。v,a1,a2,a3 なら、3次元。[[値vで長さa3の配列]をa2個並べた配列]をa1個並べた配列。
function xArray(v) {
    var a = arguments,
        l = a.length,
        r = "Array(a[" + --l + "]).fill().map(x=>{return " + v + ";})";
    while (--l) r = "Array(a[" + l + "]).fill().map(x=>" + r + ")";
    return eval(r);
}


console.log(main().toString());

function main() {
    let n = next();
    let i;
    for (i = 1; i * 2 <= n; i = i * 2) {}
    return i
}

Measured memory_bytes: 7372
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}


#[allow(unused_imports)]
use input::*;

fn main() {
    let (x, y): (usize, usize);
    let mut s = input_line_str().bytes().collect::<Vec<_>>();
    if s[0] < s[2] {
        println!("<");
    } else if s[0] > s[2] {
        println!(">");
    } else {
        println!("=");
    }
}

Measured memory_bytes: 4352
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<cmath>
#include<cstdio>
#include<cassert>
using namespace std;

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0)); 
const double INF = 0x3f3f3f3f;
const double INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const double mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int n,k;
    string s;
    cin >> n >> k >> s;
    deque<int> a(n); 
    rep(i,n) a[i] = s[i] == 'B';
    if(k > 2*n) k = 2*n + (k&1);
    int rev = 0;
    rep(i,k){
        if(a[0] == rev) a[0] ^= 1;
        else{ a.pop_front(); a.push_back(rev^1); rev ^= 1; }
    }
    rep(i,n) cout << ((a[i]^rev)?'B':'A');
    cout << endl;
    return 0;
}


Measured memory_bytes: 1560
import java.util.*;
import java.util.function.BinaryOperator;
import java.util.function.UnaryOperator;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        SegmentTree<Integer> seg = new SegmentTree<>(300001, Integer::max, Integer.MIN_VALUE);
        
        // 初期の配列を取得
        for (int i = 0; i < 300001; i++) {
            seg.update(i, 0);;
        }
        
        for (int i = 0; i < n; i++) {
            int num = array[i];
            
            int res = seg.query(num-k, num+k+1);
            seg.update(num, res+1);
        }
        
        int ans = seg.query(0, 300001);
        System.out.println(ans);
    }
}

class SegmentTree<T> {
    // dat: 0-indexed
    // 00000000
    // 11112222
    // 33445566
    // 789ABCDE ... a[0]-a[n]
    
    final T[] dat;              // データを格納する配列
    final int n;                // datの一番下のレベルの要素数
    final BinaryOperator<T> f;  // 二項演算子
    final T e;                  // 単位元

    // 単位元で埋めて新規作成
    public SegmentTree(int len, BinaryOperator<T> f, T e) {
        int n = 1;
        while (n < len) n <<= 1;
        this.n = n;
        this.f = f;
        this.e = e;
        this.dat = (T[]) new Object[n << 1];
        Arrays.fill(dat, e);
    }
    
    // 一点更新(a[i] = x) O(logN)
    public void update(int i, T x) {
        i += n - 1;
        dat[i] = x;
        while (i > 0) {
            i = (i - 1) / 2;  // i: parent of vl/vr
            T vl = dat[i * 2 + 1];
            T vr = dat[i * 2 + 2];
            dat[i] = f.apply(vl, vr);
        }
    }
    
    // 区間取得[a, b) O(logN)
    public T query(int a, int b) { return query_sub(a, b, 0, 0, n); }
    public T query_sub(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) {             // outside completely
            return e;
        } else if (a <= l && r <= b) {      // inside completely
            return dat[k];
        } else {
            T vl = query_sub(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = query_sub(a, b, k * 2 + 2, (l + r) / 2, r);
            return f.apply(vl, vr);
        }
    }
    
    // 使用例
    // Range Sum Query
    // SegmentTree<Integer> seg = new SegmentTree<>(n, Integer::sum, 0);
    // SegmentTree<Long> seg = new SegmentTree<>(n, Long::sum, 0L);
    
    // Range Minimum Query
    // SegmentTree<Integer> seg = new SegmentTree<>(n, Integer::min, Integer.MAX_VALUE);
    
    // Range Maximum Query
    // SegmentTree<Long> seg = new SegmentTree<>(n, Long::max, Long.MIN_VALUE);
}

Measured memory_bytes: 79416
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
    int a, b;
    while(cin >> a >> b)
    {
        int c = a + b;
        int i;
        for (i = 0; 0 < c; i++)
        {
            c = c / 10;
        }
        cout << i << "\n";
    }
}



Measured memory_bytes: 2980
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<double, double> Pdd;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;

const ll mod = 1e9+7;
const int INF = 2e9;
const double epsilon = 1e-7;
const double PI = 3.1415926535;

ll mi(ll x, ll y){
    if(x<y)return x;
    return y;
}
ll v[100001];
int n, k, flag=0;
vector <int> e[100001];
int z[100001];
void res(int now, int pr){
    if(v[now] != 0)return;
    z[pr]--;
    int ps = k - z[pr]-1;
    if(ps <= 0){
        flag = 1;
        ps = 1;
    }
    v[now] = ps;
    for(int i = 0;i < e[now].size();i++){
        res(e[now][i], now);
    }
    return;
}
int main(void){
    cin >> n >> k; ll ans = 1;
    for(int i = 0;i < n-1;i++){
        int a, b; cin >> a >> b; a--; b--;
        e[a].push_back(b); e[b].push_back(a);
    }
    fill(v, v+n, 0);
    for(int i = 0;i < n;i++)z[i] = e[i].size();
    res(0, 100000);
    if(flag){
        cout << "0" << endl;
        return 0;
    }
    v[0] = k;
    for(int i = 0;i < n;i++){
        ans = (ans * v[i])%mod;
    }
    //for(int i = 0;i < n;i++)cout << v[i] << endl;
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 10368
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cassert>
using namespace std;

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

    vector<int> A(M);
    for (int i = 0; i < M; ++i) {
        cin >> A[i];
    }


    int sum = 0;
    for (int i = 0; i < M; ++i) {
        sum += A[i];
    }
    int ans = N - sum;
    if (ans < 0) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
}



Measured memory_bytes: 3640
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<queue>
#include<list>
#include<map>
using namespace std ;
int n; double a[55];
int main(){
	cin>>n;
	for(int i=1;i<=n;++i) cin>>a[i] ;
	sort(a+1, a+n+1) ;
	for(int i=2;i<=n;++i){
		a[i] = (a[i]+a[i-1])/2 ;
	}
	cout<<a[n]<<endl ;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/rope"
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
mt19937 rng(high_resolution_clock::now().time_since_epoch().count());
mt19937_64 rngll(high_resolution_clock::now().time_since_epoch().count());
#define lambdify(x) [&](auto &&...args){ return x(forward<decltype(args)>(args)...); }
template<typename T, typename U> T &ctmax(T &x, const U &y){ return x = max<T>(x, y); }
template<typename T, typename U> T &ctmin(T &x, const U &y){ return x = min<T>(x, y); }
template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



int main(){
	cin.tie(0)->sync_with_stdio(0);
	int a, b;
	cin >> a >> b;
	cout << a * b;
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    string s;
    cin >> s;
    if (s[5] == '0' && s[6] <= '4') {
        cout << "Heisei" << endl;
    }else{
        cout << "TBD" <<endl;
    }
    return 0;
}

Measured memory_bytes: 256
//include <bits/stdc++.h>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <cstring> 
#define db double 
#define LL long long
//#define int LL
#define rep(i,x,y) for (int i=x;i<=y;++i)

using namespace std;
//const int N  =  ;
//const int mod = ;
void read(int &x)
{
	int f=1;
	x=0;
	char ch=getchar();
	while (!isdigit(ch)) (ch=='-'?f=-1:0),ch=getchar();
	while ( isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	x*=f;
	return ;
}
signed main()
{
		int n,k;
		read(n)	;read(k);--n;--k;
	
		printf("%d",n/k+(n%k?1:0));
		return 0;
}


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

int main() {
  int N;
  double ans;
  cin >> N;
  if(N % 2 == 0) ans = 1.0 / 2.0;
  else ans = (double)(N+1) / (N * 2) ;
  cout << fixed << setprecision(10);
  cout << ans << endl ;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>

using ll = long long;
using namespace std;
#define modmod 1000000007

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,k,n) for(int i=k;i<n;i++)


int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int dx = tx-sx;
    int dy = ty-sy;

    string result = "";

    // 一週目 //
    for(int i = 0; i < dy; i++){
        result += "U";
    }
    for(int i = 0; i < dx; i++){
        result += "R";
    }
    for(int i = 0; i < dy; i++){
        result += "D";
    }
    for(int i = 0; i < dx; i++){
        result += "L";
    }

    // 2週目 //
    result += "L";
    for(int i = 0; i < dy+1; i++){
        result += "U";
    }
    for(int i = 0; i < dx+1; i++){
        result += "R";
    }
    result += "D";
    result += "R";
    for(int i = 0; i < dy+1; i++){
        result += "D";
    }
    for(int i = 0; i < dx+1; i++){
        result += "L";
    }
    result += "U";

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace C_PANA2020
{
    class MainClass
    {

        static long[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), long.Parse);
            // decimal a = MySqrt(s[0]);
            // decimal b = MySqrt(s[1]);
            // decimal c = MySqrt(s[2]);
            // WriteLine("{0} {1} {2}", a, b, c);
            // if (a + b < c)
            // {
            //     WriteLine("Yes");
            // }
            // else
            // {
            //     WriteLine("No");
            // }
            // double ab2 = 2 * Sqrt(s[0]*s[1]);
            // double cab = s[2]-s[1]-s[0];
            // if(ab2<cab){
            //     WriteLine("Yes");
            // }else{
            //     WriteLine("No");

            long ab = s[0] * s[1];
            long cab = s[2]-s[0]-s[1];
            if(cab<0){
                WriteLine("No");
            }else{
                if(4*ab<cab*cab){
                    WriteLine("Yes");
                }else{
                    WriteLine("No");
                }
            }





        }
        static decimal MySqrt(decimal x, decimal epsilon = 0.0M)
        {
            if (x < 0) throw new OverflowException("Cannot calculate square root from a negative number");

            decimal current = (decimal)Math.Sqrt((double)x), previous;
            do
            {
                previous = current;
                if (previous == 0.0M) return 0;
                current = (previous + x / previous) / 2;
            }
            while (Math.Abs(previous - current) > epsilon);
            return current;
        }
    }

}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define N 105
#define task "t"
#define mu(x) x*x

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using piii=pair<int,pii>;
const int inf=1e9+7;

int n;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie();cout.tie();
    #ifndef ONLINE_JUDGE
   // freopen(task".inp","r",stdin);
  //  freopen(task".out","w",stdout);
    #endif // ONLINE_JUDGE
    cin>>n;
    priority_queue<double,vector<double> , greater<double>> q;
    for (int i=1;i<=n;i++) {
        int x;
        cin>>x;
        q.push(x);
    }
    while (q.size()!=1) {
        double x,y;
        x=q.top();q.pop();
        y=q.top();q.pop();
        q.push((x+y)/2);
    }
    cout<<q.top();
    return 0;
}


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

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

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

#define INF 1e16
#define mod 998244353

int N,X;
int dp[2][530][530];
int sum[2][530][530];

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

  cin>>N>>X;
  const ll M=512;
  dp[0][0][0]=1;
  rep(j,M)rep(x,X+1){
  	(sum[0][j][x+1]=sum[0][j][x]+dp[0][j][x])%=mod;
  }
  repl(i,1,N+1){
  	rep(j,M)rep(x,X+1){
  		ll pre=j^x;
  		(dp[i%2][j][x]+=sum[(i+1)%2][j^x][x+1])%=mod;
  	}
  	rep(j,M)rep(x,X+1){
  		(sum[i%2][j][x+1]=sum[i%2][j][x]+dp[i%2][j][x])%=mod;
  		dp[(i+1)%2][j][x]=0;
  	}
  }
  int res=0;
  rep(j,X+1)(res+=dp[N%2][X][j])%=mod;
  cout<<res<<endl;

  return 0;
}



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

using namespace std;

#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define MP make_pair
#define PB push_back
#define X first
#define Y second

typedef long long int lld;
typedef pair<int, int> pii;
typedef pair<lld, lld> pll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    lld x;
    cin >> x;

    auto func = [](lld x) {
        return x * x * x * x * x;
    };

    for (lld i = -200; i <= 200; i++) {
        for (lld j = -200; j <= 200; j++) {
            if (func(i) - func(j) == x) {
                cout << i << ' ' << j << '\n';
                return 0;
            }
        }
    }



    return 0;
}

// g++ sol.cpp -o sol.out -Wall -Wextra -Wshadow -fsanitize=undefined -std=c++17

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

B=sorted(A,reverse=True)
alice_num=0
bob_num=0

for i in range(N):
    if i%2==0:
        alice_num+=B[i]
    else:
        bob_num+=B[i]

print(alice_num-bob_num)      

Measured memory_bytes: 3060
N=int(input())
a=list(map(int,input().split()))
ans=1
a=sorted(a)
for i in range(N):
    if a[i]==0:
        print(0)
        break
    else:
        ans*=a[i]
        if ans>10**18:
            print(-1)
            break
else:
    print(ans)

Measured memory_bytes: 21652
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int main(){
    ll k, a, b; cin>>k>>a>>b;

    ll sum=1;
    if(a+2<=b){
        bool money=false;
        for(int i=0; i<k; i++){
            if(!money && a<=sum && i<k-1){
                sum-=a;
                money=true;
            }
            else if(money){
                sum+=b;
                money=false;
            }
            else sum++;
        }
    }
    else{
        sum+=k;
    }

    cout << sum << endl;
}

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

using namespace std;

int main()
{
    string S;
    cin >> S;
    unordered_map<string, int> stringmap;

    string temp = "";
    int result = 0;
    for (int i=0; i<S.length(); i++) {
        temp += S[i];
        auto itr = stringmap.find(temp);
        //cout << temp << " " << stringmap[temp] << " " << result-1 << endl;
        if (itr == stringmap.end()) {
            //cout << "add end" << endl;
            stringmap[temp] = result;
            temp = "";
            result++;
        } else if (stringmap[temp] != result-1) {
            //cout << "add sum" << endl;
            stringmap[temp] = result;
            temp = "";
            result++;
        }
    }
    cout << result;

    return 0;
}


Measured memory_bytes: 640
def main(S):
    listdreamereraser = ['dreamer','eraser','dream','erase']
    while True:
        for i in listdreamereraser:
            if i in S[-len(i):]:
                S = S[:-len(i)]
                break
        else:
            return False
        if len(S) == 0:
            return True

S = input()
print('YES' if main(S) else 'NO')

Measured memory_bytes: 3316
// C++ program to count number of triangles that can be
// formed from given array
#include <bits/stdc++.h>
using namespace std;

/* Following function is needed for library function
qsort(). Refer
http://www.cplusplus.com/reference/clibrary/cstdlib/qsort/ */
int comp(const void* a, const void* b)
{ return *(int*)a > *(int*)b ; }

// Function to count all possible triangles with arr[]
// elements
int findNumberOfTriangles(int arr[], int n)
{
    // Sort the array elements in non-decreasing order
    qsort(arr, n, sizeof( arr[0] ), comp);

    // Initialize count of triangles
    int count = 0;

    // Fix the first element. We need to run till n-3
    // as the other two elements are selected from
    // arr[i+1...n-1]
    for (int i = 0; i < n - 2; ++i)
    {
        // Initialize index of the rightmost third
        // element
        int k = i + 2;

        // Fix the second element
        for (int j = i + 1; j < n; ++j)
        {
            // Find the rightmost element which is
            // smaller than the sum of two fixed elements
            // The important thing to note here is, we
            // use the previous value of k. If value of
            // arr[i] + arr[j-1] was greater than arr[k],
            // then arr[i] + arr[j] must be greater than k,
            // because the array is sorted.
            while (k < n && arr[i] + arr[j] > arr[k])
            ++k;

            // Total number of possible triangles that can
            // be formed with the two fixed elements is
            // k - j - 1. The two fixed elements are arr[i]
            // and arr[j]. All elements between arr[j+1]/ to
            // arr[k-1] can form a triangle with arr[i] and arr[j].
            // One is subtracted from k because k is incremented
            // one extra in above while loop.
            // k will always be greater than j. If j becomes equal
            // to k, then above loop will increment k, because arr[k]
            // + arr[i] is always greater than arr[k]
            if(k > j)
            count += k - j - 1;
        }
    }

    return count;
}

// Driver code
int main()
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    cout<<findNumberOfTriangles( arr, n );
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(0, min(b, d) - max(a, c)) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;
ll K, N;
ll A[200100];

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> K >> N;
    for(int i = 0; i < N; i++) cin >> A[i];
    ll ans = 1e9;
    for(int i = 0; i < N - 1; i++) {
        chmin(ans, K - A[i+1] + A[i]);
    }
    chmin(ans, A[N-1] - A[0]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
# https://atcoder.jp/contests/arc098/tasks/arc098_a
from collections import Counter, defaultdict
n = int(input())
s = input()

left = defaultdict(int)
right = Counter(s)

ans = float('inf')
for i in range(n):
    t = s[i]
    right[t] -= 1
    l = left['W']
    r = right['E']
    ans = min(ans, l + r)
    left[t] += 1
print(ans)


Measured memory_bytes: 74548
#include<bits/stdc++.h> 
using namespace std; 
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define forp(i,a,b) for (int i = a; i <b; i++)
#define forn(i,a,b) for (int i = a; i >b; i--)
#define mod 1000000007
#define multiple_testcases_t int t;cin>>t;while(t--){solve();}
#define single_testcase_t solve();
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;


ll fact(ll n)
{
  if(n==0 || n==1)
  return 1;
  else
  return (n*fact(n-1)%mod)%mod;
}

int prime(ll n)
{
  for(int i=2;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      return 0;
    }
  }
  return 1;
}

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

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

int check_palin(string s)
{
  string str=s;
  reverse(str.begin(),str.end());
  if(str==s)
  return 1;
  else 
  return 0;
}

vector<ll> divisors(ll n)
{
  vector<ll> v;
  for(int i=2;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      if(i==n/i)
      v.PB(i);
      else
      v.PB(i),v.PB(n/i);
    }
  }
return v;
}

ll bin_expo(int x,int n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_expo(x*x,n/2);
    else                             //n is odd
        return x*bin_expo(x*x,(n-1)/2);
}

ll modular_expo(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return modular_expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*modular_expo((x*x)%M,(n-1)/2,M))%M;
}

ll kadane_algo(int a[],int n)
{
   ll max_so_far=0,max_ending_here=0;
   forp(i,0,n)
   {
     max_ending_here+=a[i];
     if(max_ending_here<0)
     max_ending_here=0;
     
     if(max_ending_here>max_so_far)
     max_so_far=max_ending_here;
   }

   return max_so_far;
}

// <----- Actual solve() function to print output -----> //
void solve()
{
  ll n,z=0,k=0,ans=0;
  cin>>n;
  ans=(1000-n%1000);
  if(n%1000==0)
    ans=0;
  cout<<ans;
  //cout<<"\n";      //if t>1 uncomment this
}

// MAIN function --------------------------------------------------------------------------//
int main()
{
    fast_io
    single_testcase_t   //Uncomment this if only single testcase & single answer to print
  //  multiple_testcases_t  //Uncomment this if t>1(t is given in question)(multiple testcases)      
return 0;
}
            
            
            
            

Measured memory_bytes: 3672
#include<iostream>
#include<string>
#include<queue>
#include<utility>

using namespace std;

typedef pair<string,int> P;

int main(){

	int N,T;
	int bt,bm,at,am;
	char gav;
	string bs,as;
	queue<P > ok;

	cin>>N>>T;

	cin>>bt>>gav>>bm>>bs;
	for(int i=0;i<N-1;i++){
		cin>>at>>gav>>am>>as>>bt>>gav>>bm>>bs;
		if((bt-at)*60+(bm-am)>=T) ok.push(P(bs,(bt-at)*60+(bm-am)));
	}
	cin>>at>>gav>>am>>as;

	cout<<ok.size()<<endl;
	while(!ok.empty()){
		cout<<ok.front().first<<" "<<ok.front().second<<endl;
		ok.pop();
	}

	return 0;
}

Measured memory_bytes: 1220
module Main

let n = stdin.ReadLine() |> int
let a = stdin.ReadLine().Split(' ') |> Array.map int64

let rec isEven =
    fun i ->
        match i with
        | i when i % 2L = 0L -> 1L + isEven (i / 2L)
        | _ -> 0L

a
|> Array.map isEven
|> Array.min
|> stdout.WriteLine


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(c, i, n) for (int i = c; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N + 1, 0), B(N + 2, 0), C(N + 1, 0);
    ll ans = 0;
    rep(0, i, N + 1)
    {
        cin >> A.at(i);
    }
    rep(0, i, N)
    {
        cin >> B.at(i);
    }
    rep(0, i, N + 1)
    {
        if (A.at(i) >= B.at(i))
        {
            ans += B.at(i);
        }
        else
        {
            ans += A.at(i);
            if (A.at(i + 1) < B.at(i) - A.at(i))
            {
                ans += A.at(i + 1);
                A.at(i + 1) = 0;
            }
            else
            {
                ans += B.at(i) - A.at(i);
                A.at(i + 1) -= B.at(i) - A.at(i);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    map<string,int> memo;
    rep(i,n){
        string s;
        cin>>s;
        memo[s]++;
    }
    int maxv=0;
    for(auto x:memo) maxv=max(maxv,x.second);
    for(auto x:memo){
        if(x.second!=maxv) continue;
        cout<<x.first<<endl;
    }
}

Measured memory_bytes: 19264
import sys
readline = sys.stdin.readline
write = sys.stdout.write

n = int(input())
G = [None for i in range(n+1)]
for i in range(n):
    node_id, k, *adj = map(int, readline().split())
    # adj.sort()
    G[node_id] = adj

begin = [0,]*(n+1)
end = [0,]*(n+1)
time = 1

def dfs(v):
    global time

    begin[v] = time

    adjlen = len(G[v])
    for i in range(adjlen):
        if begin[G[v][i]] != 0:
            continue
        time += 1
        dfs(G[v][i])
    time += 1
    end[v] = time

for i in range(1, n+1):
    if begin[i] == 0:
        if i != 1:
            time += 1 #新しく始点を選ぶのにもコストがかかる
        dfs(i)

for i in range(1, n+1):
    write(str(i) + " " + str(begin[i]) + " " + str(end[i]) + "\n")


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

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define REP2(i,n) for(int i=0;i<(int)(n);i++)
#define REP3(i,m,n) for(int i=m;i<(int)(n);i++)
#define REP4(i,m,n,s) for(int i=m;(s>0 and i<(int)(n)) or (s<0 and i>(int)(n));i+=s)
#define REP(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define REPIT(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define PIS(x) printf("%d ",x)
#define PN() putchar('\n')
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define MT make_tuple

using PII = pair<int, int>;
using TI3 = tuple<int, int, int>;
using LL = long long;
using ULL =  unsigned long long;
using MAT = array<array<LL, 2>, 2>;

void RI() {}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d", &head);
    RI(tail...);
}
void RLL() {}
template<typename... T>
void RLL( LL& head, T&... tail ) {
    scanf("%lld", &head);
    RLL(tail...);
}
void print() {putchar('\n');}
template<typename T, typename... U>
void print(T head, U... tail) {
    cout << head << " ";
    print(tail...);
}

const int MOD = 1000000007;
#define MAX_N 100005
bool dp[MAX_N][20];
int qv[MAX_N], qd[MAX_N], qc[MAX_N];
vector<int> G[MAX_N];
int color[MAX_N];

void paint(int v, int d, int c) {
    if(dp[v][d] > 0) {
        return;
    }
    if(d == 0) {
        color[v] = c;
    } else {
        paint(v, d-1, c);
        REPIT(ii, G[v]) {
            paint(*ii, d-1, c);
        }
    }
    dp[v][d] = 1;
    return;
}

int main()
{
    int n, m;
    RI(n, m);
    REP(i, m) {
        int u, v;
        RI(u, v);
        G[u].PB(v);
        G[v].PB(u);
    }
    int Q;
    RI(Q);
    REP(i, Q) {
        RI(qv[i], qd[i], qc[i]);
    }
    REP(i, Q-1, -1, -1) {
        paint(qv[i], qd[i], qc[i]);
    }
    REP(i, 1, n + 1) {
        printf("%d\n", color[i]);
    }
    return 0;
}


Measured memory_bytes: 9976
P = 10**9 + 7
N = 1000001
inv_t = [0]+[1]
for i in range(2,N):
  inv_t += [inv_t[P % i] * (P - int(P / i)) % P]

n = int(input())
lili = list(map(int,input().split()))
import copy
lili2 = copy.copy(lili)
#a>b
inin = 1
lili = list(set(lili))
for i in range(2,10 ** 3+2):
    count = 0
    for j in range(len(lili)):
        if lili[j] % i != 0: continue
        now = 0
        while (lili[j] % i == 0):
            now += 1
            lili[j] = lili[j] // i
        count = max(count,now)
    inin = inin * (i ** count) % P
lili = list(set(lili))
for i in range(len(lili)):

    inin = inin * lili[i] %P

ans = 0
for i in range(n):
    ans += inin * (pow(lili2[i],P-2,P)) %P
    ans % P
print(ans %P)

    
        

Measured memory_bytes: 71756
#include <bits/stdc++.h>
using namespace std;
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y

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;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#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))
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;
}
template<typename Val>
bool bitcheck(Val bit, size_t idx) {
    return bit & (1 << idx);
}
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;
int rem[1000001];

void solve() {
    ll k; cin >> k;

    rem[1] = 7 % k;
    for(int i = 2; i<= k; ++i) {
        rem[i] = (rem[i-1] * 10 + 7) % k;
    }

    for (int i = 1; i <= k; ++i) {
        if (rem[i] == 0) {
            cout << i << endl;
            return;
        }
    }

    cout << -1 << endl;
}

signed main() {
    solve();
    return 0;
}

Measured memory_bytes: 7484
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
long long f[10000001];
int main(void){
    int N;

    cin >> N;
    long long ans=0;
    
    for(int i=1;i<=N;i++){
        int j=i;
        while(j <= N){
            f[j]++;
            j += i;
        };
    }
    for(int i=1;i<=N;i++){
        ans+=i*f[i];
    }
    cout << ans;
    
}


Measured memory_bytes: 81700
#include <bits/stdc++.h>
using namespace std;
typedef tuple<int, int, int> tp;
typedef long long LL;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<int, LL> pil;
typedef pair<LL, int> pli;
typedef pair<LL, LL> pll;
typedef pair<pii, int> piipi;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;
typedef pair<LL, pii> plpii;
typedef pair<LD, LD> pdd;
typedef pair<LD, int> pdi;
typedef pair<LD, LL> pdl;
typedef pair<int, LD> pid;
typedef pair<LL, LD> pld;
const int mod = 1e9 + 7;
const int hf = 999983;
const int N = 1e6;
vector<pii> g[100005];
int c[100005];
LL dfs(int u, int p, LL w){
    c[u] = w%2;
    for(int i=0;i<g[u].size();i++){
        int v = g[u][i].first, co = g[u][i].second;
        if(v == p) continue;
        dfs(v, u, w+co);
    }
}
int main(){
    int n, a, b, d;
    scanf("%d", &n);
    for(int i=1;i<=n-1;i++){
        scanf("%d%d%d", &a, &b, &d);
        g[a].push_back(pii(b, d));
        g[b].push_back(pii(a, d));
    }    
    dfs(1, 0, 0);
    for(int i=1;i<=n;i++) printf("%d\n", c[i]);
}

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

int main(int argc, const char * argv[])
{

    int a[3] = {0};
    int num = 0;
    int i = 0;
    int j = 0;
    int biggest = 0;
    int idx;
    
    scanf("%d",&num);
    for (j = 0; j < num; j++) {
        scanf("%d %d %d",&a[0] ,&a[1] ,&a[2]);
        for (i = 0; i < 3; i++) {
            if (biggest < a[i] || i == 0) {
                biggest = a[i];
                idx = i;
                
            }
        }
        //printf("%d\n",biggest);
        if (idx == 0 && (pow(a[0], 2) == pow(a[1], 2) + pow(a[2], 2))) {
            printf("YES\n");
        }
        else if (idx == 1 && (pow(a[1], 2) == pow(a[0], 2) + pow(a[2], 2))) {
            printf("YES\n");
        }
        else if (idx == 2 && (pow(a[2], 2) == pow(a[1], 2) + pow(a[0], 2))) {
            printf("YES\n");
        }
        else {
            printf("NO\n");
        }
        biggest = 0;
        idx = 0;
    }
    return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
#define rep(x, a, b) for(int x = (a); x <= (b); ++x)
#define rop(x, a, b) for(int x = (a); x < (b); ++x)
#define per(x, a, b) for(int x = (a); x >= (b); --x)
using namespace std;
typedef long long LL;
typedef double DB;
int V[100005], xs[100005];
int n, as, a[100005], b[100005], q[100005], tt;
void get(int nw, int w) {
	if(nw == 0) return;
	int k = upper_bound(q + 1, q + 1 + tt, nw) - q - 1;
	if(k == 0) {V[nw] += w; return;}
	xs[k] += nw / q[k] * w;
	get(nw % q[k], w);
	return;
}
int Q, x;
signed main() {
	scanf("%lld%lld", &n, &Q);
	q[++tt] = n;
	rep(i, 1, Q) {
		scanf("%lld", &x);
		while(tt && x <= q[tt]) --tt;
		q[++tt] = x;
	}
	xs[tt] = 1;
	per(i, tt, 2) {
		xs[i - 1] += q[i] / q[i - 1] * xs[i];
		get(q[i] % q[i - 1], xs[i]);
	}
	V[q[1]] += xs[1];
	per(i, n - 1, 1) {
		V[i] += V[i + 1];
	}
	rep(i, 1, n) printf("%lld\n", V[i]);
	return 0;
}


Measured memory_bytes: 4096
N = int(input())
S = input()

def char2ascii(char):
    return ord(char)
    
def ascii_ope(ascii, num):
    pre_ascii = ascii + num
    if pre_ascii > 90:
        pre_ascii = pre_ascii - 26
    return pre_ascii

pre_str=''
for char in S:
    ascii = char2ascii(char)
    pre_ascii = ascii_ope(ascii, N)
    # print(pre_ascii, type(pre_ascii))
    pre_char = chr(pre_ascii)
    pre_str += pre_char
    

print(pre_str)

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

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

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

  int N, M;
  cin >> N >> M;
  
  int B = 0;
  vector<int> A(N);

  rep(i, N){
    cin >> A[i];
    B += A[i];
  }

  int cnt = 0;
  rep(i, N){
    if(4 * M * A[i] >= B){
      cnt++;
    }
  }

  if(cnt >= M){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }


  return 0;
}


Measured memory_bytes: 256
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int n; string s;
int main() {
	cin >> n >> s;
	int d = 0, ret = 0;
	for(int i = 0; i < n; i++) {
		if(s[i] == 'I') d++;
		else d--;
		ret = max(ret, d);
	}
	cout << ret << endl;
	return 0;
}

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

int main()
{
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++)
		cin >> A[i];

	sort(A.begin(), A.end());

	long long sum = A[0];
	int t = 0;
	for (int i = 1; i < N; i++)
	{
		if (sum * 2 < A[i])
			t = i;
		sum += A[i];
	}

	cout << N - t;
}

Measured memory_bytes: 640