akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

struct ST {
  int p;
  int i;
};
bool operator<(const ST& x, const ST& y){
  return x.i < y.i;
}

int main(){
  int N;
  cin >> N;
  vector<ST> v;
  rep(i,N){
    ST st;
    cin >> st.p;
    st.i = i;
    v.push_back(st);
  }
  sort(ALLOF(v),[](const ST& x, const ST& y){ return x.p > y.p; });

  ll ret = 0;
  set<ST> s;
  rep(i,N){
    ST st = v[i];
    s.insert(st);

    int rhs2 = N;
    int rhs1 = N;
    int pos = st.i;
    int lhs1 = -1;
    int lhs2 = -1;

    auto itr = s.find(st);
    itr++;
    if(itr != s.end()){
      rhs1 = itr->i;

      itr++;
      if(itr != s.end()){
        rhs2 = itr->i;
      }
    }
    auto itl = s.find(st);
    if(itl != s.begin()){
      itl--;
      lhs1 = itl->i;
      
      if(itl != s.begin()){
        itl--;
        lhs2 = itl->i;
      }
    }

    //cout << lhs2 << " " << lhs1 << " " << pos << " " << rhs1 << " " << rhs2 << endl;

    ll a = pos - lhs1;
    ll b = lhs1 - lhs2;
    ll c = rhs1 - pos;
    ll d = rhs2 - rhs1;

    //cout << a << " " << b << " " << c << " " << d << endl;
    ret += st.p * (b*c + a*d);
  }
  
  cout << ret << endl;
  
  return 0;
}



Measured memory_bytes: 5748
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int tcs;cin>>tcs;while(tcs--)
const int N=10002;
const int MOD=1e9+7;
// lower_bound - which does not compare less than val
// upper_bound - which compares greater than val
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define printclock cerr<<"Time : "<<1000*(int)clock()/(int)CLOCKS_PER_SEC<<"ms\n"
vector<int> v(N,0);
void solve()
{
for(int i=1;i<=100;i++)
{
	for(int j=1;j<=100;j++)
	{
		for(int k=1;k<=100;k++)
		{
			int val=i*i+j*j+k*k+i*j+j*k+k*i;
			if(val>10000)
			continue;
			v[val]++;
		}
	}
}
}
int32_t main()
{
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  /* stuff you should look for
  * int overflow, array bounds
  * special cases (n=1?)
  * do smth instead of nothing and stay organized
*/
int n;
cin>>n;
solve();
for(int i=1;i<=n;i++)
{
	cout<<v[i]<<endl;
}


cout<<endl;
printclock;
}




Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	void doIt() {
		int x = sc.nextInt();
		if(x == 3 || x == 5 || x == 7)System.out.println("YES");
		else System.out.println("NO"); 
	
	}
	Main(){doIt();}
	public static void main(String[] args) {
		new Main();
	}

}


Measured memory_bytes: 23252
#include<iostream>
#include<algorithm>
using namespace std;
long long a[1005],b[1005],c[1005],d[1000005],ans[3000005];
bool cmp(long long x,long long y){
	return x>y;
}
int main()
{
	int x,y,z,k,i,j,s;
	cin>>x>>y>>z>>k;
	for(i=1;i<=x;i++) cin>>a[i];
	for(i=1;i<=y;i++) cin>>b[i];
	for(i=1;i<=z;i++) cin>>c[i];
	
	int t=0;
	for(i=1;i<=x;i++)
		for(j=1;j<=y;j++){
			d[++t]=a[i]+b[j];
		}
	
	sort(d+1,d+t+1,cmp);
	
	s=0;
	for(i=1;i<=z;i++)
		for(j=1;j<=k;j++)
			ans[++s]=c[i]+d[j];
	
	sort(ans+1,ans+s+1,cmp);
	
	for(i=1;i<=k;i++)
		cout<<ans[i]<<endl;
	return 0;
}


Measured memory_bytes: 31616
/**
 *    author:  tourist
 *    created: 21.09.2019 15:39:25       
**/
#include <bits/stdc++.h>
 
using namespace std;
 
template <typename T, class F = function<T(const T&, const T&)>>
class SparseTable {
 public:
  int n;
  vector<vector<T>> mat;
  F func;
 
  SparseTable(const vector<T>& a, const F& f) : func(f) {
    n = static_cast<int>(a.size());
    int max_log = 32 - __builtin_clz(n);
    mat.resize(max_log);
    mat[0] = a;
    for (int j = 1; j < max_log; j++) {
      mat[j].resize(n - (1 << j) + 1);
      for (int i = 0; i <= n - (1 << j); i++) {
        mat[j][i] = func(mat[j - 1][i], mat[j - 1][i + (1 << (j - 1))]);
      }
    }
  }
 
  T get(int from, int to) const {
    assert(0 <= from && from <= to && to <= n - 1);
    int lg = 32 - __builtin_clz(to - from + 1) - 1;
    return func(mat[lg][from], mat[lg][to - (1 << lg) + 1]);
  }
};
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  SparseTable<int> smin(a, [&](int i, int j) { return min(i, j); });
  SparseTable<int> smax(a, [&](int i, int j) { return max(i, j); });
  vector<int> to(n);
  for (int i = n - 1; i >= 0; i--) {
    if(i < n - 1 && a[i] < a[i + 1]) to[i] = to[i + 1];
    else to[i] = i;
  }
  int ans = 0;
  int nosort = 0;
  for (int i = 0; i <= n - k; i++) {
    if (to[i] >= i + k - 1) {
      nosort = 1;
      continue;
    }
    if (i > 0 && smin.get(i - 1, i + k - 2) == a[i - 1] && smax.get(i, i + k - 1) == a[i + k - 1]) {
      continue;
    }
    ++ans;
  }
  cout << ans + nosort << '\n';
  return 0;
}


