akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
long long n,m,k=0;
string s;
int main()
{
    cin>>n>>m>>s;
    for(int i=0;i<=s.size()-1;i++)
    if(s[i]>='0'&&s[i]<='9')
    int o;
    else
    if(i!=n)
    k++;
    if(s[n]!='-'||k>=1)
    {
    	cout<<"No"<<endl;
    	return 0;
    }
    else
    cout<<"Yes"<<endl;
    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 ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 1000001;

int N, W;



void solve() {
    cin >> N >> W;
    vector<l_l> items(N);
    for (int i = 0; i < N; i++) {
        cin >> items[i].first >> items[i].second;
    }
    
    ll dp[N + 1][W + 1];
    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= W; j++) {
            dp[i][j] = 0;
        }
    }
    for (int item = 1; item <= N; item++) {
        for (int capacity = 1; capacity <= W; capacity++) {
            dp[item][capacity] = dp[item - 1][capacity];
            ll maxWithItem = 0;
            
            if (capacity >= items[item - 1].first) {
                maxWithItem = items[item - 1].second;
                maxWithItem += dp[item - 1][capacity - items[item - 1].first];
            }
            
            chmax(dp[item][capacity], maxWithItem);
        }
    }
    
    cout << dp[N][W];
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 79232
#include <bits/stdc++.h>
using namespace std;
const int maxn=(3e5)+10;
int n,s1[maxn],s2[maxn],ans;
char s[maxn];
int main() {
	//freopen("1.txt","r",stdin);
	scanf("%d %s",&n,s+1);
	for (int i=1;i<=n;i++) {
		s1[i]=s1[i-1];
		if (s[i]=='W') s1[i]++;
	}
	for (int i=n;i>=1;i--) {
		s2[i]=s2[i+1];
		if (s[i]=='E') s2[i]++;
	}
	ans=n*2+1;
	for (int i=1;i<=n;i++)
		ans=min(ans,s1[i-1]+s2[i+1]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2944
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
using namespace std;
 
 
int res=0;
 
bool saiki(int ball[],int ttB,int ttC,int res){
    if(res==10)return true;
    if(ball[res]>ttB){
        return saiki(ball,ball[res],ttC,res+1);
    }
    if(ball[res]>ttC){
        return saiki(ball,ttB,ball[res],res+1);
    }
    return false;
}
 
int main(void){
    int a,b;
    int ball[11];
    int ttB=0,ttC=0;
    int n;
    scanf("%d",&n);
    for(a=0;a<n;a++){
        for(b=0;b<10;b++){
            ball[b]=0;
        }
        ttB=0;
        ttC=0;
        res=0;
        for(b=0;b<10;b++){
            scanf("%d",&ball[b]);
        }
        if(saiki(ball,ttB,ttC,res)==true)printf("YES\n");else printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 3144
class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]
        
n,m=map(int,input().split())
t=UnionFind(n)
for i in range(m):
    x,y,z=map(int,input().split())
    t.Unite(x,y)
s=set()
for i in range(1,n+1):
    s.add(t.Find_Root(i))
print(len(s))

Measured memory_bytes: 13548
N,X,Y=map(int,input().split())
ans=[0 for i in range(1,N)]
 
for i in range(1,N):
    for j in range(i+1,N+1):
        k=min(abs(j-i),abs(X-i)+1+abs(Y-j),abs(Y-i)+1+abs(X-j))
        ans[k-1]+=1
 
for i in ans:
    print(i)

Measured memory_bytes: 3444
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
class union_find_tree {
private:
	vector<int>par, rank_;
public:
	union_find_tree(int n) : par(n),rank_(n) {
		for (int i = 0; i < n; i++) {
			par[i] = i;
			rank_[i] = 0;
		}

	}
	int root(int x) {
		if (par[x] == x) {
			return x;
		}
		else {
			return par[x] = root(par[x]);
		}
	}
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	void unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (rank_[x] > rank_[y]) {
			par[y] = x;
		}
		else if (rank_[x] == rank_[y]) {
			par[x] = y;
			rank_[y]++;
		}
		else if (rank_[x] < rank_[y]) {
			par[x] = y;
		}

	}
};

struct edge {
	int from, to, cost;
     bool operator<(const edge& other)const{
		 return cost < other.cost;
	 }
};

using edges = vector<edge>;

int kruskal(union_find_tree& uf, edges& es, int V) {

	sort(es.begin(), es.end());
	int res = 0;
	/*for (auto e : es) {
		if (!uf.same(e.from, e.cost)) {
			uf.unite(e.from, e.to);
			res += e.cost;
		}
	}*/
	int E = es.size();
	for (int i = 0; i < E; i++) {
		if (!uf.same(es[i].from, es[i].to)) {
			uf.unite(es[i].from, es[i].to);
			res += es[i].cost;
		}
	}
	return res;
}

int main() {
	int V, E;
	cin >> V >> E;
	edges es(E);
	for (int i = 0; i < E; i++) {
		cin >> es[i].from >> es[i].to >> es[i].cost;
	}
	union_find_tree uf(V);
	cout << kruskal(uf, es, V) << endl;
	return 0;

}






Measured memory_bytes: 4156
#include<iostream>
#include<cstdio>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<utility>
#include<iomanip>
using namespace std;
int read(){
    int xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
long long READ(){
    long long xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
char one(){
	char ch=getchar();
	while(ch==' '||ch=='\n')
		ch=getchar();
	return ch;
}
long long N,S;
bool check(long long b){
	long long n=N,s=S;
	while(n){
		s-=n%b;
		n/=b;
	}
	return !s;
}
int main(){
	//freopen("in","r",stdin);
	N=READ(),S=READ();
	if(N<S)
		puts("-1");
	else if(N==S)
		printf("%lld\n",N+1);
	else{
		for(int i=2;1LL*i*i<=N;i++)
			if(check(i))
				return printf("%d\n",i),0;
		long long ans=1LL<<60;
		for(int i=1;1LL*i*i<=(N-S);i++){
			if((N-S)%i==0){
				if(check(i+1))
					return printf("%d\n",i+1),0;
				if(check((N-S)/i+1))
					ans=(N-S)/i+1;
			}
		}
		if(ans==1LL<<60)
			puts("-1");
		else
			printf("%lld\n",ans);
	}
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
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()
{
  using ll = long long;
  using pi = pair<ll,int>;
  using pq = priority_queue<pi>;
  
  int n; cin >> n;
  vector<ll> a(n), b(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];

  pq q;
  rep(i,n) {
    if(a[i] < b[i]) q.push({b[i], i});
    else if(a[i] > b[i]) {
      cout << -1 << "\n";
      return 0;
    }
  }

  ll res = 0;
  while( !q.empty() ) {
    pi p = q.top(); q.pop();
    int idx = p.second;
    ll x = b[(idx - 1 + n) % n], y = b[idx], z = b[(idx + 1) % n];
    if((y - a[idx]) % (x + z) == 0) {
      res += (y - a[idx]) / (x + z);
      b[idx] = a[idx];
      continue;
    }
    ll m = (y - max(x, z) + (x + z) - 1) / (x + z);
    res += m;
    b[idx] -= m * (x + z);
    if(a[idx] < b[idx]) q.push({b[idx], idx});
    else if(a[idx] > b[idx]) {
      cout << -1 << "\n";
      return 0;
    }
  }

  cout << res << "\n";
  
  return 0;
}


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

int main()
{
    int r, g, b;
    cin >> r >> g >> b;
    int n = 100 * r + 10 * g + b;
    cout << ((n%4==0)?"YES":"NO") << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int n,k,ans=0;
    //int* c,v;
    scanf("%d %d",&n,&k);
    //c=malloc((n)*sizeof(int));
    //v=malloc((n)*sizeof(int));
    ans = n-k+1;
    
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
S = input()

if S == "".join([chr(i) for i in reversed(range(97, 97 + 26))]):
    print(-1)
    exit()

M = 96
for i in range(97, 97 + 26):
    if not chr(i) in S:
        M = i
        break
if M != 96:
    print(S + chr(M))
    exit()

unused = [False] * 128
for i in reversed(range(len(S))):
    for j in range(ord(S[i]) + 1, 97 + 26):
        if unused[j]:
            print(S[0:i] + chr(j))
            exit()
    unused[ord(S[i])] = True

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;

inline bool valid(int x, int n) {
    return 0 <= x && x < n;
}

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

template <typename T>
inline T pop(queue<T>& q) {
    T front = q.front();
    q.pop();
    return front;
}

template <typename T>
inline T gcd(T a, T b) {
    for (; b; a %= b, swap(a, b));
    return a; 
}

template <typename T>
tuple<T, T, T> xgcd(T a, T b) {
    if (b == 0) return {1, 0, a};
    T x, y, g;
    tie(x, y, g) = xgcd(b, a%b);
    return {y, x-(a/b)*y, g};
}

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

    int N; cin >> N;
    set<string> s;
    while (N--) {
        string t; cin >> t;
        s.insert(t);
    }
    cout << s.size();
}

Measured memory_bytes: 19144
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <bitset>
#include <complex>
#define ll long long
#define INF 1000000000000000001
#define MOD 998244353
using namespace std;


int main(){
    int n;
    cin >> n;
    ll A[200000]={};
    ll sum=0;
    for(int i=0; i<n; i++){
        cin >> A[i];
        sum += A[i];
    }
    
    ll ans = sum;
    ll temp=0;
    for(int i=0; i<n-1; i++){
        temp += A[i];
        ans = min(ans, abs(sum-temp-temp));
    }
    cout<<ans<<endl;
    return 0;
    
}


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

using namespace std;

using int64 = long long;
const int INF = 1 << 30;

int main() {
  int64 N, L, X[300000], Y[300000], T[300000];
  cin >> N >> L;
  for(int i = 0; i < N; i++) {
    cin >> X[i];
    Y[i] = L - X[i];
  }
  for(int i = 0; i < N; i++) {
    cin >> T[i];
  }


  int64 t[300000][2];

  int64 pre = 1, just = 0, uku = 0;
  vector< int > idx;
  for(int i = 0; i < N; i++) {
    pre += T[i] / (2 * L);
    T[i] %= 2 * L;
    if(T[i] == 0) {
    } else {
      bool latte = T[i] <= Y[i] * 2; // o---->   o<----
      bool malta = T[i] <= X[i] * 2; // <----o   ---->o
      t[i][0] = latte;
      t[i][1] = malta;
      idx.emplace_back(i);
      if(!latte && !malta) ++pre;
      else ++just;
      if(latte && malta)++uku;
    }
  }
  int tap = 0;
  auto check = [&](int times) {
    int front = 0, ret = 0;
    for(int i : idx) {
      int z = false;
      if(!t[i][0] && !t[i][1]) {
        continue;
      } else if(t[i][0] && t[i][1]) {
        if(times > 0) {
          --times;
          z = true;
        }
      } else if(t[i][1]) {
        z = true;
      }
      if(z) {
        ++front;
      } else {
        if(front > 0 || i + 1 == N) {
          ++ret;
          --front;
        }
      }
    }
    tap = max(tap, ret);
    return ret;
  };
  int ok = 0, ng = uku + 1;
  check(0), check(uku);
  while(ng - ok > 1) {
    int mid = (ok + ng) / 2;
    if(check(mid) < check(mid + 1)) ok = mid;
    else ng = mid;
  }
  cout << (pre + just - tap) * 2 * L << endl;
}





Measured memory_bytes: 14068
def partition(A, p, r):
    x = A[r]
    i = p - 1
    for j in range(p, r):
        if A[j] <= x:
            i = i + 1
            y = A[i]
            A[i] = A[j]
            A[j] = y
    z = A[i+1]
    A[i+1] = '['+str(A[r])+']'
    A[r] = z
    return i + 1

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

partition(A, 0, n-1)

print(*A)


Measured memory_bytes: 16388
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<utility>
#include<array>
#include<set>
#include <numeric>
#include <stdio.h>
#include <map>
#include <iomanip>
#include <sstream>
//#include <boost/math/common_factor_rt.hpp>
#include<fstream>
#define EPS (1e-7)
using namespace std;
#define ll long long



class Employee {
public:
	int id;
	int parent;
	vector<int> children;
	int salary;

	Employee() {
		
	}

	Employee(int num, int nparent) {
		id = num;
		parent = nparent;
		salary = -1;
	}



};



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;
}





pair<int, int> count_nonzero_cluster(vector<int>& vs) {

	int number = 0;
	int prev = 0;
	int vmax = -1;
	pair<int, int> re = make_pair(number, vmax);
	for (auto& v:vs)
	{
		if (prev <= 0 && v > 0) {
			re.first += 1;
		}
		if (re.second < v)re.second = v;
		prev = v;
	}


	return re;
}





int main() {
	
	int N;
	double ans;
	cin >> N;
	if (N % 2 == 1) {
		ans = ((N + 1) / 2) / (double)N;
	}
	else {
		ans = (N / 2) / (double)N;
	}

	std::cout << std::setprecision(9) << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<string>
#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

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

using namespace std;

#define INF 10000

int m,x,y;
int c[101][101],ct[101][101];
int d[101],dt[101];
bool b[101],bt[101];

void mc(int s){
rep(i,101){
d[i]=INF; b[i]=false;
}
d[s]=0;

while(1){
int M=INF;
rep(i,m){
if(!b[i] && d[i]<M){
	M=d[i]; x=i;
}
}

if(M==INF) break;

b[x]=true;
rep(i,m) d[i]=min(d[i],d[x]+c[x][i]);

}
}

void mt(int s){
rep(i,101){
dt[i]=INF; bt[i]=false;
}
dt[s]=0;

while(1){
int M=INF;
rep(i,m){
if(!bt[i] && dt[i]<M){
	M=dt[i]; y=i;
}
}

if(M==INF) break;

bt[y]=true;
rep(i,m) dt[i]=min(dt[i],dt[y]+ct[y][i]);

}
}

int main(){

int n,a,b,cs,tm,k,p,q,r;

while(1){
	
rep(i,101){
rep(j,101){
	c[i][j]=INF;
    ct[i][j]=INF;
}
}	
	
cin >> n >> m;
if(n==0 && m==0) break;

rep(i,n){
cin >> a >> b >> cs >> tm;

c[a-1][b-1]=cs; c[b-1][a-1]=cs;
ct[a-1][b-1]=tm; ct[b-1][a-1]=tm;
}

cin >> k;

rep(i,k){
cin >> p >> q >> r;

if(r==0){
	mc(p-1); cout << d[q-1] << endl;

}

else{
	mt(p-1); cout << dt[q-1] << endl;

}
}

}

	return 0;
}

Measured memory_bytes: 1240
K = int(input())
hist = set()

INF = 10**8

w = 0
for i in range(INF):
  w += 7 * pow(10,i,K)
  w %= K
  if w == 0:
    print(i+1)
    break
  else:
    if w in hist:
      print(-1)
      break
    else:
      hist.add(w)
      
#print(hist)

Measured memory_bytes: 157020
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(int argc, char const *argv[]) {
	unsigned long long N,M;
	unsigned long long miss = 1900;
	unsigned long long ac = 100;
	std::cin >> N >> M;
	std::cout << (ac * (N-M) + miss * M) * pow(2,M) << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()
bool RecurrenceFormula(vector<int>dx, int obj) {
	int ma = 8000;
	vector<vector<bool>>dpx(dx.size() + 1, vector<bool>(ma + 1, false));
	dpx[0][0] = true;
	for (int i = 1; i < dpx.size(); i++) {
		rep(j, dpx[i].size()) {
			bool left = j - dx[i-1] >= 0 ? dpx[i - 1][j - dx[i-1]] : false;
			bool right = j + dx[i-1] <= ma ? dpx[i - 1][j + dx[i-1]] : false;
			dpx[i][j] = left || right;
		}
	}
	return dpx[(int)dx.size()][obj];

}

int main() {
	string s;
	cin >> s;
	int x, y;
	cin >> x >> y;
	int n = s.length();
	int fcnt = 0;
	bool isx = true;
	vector<int>dx;
	vector<int>dy;
	rep(i, n) {
		if (s[i] == 'F')fcnt++;
		else {
			isx ? dx.push_back(fcnt) : dy.push_back(fcnt);
			fcnt = 0;
			isx = !isx;

		}
	}
	isx ? dx.push_back(fcnt) : dy.push_back(fcnt);


	bool xcan = RecurrenceFormula(vector<int>(dx.begin() + 1, dx.end()), abs(x - dx[0]));
	bool ycan = RecurrenceFormula(dy, abs(y));
	cout << (xcan&&ycan ? "Yes" : "No") << endl;
	return 0;
}





Measured memory_bytes: 4480
#ifdef _WIN32
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

// 継承可能な型
template <class Type>
struct IN : Type
{
	IN()
	{
		std::cin >> *this;
	}
};

// 継承不可能な型
template <class Type>
struct IN_
{
	Type val;

	IN_()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN_<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN_<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN_<Type>& value)
{
	return is >> value.val;
}

template <class Type>
void OUT(const Type& value)
{
	std::cout << value << std::endl;
}

template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value << ' ';
	OUT(args...);
}

void Yes()
{
	OUT("Yes");
}
void No()
{
	OUT("No");
}

using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;

#define FOR(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for (ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for (ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for (auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for (auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

#ifdef _DEBUG
	system("pause");
#endif

	return 0;
}

using namespace std;

//////////////////////////////

void Main()
{
	inll n;

	REP(i, n)
	{
		instr s_;
		if (s_ == "Y")
			return OUT("Four");
	}

	return OUT("Three");
}


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

int main(){
    
    int h, m, s;
    
    cin >> s;
    
    h=s/3600;
    
    m=(s%3600)/60;
    
    s=(s%3600)%60;
    
    cout<<h<<":"<<m<<":"<<s<<endl;
    
    return 0;
}




Measured memory_bytes: 3108
#include <iostream>

int min(int x, int y) {
	if(x>y) {
		return y;
	}

	return x;
}

int max(int x, int y) {
	if(x<y) {
		return y;
	}

	return x;
}

int main() {
	int a1, a2, a3;
	std::cin >> a1 >> a2 >> a3;

	int b1 = min(min(a1, a2), a3);
	int b3 = max(max(a1, a2), a3);
	
	std::cout << b3-b1 << std::endl;
	return 0;
}


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

int main(){
  int n,d,x,a[150];
  cin >> n >> d >> x;
  int i;
  for(i=0; i<n; i++){
    cin >> a[i];
  }
  int b[150];
  for(i=0; i<n; i++){
    b[i] = d/a[i];
    if(d%a[i]){
      b[i]++;
    }
  }
  int sum=x;
  for(i=0; i<n; i++){
    sum += b[i];
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val n = readInteger()
    val march = listOf('M','A','R','C','H')
    val sArray = Array(n) { br.readLine()!! }
        .filter { it.first() in march }
        .groupBy { it.first() }
    var ans = 0L
    for (i in march.indices) {
        for (j in (i + 1) until march.size) {
            for (k in (j + 1) until march.size) {
                val a = sArray[march[i]]?.size?.toLong() ?: 0
                val b = sArray[march[j]]?.size?.toLong() ?: 0
                val c = sArray[march[k]]?.size?.toLong() ?: 0
                ans += a * b * c
            }
        }
    }
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 50128
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n ; cin >> n ;
	bool odd = false ;
	for(int i=0;i<n;i++){
		ll a ; cin >> a ;
		odd |= (a&1) ;
	}
	cout << (odd?"first":"second") << endl ;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = int;
using i64 = long long;
using f64 = double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf64 = vector<f64>;
using vstr = vector<string>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  string s;
  cin >> s;
  int n = s.size();
  int ans = 0;
  rep(i, n) {
    if (i % 2 == 0) {
      if (s[i] == '0') ans++;
    } else {
      if (s[i] == '1') ans++;
    }
  }
  int cnt = 0;
  rep(i, n) {
    if (i % 2 == 0) {
      if (s[i] == '1') cnt++;
    } else {
      if (s[i] == '0') cnt++;
    }
  }
  cout << min(ans, cnt) << endl;
  return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
#define N 10

int main()
{
    char s1[10],s2[10],s3[10];
    scanf("%s%s%s", s1,s2,s3);
    char dif = 'A'-'a';

    printf("%c%c%c",s1[0]+dif,s2[0]+dif,s3[0]+dif);
    return 0;
}


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

int n, k, x[105];
int sum = 0;

int main()
{
	cin >> n >> k;
	int i = 1;
	for (int i = 0; i < n; i++)
	{
		cin >> x[i];
		sum += min(x[i], k-x[i])*2;
	}
	cout << sum << endl;
	return 0;

}


Measured memory_bytes: 256
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String n[]=new String[3];

        for(int i=0; i<3; i++){
            if(s.charAt(i)=='1'){
                n[i]="9";
            }
            else{
                n[i]="1";
            }
        }
        System.out.println(n[0]+n[1]+n[2]);
        sc.close();
    }
}

Measured memory_bytes: 21204
from collections import Counter
import itertools


n = int(input())
l = list(map(int, input().split()))
l_2d = [[i-1, i, i+1] for i in l]
l_flatten = itertools.chain.from_iterable(l_2d)
l = list(l_flatten)
c = Counter(l)
ans = c.most_common()[0][1]
print(ans)


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

int main(){
    int N;
    cin >> N;
    vector<string> word(N);
    rep(i,N){
        cin >> word[i];
    }
    bool flag = true;
    set<string> save;
    char last = word[0].back();
    save.insert(word[0]);
    for(int i = 1; i < N; i++){
        save.insert(word[i]);
        if(last != word[i].front() ){
            flag = false;
            break;
        }
        last = word[i].back();
    }
    if(save.size() != N)flag = false;
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

class UnionFind
{
  public:
    UnionFind(int n)
        : mN(n)
    {
        REP(i, n)
        {
            mNodeTbl.push_back(i);
            mRankTbl.push_back(0);
        }
    }

    int find(int x)
    {
        if (x == mNodeTbl[x])
            return x;
        return mNodeTbl[x] = find(mNodeTbl[x]);
    }
    bool same(int x, int y)
    {
        return find(x) == find(y);
    }
    void unit(int x, int y)
    {
        x = find(x);
        y = find(y);
        if (x == y)
            return;
        if (mRankTbl[x] < mRankTbl[y])
        {
            mNodeTbl[x] = y;
        }
        else
        {
            mNodeTbl[y] = x;
            if (mRankTbl[x] == mRankTbl[y])
                mRankTbl[x]++;
        }
    }

  private:
    int mN;
    vector<int> mNodeTbl;
    vector<int> mRankTbl;
};

ll P[100005];

int main()
{
    ll N, M;
    cin >> N >> M;
    REP(i, N)
    {
        cin >> P[i];
        P[i]--;
    }
    UnionFind uf(N);
    REP(i, M)
    {
        ll x, y;
        cin >> x >> y;
        x--;
        y--;
        uf.unit(x, y);
    }

    ll ans = 0;
    REP(i, N)
    {
        if (uf.same(P[i], i))
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2044
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String w = sc.next();
		int count = 0;
		
		while(true){
			String t = sc.next();
			if(t.equals("END_OF_TEXT")){
				break;
			}
			if(w.equalsIgnoreCase(t)){
				count++;
			}
		}
		
		System.out.println(count);
	}
}


Measured memory_bytes: 26268
#!/usr/bin/env python
import sys


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    if e - a <= k:
        print("Yay!")
    else:
        print(":(")
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    c = int(next(tokens))  # type: int
    d = int(next(tokens))  # type: int
    e = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    solve(a, b, c, d, e, k)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep_1(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define rep_2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main()
{
  ll n,k;
  cin >> n >> k;
  ll ans = n % k;
  ll dis = abs(ans-k);
  ans = min(ans, dis);
  cout << ans <<endl;

  return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0;i < n;i++) cin >> d[i];
  long long ans = 0;
  for (int i = 0;i < n - 1;i++){
    for (int j = i + 1;j < n;j++){
      ans += d[i] * d[j];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
p = []
m.times do |i|
  y = gets.split.map(&:to_i)
  p[i] = [i, y, ""]
end
p.sort! {|a, b| (a[1][0]<=>b[1][0]).nonzero? || (a[1][1]<=>b[1][1])}
pref = 0
cnt = 1
m.times do |i|
  if pref == p[i][1][0]
    cnt += 1
  else
    cnt = 1
    pref = p[i][1][0]
  end
  p[i][2] = p[i][1][0].to_s.rjust(6, "0").concat(cnt.to_s.rjust(6, "0"))
end
p.sort! {|a, b| a[0]<=>b[0]}
m.times do |i|
  puts p[i][2]
end

Measured memory_bytes: 27376
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 123456;
int par[MAXN], sz[MAXN];
int deg[MAXN], ans[MAXN];

int find(int cur) {
    return (par[cur] == cur) ? cur : (par[cur] = find(par[cur]));
}

void merge(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return;
    sz[y] += sz[x];
    par[x] = y;
}

int main() {
    int N, M, K;
    scanf("%d %d %d", &N, &M, &K);
    for (int i = 1; i <= N; i++)
        par[i] = i, sz[i] = 1;
    for (int i = 0; i < M; i++) {
        int x, y;
        scanf("%d %d", &x, &y);
        merge(x, y);
        deg[x]++, deg[y]++;
    }
    for (int i = 1; i <= N; i++) {
        int cur = find(i);
        ans[i] = sz[cur] - deg[i] - 1;
    }

    for (int i = 0; i < K; i++) {
        int x, y;
        scanf("%d %d", &x, &y);
        int tx = find(x), ty = find(y);
        if (tx == ty)
            ans[x]--, ans[y]--;
    }
    for (int i = 1; i <= N; i++)
        printf("%d ", ans[i]);
    puts("");
    return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;

int main()
{
  char a[105], b[105];
  int n, i, f, j;
  cin >> a >> b;
  n=strlen(a);
  char r[n+1];

  for(i=0; i<n; i++){
    f=0;
    for(j=0; j<n; j++) {
      if(a[j]==b[(i+j)%n])
	f++;
    }
    if(f==n)
      {  cout << "Yes";
	return 0;
      }
    
  }

  cout << "No";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

typedef unsigned long long ull;
typedef std::pair<ull,int> P;

int N, L, used[100004];
ull a[100004];

int main(){
    std::cin >> N >> L;
    
    REP(i, N){
        std::cin >> a[i+2];
    }

    std::priority_queue<P, std::vector<P>, std::greater<P> > q;
    
    FOR(i, 2, N+2){
        if(a[i-1] < a[i] && a[i+1] < a[i]){
            q.push(mp(L-a[i], i));
        }
    }

    used[0] = 1;
    used[1] = 1;
    used[N+2] = 1;
    used[N+3] = 1;

    ull res = 0;
    while(!q.empty()){
        P p = q.top(); q.pop();
        ull t = p.first;
        int u = p.second;

        res = std::max(res, t);

        used[u] = 1;
        a[u] = 0;

        if(!used[u-1] && a[u-2] < a[u-1] && a[u] < a[u-1]){
            q.push(mp(t + L-a[u-1], u-1));
        }

        if(!used[u+1] && a[u+2] < a[u+1] && a[u] < a[u+1]){
            q.push(mp(t + L-a[u+1], u+1));
        }
    }

    std::cout << res << std::endl;
}

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

int main()
{
	int n, m;
	cin >> n >> m;
	vector<pair<int,int>> a(m);
	for (int i = 0; i < m; i++)
	{
		cin >> a[i].second >> a[i].first;
	}
	sort(a.begin(), a.end());

	int oya = 1;
	int ans = 0;

	for (int i = 0; i < m; i++)
	{
		if (oya <=a[i].second)
		{
			ans++;
			oya = a[i].first;
		}
	}

	cout << ans << endl;

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pair<int,int> > pipii;
typedef priority_queue<pii,vector<pii>,greater<pii>> minpq;
typedef priority_queue<pii> maxpq;
//const double PI = acos(-1);
const int mod = 1000000007;

// ----------------------DEBUG TEMPLATE--------------------------
void __print(int x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
// ----------------------DEBUG TEMPLATE--------------------------



int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    map<int,int>m;
    vi arr;
    int no;
    fo(i,n){
        cin>>no;
        if(m.find(no)!=m.end()){
            m[no]++;
        }
        else{
            arr.pb(no);
            m[no]++;
        }
    }
    
    sort(all(arr));
    // debug(m);
    // debug(arr);
    int len = (int)arr.size();
    int ans=0;
    for(int i =0;i < len-2;i++){
        for(int j =i+1;j < len-1;j++){
            int sum = arr[i] + arr[j];
            for(int k =j+1;k < len;k++){
                if(sum>arr[k]){
                    // debug(arr[i],arr[j],arr[k]);
                    ans+=m[arr[i]]*m[arr[j]]*m[arr[k]];
                }
                else{
                    break;
                }
            }

        }
    }
    cout<<ans<<endl;






	
	
	
}

Measured memory_bytes: 3660
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
    	
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int ans = 0;
	
		ans = (int) Math.pow(N, 3);
		
		
		System.out.println(ans);

   		sc.close();
        return ;

    }
    
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int n;cin>>n;
  	string a,b,c;cin>>a>>b>>c;
  	int cnt=0;
  	for(int i=0;i<n;i++){
    	if(a[i]!=b[i] && b[i]==c[i] || a[i]==b[i] && b[i]!=c[i] ||a[i]==c[i] && b[i]!=c[i] ){
        	cnt++;	
        }else if(a[i]!=b[i] && b[i]!=c[i] && a[i]!=c[i]){
        	cnt+=2;
        }
    }
  	cout<<cnt<<endl;
}
     

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed  main(){
  int a,b,c=0;
  cin>>a>>b;
  if(a%b==0){
    cout<<"0\n";
  }else{
    c=a/b;
    cout<<abs(c-(c+1))<<"\n";
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
int a,b,c;
cin >> a>> b>> c;
if(c>=a&&c<=b){
    cout << "Yes" << endl;
}else{
    cout << "No" << endl;
}
return 0;
}

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

int main(){
  int N; cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  int ans=0;
  for(int i=0;i<N;i++){
    int plus;
    cin >> plus;
    ans+=plus;
  }
  vector<int> C(N-1);
  for(int i=0;i<N-1;i++){
    cin >> C[i];
  }
  for(int i=1;i<N;i++){
    if(A[i]==A[i-1]+1){
      ans+=C[A[i-1]-1];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define f(a,n) for(ll i=a;i<n;i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define all(v) v.begin(),v.end()
using namespace std;
const ll mod=(1e+9)+7;
const ll size = 2e5+9;
ll gcd(ll a,ll b) {if(b==0)return a;return gcd(b,a%b);}
ll power(ll a,ll b,ll m = mod) {ll res = 1;while(b>0){if(b&1)res = (res*a)%m;b = b>>1;a = (a*a)%m;}return res;}


void solve()
{
    ll n;
    cin>>n;
    ll a[n];
    ll b[n];
    f(0,n)
    cin>>a[i];
    f(0,n)
    cin>>b[i];

    ll ans = 0;
    f(0,n)
    {
        ans += max(0LL,a[i]-b[i]);
    }
    cout<<ans<<endl;
}

int main()
{
    #ifdef JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    clock_t beg = clock();
    solve();
    clock_t end = clock();
    fprintf(stderr, "%.3f sec, Copyright %c 2019 Skyscraper. \n", double(end - beg) / CLOCKS_PER_SEC , 184);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma region Macros
#define ios\
    ios::sync_with_stdio(false);\
    cin.tie(nullptr);
#define VEC(type, name, size)\
    V<type> name(size);\
    IN(name)
#define VVEC(type, name, h, w)\
    VV<type> name(h, V<type>(w));\
    IN(name)
#define INT(...)\
    int __VA_ARGS__;\
    IN(__VA_ARGS__)
#define LL(...)\
    ll __VA_ARGS__;\
    IN(__VA_ARGS__)
#define STR(...)\
    string __VA_ARGS__;\
    IN(__VA_ARGS__)
#define CHAR(...)\
    char __VA_ARGS__;\
    IN(__VA_ARGS__)
#define DOUBLE(...)\
    DOUBLE __VA_ARGS__;\
    IN(__VA_ARGS__)
#define LD(...)\
    LD __VA_ARGS__;\
    IN(__VA_ARGS__)
template <class T> void scan(T &a) { cin >> a; }
template <class T> void scan(vector<T> &a) { for(auto &i : a) scan(i); }
template <class T, class L> void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) { scan(head); IN(tail...); }
template <class T> inline void print(T x){ cout << x << '\n';}
#define ll long long
#define ld long double
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<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; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
template <typename T> T pow(T a, long long n, T e = 1) {T ret = e; while (n) {if (n & 1) ret *= a; a *= a; n >>= 1; } return ret; }
const ll INF = 1e18;
#pragma endregion

int main(){
    ios;
    INT(k);

    ll sum = 7;
    ll res = 1;
    while(sum % k != 0 and res <= 1000000){
        sum *= 10;
        sum += 7;
        sum %= k;
        res++;
    }
    if(res == 1000001){
        print(-1);
        return 0;
    }
    print(res);
}

Measured memory_bytes: 3684
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

use std::cmp::{max, min};

fn main() {
    let ab: Vec<u32> = read_vec();
    let a = ab[0];
    let b = ab[1];
    let mn = min(a, b);
    let mx = max(a, b);

    let mut mat: Vec<Vec<bool>>;

    if mn == 1 {
        mat = vec![vec![true; 100]; 100];

        let mut cmx = 0;
        'c: for i in 0..50 {
            for j in 0..50 {
                mat[i * 2][j * 2] = false;
                cmx += 1;
                if cmx >= mx {
                    break 'c;
                }
            }
        }
    } else {
        mat = vec![vec![false; 100]; 100];

        let mut cmn = 0;
        let mut i: usize = 0;
        'a: loop {
            for j in 0..50 {
                mat[i][j * 2 + i % 2] = true;
                cmn += 1;
                if cmn >= mn - 1 {
                    break 'a;
                }
            }
            i += 1;
        }

        i += 2;

        while i < 100 {
            for j in 0..100 {
                mat[i][j] = true;
            }
            i += 1;
        }

        let mut cmx;
        if mn <= 51 {
            cmx = 1;
        } else {
            cmx = mn - 50;
        }

        'b: loop {
            for i in (0..50).rev() {
                for j in 0..50 {
                    mat[i * 2 + 1][j * 2] = false;
                    cmx += 1;
                    if cmx >= mx {
                        break 'b;
                    }
                }
            }
        }
    }

    let m: Vec<Vec<char>> = mat
        .into_iter()
        .map(|v| {
            v.into_iter()
                .map(|bol| {
                    if a < b {
                        if bol == true {
                            '.'
                        } else {
                            '#'
                        }
                    } else {
                        if bol == true {
                            '#'
                        } else {
                            '.'
                        }
                    }
                })
                .collect()
        })
        .collect();

    println!("100 100");

    for i in 0..100 {
        for j in 0..100 {
            print!("{}", m[i][j]);
        }
        println!("");
    }
}


Measured memory_bytes: 4352
from itertools import chain

def main():
    SX, SY, TX, TY = map(int, input().split())

    ud = TY - SY
    lr = TX - SX
    move1 = (('U', ud), ('R', lr))
    move2 = (('D', ud), ('L', lr))
    move3 = (('L', 1), ('U', ud + 1), ('R', lr + 1), ('D', 1))
    move4 = (('R', 1), ('D', ud + 1), ('L', lr + 1), ('U', 1))
    for a, b in chain(move1, move2, move3, move4):
        print(a * b, end='')
    print()

main()


Measured memory_bytes: 3316
#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;

class Sieve {
public:
    Sieve(int size) : sieve(size+1) {
        sieve[0] = -1;
        sieve[1] = -1;
        for (int i = 2; i <= size; ++i) {
            if (!sieve[i]) {
                sieve[i] = i;
                for (LL j = (LL) i * i; j <= (LL) size; j += i) {
                    if (!sieve[j]) {
                        sieve[j] = i;
                    }
                }
            }
        }
    }

    bool isPrime(int x) {
        return (sieve[x] == x);
    }

    void getFactors(int x, vector<int>& out) {
        while (1 < x) {
            int f = sieve[x];
            out.push_back(f);
            x /= f;
        }
    }

private:
    vector<int> sieve;
};

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

    Sieve sv(100001);
    vector<int> sum(100001);
    for (int i = 3; i < 100000; i+= 2) {
        sum[i-1] = sum[i-2];
        sum[i] = sum[i-2];
        if (sv.isPrime(i) && sv.isPrime((i+1)/2)) {
            ++sum[i];
        }
    }

    int q;
    cin >> q;
    rep(i, q) {
        int l, r;
        cin >> l >> r;
        cout << sum[r]-sum[l-1] << '\n';
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3908
#include<stdio.h>

int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int x;
    if (a>b){
        x = a;
        a = b;
        b = x;
    }
    if (a>c){
        x = a;
        a = c;
        c = x;
    }
    if (b>c){
        x = b;
        b = c;
        c = x;
    }
    printf("%d %d %d\n",a,b,c);
    
    return 0;
}


Measured memory_bytes: 2684
a,b,c = map(int, input().split())
k = int(input())
count = 0
for i in range(7):
  if a < b:
    break
  b *= 2
  count += 1

for j in range(7):
  if b < c:
    break
  c *= 2
  count += 1

if k >= count:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9192
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>

using namespace std;

#define int long long

signed main() {
	int N, K, X, Y;
	int ans = 0;
	cin >> N >> K >> X >> Y;
	if (N <= K) {
		ans += N*X;
	}
	else {
		ans += K*X;
		ans += (N-K)*Y;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    int n;
    cin >> n;

    const int e = floor(log2(n));
    const int ans = round(pow(2, e));

    cout << ans << endl;
}


Measured memory_bytes: 256