Measured memory_bytes: 28032
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

bool calc(int[] hs) {
    hs[0]--;
    for (int i = 1; i < hs.length; i++) {
        if (hs[i - 1] < hs[i]) hs[i]--;
        if (hs[i - 1] > hs[i]) return false;
    }
    return true;
}

void main() {
    readint;
    auto hs = readints;
    writeln(calc(hs) ? "Yes" : "No");
}


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

int main(){
    int n, h, ans = 0; cin >> n >> h;
    vector<int> a(n), b(n);
    for (auto i = 0; i < n; i++) cin >> a[i] >> b[i];
    sort(a.begin(), a.end(), greater<>());
    sort(b.begin(), b.end(), greater<>());
    for (auto & elm : b) {
        if(elm > a.front() and h > 0) h -= elm, ans++;
        else break;
    }
    if(h > 0) ans += (h + (a.front() - 1))/ a.front();
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4024
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		
		while (true)
		{
			try
			{
				StringBuffer str = new StringBuffer(sc.nextLine());
			
				while (str.indexOf("the") == -1 && str.indexOf("this") == -1 && str.indexOf("that") == -1)
				{
					for (int i = 0; i < str.length(); i++)
					{
						char a = str.charAt(i);
						if (Character.isLowerCase(a))
						{
							if (a == 'z') a = 'a';
							else a++;
						}
						str.setCharAt(i, a); 
					}
				}
				System.out.println(str.toString());
			}
			catch (Exception e)
			{
				break;
			}
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
ll ans[200010];
int main() {
	ll n,k;
	ll t[200010];
	for(ll i=0;i<200010;i++){
		ans[i]=-1;
	}
	cin>>n>>k;
	for(ll i=0;i<n;i++){
		ll x;
		cin>>x;
		x--;
		t[i]=x;
	}
	ll now=0;
	ll cnt=0;
	while(ans[now]==-1){
		ans[now]=cnt;
	//	cout << now<<cnt;
	//	cout <<t[2]<<endl;
		if(cnt==k){
			cout << now+1;
			return 0;
		}
		cnt++;
		now=t[now];
	//	cout <<now;
	//	cout<< ans[now]<<endl;
	}
//	cout <<endl;
//	cout <<now<<endl;
//	cout <<ans[now]<<endl;
	ll sa=cnt-ans[now];
//	cout << sa<<endl;
//	cout <<cnt<<endl;
	for(ll i=0;i<n;i++){
		if(ans[i]==ans[now]+(k-ans[now])%sa){
			cout << i+1;
			return 0;
		}
	}
//	cout << ans[k%cnt];
	// your code goes here
	return 0;
}

Measured memory_bytes: 6752
#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define f			first
#define sz(a)       ((int)(a).size())
#define s			second
#define all(v)		v.begin(),v.end()
#define pii 		pair<int,int>
#define vpii 		vector<pii>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)		for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define vi			vector<int>

using namespace std;
using ll  = long long;
using lld = long double;

const int oo = 0x3f3f3f3f;
const ll MOD = 1000000007;

class DSU{

//union find with path compression 
    public: 
        int n , comp;
        int *par,*sz;
        DSU(int k){
            par = new int[k];
            sz = new int[k];
            n = k;
            init();
        }

        void init(){
            for(int i=0;i<n;i++){
                par[i] = i;
                sz[i] = 1;
            }
            comp = n;
        }

        bool _union(int a,int b){
            int root1 = _find(a);
            int root2 = _find(b);
            if(root1==root2) return 0;
            if(sz[root1]<sz[root2]){
                sz[root2]+=sz[root1];
                par[root1] = par[root2];
            }else{
                sz[root1]+=sz[root2];
                par[root2] = par[root1];
            }
            comp--;
            return 1;
        }

        int _find(int a){
            int tmp = a;
            while(tmp!=par[tmp]){
                tmp = par[tmp];
            }
            while(a!=par[a]){
                int z = par[a];
                par[a] = tmp;
                a = z;
            }
            return a;
        }

        bool _is_connected(int a,int b){
            return _find(a)==_find(b);
        }
        
        int get_size(int i){
            return sz[_find(i)];
        }

};

signed main(){

#ifndef ONLINE_JUDGE
	//freopen("in.txt" , "r" , stdin);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);

    int n , m;
    cin >> n >> m;

    DSU *d = new DSU(n);

    fo(i , m){
        int u , v;
        cin >> u >> v;
        u--;v--;
        d -> _union(u , v);
    }
    int ans = 0;
    for(int i = 0 ; i < n ; i++)
        ans = max(ans , d -> get_size(i));
    cout << ans << '\n';


    return 0;

}



Measured memory_bytes: 5228
#include <bits/stdc++.h>
#include <random>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using Pt = pair<int, int>;

int main()
{
	int N;
	cin >> N;
	vl L(N);
	for (auto& x : L)
		cin >> x;

	int ct = 0;
	for (int i = 0; i < N; ++i)
	{
		ll x = L[i];
		for (int j = i + 1; j < N; ++j)
		{
			ll y = L[j];
			if (x == y)
				continue;
			for (int k = j + 1; k < N; ++k)
			{
				ll z = L[k];
				if (x == z || y == z)
					continue;
				if (x + y > z && y + z > x && z + x > y)
					++ct;
			}
		}
	}
	cout << ct << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    int n; std::cin >> n;
    std::string s; std::cin >> s;
    std::string ans;
    auto func = [&](int a, int b) {
        int prev = a, cur = b;
        ans.clear();
        ans += a ? 'W' : 'S';
        ans += b ? 'W' : 'S';
        for (int i = 1; i < n; i++) {
            if ((s[i] == 'o')^cur) {
                std::tie(prev, cur) = std::make_pair(cur, prev);
            }
            else {
                std::tie(prev, cur) = std::make_pair(cur, 1 - prev);
            }
            if (i < n - 1) ans += cur ? 'W' : 'S';
        }
        bool flag;
        if ((s[0] == 'o') ^ cur) flag = prev == b;
        else flag = prev != b;
        return flag && cur == a;
    };
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            if (func(i, j)) {
                std::cout << ans << std::endl;
                return 0;
            }
        }
    }
    std::cout << -1 << std::endl;
    return 0;
}


Measured memory_bytes: 640
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
n = [K - Q] * N
for i in range(Q):
    n[A[i]-1] += 1
for i in range(N):
    if n[i] > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 10448
# 136 C
import numpy as np
N = int(input())
H = list(map(int, input().split()))
H = np.array(H)

ans = 'Yes'
for i in range(N-2, -1, -1):
    if (H[i] - H[i+1])>0:
        if (H[i] - H[i+1])==1:
            H[i] += -1
        else:
            ans='No'
            break
print(str(ans))

Measured memory_bytes: 23124
#include<stdio.h>
int main(){
  int N;
  scanf("%d",&N);
  int i;
  int a=0,b=0,c=0,d=0;
  char S[32];
  for(i=0;i<N;i++){
    scanf("%s",&S);
    if(strcmp(S,"AC")==0){
      a++;
    }else if(strcmp(S,"WA")==0){
      b++;
    }else if(strcmp(S,"TLE")==0){
      c++;
    }else{
      d++;
    }
  }
  printf("AC x %d\nWA x %d\nTLE x %d\nRE x  %d\n",a,b,c,d);
}

Measured memory_bytes: 1732
S = str(input())
ACGT = ['A','C','G','T']
L = [0]
for i in range(len(S)):
    if S[i] in ACGT:
        cnt = 0
        for j in range(i, len(S)):
            if S[j] in ACGT:
                cnt += 1
            else:
                break
        L.append(cnt)
print(max(L))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

int main(){
    int n, m, q;
    cin >> n >> m >> q;

    vector<vector<int>> sum(n + 1, vector<int>(n + 1, 0));
    for (auto i = 0; i < m; i++) {
        int l, r; cin >> l >> r; sum[l][r]++;
    }

    for (auto i = 1; i <= n; i++) {
        for (auto j = 1; j <= n; j++) {
            sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
        }
    }

    for (auto i = 0; i < q; i++) {
        int l, r; cin >> l >> r;
        cout << sum[r][r] + sum[l - 1][l - 1] - sum[l - 1][r] - sum[r][l - 1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n,t,a;
  cin >> n >> t >> a;
  vector<int> h(n);
  rep(i,n){
    cin >> h.at(i);
  }
  int ans=1,count=1e6;
  rep(i,n){
    if(count>abs(1000*a-(1000*t-6*h.at(i)))){
      count=abs(1000*a-(1000*t-6*h.at(i)));
      ans=i+1;
    }
  }
  cout << ans;
}
  

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

#define ld long double
#define ll long long
#define pb push_back
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x.size())

using namespace std;

int mn[100][100];

int main()
{
    //freopen("test.in","r",stdin);
    ios::sync_with_stdio(0); cin.tie(0);
    int h,w; cin>>h>>w;
    bool g[h][w];
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
    {
        char c; cin>>c;
        g[i][j]=bool(c=='.');
    }
    for(int i=0;i<100;i++) for(int j=0;j<100;j++) mn[i][j]=1e9;
    if(!g[0][0]) mn[0][0]=1;
    else mn[0][0]=0;
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
    {
        if(i<h-1)
        {
            if(g[i][j] && !g[i+1][j]) mn[i+1][j]=min(mn[i+1][j],mn[i][j]+1);
            else mn[i+1][j]=min(mn[i+1][j],mn[i][j]);
        }
        if(j<w-1)
        {
            if(g[i][j] && !g[i][j+1]) mn[i][j+1]=min(mn[i][j+1],mn[i][j]+1);
            else mn[i][j+1]=min(mn[i][j+1],mn[i][j]);
        }
    }
    cout<<mn[h-1][w-1]<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <cassert>
#include <unordered_map>
#include <fstream>
#include <random>
#include <cstring>
#include <bitset>
#include <functional>
#include <tuple>
#include <complex>

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;

const int MAXN = 1e5 + 10;

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

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

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    
    int tests;
    cin >> tests;

    for (int test = 0; test < tests; ++test) {
        ll a, b, c, d;
        cin >> a >> b >> c >> d;
        if (a < b) {
            cout << "No" << endl;
            continue;
        }
        if (d < b) {
            cout << "No" << endl;
            continue;
        }

        ll g = gcd(b, d);

        ll x = ((c + 1 - (a % g) + g - 1) / g) * g + a % g;

        if (x < b) {
            cout << "No" << endl;
            continue;
        }

        cout << "Yes" << endl;

    }


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,a[100];
	int gra=0,br=0,gre=0,li=0,bl=0,ye=0,da=0,re=0,others=0,count=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		if(1<=a[i] && a[i]<=399){
			gra=1;
		}
		if(400<=a[i] && a[i]<=799){
			br=1;
		}
		if(800<=a[i] && a[i]<=1199){
			gre=1;
		}
		if(1200<=a[i] && a[i]<=1599){
			li=1;
		}
		if(1600<=a[i] && a[i]<=1999){
			bl=1;
		}
		if(2000<=a[i] && a[i]<=2399){
			ye=1;
		}
		if(2400<=a[i] && a[i]<=2799){
			da=1;
		}
		if(2800<=a[i] && a[i]<=3199){
			re=1;
		}
		if(3200<=a[i]){
			others=others+1;
			count=count+1;
		}
	}
	if(n==count){
		cout<<"1"<<endl;
	}
	if(n!=count){
		cout<<gra+br+gre+li+bl+ye+da+re<<endl;
	}
	cout<<gra+br+gre+li+bl+ye+da+re+others<<endl;
}

Measured memory_bytes: 256
n = int(input())
L = list(map(int,input().split()))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if L[i]!=L[j] and L[i]!=L[k] and L[j]!=L[k] and abs(L[j]-L[k])<L[i]<L[j]+L[k]:
                ans += 1
print(ans)

Measured memory_bytes: 74148
#include<stdio.h>

 int main(void) {

 int i,n;

  int number;

  long long int sum=0;

  int min=0;

  int max=0;  

   scanf("%d",&n);

    for(i=0;i<n;i++)

  {   

    scanf("%d",&number);    

  if(i==0)

  {

    min = number;

    max = number;

  } 

  if(number<min) min = number;

   if(number>max) max = number;   

    sum += number;

     }

     printf("%d %d %lld\n",min,max,sum);

     return 0;

 }  

Measured memory_bytes: 600
# UnionFind: https://note.nkmk.me/python-union-find/
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1] * (n + 1)
        
    def find(self, x):
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.find(self.root[x])
            return self.root[x]
    
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.root[x] > self.root[y]:
            x, y = y, x
        self.root[x] += self.root[y]
        self.root[y] = x
        
    def is_same(self, x, y):
        return self.find(x) == self.find(y)
    
    def size(self, x):
        return -self.root[self.find(x)]

n, m = map(int, input().split())
cards = UnionFind(n)
for i in range(m):
    x, y, z = map(int, input().split())
    cards.unite(x, y)
print(len({i + 1 for i in range(n) if cards.root[i + 1] < 0}))

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

  set<int> s;
  for(int i = 0; i < n; i++){
    s.insert(d[i]);
  }
  cout << s.size() << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    string S;
    cin >> S;
    cout << S[0] << S.size() - 2 << S[S.size() - 1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
    long long a[200];
    a[0]=2;
    a[1]=1;
    cin>>n;
    for(int i=2; i<=n; ++i) {
        a[i]=a[i-1]+a[i-2];
    }
    cout<<a[n]<<'\n';
    return 0;
}

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

int wt(int b);
int main()
{
    int n,i,ans=0,a[10000]={0};
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&(a[i]));
        ans+=wt(a[i]);
    }
    printf("%d",ans);
}

int wt(int b)
{
    int c=0;
    while(b%2==0)
    {
        c++;
        b/=2;
    }
    return c;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
    map<string,ll> m;
    ll n;
    cin>>n;
    string s;
    for(ll i =0;i<n;i++){
        cin>>s;
        sort(s.begin(),s.end());
        m[s]++;
    }
    ll ans = 0;
    for(auto it = m.begin();it != m.end();it++){
      //  cout<<it->first<<" "<<it->second<<" "<<pow(2,it->second-1)<<"\n";

  ans += (ll)((it->second)*(it->second - 1))/2;
        
      
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    cout << min({a * b * (c % 2), (a % 2) * b * c, a * (b % 2) * c}) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()
#define fs first
#define sd second
#define couts(x) cout << (x) << (" ")
#define coutn(x) cout << (x) << ("\n")
#define endl "\n"

template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T1, typename T2> std::istream &operator>>(std::istream &is, std::pair<T1,T2> &p){is >> p.first >> p.second; return is; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::deque<T> &vec){ os << "deque["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> std::ostream &operator<<(std::ostream &os, const std::pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }

template<class T> using V = vector<T>;
template<class T> using V2 = V<V<T>>;
template<class T> using V3 = V<V2<T>>;

void solve(){
  int n; cin >> n;
  ll ans = 0;
  FOR(i,1,n+1){
    if(i%3>0 && i%5>0) ans += (ll)i;
  }
  couts(ans);
}


int main(void){
  solve();
  return 0;
}


Measured memory_bytes: 3632
N = int(input())
L = list(map(int, input().split()))

ans = 0
for i1 in range(N):
    for i2 in range(i1, N):
        for i3 in range(i2, N):
            l1 = L[i1]
            l2 = L[i2]
            l3 = L[i3]
            if l1 != l2 and l2 != l3 and l3 != l1:
                if l1 < l2 + l3 and l2 < l3 + l1 and l3 < l1 + l2:
                    ans += 1

print(ans)


Measured memory_bytes: 9048
N = int(input())
li = map(int,input().split())

g1=0
g2=0
g4=0
for v in li:
  if (v%4==0):
    g4+=1
  elif (v%2==0):
    g2+=1
  else:
    g1+=1
flag = True
if ( g2>0 and g4<g1):
  flag = False
if ( g2==0 and g4+1<g1):
  flag = False
print ( "Yes" if flag else "No" )

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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll h, w, k, total = 0, ans = 0; cin >> h >> w >> k;
    vector<string> c(h);
    rep(i, h) {
        string s; cin >> c[i];
        // 初めの黒を数える
        rep(j, w) {
            if(c[i][j] == '#') total++;
        }
    }
    // 全探索
    rep(i, (1<<h)) {
        rep(j, (1<<w)) {
            vector<string> tmp;
            ll sum = 0;
            rep(k, h) {
                tmp.push_back(c[k]);
            }
            rep(k, h) {
                // k番目のbit
                if(i & (1<<k)) {
                    rep(l, w) {
                        if(tmp[k][l] == '#') {
                            tmp[k][l] = '.';
                            sum++;
                        }
                    }
                }
            }
            rep(k, w) {
                // k番目のbit
                if(j & (1<<k)) {
                    rep(l, h) {
                        if(tmp[l][k] == '#') {
                            tmp[l][k] = '.';
                            sum++;
                        }
                    }
                }
            }
            if(k == total-sum) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <ctype.h>
int main()
{
  char ch;
  int counter[26];
  int i;
  for (i=0;i<26;i++){
    counter[i]=0;
  }
  while (scanf("%c",&ch)!=EOF){
    if (isalpha(ch)){
      int num=tolower(ch)-'a';
      counter[num]++;
    }
  }
  for (i=0;i<26;i++){
    printf("%c : %d\n",i+'a',counter[i]);
  }
  return 0;
}

Measured memory_bytes: 548
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, k int
	_, _ = fmt.Scan(&a, &b, &k)
	x, y := Solve(a, b, k)
	fmt.Println(x, y)
}

func Solve(a, b, k int) (int, int) {
	if k == 0 {
		return a, b
	} else if a > 0 {
		min := int(math.Min(float64(a), float64(k)))
		return Solve(a-min, b, k-min)
	} else if b > 0 {
		min := int(math.Min(float64(b), float64(k)))
		return Solve(a, b-min, k-min)
	} else {
		return a, b
	}
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<vector>

using namespace std;
#define MAX_M 100000000

int n;//変換表の行数
int m;//変換するデータの行数
char D[MAX_M];//変換するデータを格納する
char a,b;
int use[MAX_M];//すでに変換した行かどうか調べる

typedef pair<char,char> P;

vector<P> A;

int main(){
  while(true){
  scanf("%d",&n);
  if(n ==0)
    break;
  for(int i = 0;i < n;i++){
    cin >>a>>b;
    A.push_back(P(a,b));
  }
  scanf("%d",&m);
  for(int i = 0;i < m;i++){
    cin >>D[i];
    use[i] = 0;//使用配列初期化
  }
  for(int i=0;i<n;i++){
   a = A[i].first;
   b = A[i].second;
   for(int j = 0;j < m;j++){
     if(D[j] == a && use[j]==0){
       D[j] = b;
       use[j] = 1;
     }
     }
  }
  printf("%s\n",D);
  A.clear();
  }
  return 0;
}

Measured memory_bytes: 3628
import java.util.Calendar;
import java.util.Scanner;

class Main {
	private static final int YEAR = 2004;
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        while(true) {
            int month = sc.nextInt();
            int day = sc.nextInt();

            if(month == 0) {
                break;
            }

            System.out.println(getWeekName(month - 1, day));
        }

    }

    public static String getWeekName(int month, int day) {
        Calendar cal = Calendar.getInstance();
        cal.set(YEAR, month, day);
        String weekName = "";

        switch(cal.get(Calendar.DAY_OF_WEEK)) {
            case Calendar.SUNDAY:
                weekName = "Sunday";
                break;

            case Calendar.MONDAY:
                weekName = "Monday";
                break;

            case Calendar.TUESDAY:
                weekName = "Tuesday";
                break;

            case Calendar.WEDNESDAY:
                weekName = "Wednesday";
                break;

            case Calendar.THURSDAY:
                weekName = "Thursday";
                break;

            case Calendar.FRIDAY:
                weekName = "Friday";
                break;

            case Calendar.SATURDAY:
                weekName = "Saturday";
                break;
        }

        return weekName;
    }
}

Measured memory_bytes: 27332
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,sum=0;
    cin>>n;
    int arr[n-1];
    for(int i=0;i<n-1;i++)
    {
        cin>>arr[i];
    }
    sum+=arr[0];sum+=arr[n-2];
    for(int i=0;i<n-2;i++)
    {
        sum+=min(arr[i],arr[i+1]);
    }

    cout<<sum<<endl;

}


Measured memory_bytes: 3612
#!/usr/bin/env python3

def main():
    S = input()
    T = input()
    # permit = ["?"*len(T)]
    LENT = len(T)
    # for i in range(1,LENT+1):
    #     permit.append(T[0:i] + "?"*(LENT-i))

    permit_index = []
    for i in range(len(S)-LENT+1):
        for si in range(LENT):
            if S[i:i+LENT][si] == T[si] or S[i:i+LENT][si]=="?":
                continue
            else:
                break
        else:
            permit_index.append(i)

    if not permit_index:
        print("UNRESTORABLE")
        return

    answer = S.replace("?","z")
    S = S.replace("?","a")
    for i in permit_index:
        s = S[:i]+T+S[i+LENT:]
        answer = min(answer,s)
    
    print(answer)
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
nab = input().split(' ')
if len(nab) != 3:
    raise Exception

n = int(nab[0])
a = int(nab[1])
b = int(nab[2])

loop = int(n / (a + b))
count_blue = loop * a
last = n - (a + b) * loop
if last > a:
    count_blue += a
else:
    count_blue += last

print(count_blue)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
#include <assert.h>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> v;
    int z = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if(x) v.emplace_back(x);
        else z++;
    }
    sort(v.begin(),v.end(), [&](int x, int y){ return abs(x) > abs(y); });
    n = v.size();
    if(n < k) {
        puts("0");
        return 0;
    }
    int cnt = 0;
    for (int i = 0; i < k; ++i) {
        if(v[i] < 0) cnt++;
    }
    if(cnt%2 == 0){
        ll ans = 1;
        for (int i = 0; i < k; ++i) {
            ans = (ans*abs(v[i]))%MOD;
        }
        cout << ans << "\n";
        return 0;
    }
    ll a = 0, b = 0, c = 0, d = 0;
    for (int i = 0; i < k; ++i) {
        if(v[i] > 0) a = v[i];
        else b = v[i];
    }
    for (int i = n-1; i >= k; --i) {
        if(v[i] > 0) c = v[i];
        else d = v[i];
    }
    if(a && d && b && c){
        if(abs(d*b) < abs(a*c)){
            ll ans = 1;
            for (int i = 0; i < k; ++i) {
                if(v[i] == b){
                    ans = (ans*abs(c))%MOD;
                    b = 0;
                }else ans = (ans*abs(v[i]))%MOD;
            }
            cout << ans << "\n";
        }else {
            ll ans = 1;
            for (int i = 0; i < k; ++i) {
                if(v[i] == a){
                    ans = (ans*abs(d))%MOD;
                    a = 0;
                }else ans = (ans*abs(v[i]))%MOD;
            }
            cout << ans << "\n";
        }
    }else if(a && d){
        ll ans = 1;
        for (int i = 0; i < k; ++i) {
            if(v[i] == a){
                ans = (ans*abs(d))%MOD;
                a = 0;
            }else ans = (ans*abs(v[i]))%MOD;
        }
        cout << ans << "\n";
    }else if(b && c) {
        ll ans = 1;
        for (int i = 0; i < k; ++i) {
            if(v[i] == b){
                ans = (ans*abs(c))%MOD;
                b = 0;
            }else ans = (ans*abs(v[i]))%MOD;
        }
        cout << ans << "\n";
    }else if(z) {
        cout << 0 << "\n";
    }else {
        ll ans = 1;
        sort(v.begin(),v.end(), [&](int x, int y){ return abs(x) < abs(y); });
        for (int i = 0; i < k; ++i) {
            ans = (ans*abs(v[i]))%MOD;
        }
        cout << (MOD-ans)%MOD << "\n";
    }
    return 0;
}

Measured memory_bytes: 4320
s = input()
ans = 0
for i in range(1, len(s)):
    t = s[:-i]
    len_t = len(t)
    if len_t%2 == 0:
        if t[:int(len_t/2)] == t[int(len_t/2):]:
            ans = len_t
            break
print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<queue>
#include<numeric>
#include<algorithm>

bool solve(){
  int n;
  std::cin  >> n;
  std::vector<int> x(n);
  for (int &e : x) {
    std::cin >> e;
    e -= 1;
  }
  std::vector<int> ans(n * n, n);
  for (int i = 0; i != n; i += 1) {
    ans[x[i]] = i;
  }
  std::queue<int> task, rem;
  {
    std::vector<int> idx(n);
    std::iota(idx.begin(), idx.end(), 0);
    std::sort(idx.begin(), idx.end(),
      [&x](int l, int r){return x[l] < x[r];});
    for (const int i : idx) {
      for (int j = 0; j != i; j += 1) {
        task.push(i);
      }
      for (int j = i; j != n - 1; j += 1) {
        rem.push(i);
      }
    }
  }
  std::vector<int> count(n, 0);
  for (int i = 0; i != n * n; i += 1) {
    if (ans[i] != n) {
      if(count[ans[i]] != ans[i]) return false;
    }
    else if (!task.empty()) {
      ans[i] = task.front();
      task.pop();
    } else {
      ans[i] = rem.front();
      rem.pop();
    }
    count[ans[i]] += 1;
  }
  std::cout << "Yes\n";
  for (int i = 0; i != n * n; i += 1) {
    if (i != 0) std::cout << " ";
    std::cout << ans[i] + 1;
  }
  std::cout << "\n";
  return true;
}


int main() {
  if (!solve()) {
    std::cout << "No\n";
  }
}

Measured memory_bytes: 3200
def check(g,h,w,s):
    if (g[0]<0 or g[0]>=h) or (g[1]<0 or g[1]>=w):
        return False
    if s[g[0]][g[1]]==-1:
        return True
    else:
        return False



h,w=map(int,input().split())
c=[int(x)-1 for x in input().split()]
d=[int(x)-1 for x in input().split()]
s=[]
for j in range(h):
    l=[-1 if x=="." else -2 for x in list(input())]
    s.append(l)
s[c[0]][c[1]]=0
u=[c]
i=0
t=0
while t==0:
    for j in u:
        if j==d:
            t=1
            break
        for k in [[j[0]-1,j[1]],[j[0]+1,j[1]],[j[0],j[1]-1],[j[0],j[1]+1]]:
            if check(k,h,w,s):
                s[k[0]][k[1]]=i
                u.append(k)
    i+=1
    v=[]
    for j in u:
        if j==d:
            t=1
            break
        for k1 in range(-2,3):
            for k2 in range(-2,3):
                k=[j[0]+k1,j[1]+k2]
                if check(k,h,w,s):
                    s[k[0]][k[1]]=i
                    v.append(k)
    if v==[]:
        t=1
    u=v
print(s[d[0]][d[1]])

Measured memory_bytes: 115400
#include <bits/stdc++.h>
using namespace std;
extern const int N = 100000;
int dp[N +1];
int compute(int arr[], int n, int i){
  if(i == n-1){
  	return 0;
  }
  
  if(dp[i] != -1){
  	return dp[i];
  }
  
  int c1 = abs(arr[i] - arr[i+1]) + compute(arr, n, i+1);
  int c2 = INT_MAX;
  if(i+2 <=n-1){
    c2 = abs (arr[i]-arr[i+2]) + compute(arr,n, i+2);
  }
   

  return dp[i] = min(c1, c2);
}


int main() {
 	
  int n;
  cin >> n;
  int arr[n];
  
  for(int i = 0; i < n; i++){
  	cin >> arr[i];
  }
  memset(dp, -1, sizeof dp);
  cout<< compute(arr, n, 0);
  
  return 0;
}

Measured memory_bytes: 13704
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
vector<int> a;

bool lineSearch(int key,vector<int> aa,int n) {
	int count=0;
	aa.push_back(key);
	int i=0;
	while (i != n) {
		if (aa[i] == key)
			return true;
		i++;
	}
	return false;
}
int main()
{
	int n, q,num=0;
	cin >> n;
	int m;
	for (int i = 0; i < n; i++) {
		cin >> m;
		a.push_back(m);
	}
		
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> m;
		if (lineSearch(m, a, n))
			num++;
	}
		
	cout << num << endl;
    return 0;
}



Measured memory_bytes: 3224
#include<iostream>
#include<cmath>
int main(){
        int a,b,c,d;
        std::cin >> a >> b >> c >> d;
        if(std::abs(a - b) <= d && std::abs(b - c) <= d || std::abs(a-c) <= d) std::cout<<"Yes";
        else std::cout<<"No";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());

        if (a == b)
            System.out.println(a * 2);
        else
            System.out.println(Math.max(a, b) * 2 - 1);
    }
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <math.h>
short v[10240][333],a[10],i,j,n,s;
short summing(short n,short s){
	short ans=0,i,max=0,min=0,m,k;
	if(s>332)return 0;
	if(n==1){if(s<10 && a[s]==1)return 1; else return 0;}
	else{
		k=(a[0]+a[1]*2+a[2]*4+a[3]*8+a[4]*16+a[5]*32+a[6]*64+a[7]*128+a[8]*256+a[9]*512)*10+(n-1);
		if(v[k][s]>=0)return v[k][s];
		for(i=0,m=n;m>0 && i<10;i++){if(a[i]==1){min+=m*i;m--;if(s<min)goto answer;}}
		for(i=9,m=n;m>0 && i>=0;i--){if(a[i]==1){max+=m*i;m--;if(s<=max)break;}}if(s>max)goto answer;
		for(i=0;i<10;i++){
			if(a[i]==1 && n*i<=s){
				a[i]=0;
				ans+=summing(n-1,s-n*i);
				a[i]=1;
			}
		}
		answer:
		v[k][s]=ans;
		return ans;
	}
}
int main(void){
	for(i=0;i<10;i++)a[i]=1;
	for(i=0;i<10240;i++){{for(j=0;j<333;j++)v[i][j]=-1;}}
	while(scanf("%d %d",&n,&s)!=EOF){printf("%d\n",summing(n,s));}
	return 0;
}

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

int main(){
    long X;
    cin >> X;
    long a = ( (int) (X/500) );
    long b = (int) ( ( X-a*500 ) / 5 );

    long ans = 1000*a + 5*b;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int num = 7;
        int res = 1;
        while(num < n){
            num = num * 10 + 7;
            res++;
        }
        Set<Integer> set = new HashSet<>();
        while(true){
            if(num % n == 0)
                break;
            num %= n;
            res++;
            if(!set.add(num)) {
                res = -1;
                break;
            }
            num = num * 10 + 7;
        }
        System.out.println(res);
    }
}

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

int main() {
	int a, b, c,i;
	cin >> a >> b >> c;
	
	for (i = 0; i<c; i++) {
		b = b - a;
		if (b < 0) {
			break;
		}
	}
	cout << i << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(){
	double x;
	cin >> x;

	double money = 100;
    int i = 0;

	while(money < x)
    {
        money = floor(money * 1.01);
        i++;
    }
    cout << i << endl;
}


Measured memory_bytes: 3244
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    string s;
    scanf("%d",&a);
    cin >> s;
    scanf("%d",&b);
    if(s == "-"){
        printf("%d\n",a-b);
    }
    else{
        printf("%d\n",a+b);
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cstdlib>  
#include<cmath>   
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include<map>
#include<algorithm>
#include<functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<list>
#include<deque>
#include<climits>
#include<typeinfo>
#include<utility>
#define LEN 100005
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(ll i=0;i<n;i++)
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
using namespace std;
using ll = long long;
double pi() { return 3.14; }
int sum(int a, int b) { return a + b; }
int mul(int a, int b) { return a * b; }
ll LGCD(ll x, ll y) { if (x % y == 0) return y;else return LGCD(y, x % y); }
ll LLCM(ll x, ll y) { return x * y / LGCD(x, y); }

int GCD(int x, int y) { if (x % y == 0) return y;else return GCD(y, x % y); }
int LCM(int x, int y) { return x * y / GCD(x, y); }
ll dpc[10000][10000];

//void nCr(ll n, ll r) {
//	ll ans = 1;
//	for (int i = n; i > n - r; --i) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1; ++i) {
//		ans = ans / i;
//	}
//	printf("%d",ans);
//}

ll combination(ll n, ll r) {
	if (n == r) { return dpc[n][n] = 1; }
	else if (r == 0) { return dpc[n][0] = 1; }
	else if (r == 1) { return dpc[n][1] = n; }
	else if (dpc[n][r]) { return dpc[n][r]; }
	else { return dpc[n][r] = combination(n - 1, r - 1) + combination(n - 1, r); }
}

//cout << fixed << setprecision(10)



int main() {
	
	string s;
	cin >> s;
	if (s == "ABC")cout << "ARC" << endl;
	else cout << "ABC" << endl;

	
	return 0;
}



Measured memory_bytes: 3628
#include<cstdio>
using namespace std;
int main(){
    int k[] = {500,100,50,10,5,1};
    int n;
    while(scanf("%d",&n),n){
    n = 1000-n;
    int ans = 1;
    for(int i = 0;;){
        if(n-k[i] == 0)break;
        if(n-k[i] > 0){
            ans++;
            n = n-k[i];
        }
        else{
            i++;
        }
    }
    printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1028
#include <algorithm>
#include <iostream>
#include <vector>

#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)

using ll = long long;
using namespace std;

int keta(int _val) {
    int ans = 0;
    while (_val > 0) {
        _val /= 10;
        ans++;
    }
    return ans;
}

int main() {
    string s, t;
    cin >> s >> t;
    if (s.length() + 1 == t.length()) {
                rep(i, 0, s.length()) {
            if (s[i] != t[i]) {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

typedef long long ll;
typedef vector<int> vint;
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define mins(x,y) x=min(x,y)

ll dp[2010][2010];
ll s[100010];
int L;

ll sum(int a,int b){
	return (s[b]-(a?s[a-1]:0))/L;
}

int main(){
	int n,m;
	cin>>n>>m>>L;
	vint v(n);
	rep(i,n) cin>>v[i],v[i]--;
	sort(ALL(v));
	vint w(m);
	rep(i,m) cin>>w[i];
	rep(i,m){
		if(!i){
			s[i]=w[i];
		}
		else{
			s[i]=s[i-1]+w[i];
		}
	}
	rep(i,2010) rep(j,2010) dp[i][j]=INFL;
	dp[0][0] = 0;
	dp[1][0] = sum(v[0],v[1]);
	rep(i,n-1){
		rep(j,i){
			mins(dp[i+1][j],dp[i][j]+sum(v[i],v[i+1]));
			mins(dp[i+1][i],dp[i][j]+sum(v[j],v[i+1]));
		}
	}
	ll ans = INFL;
	rep(i,n){
		mins(ans,dp[n-1][i]+sum(v[i],v[n-1]));
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 35604
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long K, Q;
	cin >> K >> Q;
	vector<long long> D(K);
	for (int i = 0; i < K; i++) cin >> D[i];
	for (int h = 0; h < Q; h++) {
		long long N, X, M;
		cin >> N >> X >> M;
		vector<long long> E(K);
		for (int i = 0; i < K; i++) E[i] = (D[i] + M - 1) % M + 1;
		long long COUNT = X % M, SUM = 0;
		for (int i = 0; i < K; i++) SUM += E[i];
		N--;
		COUNT += SUM * (N / K);
		for (int i = 0; i < N % K; i++) COUNT += E[i];
		cout << N - COUNT / M << endl;
	}
}

Measured memory_bytes: 384
#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<math.h>
#include<time.h>
#include<vector>
#include<bitset>
#include<memory>
#include<utility>
#include<fstream>
#include<stdio.h>
#include<sstream>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
using namespace std;
long double a[155];
long long get_val(int x)
{
    long long sum=x%9;
    x-=x%9;
    for (;;)
    {
        if (x==0) break;
        sum*=10;
        x-=9;
        sum+=9;
    }
    return sum;
}
long long ans[1005];
double val[10005];
int main()
{
    #ifdef absi2011
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int i;
    for (i=1;i<=15*9;i++)
    {
        a[i]=get_val(i)/(double)i;
        ans[i-1]=get_val(i);
    }
    int cnt=15*9;
    for (i=0;i<=14;i++)
    {
        int j;
        long long pp=1;
        int k;
        for (k=0;k<i;k++)
        {
            pp*=10;
        }
        for (j=1000;j<=9999;j++)
        {
            int p=1;
            int sum=i*9;
            for (k=0;k<4;k++)
            {
                sum+=(j%(p*10))/p;
                p*=10;
            }
            long long num=(pp-1)+pp*j;
            val[j]=num/(double)sum;
        }
        double min_val=val[9999];
        for (j=9998;j>=1000;j--)
        {
            if (val[j]<min_val)
            {
                ans[cnt++]=(pp-1)+pp*j;
                min_val=val[j];
            }
        }
    }
    sort(ans,ans+cnt);
    cnt=unique(ans,ans+cnt)-ans;
    int n;
    scanf("%d",&n);
    for (i=0;i<n;i++)
    {
        cout<<ans[i]<<endl;
    }
    return 0;
} 


Measured memory_bytes: 384